From be0d646bdd3d60925de6f733c72450fb3c69e447 Mon Sep 17 00:00:00 2001 From: xGinko Date: Thu, 2 Jan 2025 14:08:52 +0100 Subject: [PATCH] improve startup order and logging of modules --- .../me/xginko/aef/AnarchyExploitFixes.java | 24 +++++++------------ .../me/xginko/aef/AnarchyExploitFixes.java | 18 +++++++------- 2 files changed, 19 insertions(+), 23 deletions(-) diff --git a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/AnarchyExploitFixes.java b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/AnarchyExploitFixes.java index 5d6fc623..510719dc 100755 --- a/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/AnarchyExploitFixes.java +++ b/AnarchyExploitFixesFolia/src/main/java/me/xginko/aef/AnarchyExploitFixes.java @@ -91,18 +91,6 @@ public void onEnable() { return; } - try { - Files.createDirectories(getDataFolder().toPath()); - } catch (Exception e) { - prefixedLogger.error("Unable to create plugin directory.", e); - getServer().getPluginManager().disablePlugin(this); - return; - } - - instance = this; - permissionHandler = PermissionHandler.create(this); - metrics = new Metrics(this, 8700); - Stream.of(" ", " ", " █████ ███████ ███████ ", @@ -131,6 +119,12 @@ public void onEnable() { return; } + instance = this; + + prefixedLogger.info("Registering Permissions"); + permissionHandler = PermissionHandler.create(this); + AEFPermission.registerAll(); + prefixedLogger.info("Loading Config"); reloadConfiguration(); @@ -140,14 +134,14 @@ public void onEnable() { prefixedLogger.info("Registering Commands"); AEFCommand.registerCommands(); - prefixedLogger.info("Registering Permissions"); - AEFPermission.registerAll(); - prefixedLogger.info("Preparing NBT-API"); // Hide all messages with a log level lower than WARNING because of the same reason as Reflections logging. Logger.getLogger("NBTAPI").setLevel(java.util.logging.Level.WARNING); if (!NBT.preloadApi()) prefixedLogger.error("Error initializing NBT-API! This will break some modules!"); + prefixedLogger.info("Loading Metrics"); + metrics = new Metrics(this, 8700); + prefixedLogger.info("Ready."); } diff --git a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/AnarchyExploitFixes.java b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/AnarchyExploitFixes.java index c3394a92..ce45c5b1 100755 --- a/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/AnarchyExploitFixes.java +++ b/AnarchyExploitFixesLegacy/src/main/java/me/xginko/aef/AnarchyExploitFixes.java @@ -96,10 +96,6 @@ public void onEnable() { return; } - instance = this; - permissionHandler = PermissionHandler.create(this); - metrics = new Metrics(this, 8700); - Stream.of(" ", " ", " █████ ███████ ███████ ", @@ -129,7 +125,13 @@ public void onEnable() { return; } - prefixedLogger.info("Loading Datastore"); + instance = this; + + prefixedLogger.info("Registering Permissions"); + permissionHandler = PermissionHandler.create(this); + AEFPermission.registerAll(); + + prefixedLogger.info("Loading Data Storage"); datastore = new Datastore(); prefixedLogger.info("Loading Config"); @@ -141,14 +143,14 @@ public void onEnable() { prefixedLogger.info("Registering Commands"); AEFCommand.registerCommands(); - prefixedLogger.info("Registering Permissions"); - AEFPermission.registerAll(); - prefixedLogger.info("Preparing NBT-API"); // Hide all messages with a log level lower than WARNING because of the same reason as Reflections logging. java.util.logging.Logger.getLogger("NBTAPI").setLevel(java.util.logging.Level.WARNING); if (!NBT.preloadApi()) prefixedLogger.error("Error initializing NBT-API! This will break some modules!"); + prefixedLogger.info("Loading Metrics"); + metrics = new Metrics(this, 8700); + prefixedLogger.info("Ready."); }