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.
This commit is contained in:
Andreas Troelsen 2013-03-21 23:47:48 +01:00
parent f9a1e6e123
commit 4b970c6fce

View File

@ -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<Integer,Integer> entry : this.enchantments.entrySet()) {