From 4b970c6fce59b48f411aac240923ebd17447d30b Mon Sep 17 00:00:00 2001 From: Andreas Troelsen Date: Thu, 21 Mar 2013 23:47:48 +0100 Subject: [PATCH] Use non-deprecated ItemStack constructor. The SerializableItem class was previously using a constructor that included a raw byte for data values. The current constructor takes no byte argument and the data value must be set explicitly. This fixes e.g. splash potions not restoring properly from arena containers. --- .../garbagemule/MobArena/util/inventory/SerializableItem.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/com/garbagemule/MobArena/util/inventory/SerializableItem.java b/src/com/garbagemule/MobArena/util/inventory/SerializableItem.java index 25470d0..976d757 100644 --- a/src/com/garbagemule/MobArena/util/inventory/SerializableItem.java +++ b/src/com/garbagemule/MobArena/util/inventory/SerializableItem.java @@ -5,6 +5,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Map.Entry; +import org.bukkit.Material; import org.bukkit.enchantments.Enchantment; import org.bukkit.inventory.ItemStack; import org.bukkit.material.MaterialData; @@ -34,7 +35,8 @@ public class SerializableItem implements Serializable } public ItemStack toItemStack() { - ItemStack stack = new ItemStack(id, amount, damage, data); + ItemStack stack = new ItemStack(id, amount, damage); + if (data != null) stack.setData(new MaterialData(data)); if (!enchantments.isEmpty()) { for (Entry entry : this.enchantments.entrySet()) {