mirror of
https://github.com/ChestShop-authors/ChestShop-3.git
synced 2024-11-27 04:25:14 +01:00
Fix damage not getting set properly
This commit is contained in:
parent
adf5340932
commit
0c6aaaa6f7
@ -10,6 +10,7 @@ import org.bukkit.Material;
|
||||
import org.bukkit.entity.Player;
|
||||
import org.bukkit.inventory.ItemStack;
|
||||
import org.bukkit.inventory.meta.BookMeta;
|
||||
import org.bukkit.inventory.meta.Damageable;
|
||||
import org.bukkit.inventory.meta.ItemMeta;
|
||||
import org.bukkit.plugin.Plugin;
|
||||
import org.json.simple.JSONObject;
|
||||
@ -293,11 +294,13 @@ public class MaterialUtil {
|
||||
}
|
||||
|
||||
itemStack = new ItemStack(material);
|
||||
itemStack.setDurability(durability);
|
||||
|
||||
ItemMeta meta = getMetadata(itemName);
|
||||
|
||||
if (meta != null) {
|
||||
if (meta instanceof Damageable) {
|
||||
((Damageable) meta).setDamage(durability);
|
||||
}
|
||||
itemStack.setItemMeta(meta);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user