From b12cd1f3e41c53c085809255dc1ecd9f2705e675 Mon Sep 17 00:00:00 2001 From: codestech <56263050+Codestech1@users.noreply.github.com> Date: Sun, 12 Jul 2026 16:36:05 +0200 Subject: [PATCH 1/2] fix(modules): it is possible to unload the module manager while not fully loaded --- .../java/net/hypejet/modules/ModuleManager.java | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/java/net/hypejet/modules/ModuleManager.java b/src/main/java/net/hypejet/modules/ModuleManager.java index 14f2df4..abecefe 100644 --- a/src/main/java/net/hypejet/modules/ModuleManager.java +++ b/src/main/java/net/hypejet/modules/ModuleManager.java @@ -124,16 +124,18 @@ public void load() { throw new IllegalStateException("The module manager is unloaded"); if (this.isLoaded()) { - LOGGER.warn("The module manager is already loaded", new Throwable()); + LOGGER.error("The module manager is already loaded", new Throwable()); return; } - this.state = State.LOADED; + this.state = State.LOADING; this.loadOrder.removeIf(entry -> { this.createAndLoadModule(entry); return true; }); + + this.state = State.LOADED; } /** @@ -145,8 +147,11 @@ public void load() { public void unload() { this.ensureLoaded(); - if (this.state == State.UNLOADING) { - LOGGER.warn("The module manager is already unloading", new Throwable()); + if (this.state == State.LOADING) { + LOGGER.error("You cannot unload the module manager before it gets fully loaded", new Throwable()); + return; + } else if (this.state == State.UNLOADING) { + LOGGER.error("The module manager is already unloading", new Throwable()); return; } @@ -217,7 +222,7 @@ private void tryUnload(Module module) { } private boolean isLoaded() { - return this.state == State.LOADED || this.state == State.UNLOADING; + return this.state == State.LOADING || this.state == State.LOADED || this.state == State.UNLOADING; } private void ensureLoaded() { @@ -227,6 +232,7 @@ private void ensureLoaded() { private enum State { CREATED, + LOADING, LOADED, UNLOADING, UNLOADED From 9498074ff61bb0b0b56cdcc3a705e42f3f362752 Mon Sep 17 00:00:00 2001 From: codestech <56263050+Codestech1@users.noreply.github.com> Date: Sun, 12 Jul 2026 16:39:10 +0200 Subject: [PATCH 2/2] chore(gradle): increment the project version to `1.0.1-SNAPSHOT` --- build.gradle.kts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle.kts b/build.gradle.kts index 0966538..6292b24 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -9,7 +9,7 @@ plugins { val javaVersion = 25 group = "net.hypejet" -version = releaseTag() ?: "1.0-SNAPSHOT" +version = releaseTag() ?: "1.0.1-SNAPSHOT" description = "A Java library making modular programming easier" repositories {