mirror of
https://github.com/garbagemule/MobArena.git
synced 2025-01-27 02:31:28 +01:00
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:
parent
f9a1e6e123
commit
4b970c6fce
@ -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()) {
|
||||
|
Loading…
Reference in New Issue
Block a user