Skip to content

Commit

Permalink
Merge pull request #2461 from BentoBoxWorld/2459_glow_api_backward_co…
Browse files Browse the repository at this point in the history
…mpatibility

Add a try around the new API for glow and fallback to old way #2459
  • Loading branch information
tastybento authored Aug 8, 2024
2 parents 3194195 + 21efeb8 commit 27ba0fe
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/main/java/world/bentobox/bentobox/api/panels/PanelItem.java
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,19 @@ public void setGlow(boolean glow) {
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);

}
Expand Down

0 comments on commit 27ba0fe

Please sign in to comment.