Added protection around addon onDisable().
https://github.com/BentoBoxWorld/BentoBox/issues/1018
This commit is contained in:
parent
9ff2eda576
commit
b9a04bcf57
|
@ -416,9 +416,16 @@ public class AddonsManager {
|
||||||
plugin.getFlagsManager().unregister(addon);
|
plugin.getFlagsManager().unregister(addon);
|
||||||
// Disable
|
// Disable
|
||||||
if (addon.isEnabled()) {
|
if (addon.isEnabled()) {
|
||||||
addon.onDisable();
|
|
||||||
Bukkit.getPluginManager().callEvent(new AddonEvent().builder().addon(addon).reason(AddonEvent.Reason.DISABLE).build());
|
|
||||||
plugin.log("Disabling " + addon.getDescription().getName() + "...");
|
plugin.log("Disabling " + addon.getDescription().getName() + "...");
|
||||||
|
try {
|
||||||
|
addon.onDisable();
|
||||||
|
} catch (Exception e) {
|
||||||
|
plugin.logError("Error occured when disabling addon " + addon.getDescription().getName());
|
||||||
|
plugin.logError("Report this to the addon's author(s)");
|
||||||
|
addon.getDescription().getAuthors().forEach(plugin::logError);
|
||||||
|
plugin.logStacktrace(e);
|
||||||
|
}
|
||||||
|
Bukkit.getPluginManager().callEvent(new AddonEvent().builder().addon(addon).reason(AddonEvent.Reason.DISABLE).build());
|
||||||
}
|
}
|
||||||
// Clear loaders
|
// Clear loaders
|
||||||
if (loaders.containsKey(addon)) {
|
if (loaders.containsKey(addon)) {
|
||||||
|
|
Loading…
Reference in New Issue