diff --git a/src/main/java/world/bentobox/bentobox/BentoBox.java b/src/main/java/world/bentobox/bentobox/BentoBox.java index 6fd11d309..4e6379456 100644 --- a/src/main/java/world/bentobox/bentobox/BentoBox.java +++ b/src/main/java/world/bentobox/bentobox/BentoBox.java @@ -142,7 +142,6 @@ public class BentoBox extends JavaPlugin { hooksManager = new HooksManager(this); hooksManager.registerHook(new VaultHook()); hooksManager.registerHook(new PlaceholderAPIHook()); - hooksManager.registerHook(new MultiverseCoreHook()); // Load addons. Addons may load worlds, so they must go before islands are loaded. addonsManager = new AddonsManager(this); @@ -172,7 +171,9 @@ public class BentoBox extends JavaPlugin { metrics.registerMetrics(); } + // Register Multiverse hook - MV loads AFTER BentoBox // Make sure all worlds are already registered to Multiverse. + hooksManager.registerHook(new MultiverseCoreHook()); islandWorldManager.registerWorldsToMultiverse(); // Setup the Placeholders manager diff --git a/src/main/java/world/bentobox/bentobox/database/Database.java b/src/main/java/world/bentobox/bentobox/database/Database.java index 9f05b0561..4ae50ac2c 100644 --- a/src/main/java/world/bentobox/bentobox/database/Database.java +++ b/src/main/java/world/bentobox/bentobox/database/Database.java @@ -89,7 +89,6 @@ public class Database { } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | SecurityException | IntrospectionException e) { logger.severe(() -> "Could not save object to database! Error: " + e.getMessage()); - e.printStackTrace(); return false; } return true; diff --git a/src/main/java/world/bentobox/bentobox/managers/AddonsManager.java b/src/main/java/world/bentobox/bentobox/managers/AddonsManager.java index 196524052..7ad2e2206 100644 --- a/src/main/java/world/bentobox/bentobox/managers/AddonsManager.java +++ b/src/main/java/world/bentobox/bentobox/managers/AddonsManager.java @@ -108,7 +108,15 @@ public class AddonsManager { try { // Run the onLoad. addon.onLoad(); - + // If this is a GameModeAddon create the worlds, register it and load the schems + if (addon instanceof GameModeAddon) { + GameModeAddon gameMode = (GameModeAddon) addon; + // Create the gameWorlds + gameMode.createWorlds(); + plugin.getIWM().addGameMode(gameMode); + // Register the schems + plugin.getSchemsManager().loadIslands(gameMode); + } // Addon successfully loaded addon.setState(Addon.State.LOADED); } catch (NoClassDefFoundError | NoSuchMethodError | NoSuchFieldError e) { @@ -128,16 +136,6 @@ public class AddonsManager { plugin.log("Enabling addons..."); getLoadedAddons().forEach(addon -> { - // If this is a GameModeAddon create the worlds, register it and load the schems - if (addon instanceof GameModeAddon) { - GameModeAddon gameMode = (GameModeAddon) addon; - // Create the gameWorlds - gameMode.createWorlds(); - plugin.getIWM().addGameMode(gameMode); - // Register the schems - plugin.getSchemsManager().loadIslands(gameMode); - } - try { addon.onEnable(); Bukkit.getPluginManager().callEvent(new AddonEvent().builder().addon(addon).reason(AddonEvent.Reason.ENABLE).build()); @@ -179,7 +177,6 @@ public class AddonsManager { addon.setState(Addon.State.ERROR); plugin.logError("Skipping " + addon.getDescription().getName() + " due to an unhandled exception..."); plugin.logError("STACKTRACE: " + throwable.getClass().getSimpleName() + " - " + throwable.getMessage() + " - " + throwable.getCause()); - throwable.printStackTrace(); if (plugin.getConfig().getBoolean("debug")) { plugin.logDebug(throwable.toString()); plugin.logDebug(throwable.getStackTrace()); diff --git a/src/main/java/world/bentobox/bentobox/managers/HooksManager.java b/src/main/java/world/bentobox/bentobox/managers/HooksManager.java index bf967e31b..732908436 100644 --- a/src/main/java/world/bentobox/bentobox/managers/HooksManager.java +++ b/src/main/java/world/bentobox/bentobox/managers/HooksManager.java @@ -1,12 +1,12 @@ package world.bentobox.bentobox.managers; -import world.bentobox.bentobox.BentoBox; -import world.bentobox.bentobox.api.hooks.Hook; - import java.util.ArrayList; import java.util.List; import java.util.Optional; +import world.bentobox.bentobox.BentoBox; +import world.bentobox.bentobox.api.hooks.Hook; + /** * @author Poslovitch */ @@ -25,10 +25,10 @@ public class HooksManager { plugin.log("Hooking with " + hook.getPluginName() + "..."); if (hook.hook()) { hooks.add(hook); - } else { - plugin.log("Could not hook with " + hook.getPluginName() + ((hook.getFailureCause() != null) ? " because: " + hook.getFailureCause() : "") + ". Skipping..."); + return; } } + plugin.logError("Could not hook with " + hook.getPluginName() + ((hook.getFailureCause() != null) ? " because: " + hook.getFailureCause() : "") + ". Skipping..."); } public List getHooks() {