From ce9e630072949808f7e9cae79623e4ec6e040a62 Mon Sep 17 00:00:00 2001 From: snowleo Date: Sun, 17 Feb 2013 15:10:41 +0100 Subject: [PATCH] Fix all removeItem() This could fix some broken logging of selling items --- Essentials/src/com/earth2me/essentials/Trade.java | 2 +- .../src/com/earth2me/essentials/commands/Commandsell.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Essentials/src/com/earth2me/essentials/Trade.java b/Essentials/src/com/earth2me/essentials/Trade.java index 1a03a0145..3d51c5aa4 100644 --- a/Essentials/src/com/earth2me/essentials/Trade.java +++ b/Essentials/src/com/earth2me/essentials/Trade.java @@ -169,7 +169,7 @@ public class Trade { throw new ChargeException(_("missingItems", getItemStack().getAmount(), getItemStack().getType().toString().toLowerCase(Locale.ENGLISH).replace("_", " "))); } - user.getInventory().removeItem(getItemStack()); + user.getInventory().removeItem(getItemStack().clone()); user.updateInventory(); } if (command != null) diff --git a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java index a7b1ae32d..b238361b2 100644 --- a/Essentials/src/com/earth2me/essentials/commands/Commandsell.java +++ b/Essentials/src/com/earth2me/essentials/commands/Commandsell.java @@ -157,7 +157,7 @@ public class Commandsell extends EssentialsCommand // This should never happen. throw new IllegalStateException("Trying to remove more items than are available."); } - user.getInventory().removeItem(ris); + user.getInventory().removeItem(ris.clone()); user.updateInventory(); 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);