diff options
author | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-10-02 23:01:01 +0200 |
---|---|---|
committer | Tiger Wang <ziwei.tiger@hotmail.co.uk> | 2013-10-02 23:01:01 +0200 |
commit | a171757f1afee864b7d27357b4babb0c28c50d9a (patch) | |
tree | c328991db7516c0270db871c072412f0822b72ea | |
parent | Merge pull request #2 from tigerw/bugfixes (diff) | |
download | cuberite-a171757f1afee864b7d27357b4babb0c28c50d9a.tar cuberite-a171757f1afee864b7d27357b4babb0c28c50d9a.tar.gz cuberite-a171757f1afee864b7d27357b4babb0c28c50d9a.tar.bz2 cuberite-a171757f1afee864b7d27357b4babb0c28c50d9a.tar.lz cuberite-a171757f1afee864b7d27357b4babb0c28c50d9a.tar.xz cuberite-a171757f1afee864b7d27357b4babb0c28c50d9a.tar.zst cuberite-a171757f1afee864b7d27357b4babb0c28c50d9a.zip |
-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 |