modifying exception handling for completeSetup, now it will print the log and stack traces together

This commit is contained in:
4o4E 2023-06-29 23:11:05 +08:00
parent cbed9ac831
commit c2bf481767
No known key found for this signature in database
GPG Key ID: E4E74EF644B1A6AC

View File

@ -2,6 +2,7 @@ package world.bentobox.bentobox;
import java.util.List; import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.logging.Level;
import org.apache.commons.lang.exception.ExceptionUtils; import org.apache.commons.lang.exception.ExceptionUtils;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -174,8 +175,15 @@ public class BentoBox extends JavaPlugin implements Listener {
try { try {
completeSetup(loadTime); completeSetup(loadTime);
} catch (Exception e) { } catch (Exception e) {
fireCriticalError(e.getMessage(), ""); getLogger().log(Level.WARNING,
e.printStackTrace(); "unexpected exception occurred during completeSetup, Disabling BentoBox...", e);
// Do not save players or islands, just shutdown
shutdown = true;
// Stop all addons
if (addonsManager != null) {
addonsManager.disableAddons();
}
instance.setEnabled(false);
} }
}); });
} }