Use instanceof pattern

This commit is contained in:
tastybento 2021-07-31 10:51:46 -07:00
parent 908b0a834f
commit 21c09a8a34

View File

@ -324,8 +324,7 @@ public class AcidEffect implements Listener {
private static boolean damage(ItemStack item) { private static boolean damage(ItemStack item) {
ItemMeta im = item.getItemMeta(); ItemMeta im = item.getItemMeta();
if (im instanceof Damageable) { if (im instanceof Damageable d) {
Damageable d = (Damageable)im;
d.setDamage(d.getDamage() + 1); d.setDamage(d.getDamage() + 1);
item.setItemMeta((ItemMeta) d); item.setItemMeta((ItemMeta) d);
return d.getDamage() >= item.getType().getMaxDurability(); return d.getDamage() >= item.getType().getMaxDurability();