diff options
Diffstat (limited to '')
-rw-r--r-- | MCServer/Plugins/MagicCarpet/coremessaging.lua | 28 | ||||
-rw-r--r-- | MCServer/Plugins/MagicCarpet/plugin.lua | 10 | ||||
-rw-r--r-- | source/Server.cpp | 2 |
3 files changed, 33 insertions, 7 deletions
diff --git a/MCServer/Plugins/MagicCarpet/coremessaging.lua b/MCServer/Plugins/MagicCarpet/coremessaging.lua new file mode 100644 index 000000000..1677e8940 --- /dev/null +++ b/MCServer/Plugins/MagicCarpet/coremessaging.lua @@ -0,0 +1,28 @@ +IniFile = cIniFile( "settings.ini" ) +IniFile:ReadFile() +UsePrefixes = IniFile:GetValueSet( "Messaging", "Prefixes", "true" ) +IniFile:WriteFile() + +function SendMessage(a_Player, a_Message) + if (UsePrefixes) then + a_Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. a_Message) + else + a_Player:SendMessage(cChatColor.Yellow .. a_Message) + end +end + +function SendMessageSuccess(a_Player, a_Message) + if (UsePrefixes) then + a_Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. a_Message) + else + a_Player:SendMessage(cChatColor.Green .. a_Message) + end +end + +function SendMessageFailure(a_Player, a_Message) + if (UsePrefixes) then + a_Player:SendMessage(cChatColor.Red .. "[INFO] " .. cChatColor.White .. a_Message) + else + a_Player:SendMessage(cChatColor.Red .. a_Message) + end +end
\ No newline at end of file diff --git a/MCServer/Plugins/MagicCarpet/plugin.lua b/MCServer/Plugins/MagicCarpet/plugin.lua index 219956984..4a2097351 100644 --- a/MCServer/Plugins/MagicCarpet/plugin.lua +++ b/MCServer/Plugins/MagicCarpet/plugin.lua @@ -33,17 +33,15 @@ end function HandleCarpetCommand( Split, Player ) Carpet = Carpets[ Player ] - PluginManager = cPluginManager:Get() - local Core = PluginManager:GetPlugin("Core") - + if( Carpet == nil ) then Carpets[ Player ] = cCarpet:new() - Core:Call("SendMessageSuccess", Player, "You're on a magic carpet!") - Core:Call("SendMessage", Player, "Look straight down to descend. Jump to ascend.") + SendMessageSuccess(Player, "You're on a magic carpet!") + SendMessage(Player, "Look straight down to descend. Jump to ascend.") else Carpet:remove() Carpets[ Player ] = nil - Core:Call("SendMessageSuccess", Player, "The carpet vanished!") + SendMessageSuccess(Player, "The carpet vanished!") end return true diff --git a/source/Server.cpp b/source/Server.cpp index dd18f8d3d..5e65213fd 100644 --- a/source/Server.cpp +++ b/source/Server.cpp @@ -321,7 +321,7 @@ void cServer::OnConnectionAccepted(cSocket & a_Socket) return; } - LOG("Client \"%s\" connected!", ClientIP.c_str()); + LOGD("Client \"%s\" connected!", ClientIP.c_str()); cClientHandle * NewHandle = new cClientHandle(&a_Socket, m_ClientViewDistance); if (!m_SocketThreads.AddClient(a_Socket, NewHandle)) |