summaryrefslogtreecommitdiffstats
path: root/MCServer/Plugins/Debuggers
diff options
context:
space:
mode:
authormadmaxoft <github@xoft.cz>2014-07-18 23:51:15 +0200
committermadmaxoft <github@xoft.cz>2014-07-18 23:51:15 +0200
commit0346ab15adaf73e4d7c4ee4cfb175d40e721adfe (patch)
tree26930bf30ee1e92021165bbb12114bc396a33ac0 /MCServer/Plugins/Debuggers
parentAPIDump: Documented RemoveItem(). (diff)
downloadcuberite-0346ab15adaf73e4d7c4ee4cfb175d40e721adfe.tar
cuberite-0346ab15adaf73e4d7c4ee4cfb175d40e721adfe.tar.gz
cuberite-0346ab15adaf73e4d7c4ee4cfb175d40e721adfe.tar.bz2
cuberite-0346ab15adaf73e4d7c4ee4cfb175d40e721adfe.tar.lz
cuberite-0346ab15adaf73e4d7c4ee4cfb175d40e721adfe.tar.xz
cuberite-0346ab15adaf73e4d7c4ee4cfb175d40e721adfe.tar.zst
cuberite-0346ab15adaf73e4d7c4ee4cfb175d40e721adfe.zip
Diffstat (limited to 'MCServer/Plugins/Debuggers')
-rw-r--r--MCServer/Plugins/Debuggers/Debuggers.lua12
1 files changed, 8 insertions, 4 deletions
diff --git a/MCServer/Plugins/Debuggers/Debuggers.lua b/MCServer/Plugins/Debuggers/Debuggers.lua
index 95b36e854..b402c1867 100644
--- a/MCServer/Plugins/Debuggers/Debuggers.lua
+++ b/MCServer/Plugins/Debuggers/Debuggers.lua
@@ -1107,18 +1107,21 @@ end
function HandleRMItem(a_Split, a_Player)
- if ((#a_Split ~= 2) and (#a_Split ~= 3)) then
+ -- 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
- if (#a_Split == 3) then
+ -- 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")
@@ -1128,8 +1131,9 @@ function HandleRMItem(a_Split, a_Player)
Item.m_ItemCount = Count
end
- local RemovedItems = a_Player:GetInventory():RemoveItem(Item)
- a_Player:SendMessageSuccess("Removed " .. RemovedItems .. " Items!")
+ -- Remove the item:
+ local NumRemovedItems = a_Player:GetInventory():RemoveItem(Item)
+ a_Player:SendMessageSuccess("Removed " .. NumRemovedItems .. " Items!")
return true
end