Enchantments on Trade signs? Fixes check, so we won't add items that are enchanted.

This commit is contained in:
snowleo 2011-11-27 07:47:16 +01:00
parent a8a72da15e
commit 41e8c4c7b8

View File

@ -4,7 +4,7 @@ import static com.earth2me.essentials.I18n._;
import com.earth2me.essentials.*; import com.earth2me.essentials.*;
import org.bukkit.inventory.ItemStack; import org.bukkit.inventory.ItemStack;
//TODO: Sell Enchantment on Trade signs?
public class SignTrade extends EssentialsSign public class SignTrade extends EssentialsSign
{ {
public SignTrade() public SignTrade()
@ -70,7 +70,8 @@ public class SignTrade extends EssentialsSign
final Trade trade = getTrade(sign, 2, false, false, ess); final Trade trade = getTrade(sign, 2, false, false, ess);
if (trade.getItemStack() != null && player.getItemInHand() != null if (trade.getItemStack() != null && player.getItemInHand() != null
&& trade.getItemStack().getTypeId() == player.getItemInHand().getTypeId() && trade.getItemStack().getTypeId() == player.getItemInHand().getTypeId()
&& trade.getItemStack().getDurability() == player.getItemInHand().getDurability()) && trade.getItemStack().getDurability() == player.getItemInHand().getDurability()
&& trade.getItemStack().getEnchantments().equals(player.getItemInHand().getEnchantments()))
{ {
int amount = player.getItemInHand().getAmount(); int amount = player.getItemInHand().getAmount();
amount -= amount % trade.getItemStack().getAmount(); amount -= amount % trade.getItemStack().getAmount();