Skip to content

Commit

Permalink
improve startup order and logging of modules
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Jan 2, 2025
1 parent 6585a6b commit be0d646
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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(" ",
" ",
" █████ ███████ ███████ ",
Expand Down Expand Up @@ -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();

Expand All @@ -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.");
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,6 @@ public void onEnable() {
return;
}

instance = this;
permissionHandler = PermissionHandler.create(this);
metrics = new Metrics(this, 8700);

Stream.of(" ",
" ",
" █████ ███████ ███████ ",
Expand Down Expand Up @@ -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");
Expand All @@ -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.");
}

Expand Down

0 comments on commit be0d646

Please sign in to comment.