diff options
author | ementalo <ementalodev@gmx.co.uk> | 2013-01-29 10:25:01 +0000 |
---|---|---|
committer | ementalo <ementalodev@gmx.co.uk> | 2013-01-29 10:25:01 +0000 |
commit | d3087cc1652b26013b034035d46216b14fd3ef2d (patch) | |
tree | 6d69185ed8af716cccbb2d9529ec2974e285223c | |
parent | ad4853454588cb482373e55b173b303e9fb8e45c (diff) | |
download | Essentials-d3087cc1652b26013b034035d46216b14fd3ef2d.tar Essentials-d3087cc1652b26013b034035d46216b14fd3ef2d.tar.gz Essentials-d3087cc1652b26013b034035d46216b14fd3ef2d.tar.lz Essentials-d3087cc1652b26013b034035d46216b14fd3ef2d.tar.xz Essentials-d3087cc1652b26013b034035d46216b14fd3ef2d.zip |
Revert "Merge pull request #286 from GunfighterJ/2.9"
This reverts commit ad4853454588cb482373e55b173b303e9fb8e45c, reversing
changes made to f2619a4dde740d279a299b0ddf6be9eca63fb180.
-rw-r--r-- | Essentials/src/com/earth2me/essentials/commands/Commandsell.java | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java index a70b1e3cc..ec3262958 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java @@ -43,7 +43,7 @@ public class Commandsell extends EssentialsCommand } try { - totalWorth += sellItem(user, stack, args, true); + totalWorth += sellItem(user, stack, args, true); } catch (Exception e) { @@ -164,23 +164,11 @@ public class Commandsell extends EssentialsCommand } //TODO: Prices for Enchantments - ItemStack[] pinv = user.getInventory().getContents(); - int itemIndex = -1; - for (int i = 0; i < pinv.length; i++) - { - if (pinv[i] != null) - { - if (pinv[i].getType() == is.getType() && pinv[i].getDurability() == is.getDurability()) - { - itemIndex = i; - break; - } - } - } - pinv[itemIndex].setAmount(pinv[itemIndex].getAmount() - amount); - user.getInventory().setContents(pinv); + final ItemStack ris = is.clone(); + ris.setAmount(amount); + user.getInventory().removeItem(ris); user.updateInventory(); - Trade.log("Command", "Sell", "Item", user.getName(), new Trade(pinv[itemIndex], ess), user.getName(), new Trade(worth * amount, ess), user.getLocation(), ess); + Trade.log("Command", "Sell", "Item", user.getName(), new Trade(ris, ess), user.getName(), new Trade(worth * amount, ess), user.getLocation(), ess); user.giveMoney(worth * amount); user.sendMessage(_("itemSold", Util.displayCurrency(worth * amount, ess), amount, is.getType().toString().toLowerCase(Locale.ENGLISH), Util.displayCurrency(worth, ess))); logger.log(Level.INFO, _("itemSoldConsole", user.getDisplayName(), is.getType().toString().toLowerCase(Locale.ENGLISH), Util.displayCurrency(worth * amount, ess), amount, Util.displayCurrency(worth, ess))); |