Skip to content

Commit 27ba0fe

Browse files
authored
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
2 parents 3194195 + 21efeb8 commit 27ba0fe

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/main/java/world/bentobox/bentobox/api/panels/PanelItem.java

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,19 @@ public void setGlow(boolean glow) {
132132
return;
133133
}
134134
if (meta != null) {
135-
meta.setEnchantmentGlintOverride(glow);
135+
try {
136+
meta.setEnchantmentGlintOverride(glow);
137+
} catch (NoSuchMethodError e) {
138+
// Try the old way
139+
if (meta != null) {
140+
if (glow) {
141+
meta.addEnchant(Enchantment.LURE, 0, glow);
142+
} else {
143+
meta.removeEnchant(Enchantment.LURE);
144+
}
145+
icon.setItemMeta(meta);
146+
}
147+
}
136148
icon.setItemMeta(meta);
137149

138150
}

0 commit comments

Comments
 (0)