mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-27 21:27:44 +01:00
Fixed Multiverse issues
Multiverse hookin wasn't working.
This commit is contained in:
parent
daef788e65
commit
9968a8e083
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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());
|
||||
|
@ -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() {
|
||||
|
Loading…
Reference in New Issue
Block a user