summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-16 10:20:45 +0200
committermadmaxoft@gmail.com <madmaxoft@gmail.com@0a769ca7-a7f5-676a-18bf-c427514a06d6>2012-10-16 10:20:45 +0200
commitcda079f83b74a0ec3a2ceff482f91676f654977e (patch)
tree650dd7c90f010af697720e30f5db3d5e58ff0fbe
parentCore: fixed /help and /pluginlist (diff)
downloadcuberite-cda079f83b74a0ec3a2ceff482f91676f654977e.tar
cuberite-cda079f83b74a0ec3a2ceff482f91676f654977e.tar.gz
cuberite-cda079f83b74a0ec3a2ceff482f91676f654977e.tar.bz2
cuberite-cda079f83b74a0ec3a2ceff482f91676f654977e.tar.lz
cuberite-cda079f83b74a0ec3a2ceff482f91676f654977e.tar.xz
cuberite-cda079f83b74a0ec3a2ceff482f91676f654977e.tar.zst
cuberite-cda079f83b74a0ec3a2ceff482f91676f654977e.zip
-rw-r--r--MCServer/Plugins/Debuggers/Debuggers.lua69
-rw-r--r--MCServer/Plugins/sTick/main.lua20
-rw-r--r--MCServer/Plugins/sTick/onblockplace.lua19
-rw-r--r--MCServer/settings.ini2
4 files changed, 70 insertions, 40 deletions
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua
new file mode 100644
index 000000000..6e39e6393
--- /dev/null
+++ b/MCServer/Plugins/Debuggers/Debuggers.lua
@@ -0,0 +1,69 @@
+
+-- Global variables
+PLUGIN = {} -- Reference to own plugin object
+
+
+
+
+
+function Initialize(Plugin)
+ PLUGIN = Plugin
+
+ Plugin:SetName("Debuggers")
+ Plugin:SetVersion(1)
+
+ PluginManager = cRoot:Get():GetPluginManager()
+ PluginManager:AddHook(Plugin, cPluginManager.E_PLUGIN_BLOCK_PLACE)
+
+ LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
+ return true
+end
+
+
+
+
+
+function OnBlockPlace(Player, BlockX, BlockY, BlockZ, BlockFace, HeldItem)
+
+ -- dont check if the direction is in the air
+ if BlockFace == BLOCK_FACE_NONE then
+ return false
+ end
+
+ 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 .. "}")
+ Player:GetWorld():SetNextBlockTick(BlockX, BlockY, BlockZ);
+ return true
+ end
+
+ if (HeldItem.m_ItemType == E_ITEM_BLAZE_ROD) then
+ -- 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);
+ if (Type == E_BLOCK_AIR) then
+ Player:SendMessage(cChatColor.LightGray .. "Block {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "}: air:" .. Meta);
+ else
+ local TempItem = cItem(Type, 1, Meta);
+ Player:SendMessage(cChatColor.LightGray .. "Block {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "}: " .. ItemToFullString(TempItem) .. " (" .. Type .. ":" .. Meta .. ")");
+ end
+
+ 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);
+ if (Type == E_BLOCK_AIR) then
+ Player:SendMessage(cChatColor.LightGray .. "Block {" .. X .. ", " .. Y .. ", " .. Z .. "}: air:" .. Meta);
+ else
+ local TempItem = cItem(Type, 1, Meta);
+ Player:SendMessage(cChatColor.LightGray .. "Block {" .. X .. ", " .. Y .. ", " .. Z .. "}: " .. ItemToFullString(TempItem) .. " (" .. Type .. ":" .. Meta .. ")");
+ return true;
+ end
+ end
+end
+
+
+
+
diff --git a/MCServer/Plugins/sTick/main.lua b/MCServer/Plugins/sTick/main.lua
deleted file mode 100644
index 057cd22d1..000000000
--- a/MCServer/Plugins/sTick/main.lua
+++ /dev/null
@@ -1,20 +0,0 @@
-
--- Global variables
-PLUGIN = {} -- Reference to own plugin object
-
-
-
-
-
-function Initialize(Plugin)
- PLUGIN = Plugin
-
- Plugin:SetName("sTick")
- Plugin:SetVersion(2)
-
- PluginManager = cRoot:Get():GetPluginManager()
- PluginManager:AddHook(Plugin, cPluginManager.E_PLUGIN_BLOCK_PLACE)
-
- LOG("Initialized " .. Plugin:GetName() .. " v." .. Plugin:GetVersion())
- return true
-end \ No newline at end of file
diff --git a/MCServer/Plugins/sTick/onblockplace.lua b/MCServer/Plugins/sTick/onblockplace.lua
deleted file mode 100644
index 6bc2ce46a..000000000
--- a/MCServer/Plugins/sTick/onblockplace.lua
+++ /dev/null
@@ -1,19 +0,0 @@
-function OnBlockPlace(Player, BlockX, BlockY, BlockZ, BlockFace, HeldItem)
-
- -- dont check if the direction is in the air
- if BlockFace == BLOCK_FACE_NONE then
- return false
- end
-
- if (HeldItem.m_ItemType ~= 280) then
- -- not a Stick of Ticking
- return false
- end
-
- LOG("Setting next block tick to {" .. BlockX .. ", " .. BlockY .. ", " .. BlockZ .. "}")
-
- Player:GetWorld():SetNextBlockTick(BlockX, BlockY, BlockZ);
-
- return true
-
-end \ No newline at end of file
diff --git a/MCServer/settings.ini b/MCServer/settings.ini
index 7e545c86d..5754d19c5 100644
--- a/MCServer/settings.ini
+++ b/MCServer/settings.ini
@@ -11,7 +11,7 @@ Description=MCServer - in C++
DefaultWorld=world
[Plugins]
-; Plugin=sTick
+; Plugin=Debuggers
; Plugin=DiamondMover
Plugin=Core
Plugin=ChunkWorx