Fix worth display bug

This commit is contained in:
KHobbits 2013-07-14 12:09:49 +01:00
parent 8009c1539a
commit 0d2dea41e3
3 changed files with 11 additions and 8 deletions

View file

@ -147,7 +147,11 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb
{ {
List<ItemStack> is = new ArrayList<ItemStack>(); List<ItemStack> is = new ArrayList<ItemStack>();
if (args[0].equalsIgnoreCase("hand")) if (args.length < 1)
{
is.add(user.getItemInHand());
}
else if (args[0].equalsIgnoreCase("hand"))
{ {
is.add(user.getItemInHand()); is.add(user.getItemInHand());
} }
@ -173,14 +177,11 @@ public class ItemDb implements IConf, net.ess3.api.IItemDb
is.add(stack); is.add(stack);
} }
} }
else if (args.length > 0) else
{ {
is.add(get(args[0])); is.add(get(args[0]));
} }
else {
is.add(user.getItemInHand());
}
return is; return is;
} }

View file

@ -40,10 +40,11 @@ public class Commandsell extends EssentialsCommand
if (stack.getAmount() > 0) if (stack.getAmount() > 0)
{ {
totalWorth = totalWorth.add(sellItem(user, stack, args, isBulk)); totalWorth = totalWorth.add(sellItem(user, stack, args, isBulk));
stack = stack.clone();
count++; count++;
for (ItemStack zeroStack : is) for (ItemStack zeroStack : is)
{ {
if (!zeroStack.equals(stack) && zeroStack.isSimilar(stack)) if (zeroStack.isSimilar(stack))
{ {
zeroStack.setAmount(0); zeroStack.setAmount(0);
} }

View file

@ -36,10 +36,11 @@ public class Commandworth extends EssentialsCommand
if (stack.getAmount() > 0) if (stack.getAmount() > 0)
{ {
totalWorth = totalWorth.add(itemWorth(user.getBase(), user, stack, args)); totalWorth = totalWorth.add(itemWorth(user.getBase(), user, stack, args));
stack = stack.clone();
count++; count++;
for (ItemStack zeroStack : is) for (ItemStack zeroStack : is)
{ {
if (!zeroStack.equals(stack) && zeroStack.isSimilar(stack)) if (zeroStack.isSimilar(stack))
{ {
zeroStack.setAmount(0); zeroStack.setAmount(0);
} }