Catch UnsupportedOperationException for cb.spigot().setUnbreakable

This commit is contained in:
Olof Larsson 2017-12-29 17:53:53 +01:00
parent c0e5746e3c
commit 2bdabf9619

View File

@ -35,13 +35,21 @@ public class WriterItemStackMetaUnbreakable extends WriterAbstractItemStackMetaF
@Override @Override
public Boolean getB(ItemMeta cb, ItemStack d) public Boolean getB(ItemMeta cb, ItemStack d)
{ {
try {
return cb.spigot().isUnbreakable(); return cb.spigot().isUnbreakable();
} catch (UnsupportedOperationException ignored) {
return false;
}
} }
@Override @Override
public void setB(ItemMeta cb, Boolean fb, ItemStack d) public void setB(ItemMeta cb, Boolean fb, ItemStack d)
{ {
try {
cb.spigot().setUnbreakable(fb); cb.spigot().setUnbreakable(fb);
} catch (UnsupportedOperationException ignored) {
// ignored
}
} }
} }