diff options
author | Mattes D <github@xoft.cz> | 2014-10-08 22:29:58 +0200 |
---|---|---|
committer | Mattes D <github@xoft.cz> | 2014-10-08 22:29:58 +0200 |
commit | b77d721daa1a9218fe0ee30fea83cea57f11f2ed (patch) | |
tree | bb7da1724320c934396a3064065f9892468d2803 /MCServer/Plugins/MagicCarpet/plugin.lua | |
parent | Merge pull request #1518 from mc-server/AcaciaTrees (diff) | |
parent | Reordered .gitmodules. Fixes #496 (diff) | |
download | cuberite-b77d721daa1a9218fe0ee30fea83cea57f11f2ed.tar cuberite-b77d721daa1a9218fe0ee30fea83cea57f11f2ed.tar.gz cuberite-b77d721daa1a9218fe0ee30fea83cea57f11f2ed.tar.bz2 cuberite-b77d721daa1a9218fe0ee30fea83cea57f11f2ed.tar.lz cuberite-b77d721daa1a9218fe0ee30fea83cea57f11f2ed.tar.xz cuberite-b77d721daa1a9218fe0ee30fea83cea57f11f2ed.tar.zst cuberite-b77d721daa1a9218fe0ee30fea83cea57f11f2ed.zip |
Diffstat (limited to 'MCServer/Plugins/MagicCarpet/plugin.lua')
m--------- | MCServer/Plugins/MagicCarpet | 0 | ||||
-rw-r--r-- | MCServer/Plugins/MagicCarpet/plugin.lua | 81 |
2 files changed, 0 insertions, 81 deletions
diff --git a/MCServer/Plugins/MagicCarpet b/MCServer/Plugins/MagicCarpet new file mode 160000 +Subproject 493f2dfa6d39f134e37c4c614cf8d6ffd10c825 diff --git a/MCServer/Plugins/MagicCarpet/plugin.lua b/MCServer/Plugins/MagicCarpet/plugin.lua deleted file mode 100644 index 417ea0e02..000000000 --- a/MCServer/Plugins/MagicCarpet/plugin.lua +++ /dev/null @@ -1,81 +0,0 @@ -local Carpets = {} -local PLUGIN - -function Initialize( Plugin ) - Plugin:SetName( "MagicCarpet" ) - Plugin:SetVersion( 2 ) - - cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_MOVING, OnPlayerMoving) - cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_DESTROYED, OnDisconnect) - - local PluginManager = cPluginManager:Get() - PluginManager:BindCommand("/mc", "magiccarpet", HandleCarpetCommand, " - Spawns a magical carpet"); - - PLUGIN = Plugin - - LOG( "Initialised " .. Plugin:GetName() .. " v." .. Plugin:GetVersion() ) - return true -end - - - - - -function OnDisable() - LOG( PLUGIN:GetName() .. " v." .. PLUGIN:GetVersion() .. " is shutting down..." ) - for i, Carpet in pairs( Carpets ) do - Carpet:remove() - end -end - - - - - -function HandleCarpetCommand( Split, Player ) - Carpet = Carpets[ Player ] - - if( Carpet == nil ) then - Carpets[ Player ] = cCarpet:new() - Player:SendMessageSuccess("You're on a magic carpet!") - Player:SendMessageInfo("Look straight down to descend. Jump to ascend.") - else - Carpet:remove() - Carpets[ Player ] = nil - Player:SendMessageSuccess("The carpet vanished!") - end - - return true -end - - - - - -function OnDisconnect( Reason, Player ) - local Carpet = Carpets[ Player ] - if( Carpet ~= nil ) then - Carpet:remove() - end - Carpets[ Player ] = nil -end - - - - - -function OnPlayerMoving(Player) - local Carpet = Carpets[ Player ] - if( Carpet == nil ) then - return - end - - if( Player:GetPitch() == 90 ) then - Carpet:moveTo( cLocation:new( Player:GetPosX(), Player:GetPosY() - 1, Player:GetPosZ() ) ) - else - if( Player:GetPosY() < Carpet:getY() ) then - Player:TeleportToCoords(Player:GetPosX(), Carpet:getY() + 0.2, Player:GetPosZ()) - end - Carpet:moveTo( cLocation:new( Player:GetPosX(), Player:GetPosY(), Player:GetPosZ() ) ) - end -end |