summaryrefslogtreecommitdiffstats
path: root/Server/Plugins/Debuggers/Debuggers.lua
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-11-26 19:24:24 +0100
committerMattes D <github@xoft.cz>2016-11-26 19:24:24 +0100
commit56f8dedb6b0c8922257055d22c6166e85f5e066f (patch)
treeeb430c09bd70e97dd7dc5e5af7ec5382ec2f17e2 /Server/Plugins/Debuggers/Debuggers.lua
parentDebuggers: Added commands to investigate item's Lore. (diff)
downloadcuberite-56f8dedb6b0c8922257055d22c6166e85f5e066f.tar
cuberite-56f8dedb6b0c8922257055d22c6166e85f5e066f.tar.gz
cuberite-56f8dedb6b0c8922257055d22c6166e85f5e066f.tar.bz2
cuberite-56f8dedb6b0c8922257055d22c6166e85f5e066f.tar.lz
cuberite-56f8dedb6b0c8922257055d22c6166e85f5e066f.tar.xz
cuberite-56f8dedb6b0c8922257055d22c6166e85f5e066f.tar.zst
cuberite-56f8dedb6b0c8922257055d22c6166e85f5e066f.zip
Diffstat (limited to '')
-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 27440027e..914da8036 100644
--- a/Server/Plugins/Debuggers/Debuggers.lua
+++ b/Server/Plugins/Debuggers/Debuggers.lua
@@ -987,6 +987,28 @@ end;
+function HandleGetCustomNameCmd(a_Split, a_Player)
+ local item = a_Player:GetInventory():GetEquippedItem()
+ if (not(item.m_CustomName) or (item.m_CustomName == "")) then
+ a_Player:SendMessage("The custom name is empty")
+ return true
+ end
+ local dispCN = string.gsub(item.m_CustomName, ".",
+ function(a_Char)
+ if (a_Char < " ") then
+ return string.byte(a_Char)
+ end
+ return a_Char
+ end
+ )
+ a_Player:SendMessage(string.format("The custom name is %d bytes: %s", string.len(item.m_CustomName), dispCN))
+ return true
+end
+
+
+
+
+
function HandleGetLoreCmd(a_Split, a_Player)
local item = a_Player:GetInventory():GetEquippedItem()
if (not(item.m_Lore) or (item.m_Lore == "")) then
@@ -1062,6 +1084,31 @@ end
+function HandleSetCustomNameCmd(a_Split, a_Player, a_EntireCmd)
+ if not(a_Split[2]) then
+ a_Player:SendMessageFatal("Missing an argument: the custom name to set");
+ return true
+ end
+ local nameToSet = a_EntireCmd:match("/setcustomname%s(.*)")
+ if not(nameToSet) then
+ a_Player:SendMessageFatal("Failed to extract the custom name to set")
+ return true
+ end
+ nameToSet = nameToSet:gsub("\\([0-9][0-9][0-9])", string.char)
+
+ local inv = a_Player:GetInventory()
+ local slotNum = inv:GetEquippedSlotNum()
+ local item = cItem(inv:GetEquippedItem()) -- Make a copy of the item
+ item.m_CustomName = nameToSet
+ inv:SetHotbarSlot(slotNum, item)
+ a_Player:SendMessage("Custom name set to " .. nameToSet)
+ 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");