summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--MCServer/Plugins/Core/onjoinleave.lua37
-rw-r--r--source/Bindings.cpp39
-rw-r--r--source/Bindings.h2
-rw-r--r--source/World.h4
4 files changed, 59 insertions, 23 deletions
diff --git a/MCServer/Plugins/Core/onjoinleave.lua b/MCServer/Plugins/Core/onjoinleave.lua
index c794aaf94..cd0ead4fc 100644
--- a/MCServer/Plugins/Core/onjoinleave.lua
+++ b/MCServer/Plugins/Core/onjoinleave.lua
@@ -1,24 +1,23 @@
+
+
+
+
+
function OnPlayerJoined(Player)
- --if( BannedPlayersIni:GetValueB("Banned", Player:GetName(), false) == true ) then
- -- LOGINFO( Player:GetName() .. " tried to join, but is banned!" )
- -- KickPlayer(Player:GetName(), cChatColor.Red .. "You are banned!" )
- -- return true
- --elseif( WhiteListIni:GetValueB("WhiteListSettings", "WhiteListOn", false ) == true ) then
- -- if( WhiteListIni:GetValueB("WhiteList", Player:GetName(), false ) == false ) then
- -- LOGINFO( Player:GetName() .. " tried to join, but is not whitelisted!" )
- -- KickPlayer(Player:GetName(), cChatColor.Red .. "You are not whitelisted!" )
- -- end
- --else
- ShowMOTDTo( Player )
- local Server = cRoot:Get():GetServer()
- Server:SendMessage(cChatColor.Yellow .. "[JOIN] " .. cChatColor.White .. Player:GetName() .. " has joined the game" )
- return false
- --end
+ ShowMOTDTo(Player)
+ Player:GetWorld():BroadcastChat(cChatColor.Yellow .. "[JOIN] " .. cChatColor.White .. Player:GetName() .. " has joined the game")
+ return false
end
+
+
+
+
function OnDisconnect(Player, Reason)
- local Server = cRoot:Get():GetServer()
- Server:SendMessage(cChatColor.Yellow .. "[LEAVE] " .. cChatColor.White .. Player:GetName() .. " has left the game" )
- LOG("Player " .. Player:GetName() .. " has left the game.")
+ Player:GetWorld():BroadcastChat(cChatColor.Yellow .. "[LEAVE] " .. cChatColor.White .. Player:GetName() .. " has left the game")
return true
-end \ No newline at end of file
+end
+
+
+
+
diff --git a/source/Bindings.cpp b/source/Bindings.cpp
index e7a71ce76..8feb070e1 100644
--- a/source/Bindings.cpp
+++ b/source/Bindings.cpp
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 08/13/13 23:00:22.
+** Generated automatically by tolua++-1.0.92 on 08/13/13 23:07:52.
*/
#ifndef __cplusplus
@@ -11896,6 +11896,42 @@ static int tolua_AllToLua_cWorld_GetHeight00(lua_State* tolua_S)
}
#endif //#ifndef TOLUA_DISABLE
+/* method: BroadcastChat of class cWorld */
+#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_BroadcastChat00
+static int tolua_AllToLua_cWorld_BroadcastChat00(lua_State* tolua_S)
+{
+#ifndef TOLUA_RELEASE
+ tolua_Error tolua_err;
+ if (
+ !tolua_isusertype(tolua_S,1,"cWorld",0,&tolua_err) ||
+ !tolua_iscppstring(tolua_S,2,0,&tolua_err) ||
+ !tolua_isusertype(tolua_S,3,"const cClientHandle",1,&tolua_err) ||
+ !tolua_isnoobj(tolua_S,4,&tolua_err)
+ )
+ goto tolua_lerror;
+ else
+#endif
+ {
+ cWorld* self = (cWorld*) tolua_tousertype(tolua_S,1,0);
+ const AString a_Message = ((const AString) tolua_tocppstring(tolua_S,2,0));
+ const cClientHandle* a_Exclude = ((const cClientHandle*) tolua_tousertype(tolua_S,3,NULL));
+#ifndef TOLUA_RELEASE
+ if (!self) tolua_error(tolua_S,"invalid 'self' in function 'BroadcastChat'", NULL);
+#endif
+ {
+ self->BroadcastChat(a_Message,a_Exclude);
+ tolua_pushcppstring(tolua_S,(const char*)a_Message);
+ }
+ }
+ return 1;
+#ifndef TOLUA_RELEASE
+ tolua_lerror:
+ tolua_error(tolua_S,"#ferror in function 'BroadcastChat'.",&tolua_err);
+ return 0;
+#endif
+}
+#endif //#ifndef TOLUA_DISABLE
+
/* method: UnloadUnusedChunks of class cWorld */
#ifndef TOLUA_DISABLE_tolua_AllToLua_cWorld_UnloadUnusedChunks00
static int tolua_AllToLua_cWorld_UnloadUnusedChunks00(lua_State* tolua_S)
@@ -29713,6 +29749,7 @@ TOLUA_API int tolua_AllToLua_open (lua_State* tolua_S)
tolua_function(tolua_S,"IsDeepSnowEnabled",tolua_AllToLua_cWorld_IsDeepSnowEnabled00);
tolua_function(tolua_S,"GetDimension",tolua_AllToLua_cWorld_GetDimension00);
tolua_function(tolua_S,"GetHeight",tolua_AllToLua_cWorld_GetHeight00);
+ tolua_function(tolua_S,"BroadcastChat",tolua_AllToLua_cWorld_BroadcastChat00);
tolua_function(tolua_S,"UnloadUnusedChunks",tolua_AllToLua_cWorld_UnloadUnusedChunks00);
tolua_function(tolua_S,"RegenerateChunk",tolua_AllToLua_cWorld_RegenerateChunk00);
tolua_function(tolua_S,"GenerateChunk",tolua_AllToLua_cWorld_GenerateChunk00);
diff --git a/source/Bindings.h b/source/Bindings.h
index 1e5ad7e84..a8d39e32f 100644
--- a/source/Bindings.h
+++ b/source/Bindings.h
@@ -1,6 +1,6 @@
/*
** Lua binding: AllToLua
-** Generated automatically by tolua++-1.0.92 on 08/13/13 23:00:22.
+** Generated automatically by tolua++-1.0.92 on 08/13/13 23:07:53.
*/
/* Exported function */
diff --git a/source/World.h b/source/World.h
index da59b12f6..2c04c4cc6 100644
--- a/source/World.h
+++ b/source/World.h
@@ -154,8 +154,8 @@ public:
void BroadcastAttachEntity (const cEntity & a_Entity, const cEntity * a_Vehicle);
void BroadcastBlockAction (int a_BlockX, int a_BlockY, int a_BlockZ, char a_Byte1, char a_Byte2, BLOCKTYPE a_BlockType, const cClientHandle * a_Exclude = NULL);
void BroadcastBlockBreakAnimation(int a_EntityID, int a_BlockX, int a_BlockY, int a_BlockZ, char a_Stage, const cClientHandle * a_Exclude = NULL);
- void BroadcastBlockEntity (int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude = NULL); ///< If there is a block entity at the specified coods, sends it to all clients except a_Exclude
- void BroadcastChat (const AString & a_Message, const cClientHandle * a_Exclude = NULL);
+ void BroadcastBlockEntity (int a_BlockX, int a_BlockY, int a_BlockZ, const cClientHandle * a_Exclude = NULL); ///< If there is a block entity at the specified coods, sends it to all clients except a_Exclude
+ void BroadcastChat (const AString & a_Message, const cClientHandle * a_Exclude = NULL); // tolua_export
void BroadcastChunkData (int a_ChunkX, int a_ChunkZ, cChunkDataSerializer & a_Serializer, const cClientHandle * a_Exclude = NULL);
void BroadcastCollectPickup (const cPickup & a_Pickup, const cPlayer & a_Player, const cClientHandle * a_Exclude = NULL);
void BroadcastDestroyEntity (const cEntity & a_Entity, const cClientHandle * a_Exclude = NULL);