summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/Debuggers/Debuggers.lua
diff options
context:
space:
mode:
authorTiger Wang <ziwei.tiger@hotmail.co.uk>2014-07-22 11:24:28 +0200
committerTiger Wang <ziwei.tiger@hotmail.co.uk>2014-07-22 11:24:28 +0200
commit3385ed56b86a7816892e199fdda177ebb3a33966 (patch)
treee4ebda8e1fc245e9a84c3c4b363c05bbbad3a85f /MCServer/Plugins/Debuggers/Debuggers.lua
parentSuggestions (diff)
parentUpdated prefabs to current Gallery content. (diff)
downloadcuberite-3385ed56b86a7816892e199fdda177ebb3a33966.tar
cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.tar.gz
cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.tar.bz2
cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.tar.lz
cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.tar.xz
cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.tar.zst
cuberite-3385ed56b86a7816892e199fdda177ebb3a33966.zip
Diffstat (limited to '')
-rw-r--r--MCServer/Plugins/Debuggers/Debuggers.lua44
1 files changed, 40 insertions, 4 deletions
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua
index 918204deb..b402c1867 100644
--- a/MCServer/Plugins/Debuggers/Debuggers.lua
+++ b/MCServer/Plugins/Debuggers/Debuggers.lua
@@ -60,9 +60,10 @@ function Initialize(Plugin)
PM:BindCommand("/ff", "debuggers", HandleFurnaceFuel, "- Shows how long the currently held item would burn in a furnace");
PM:BindCommand("/sched", "debuggers", HandleSched, "- Schedules a simple countdown using cWorld:ScheduleTask()");
PM:BindCommand("/cs", "debuggers", HandleChunkStay, "- Tests the ChunkStay Lua integration for the specified chunk coords");
- PM:BindCommand("/compo", "debuggers", HandleCompo, "- Tests the cCompositeChat bindings")
- PM:BindCommand("/sb", "debuggers", HandleSetBiome, "- Sets the biome around you to the specified one")
- PM:BindCommand("/wesel", "debuggers", HandleWESel, "- Expands the current WE selection by 1 block in X/Z")
+ PM:BindCommand("/compo", "debuggers", HandleCompo, "- Tests the cCompositeChat bindings");
+ PM:BindCommand("/sb", "debuggers", HandleSetBiome, "- Sets the biome around you to the specified one");
+ PM:BindCommand("/wesel", "debuggers", HandleWESel, "- Expands the current WE selection by 1 block in X/Z");
+ PM:BindCommand("/rmitem", "debuggers", HandleRMItem, "- Remove the specified item from the inventory.");
Plugin:AddWebTab("Debuggers", HandleRequest_Debuggers)
Plugin:AddWebTab("StressTest", HandleRequest_StressTest)
@@ -533,7 +534,7 @@ function OnTakeDamage(Receiver, TDI)
-- Receiver is cPawn
-- TDI is TakeDamageInfo
- LOG(Receiver:GetClass() .. " was dealt " .. DamageTypeToString(TDI.DamageType) .. " damage: Raw " .. TDI.RawDamage .. ", Final " .. TDI.FinalDamage .. " (" .. (TDI.RawDamage - TDI.FinalDamage) .. " covered by armor)");
+ -- LOG(Receiver:GetClass() .. " was dealt " .. DamageTypeToString(TDI.DamageType) .. " damage: Raw " .. TDI.RawDamage .. ", Final " .. TDI.FinalDamage .. " (" .. (TDI.RawDamage - TDI.FinalDamage) .. " covered by armor)");
return false;
end
@@ -1105,6 +1106,41 @@ end
+function HandleRMItem(a_Split, a_Player)
+ -- Check params:
+ if (a_Split[2] == nil) then
+ a_Player:SendMessage("Usage: /rmitem <Item> [Count]")
+ return true
+ end
+
+ -- Parse the item type:
+ local Item = cItem()
+ if (not StringToItem(a_Split[2], Item)) then
+ a_Player:SendMessageFailure(a_Split[2] .. " isn't a valid item")
+ return true
+ end
+
+ -- Parse the optional item count
+ if (a_Split[3] ~= nil) then
+ local Count = tonumber(a_Split[3])
+ if (Count == nil) then
+ a_Player:SendMessageFailure(a_Split[3] .. " isn't a valid number")
+ return true
+ end
+
+ Item.m_ItemCount = Count
+ end
+
+ -- Remove the item:
+ local NumRemovedItems = a_Player:GetInventory():RemoveItem(Item)
+ a_Player:SendMessageSuccess("Removed " .. NumRemovedItems .. " Items!")
+ return true
+end
+
+
+
+
+
function HandleRequest_Debuggers(a_Request)
local FolderContents = cFile:GetFolderContents("./");
return "<p>The following objects have been returned by cFile:GetFolderContents():<ul><li>" .. table.concat(FolderContents, "</li><li>") .. "</li></ul></p>";