mirror of
https://github.com/BentoBoxWorld/BentoBox.git
synced 2024-06-25 06:14:52 +02:00
Add try catch around second stage plugin loading task. (#1609)
https://github.com/BentoBoxWorld/BentoBox/issues/1281
This commit is contained in:
parent
0e4b3b40fa
commit
9570f342ee
|
@ -168,6 +168,15 @@ public class BentoBox extends JavaPlugin {
|
||||||
final long loadTime = System.currentTimeMillis() - loadStart;
|
final long loadTime = System.currentTimeMillis() - loadStart;
|
||||||
|
|
||||||
Bukkit.getScheduler().runTask(instance, () -> {
|
Bukkit.getScheduler().runTask(instance, () -> {
|
||||||
|
try {
|
||||||
|
completeSetup(loadTime);
|
||||||
|
} catch (Exception e) {
|
||||||
|
fireCriticalError(e.getMessage(), "");
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private void completeSetup(long loadTime) {
|
||||||
final long enableStart = System.currentTimeMillis();
|
final long enableStart = System.currentTimeMillis();
|
||||||
hooksManager.registerHook(new PlaceholderAPIHook());
|
hooksManager.registerHook(new PlaceholderAPIHook());
|
||||||
// Setup the Placeholders manager
|
// Setup the Placeholders manager
|
||||||
|
@ -186,18 +195,7 @@ public class BentoBox extends JavaPlugin {
|
||||||
try {
|
try {
|
||||||
islandsManager.load();
|
islandsManager.load();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logError("*****************CRITIAL ERROR!******************");
|
fireCriticalError(e.getMessage(), "Could not load islands!");
|
||||||
logError(e.getMessage());
|
|
||||||
//Arrays.stream(e.getMessage().split("[\n\r]+")).forEach(this::logError);
|
|
||||||
logError("Could not load islands! Disabling BentoBox...");
|
|
||||||
logError("*************************************************");
|
|
||||||
// Stop all addons
|
|
||||||
if (addonsManager != null) {
|
|
||||||
addonsManager.disableAddons();
|
|
||||||
}
|
|
||||||
// Do not save players or islands, just shutdown
|
|
||||||
shutdown = true;
|
|
||||||
instance.setEnabled(false);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +258,20 @@ public class BentoBox extends JavaPlugin {
|
||||||
logWarning("There is NO guarantee YAML database will remain properly supported in the following updates, and its usage should as such be considered a non-viable situation.");
|
logWarning("There is NO guarantee YAML database will remain properly supported in the following updates, and its usage should as such be considered a non-viable situation.");
|
||||||
logWarning("*** *** *** *** *** *** *** *** *** *** ***");
|
logWarning("*** *** *** *** *** *** *** *** *** *** ***");
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
private void fireCriticalError(String message, String error) {
|
||||||
|
logError("*****************CRITIAL ERROR!******************");
|
||||||
|
logError(message);
|
||||||
|
logError(error + " Disabling BentoBox...");
|
||||||
|
logError("*************************************************");
|
||||||
|
// Stop all addons
|
||||||
|
if (addonsManager != null) {
|
||||||
|
addonsManager.disableAddons();
|
||||||
|
}
|
||||||
|
// Do not save players or islands, just shutdown
|
||||||
|
shutdown = true;
|
||||||
|
instance.setEnabled(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in New Issue
Block a user