Fix broken trade/buy signs because of a wrong cast

This commit is contained in:
snowleo 2011-11-27 22:36:32 +01:00
parent aceda4c680
commit 6603d0997e

View File

@ -151,13 +151,27 @@ public final class InventoryWorkaround
{
ItemStack stack = item.clone();
stack.setAmount(dontBreakStacks ? ess.getSettings().getDefaultStackSize() : item.getType().getMaxStackSize());
EnchantmentFix.setItem(cinventory, firstFree, stack);
if (cinventory instanceof FakeInventory)
{
cinventory.setItem(firstFree, stack);
}
else
{
EnchantmentFix.setItem(cinventory, firstFree, stack);
}
item.setAmount(item.getAmount() - item.getType().getMaxStackSize());
}
else
{
// Just store it
EnchantmentFix.setItem(cinventory, firstFree, item);
if (cinventory instanceof FakeInventory)
{
cinventory.setItem(firstFree, item);
}
else
{
EnchantmentFix.setItem(cinventory, firstFree, item);
}
break;
}
}