Fixed Multiverse issues

Multiverse hookin wasn't working.
This commit is contained in:
tastybento 2019-01-26 16:33:59 -08:00
parent daef788e65
commit 9968a8e083
4 changed files with 16 additions and 19 deletions

View File

@ -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

View File

@ -89,7 +89,6 @@ public class Database<T> {
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | SecurityException
| IntrospectionException e) {
logger.severe(() -> "Could not save object to database! Error: " + e.getMessage());
e.printStackTrace();
return false;
}
return true;

View File

@ -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());

View File

@ -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<Hook> getHooks() {