diff options
author | Andrew Ardill <andrew.ardill@gmail.com> | 2011-12-20 00:30:54 +1100 |
---|---|---|
committer | Andrew Ardill <andrew.ardill@gmail.com> | 2011-12-20 00:30:54 +1100 |
commit | 1c6adc158776cd267a891529a781ac1daef4d721 (patch) | |
tree | e0d3a993b73dea7aa78b95ea072834cb2292660b /src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java | |
parent | acfb4f2fbe00bf103c2779cfa7d970ebdeb48fa3 (diff) | |
download | craftbukkit-1c6adc158776cd267a891529a781ac1daef4d721.tar craftbukkit-1c6adc158776cd267a891529a781ac1daef4d721.tar.gz craftbukkit-1c6adc158776cd267a891529a781ac1daef4d721.tar.lz craftbukkit-1c6adc158776cd267a891529a781ac1daef4d721.tar.xz craftbukkit-1c6adc158776cd267a891529a781ac1daef4d721.zip |
Fix error when cloning enchanted ItemStacks.
The existing method for cloning a Bukkit ItemStack fails to correctly copy
the underlying enchantments. Fix this by overriding .clone() in
CraftItemStack, cloning the underlying nms ItemStack correctly.
Fixes BUKKIT-360
Diffstat (limited to 'src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java')
-rw-r--r-- | src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java index cd621272..c0854276 100644 --- a/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java +++ b/src/main/java/org/bukkit/craftbukkit/inventory/CraftItemStack.java @@ -210,6 +210,11 @@ public class CraftItemStack extends ItemStack { return item; } + @Override + public CraftItemStack clone() { + return new CraftItemStack(this.item.cloneItemStack()); + } + public static net.minecraft.server.ItemStack createNMSItemStack(ItemStack original) { return new CraftItemStack(original).getHandle(); } |