summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/Debuggers/Debuggers.lua
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-01-13 12:10:26 +0100
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2013-01-13 12:10:26 +0100
commit752057fb1b3a71058b5391bde9b0e21d87196539 (patch)
treecfeb16a291ce13dc8408a82459224f029f56cd2f /MCServer/Plugins/Debuggers/Debuggers.lua
parentMerged branch "branches/hooks" into "trunk". (diff)
downloadcuberite-752057fb1b3a71058b5391bde9b0e21d87196539.tar
cuberite-752057fb1b3a71058b5391bde9b0e21d87196539.tar.gz
cuberite-752057fb1b3a71058b5391bde9b0e21d87196539.tar.bz2
cuberite-752057fb1b3a71058b5391bde9b0e21d87196539.tar.lz
cuberite-752057fb1b3a71058b5391bde9b0e21d87196539.tar.xz
cuberite-752057fb1b3a71058b5391bde9b0e21d87196539.tar.zst
cuberite-752057fb1b3a71058b5391bde9b0e21d87196539.zip
Diffstat (limited to '')
-rw-r--r--MCServer/Plugins/Debuggers/Debuggers.lua16
1 files changed, 10 insertions, 6 deletions
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua
index 5550f0335..f2f3f9570 100644
--- a/MCServer/Plugins/Debuggers/Debuggers.lua
+++ b/MCServer/Plugins/Debuggers/Debuggers.lua
@@ -13,7 +13,7 @@ function Initialize(Plugin)
Plugin:SetVersion(1)
PluginManager = cRoot:Get():GetPluginManager()
- PluginManager:AddHook(Plugin, cPluginManager.E_PLUGIN_BLOCK_PLACE)
+ PluginManager:AddHook(Plugin, cPluginManager.HOOK_PLAYER_USING_ITEM)
PluginManager:AddHook(Plugin, cPluginManager.HOOK_TAKE_DAMAGE)
LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
@@ -24,13 +24,15 @@ end
-function OnBlockPlace(Player, BlockX, BlockY, BlockZ, BlockFace, HeldItem)
+function OnPlayerUsingItem(Player, BlockX, BlockY, BlockZ, BlockFace, CursorX, CursorY, CursorZ)
-- dont check if the direction is in the air
- if BlockFace == BLOCK_FACE_NONE then
+ if (BlockFace == BLOCK_FACE_NONE) then
return false
end
+ local HeldItem = Player:GetEquippedItem();
+
if (HeldItem.m_ItemType == E_ITEM_STICK) then
-- Magic sTick of ticking: set the pointed block for ticking at the next tick
Player:SendMessage(cChatColor.LightGray .. "Setting next block tick to {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "}")
@@ -42,7 +44,9 @@ function OnBlockPlace(Player, BlockX, BlockY, BlockZ, BlockFace, HeldItem)
-- Magic rod of query: show block types and metas for both neighbors of the pointed face
local Type = 0;
local Meta = 0;
- Type, Meta = Player:GetWorld():GetBlockTypeMeta(BlockX, BlockY, BlockZ, Type, Meta);
+ local Valid = false;
+ Valid, Type, Meta = Player:GetWorld():GetBlockTypeMeta(BlockX, BlockY, BlockZ, Type, Meta);
+
if (Type == E_BLOCK_AIR) then
Player:SendMessage(cChatColor.LightGray .. "Block {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "}: air:" .. Meta);
else
@@ -53,8 +57,8 @@ function OnBlockPlace(Player, BlockX, BlockY, BlockZ, BlockFace, HeldItem)
local X = BlockX;
local Y = BlockY;
local Z = BlockZ;
- X, Y, Z = AddDirection(BlockX, BlockY, BlockZ, BlockFace);
- Type, Meta = Player:GetWorld():GetBlockTypeMeta(X, Y, Z, Type, Meta);
+ X, Y, Z = AddFaceDirection(BlockX, BlockY, BlockZ, BlockFace);
+ Valid, Type, Meta = Player:GetWorld():GetBlockTypeMeta(X, Y, Z, Type, Meta);
if (Type == E_BLOCK_AIR) then
Player:SendMessage(cChatColor.LightGray .. "Block {" .. X .. ", " .. Y .. ", " .. Z .. "}: air:" .. Meta);
else