summaryrefslogtreecommitdiffstats
path: root/src/main/java
diff options
context:
space:
mode:
authorNathan Adams <dinnerbone@dinnerbone.com>2011-12-04 13:22:50 +0000
committerNathan Adams <dinnerbone@dinnerbone.com>2011-12-04 13:22:50 +0000
commitc6d182286c69a5d0500c53fd3a743d48e9f326e8 (patch)
tree4c08b289aa7ce4007a1f1a2a4d5baa6137313570 /src/main/java
parent1185ca75fcc5ed9c1aeed85d145de7c6763646ef (diff)
downloadcraftbukkit-c6d182286c69a5d0500c53fd3a743d48e9f326e8.tar
craftbukkit-c6d182286c69a5d0500c53fd3a743d48e9f326e8.tar.gz
craftbukkit-c6d182286c69a5d0500c53fd3a743d48e9f326e8.tar.lz
craftbukkit-c6d182286c69a5d0500c53fd3a743d48e9f326e8.tar.xz
craftbukkit-c6d182286c69a5d0500c53fd3a743d48e9f326e8.zip
Fixed some various CraftInventory bugs related to dropping Enchantments
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
index f1d21afa..6f1bcaad 100644
--- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
+++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftInventory.java
@@ -205,7 +205,7 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
}
for (int i = 0; i < inventory.length; i++) {
ItemStack cItem = inventory[i];
- if (cItem != null && cItem.getTypeId() == filteredItem.getTypeId() && cItem.getAmount() < cItem.getMaxStackSize() && cItem.getDurability() == filteredItem.getDurability()) {
+ if (cItem != null && cItem.getTypeId() == filteredItem.getTypeId() && cItem.getAmount() < cItem.getMaxStackSize() && cItem.getDurability() == filteredItem.getDurability() && cItem.getEnchantments().equals(filteredItem.getEnchantments())) {
return i;
}
}
@@ -239,7 +239,9 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
} else {
// More than a single stack!
if (item.getAmount() > getMaxItemStack()) {
- setItem(firstFree, new CraftItemStack(item.getTypeId(), getMaxItemStack(), item.getDurability()));
+ CraftItemStack stack = new CraftItemStack(item.getTypeId(), getMaxItemStack(), item.getDurability());
+ stack.addUnsafeEnchantments(item.getEnchantments());
+ setItem(firstFree, stack);
item.setAmount(item.getAmount() - getMaxItemStack());
} else {
// Just store it
@@ -280,7 +282,7 @@ public class CraftInventory implements org.bukkit.inventory.Inventory {
int toDelete = item.getAmount();
while (true) {
- int first = first(item.getType());
+ int first = first(item);
// Drat! we don't have this type in the inventory
if (first == -1) {