summaryrefslogtreecommitdiffstats
path: root/Server/Plugins/Debuggers/Debuggers.lua
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-11-26 20:45:01 +0100
committerMattes D <github@xoft.cz>2016-11-26 20:45:01 +0100
commit12071bc51a46b245d7b46bfe697dda1d54ee2f56 (patch)
tree7800402041e8ae8ecfb10fd2fb3efc6cc8921c61 /Server/Plugins/Debuggers/Debuggers.lua
parentDebuggers: Added commands to investigate item's custom name. (diff)
downloadcuberite-12071bc51a46b245d7b46bfe697dda1d54ee2f56.tar
cuberite-12071bc51a46b245d7b46bfe697dda1d54ee2f56.tar.gz
cuberite-12071bc51a46b245d7b46bfe697dda1d54ee2f56.tar.bz2
cuberite-12071bc51a46b245d7b46bfe697dda1d54ee2f56.tar.lz
cuberite-12071bc51a46b245d7b46bfe697dda1d54ee2f56.tar.xz
cuberite-12071bc51a46b245d7b46bfe697dda1d54ee2f56.tar.zst
cuberite-12071bc51a46b245d7b46bfe697dda1d54ee2f56.zip
Diffstat (limited to 'Server/Plugins/Debuggers/Debuggers.lua')
-rw-r--r--Server/Plugins/Debuggers/Debuggers.lua47
1 files changed, 47 insertions, 0 deletions
diff --git a/Server/Plugins/Debuggers/Debuggers.lua b/Server/Plugins/Debuggers/Debuggers.lua
index 914da8036..4dfc55030 100644
--- a/Server/Plugins/Debuggers/Debuggers.lua
+++ b/Server/Plugins/Debuggers/Debuggers.lua
@@ -1031,6 +1031,28 @@ end
+function HandleGetPropCmd(a_Split, a_Player)
+ local item = a_Player:GetInventory():GetEquippedItem()
+ if not(item.m_DebuggersCustomProp) then
+ a_Player:SendMessage("The custom property is not set.")
+ return true
+ end
+ local dispValue = string.gsub(item.m_DebuggersCustomProp, ".",
+ function(a_Char)
+ if (a_Char < " ") then
+ return string.byte(a_Char)
+ end
+ return a_Char
+ end
+ )
+ a_Player:SendMessage(string.format("The custom property value is %d bytes: %s", string.len(item.m_DebuggersCustomProp), dispValue))
+ return true
+end
+
+
+
+
+
function HandleHungerCmd(a_Split, a_Player)
a_Player:SendMessage("FoodLevel: " .. a_Player:GetFoodLevel());
a_Player:SendMessage("FoodSaturationLevel: " .. a_Player:GetFoodSaturationLevel());
@@ -1109,6 +1131,31 @@ end
+function HandleSetPropCmd(a_Split, a_Player, a_EntireCmd)
+ if not(a_Split[2]) then
+ a_Player:SendMessageFatal("Missing an argument: the property value to set");
+ return true
+ end
+ local valueToSet = a_EntireCmd:match("/setprop%s(.*)")
+ if not(valueToSet) then
+ a_Player:SendMessageFatal("Failed to extract the property value to set")
+ return true
+ end
+ valueToSet = valueToSet:gsub("\\([0-9][0-9][0-9])", string.char)
+
+ local inv = a_Player:GetInventory()
+ local slotNum = inv:GetEquippedSlotNum()
+ local item = inv:GetEquippedItem()
+ item.m_DebuggersCustomProp = valueToSet
+ inv:SetHotbarSlot(slotNum, item)
+ a_Player:SendMessage("Custom property set to " .. valueToSet)
+ return true
+end
+
+
+
+
+
function HandleSetLoreCmd(a_Split, a_Player, a_EntireCmd)
if not(a_Split[2]) then
a_Player:SendMessageFatal("Missing an argument: the lore to set");