Catch UnsupportedOperationException for cb.spigot().setUnbreakable
This commit is contained in:
1 parent
c0e5746e3c
commit
2bdabf9619
1 file changed
+10
-2
@@ -35,13 +35,21 @@ public class WriterItemStackMetaUnbreakable extends WriterAbstractItemStackMetaF
|
||||
@Override
|
||||
public Boolean getB(ItemMeta cb, ItemStack d)
|
||||
{
|
||||
return cb.spigot().isUnbreakable();
|
||||
try {
|
||||
return cb.spigot().isUnbreakable();
|
||||
} catch (UnsupportedOperationException ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setB(ItemMeta cb, Boolean fb, ItemStack d)
|
||||
{
|
||||
cb.spigot().setUnbreakable(fb);
|
||||
try {
|
||||
cb.spigot().setUnbreakable(fb);
|
||||
} catch (UnsupportedOperationException ignored) {
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user