diff options
Diffstat (limited to 'MCServer/Plugins/MagicCarpet/plugin.lua')
-rw-r--r-- | MCServer/Plugins/MagicCarpet/plugin.lua | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/MCServer/Plugins/MagicCarpet/plugin.lua b/MCServer/Plugins/MagicCarpet/plugin.lua index 27dcdf45d..bcf87d202 100644 --- a/MCServer/Plugins/MagicCarpet/plugin.lua +++ b/MCServer/Plugins/MagicCarpet/plugin.lua @@ -1,18 +1,18 @@ -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 +33,17 @@ end function HandleCarpetCommand( Split, Player ) Carpet = Carpets[ Player ] + PluginManager = cPluginManager:Get() + local Core = PluginManager:GetPlugin("Core") + 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!" ) + Core:Call("SendMessageSuccess", Player, "You're on a magic carpet!") + Core:Call("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!" ) + Core:Call("SendMessage", Player, "The carpet vanished!") end return true |