Merge pull request #2461 from BentoBoxWorld/2459_glow_api_backward_compatibility

Add a try around the new API for glow and fallback to old way #2459
This commit is contained in:
tastybento 2024-08-07 21:46:56 -07:00 committed by GitHub
commit 27ba0fe26e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -132,7 +132,19 @@ public class PanelItem {
return;
}
if (meta != null) {
meta.setEnchantmentGlintOverride(glow);
try {
meta.setEnchantmentGlintOverride(glow);
} catch (NoSuchMethodError e) {
// Try the old way
if (meta != null) {
if (glow) {
meta.addEnchant(Enchantment.LURE, 0, glow);
} else {
meta.removeEnchant(Enchantment.LURE);
}
icon.setItemMeta(meta);
}
}
icon.setItemMeta(meta);
}