FancyHolograms
FancyHolograms copied to clipboard
[Bug] Calling `isEnabled` before enabled causes plugin to not start correctly
When using the API, calling FancyHologramsPlugin.isEnabled() will cause the plugin to not correctly enable.
Steps to reproduce
- Create a plugin soft depending on
FancyHolograms 2.4.0 - Call
FancyHologramsPlugin.isEnabled()on startup - Try and use the plugin in game
- Observe a
Plugin Not Enabledstacktrace in console.
Fixes
FancyHologramsPlugin.java
public static Boolean isFancyHologramsEnabled() {
if (enabled == null) {
enabled = Bukkit.getPluginManager().isPluginEnabled("FancyHolograms");
if (enabled) {
try {
plugin = (FancyHologramsPlugin)Bukkit.getPluginManager().getPlugin("FancyHolograms");
} catch (ClassCastException var1) {
throw new IllegalStateException("API failed to access plugin, if using the FancyHolograms API make sure to set the dependency to compile only.");
}
}
}
return enabled;
}
The enabled var is only set once. Calling the method before the plugin is initialized results in unintended behaviour.
Should be fixed in 31598f86787ca7eee5d7a7a40473629169a8816d and dev build #118
Never realized i didnt add a title 😭