summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2013-09-02 15:15:28 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2013-09-02 15:15:28 +0200
commit20b64e18e49550e7a105899045fd51be192e86bc (patch)
treec261c71ea2feb99bc5d4b058da5811c6b80db70c /MCServer/Plugins
parentMinecart enhancements [SEE DESC] (diff)
parentExported BroadcastSoundEffect and BroadcastSoundParticleEffect to the Lua API (diff)
downloadcuberite-20b64e18e49550e7a105899045fd51be192e86bc.tar
cuberite-20b64e18e49550e7a105899045fd51be192e86bc.tar.gz
cuberite-20b64e18e49550e7a105899045fd51be192e86bc.tar.bz2
cuberite-20b64e18e49550e7a105899045fd51be192e86bc.tar.lz
cuberite-20b64e18e49550e7a105899045fd51be192e86bc.tar.xz
cuberite-20b64e18e49550e7a105899045fd51be192e86bc.tar.zst
cuberite-20b64e18e49550e7a105899045fd51be192e86bc.zip
Diffstat (limited to 'MCServer/Plugins')
-rw-r--r--MCServer/Plugins/ChatLog/plugin.lua3
-rw-r--r--MCServer/Plugins/ChunkWorx/chunkworx_main.lua3
m---------MCServer/Plugins/Core0
-rw-r--r--MCServer/Plugins/Debuggers/Debuggers.lua60
-rw-r--r--MCServer/Plugins/DiamondMover/DiamondMover.lua12
-rw-r--r--MCServer/Plugins/HookNotify/HookNotify.lua82
-rw-r--r--MCServer/Plugins/MagicCarpet/plugin.lua5
m---------MCServer/Plugins/ProtectionAreas0
8 files changed, 102 insertions, 63 deletions
diff --git a/MCServer/Plugins/ChatLog/plugin.lua b/MCServer/Plugins/ChatLog/plugin.lua
index c2f6fb81a..adbf986e0 100644
--- a/MCServer/Plugins/ChatLog/plugin.lua
+++ b/MCServer/Plugins/ChatLog/plugin.lua
@@ -13,8 +13,7 @@ function Initialize(Plugin)
Plugin:SetName("ChatLog")
Plugin:SetVersion(3)
- PluginManager = cRoot:Get():GetPluginManager()
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT)
+ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChat)
LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
return true
diff --git a/MCServer/Plugins/ChunkWorx/chunkworx_main.lua b/MCServer/Plugins/ChunkWorx/chunkworx_main.lua
index 66cf00b97..ab9962387 100644
--- a/MCServer/Plugins/ChunkWorx/chunkworx_main.lua
+++ b/MCServer/Plugins/ChunkWorx/chunkworx_main.lua
@@ -26,8 +26,7 @@ function Initialize(Plugin)
PLUGIN:SetName("ChunkWorx")
PLUGIN:SetVersion(6)
- PluginManager = cRoot:Get():GetPluginManager()
- PluginManager:AddHook(PLUGIN, cPluginManager.HOOK_TICK)
+ cPluginManager.AddHook(cPluginManager.HOOK_TICK, OnTick)
Plugin:AddWebTab("(Re)Generation", HandleRequest_Generation)
diff --git a/MCServer/Plugins/Core b/MCServer/Plugins/Core
-Subproject e3a45f34303331be77aceacf2ba53e503ad7284
+Subproject c8ef7e9f8ed2bc1ffdbb3756c2024536bf00469
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua
index 90a897aa6..be16e3465 100644
--- a/MCServer/Plugins/Debuggers/Debuggers.lua
+++ b/MCServer/Plugins/Debuggers/Debuggers.lua
@@ -16,15 +16,21 @@ function Initialize(Plugin)
Plugin:SetName("Debuggers")
Plugin:SetVersion(1)
- PluginManager = cRoot:Get():GetPluginManager()
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_BLOCK);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_ITEM);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_TAKE_DAMAGE);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_TICK);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_RIGHT_CLICKING_ENTITY);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_WORLD_TICK);
-
+ --[[
+ -- Test multiple hook handlers:
+ cPluginManager.AddHook(cPluginManager.HOOK_TICK, OnTick1);
+ cPluginManager.AddHook(cPluginManager.HOOK_TICK, OnTick2);
+ --]]
+
+ cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_USING_BLOCK, OnPlayerUsingBlock);
+ cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_USING_ITEM, OnPlayerUsingItem);
+ cPluginManager.AddHook(cPluginManager.HOOK_TAKE_DAMAGE, OnTakeDamage);
+ cPluginManager.AddHook(cPluginManager.HOOK_TICK, OnTick);
+ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChat);
+ cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_RIGHT_CLICKING_ENTITY, OnPlayerRightClickingEntity);
+ cPluginManager.AddHook(cPluginManager.HOOK_WORLD_TICK, OnWorldTick);
+
+ PluginManager = cRoot:Get():GetPluginManager();
PluginManager:BindCommand("/le", "debuggers", HandleListEntitiesCmd, "- Shows a list of all the loaded entities");
PluginManager:BindCommand("/ke", "debuggers", HandleKillEntitiesCmd, "- Kills all the loaded entities");
PluginManager:BindCommand("/wool", "debuggers", HandleWoolCmd, "- Sets all your armor to blue wool");
@@ -39,6 +45,7 @@ function Initialize(Plugin)
PluginManager:BindCommand("/spidey", "debuggers", HandleSpideyCmd, "- Shoots a line of web blocks until it hits non-air");
PluginManager:BindCommand("/ench", "debuggers", HandleEnchCmd, "- Provides an instant dummy enchantment window");
PluginManager:BindCommand("/fs", "debuggers", HandleFoodStatsCmd, "- Turns regular foodstats message on or off");
+ PluginManager:BindCommand("/arr", "debuggers", HandleArrowCmd, "- Creates an arrow going away from the player");
-- Enable the following line for BlockArea / Generator interface testing:
-- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATED);
@@ -415,6 +422,24 @@ end
+function OnTick1()
+ -- For testing multiple hook handlers per plugin
+ LOGINFO("Tick1");
+end
+
+
+
+
+
+function OnTick2()
+ -- For testing multiple hook handlers per plugin
+ LOGINFO("Tick2");
+end
+
+
+
+
+
--- When set to a positive number, the following OnTick() will perform GC and decrease until 0 again
GCOnTick = 0;
@@ -770,6 +795,7 @@ function HandleEnchCmd(a_Split, a_Player)
Wnd:SetProperty(0, 10);
Wnd:SetProperty(1, 15);
Wnd:SetProperty(2, 25);
+ return true;
end
@@ -778,6 +804,22 @@ end
function HandleFoodStatsCmd(a_Split, a_Player)
g_ShowFoodStats = not(g_ShowFoodStats);
+ return true;
+end
+
+
+
+
+
+function HandleArrowCmd(a_Split, a_Player)
+ local World = a_Player:GetWorld();
+ local Pos = a_Player:GetEyePosition();
+ local Speed = a_Player:GetLookVector();
+ Speed:Normalize();
+ Pos = Pos + Speed;
+
+ World:CreateProjectile(Pos.x, Pos.y, Pos.z, cProjectileEntity.pkArrow, a_Player, Speed * 10);
+ return true;
end
diff --git a/MCServer/Plugins/DiamondMover/DiamondMover.lua b/MCServer/Plugins/DiamondMover/DiamondMover.lua
index c89a3394f..0fdd32250 100644
--- a/MCServer/Plugins/DiamondMover/DiamondMover.lua
+++ b/MCServer/Plugins/DiamondMover/DiamondMover.lua
@@ -9,7 +9,6 @@
-- Global variables
-PLUGIN = {} -- Reference to own plugin object
MOVER_SIZE_X = 4;
MOVER_SIZE_Y = 4;
MOVER_SIZE_Z = 4;
@@ -19,13 +18,10 @@ MOVER_SIZE_Z = 4;
function Initialize(Plugin)
- PLUGIN = Plugin;
-
Plugin:SetName("DiamondMover");
Plugin:SetVersion(1);
- PluginManager = cRoot:Get():GetPluginManager();
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USED_ITEM);
+ cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_USED_ITEM, OnPlayerUsedItem);
return true;
end
@@ -80,4 +76,8 @@ function OnPlayerUsedItem(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, Cu
Area:Write(Player:GetWorld(), BlockX - MOVER_SIZE_X, BlockY - MOVER_SIZE_Y, BlockZ - MOVER_SIZE_Z);
return false;
end
-end \ No newline at end of file
+end
+
+
+
+
diff --git a/MCServer/Plugins/HookNotify/HookNotify.lua b/MCServer/Plugins/HookNotify/HookNotify.lua
index 6badc63e7..ed791090e 100644
--- a/MCServer/Plugins/HookNotify/HookNotify.lua
+++ b/MCServer/Plugins/HookNotify/HookNotify.lua
@@ -13,47 +13,47 @@ function Initialize(Plugin)
Plugin:SetVersion(1);
PluginManager = cPluginManager:Get();
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_BLOCK_TO_PICKUPS);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHAT);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_AVAILABLE);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATED);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_GENERATING);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_UNLOADED);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CHUNK_UNLOADING);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_COLLECTING_PICKUP);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_CRAFTING_NO_RECIPE);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_DISCONNECT);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_EXECUTE_COMMAND);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_HANDSHAKE);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_KILLING);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_LOGIN);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_BREAKING_BLOCK);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_BROKEN_BLOCK);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_EATING);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_JOINED);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_LEFT_CLICK);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_MOVING);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_PLACED_BLOCK);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_PLACING_BLOCK);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_RIGHT_CLICK);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_SHOOTING);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_SPAWNED);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_TOSSING_ITEM);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USED_BLOCK);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USED_ITEM);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_BLOCK);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_ITEM);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_POST_CRAFTING);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PRE_CRAFTING);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_SPAWNED_ENTITY);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_SPAWNED_MONSTER);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_SPAWNING_ENTITY);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_SPAWNING_MONSTER);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_TAKE_DAMAGE);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_UPDATED_SIGN);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_UPDATING_SIGN);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_WEATHER_CHANGED);
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_WEATHER_CHANGING);
+ cPluginManager.AddHook(cPluginManager.HOOK_BLOCK_TO_PICKUPS, OnBlockToPickups);
+ cPluginManager.AddHook(cPluginManager.HOOK_CHAT, OnChat);
+ cPluginManager.AddHook(cPluginManager.HOOK_CHUNK_AVAILABLE, OnChunkAvailable);
+ cPluginManager.AddHook(cPluginManager.HOOK_CHUNK_GENERATED, OnChunkGenerated);
+ cPluginManager.AddHook(cPluginManager.HOOK_CHUNK_GENERATING, OnChunkGenerating);
+ cPluginManager.AddHook(cPluginManager.HOOK_CHUNK_UNLOADED, OnChunkUnloaded);
+ cPluginManager.AddHook(cPluginManager.HOOK_CHUNK_UNLOADING, OnChunkUnloading);
+ cPluginManager.AddHook(cPluginManager.HOOK_COLLECTING_PICKUP, OnCollectingPickup);
+ cPluginManager.AddHook(cPluginManager.HOOK_CRAFTING_NO_RECIPE, OnCraftingNoRecipe);
+ cPluginManager.AddHook(cPluginManager.HOOK_DISCONNECT, OnDisconnect);
+ cPluginManager.AddHook(cPluginManager.HOOK_EXECUTE_COMMAND, OnExecuteCommand);
+ cPluginManager.AddHook(cPluginManager.HOOK_HANDSHAKE, OnHandshake);
+ cPluginManager.AddHook(cPluginManager.HOOK_KILLING, OnKilling);
+ cPluginManager.AddHook(cPluginManager.HOOK_LOGIN, OnLogin);
+ cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_BREAKING_BLOCK, OnPlayerBreakingBlock);
+ cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_BROKEN_BLOCK, OnPlayerBrokenBlock);
+ cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_EATING, OnPlayerEating);
+ cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_JOINED, OnPlayerJoined);
+ cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_LEFT_CLICK, OnPlayerLeftClick);
+ cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_MOVING, OnPlayerMoving);
+ cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_PLACED_BLOCK, OnPlayerPlacedBlock);
+ cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_PLACING_BLOCK, OnPlayerPlacingBlock);
+ cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_RIGHT_CLICK, OnPlayerRightClick);
+ cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_SHOOTING, OnPlayerShooting);
+ cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_SPAWNED, OnPlayerSpawned);
+ cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_TOSSING_ITEM, OnPlayerTossingItem);
+ cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_USED_BLOCK, OnPlayerUsedBlock);
+ cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_USED_ITEM, OnPlayerUsedItem);
+ cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_USING_BLOCK, OnPlayerUsingBlock);
+ cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_USING_ITEM, OnPlayerUsingItem);
+ cPluginManager.AddHook(cPluginManager.HOOK_POST_CRAFTING, OnPostCrafting);
+ cPluginManager.AddHook(cPluginManager.HOOK_PRE_CRAFTING, OnPreCrafting);
+ cPluginManager.AddHook(cPluginManager.HOOK_SPAWNED_ENTITY, OnSpawnedEntity);
+ cPluginManager.AddHook(cPluginManager.HOOK_SPAWNED_MONSTER, OnSpawnedMonster);
+ cPluginManager.AddHook(cPluginManager.HOOK_SPAWNING_ENTITY, OnSpawningEntity);
+ cPluginManager.AddHook(cPluginManager.HOOK_SPAWNING_MONSTER, OnSpawningMonster);
+ cPluginManager.AddHook(cPluginManager.HOOK_TAKE_DAMAGE, OnTakeDamage);
+ cPluginManager.AddHook(cPluginManager.HOOK_UPDATED_SIGN, OnUpdatedSign);
+ cPluginManager.AddHook(cPluginManager.HOOK_UPDATING_SIGN, OnUpdatingSign);
+ cPluginManager.AddHook(cPluginManager.HOOK_WEATHER_CHANGED, OnWeatherChanged);
+ cPluginManager.AddHook(cPluginManager.HOOK_WEATHER_CHANGING, OnWeatherChanging);
LOGINFO("HookNotify plugin is installed, beware, the log output may be quite large!");
LOGINFO("You want this plugin enabled only when developing another plugin, not for regular gameplay.");
diff --git a/MCServer/Plugins/MagicCarpet/plugin.lua b/MCServer/Plugins/MagicCarpet/plugin.lua
index 3101866cd..27dcdf45d 100644
--- a/MCServer/Plugins/MagicCarpet/plugin.lua
+++ b/MCServer/Plugins/MagicCarpet/plugin.lua
@@ -7,9 +7,8 @@ function Initialize( Plugin )
Plugin:SetName( "MagicCarpet" )
Plugin:SetVersion( 1 )
- PluginManager = cRoot:Get():GetPluginManager()
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_MOVING)
- PluginManager:AddHook(Plugin, cPluginManager.HOOK_DISCONNECT)
+ cPluginManager.AddHook(cPluginManager.HOOK_PLAYER_MOVING, OnPlayerMoving)
+ cPluginManager.AddHook(cPluginManager.HOOK_DISCONNECT, OnDisconnect)
PluginManager:BindCommand("/mc", "magiccarpet", HandleCarpetCommand, " - Spawns a magical carpet");
diff --git a/MCServer/Plugins/ProtectionAreas b/MCServer/Plugins/ProtectionAreas
-Subproject 3019c7b396221b987cd3f89d422276f764834ff
+Subproject bef8ff2a883e98db94f842f9db3d256a039b1fc