summaryrefslogtreecommitdiffstats
path: root/Server/Plugins
diff options
context:
space:
mode:
authorMattes D <github@xoft.cz>2016-11-26 17:52:33 +0100
committerMattes D <github@xoft.cz>2016-11-26 17:52:33 +0100
commit3872e813f32398d55d8a038b450fc2faba3b46b6 (patch)
tree1256310e254895440ae6bd028f912e914036536a /Server/Plugins
parentDebuggers: Sorted the Info.lua commands. (diff)
downloadcuberite-3872e813f32398d55d8a038b450fc2faba3b46b6.tar
cuberite-3872e813f32398d55d8a038b450fc2faba3b46b6.tar.gz
cuberite-3872e813f32398d55d8a038b450fc2faba3b46b6.tar.bz2
cuberite-3872e813f32398d55d8a038b450fc2faba3b46b6.tar.lz
cuberite-3872e813f32398d55d8a038b450fc2faba3b46b6.tar.xz
cuberite-3872e813f32398d55d8a038b450fc2faba3b46b6.tar.zst
cuberite-3872e813f32398d55d8a038b450fc2faba3b46b6.zip
Diffstat (limited to 'Server/Plugins')
-rw-r--r--Server/Plugins/Debuggers/Debuggers.lua48
-rw-r--r--Server/Plugins/Debuggers/Info.lua12
2 files changed, 60 insertions, 0 deletions
diff --git a/Server/Plugins/Debuggers/Debuggers.lua b/Server/Plugins/Debuggers/Debuggers.lua
index 6397962d9..27440027e 100644
--- a/Server/Plugins/Debuggers/Debuggers.lua
+++ b/Server/Plugins/Debuggers/Debuggers.lua
@@ -987,6 +987,28 @@ end;
+function HandleGetLoreCmd(a_Split, a_Player)
+ local item = a_Player:GetInventory():GetEquippedItem()
+ if (not(item.m_Lore) or (item.m_Lore == "")) then
+ a_Player:SendMessage("The lore is empty")
+ return true
+ end
+ local dispLore = string.gsub(item.m_Lore, ".",
+ function(a_Char)
+ if (a_Char < " ") then
+ return string.byte(a_Char)
+ end
+ return a_Char
+ end
+ )
+ a_Player:SendMessage(string.format("The lore is %d bytes: %s", string.len(item.m_Lore), dispLore))
+ return true
+end
+
+
+
+
+
function HandleHungerCmd(a_Split, a_Player)
a_Player:SendMessage("FoodLevel: " .. a_Player:GetFoodLevel());
a_Player:SendMessage("FoodSaturationLevel: " .. a_Player:GetFoodSaturationLevel());
@@ -1040,6 +1062,32 @@ 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");
+ return true
+ end
+ local loreToSet = a_EntireCmd:match("/setlore%s(.*)")
+ if not(loreToSet) then
+ a_Player:SendMessageFatal("Failed to extract the lore to set")
+ return true
+ end
+ loreToSet = loreToSet: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
+ local oldLore = item.m_Lore
+ item.m_Lore = loreToSet
+ inv:SetHotbarSlot(slotNum, item)
+ a_Player:SendMessage("Lore set to " .. loreToSet)
+ return true
+end
+
+
+
+
+
function HandleSpideyCmd(a_Split, a_Player)
-- Place a line of cobwebs from the player's eyes until non-air block, in the line-of-sight of the player
local World = a_Player:GetWorld();
diff --git a/Server/Plugins/Debuggers/Info.lua b/Server/Plugins/Debuggers/Info.lua
index 6964a9036..06fabad14 100644
--- a/Server/Plugins/Debuggers/Info.lua
+++ b/Server/Plugins/Debuggers/Info.lua
@@ -100,6 +100,12 @@ g_PluginInfo =
Handler = HandleGCCmd,
HelpString = "Activates the Lua garbage collector"
},
+ ["/getlore"] =
+ {
+ Permission = "debuggers",
+ Handler = HandleGetLoreCmd,
+ HelpString = "Displays the Lore of currently held item",
+ },
["/hunger"] =
{
Permission = "debuggers",
@@ -166,6 +172,12 @@ g_PluginInfo =
Handler = HandleSched,
HelpString = "Schedules a simple countdown using cWorld:ScheduleTask()"
},
+ ["/setlore"] =
+ {
+ Permission = "debuggers",
+ Handler = HandleSetLoreCmd,
+ HelpString = "Sets the lore for the item currently in hand",
+ },
["/spidey"] =
{
Permission = "debuggers",