Skip to content

Commit

Permalink
Add '- take inventory' to clear a player's inventory. Careful! :)
Browse files Browse the repository at this point in the history
  • Loading branch information
aufdemrand committed Apr 8, 2013
1 parent 6e2ace8 commit acd5e68
Showing 1 changed file with 8 additions and 1 deletion.
Expand Up @@ -29,7 +29,7 @@

public class TakeCommand extends AbstractCommand{

private enum TakeType { MONEY, ITEMINHAND, ITEM }
private enum TakeType { MONEY, ITEMINHAND, ITEM, INVENTORY }

@Override
public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException {
Expand All @@ -45,6 +45,9 @@ public void parseArgs(ScriptEntry scriptEntry) throws InvalidArgumentsException
else if (aH.matchesArg("ITEM_IN_HAND", arg))
takeType = TakeType.ITEMINHAND;

else if (aH.matchesArg("INVENTORY", arg))
takeType = TakeType.INVENTORY;

else if (aH.matchesValueArg("QTY", arg, aH.ArgumentType.Double))
quantity = aH.getDoubleFrom(arg);

Expand All @@ -67,6 +70,10 @@ public void execute(ScriptEntry scriptEntry) throws CommandExecutionException {

switch ((TakeType)scriptEntry.getObject("takeType")) {

case INVENTORY:
scriptEntry.getPlayer().getInventory().clear();
break;

case ITEMINHAND:
int inHandAmt = scriptEntry.getPlayer().getItemInHand().getAmount();
int theAmount = ((Double) scriptEntry.getObject("quantity")).intValue();
Expand Down

0 comments on commit acd5e68

Please sign in to comment.