From 0d2dea41e3da531fcf14c0fef7df1605bf9066eb Mon Sep 17 00:00:00 2001 From: KHobbits Date: Sun, 14 Jul 2013 12:09:49 +0100 Subject: Fix worth display bug --- Essentials/src/com/earth2me/essentials/ItemDb.java | 13 +++++++------ .../src/com/earth2me/essentials/commands/Commandsell.java | 3 ++- .../src/com/earth2me/essentials/commands/Commandworth.java | 3 ++- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/ItemDb.java b/Essentials/src/com/earth2me/essentials/ItemDb.java index 83a3b0686..6a7af9b7d 100644 --- a/Essentials/src/com/earth2me/essentials/ItemDb.java +++ b/Essentials/src/com/earth2me/essentials/ItemDb.java @@ -147,7 +147,11 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb { List is = new ArrayList(); - if (args[0].equalsIgnoreCase("hand")) + if (args.length < 1) + { + is.add(user.getItemInHand()); + } + else if (args[0].equalsIgnoreCase("hand")) { is.add(user.getItemInHand()); } @@ -173,14 +177,11 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb is.add(stack); } } - else if (args.length > 0) + else { is.add(get(args[0])); } - else { - is.add(user.getItemInHand()); - } - + return is; } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java index 773e94b68..386aac603 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java @@ -40,10 +40,11 @@ public class Commandsell extends EssentialsCommand if (stack.getAmount() > 0) { totalWorth = totalWorth.add(sellItem(user, stack, args, isBulk)); + stack = stack.clone(); count++; for (ItemStack zeroStack : is) { - if (!zeroStack.equals(stack) && zeroStack.isSimilar(stack)) + if (zeroStack.isSimilar(stack)) { zeroStack.setAmount(0); } diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandworth.java b/Essentials/src/com/earth2me/essentials/commands/Commandworth.java index 45ff23c9b..bc832a44b 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandworth.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandworth.java @@ -36,10 +36,11 @@ public class Commandworth extends EssentialsCommand if (stack.getAmount() > 0) { totalWorth = totalWorth.add(itemWorth(user.getBase(), user, stack, args)); + stack = stack.clone(); count++; for (ItemStack zeroStack : is) { - if (!zeroStack.equals(stack) && zeroStack.isSimilar(stack)) + if (zeroStack.isSimilar(stack)) { zeroStack.setAmount(0); } -- cgit v1.2.3