mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-11-28 05:35: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 = new HooksManager(this);
|
||||||
hooksManager.registerHook(new VaultHook());
|
hooksManager.registerHook(new VaultHook());
|
||||||
hooksManager.registerHook(new PlaceholderAPIHook());
|
hooksManager.registerHook(new PlaceholderAPIHook());
|
||||||
hooksManager.registerHook(new MultiverseCoreHook());
|
|
||||||
|
|
||||||
// Load addons. Addons may load worlds, so they must go before islands are loaded.
|
// Load addons. Addons may load worlds, so they must go before islands are loaded.
|
||||||
addonsManager = new AddonsManager(this);
|
addonsManager = new AddonsManager(this);
|
||||||
@ -172,7 +171,9 @@ public class BentoBox extends JavaPlugin {
|
|||||||
metrics.registerMetrics();
|
metrics.registerMetrics();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Register Multiverse hook - MV loads AFTER BentoBox
|
||||||
// Make sure all worlds are already registered to Multiverse.
|
// Make sure all worlds are already registered to Multiverse.
|
||||||
|
hooksManager.registerHook(new MultiverseCoreHook());
|
||||||
islandWorldManager.registerWorldsToMultiverse();
|
islandWorldManager.registerWorldsToMultiverse();
|
||||||
|
|
||||||
// Setup the Placeholders manager
|
// Setup the Placeholders manager
|
||||||
|
@ -89,7 +89,6 @@ public class Database<T> {
|
|||||||
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | SecurityException
|
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | SecurityException
|
||||||
| IntrospectionException e) {
|
| IntrospectionException e) {
|
||||||
logger.severe(() -> "Could not save object to database! Error: " + e.getMessage());
|
logger.severe(() -> "Could not save object to database! Error: " + e.getMessage());
|
||||||
e.printStackTrace();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -108,7 +108,15 @@ public class AddonsManager {
|
|||||||
try {
|
try {
|
||||||
// Run the onLoad.
|
// Run the onLoad.
|
||||||
addon.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 successfully loaded
|
||||||
addon.setState(Addon.State.LOADED);
|
addon.setState(Addon.State.LOADED);
|
||||||
} catch (NoClassDefFoundError | NoSuchMethodError | NoSuchFieldError e) {
|
} catch (NoClassDefFoundError | NoSuchMethodError | NoSuchFieldError e) {
|
||||||
@ -128,16 +136,6 @@ public class AddonsManager {
|
|||||||
plugin.log("Enabling addons...");
|
plugin.log("Enabling addons...");
|
||||||
|
|
||||||
getLoadedAddons().forEach(addon -> {
|
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 {
|
try {
|
||||||
addon.onEnable();
|
addon.onEnable();
|
||||||
Bukkit.getPluginManager().callEvent(new AddonEvent().builder().addon(addon).reason(AddonEvent.Reason.ENABLE).build());
|
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);
|
addon.setState(Addon.State.ERROR);
|
||||||
plugin.logError("Skipping " + addon.getDescription().getName() + " due to an unhandled exception...");
|
plugin.logError("Skipping " + addon.getDescription().getName() + " due to an unhandled exception...");
|
||||||
plugin.logError("STACKTRACE: " + throwable.getClass().getSimpleName() + " - " + throwable.getMessage() + " - " + throwable.getCause());
|
plugin.logError("STACKTRACE: " + throwable.getClass().getSimpleName() + " - " + throwable.getMessage() + " - " + throwable.getCause());
|
||||||
throwable.printStackTrace();
|
|
||||||
if (plugin.getConfig().getBoolean("debug")) {
|
if (plugin.getConfig().getBoolean("debug")) {
|
||||||
plugin.logDebug(throwable.toString());
|
plugin.logDebug(throwable.toString());
|
||||||
plugin.logDebug(throwable.getStackTrace());
|
plugin.logDebug(throwable.getStackTrace());
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
package world.bentobox.bentobox.managers;
|
package world.bentobox.bentobox.managers;
|
||||||
|
|
||||||
import world.bentobox.bentobox.BentoBox;
|
|
||||||
import world.bentobox.bentobox.api.hooks.Hook;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
|
|
||||||
|
import world.bentobox.bentobox.BentoBox;
|
||||||
|
import world.bentobox.bentobox.api.hooks.Hook;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Poslovitch
|
* @author Poslovitch
|
||||||
*/
|
*/
|
||||||
@ -25,10 +25,10 @@ public class HooksManager {
|
|||||||
plugin.log("Hooking with " + hook.getPluginName() + "...");
|
plugin.log("Hooking with " + hook.getPluginName() + "...");
|
||||||
if (hook.hook()) {
|
if (hook.hook()) {
|
||||||
hooks.add(hook);
|
hooks.add(hook);
|
||||||
} else {
|
return;
|
||||||
plugin.log("Could not hook with " + hook.getPluginName() + ((hook.getFailureCause() != null) ? " because: " + hook.getFailureCause() : "") + ". Skipping...");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
plugin.logError("Could not hook with " + hook.getPluginName() + ((hook.getFailureCause() != null) ? " because: " + hook.getFailureCause() : "") + ". Skipping...");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Hook> getHooks() {
|
public List<Hook> getHooks() {
|
||||||
|
Loading…
Reference in New Issue
Block a user