Catch UnsupportedOperationException for cb.spigot().setUnbreakable
This commit is contained in:
parent
c0e5746e3c
commit
2bdabf9619
@ -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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user