summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--MCServer/Plugins/MagicCarpet/coremessaging.lua19
-rw-r--r--MCServer/Plugins/MagicCarpet/plugin.lua15
2 files changed, 26 insertions, 8 deletions
diff --git a/MCServer/Plugins/MagicCarpet/coremessaging.lua b/MCServer/Plugins/MagicCarpet/coremessaging.lua
new file mode 100644
index 000000000..9fb2c0db1
--- /dev/null
+++ b/MCServer/Plugins/MagicCarpet/coremessaging.lua
@@ -0,0 +1,19 @@
+Core = cPluginManager:Get():GetPlugin("Core")
+
+function SendMessage(a_Player, a_Message)
+ if (Core ~= nil) then
+ Core:Call("SendMessage", a_Player, a_Message)
+ end
+end
+
+function SendMessageSuccess(a_Player, a_Message)
+ if (Core ~= nil) then
+ Core:Call("SendMessageSuccess", a_Player, a_Message)
+ end
+end
+
+function SendMessageFailure(a_Player, a_Message)
+ if (Core ~= nil) then
+ Core:Call("SendMessageFailure", a_Player, a_Message)
+ end
+end
diff --git a/MCServer/Plugins/MagicCarpet/plugin.lua b/MCServer/Plugins/MagicCarpet/plugin.lua
index 27dcdf45d..81eb02a9c 100644
--- a/MCServer/Plugins/MagicCarpet/plugin.lua
+++ b/MCServer/Plugins/MagicCarpet/plugin.lua
@@ -1,18 +1,16 @@
-local PLUGIN = {}
local Carpets = {}
function Initialize( Plugin )
- PLUGIN = Plugin
-
Plugin:SetName( "MagicCarpet" )
- Plugin:SetVersion( 1 )
+ Plugin:SetVersion( 2 )
cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_MOVING, OnPlayerMoving)
cPluginManager.AddHook(cPluginManager.HOOK_DISCONNECT, OnDisconnect)
+ local PluginManager = cPluginManager:Get()
PluginManager:BindCommand("/mc", "magiccarpet", HandleCarpetCommand, " - Spawns a magical carpet");
- LOG( "Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion() )
+ LOG( "Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion() )
return true
end
@@ -33,14 +31,15 @@ end
function HandleCarpetCommand( Split, Player )
Carpet = Carpets[ Player ]
+
if( Carpet == nil ) then
Carpets[ Player ] = cCarpet:new()
- Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "You're on a magic carpet!" )
- Player:SendMessage(cChatColor.Yellow .. "[INFO] " .. cChatColor.White .. "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
- Player:SendMessage(cChatColor.Green .. "[INFO] " .. cChatColor.White .. "The carpet vanished!" )
+ SendMessageSuccess(Player, "The carpet vanished!")
end
return true