summaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
author alemi <me@alemi.dev>2023-03-01 01:00:04 +0100
committer alemi <me@alemi.dev>2023-03-01 01:00:04 +0100
commitf4889c1ce2f324f43c2be1425044127cf974a517 (patch)
treecebb02cef153673b0b7f6a2c4da9e54390f754c9 /src/main
parent930ccf34c72fc6c0e85648681b91d46c986e2b9a (diff)
fix: null ptr, activemodules, service
modManager must be set during ModManager initialization. moved that part into a separate method. Activemodules had the check inverted. Abstract classes cannot be loaded (and thus should not be annotated)
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/ftbsc/bscv/BoSCoVicino.java1
-rw-r--r--src/main/java/ftbsc/bscv/modules/QuickModule.java3
-rw-r--r--src/main/java/ftbsc/bscv/modules/hud/ActiveModules.java2
-rw-r--r--src/main/java/ftbsc/bscv/system/ModManager.java2
4 files changed, 4 insertions, 4 deletions
diff --git a/src/main/java/ftbsc/bscv/BoSCoVicino.java b/src/main/java/ftbsc/bscv/BoSCoVicino.java
index 141aa76..117544c 100644
--- a/src/main/java/ftbsc/bscv/BoSCoVicino.java
+++ b/src/main/java/ftbsc/bscv/BoSCoVicino.java
@@ -47,6 +47,7 @@ public class BoSCoVicino implements ICommons {
CommandDispatcher<CommandSource> dp = this.dispatcher;
BoSCoVicino.modManager = new ModManager(cfg, dp);
+ BoSCoVicino.modManager.load();
BoSCoVicino.spec = cfg.build();
diff --git a/src/main/java/ftbsc/bscv/modules/QuickModule.java b/src/main/java/ftbsc/bscv/modules/QuickModule.java
index 230d3ef..a2e989b 100644
--- a/src/main/java/ftbsc/bscv/modules/QuickModule.java
+++ b/src/main/java/ftbsc/bscv/modules/QuickModule.java
@@ -8,11 +8,8 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import ftbsc.bscv.BoSCoVicino;
-import ftbsc.bscv.api.ILoadable;
-import com.google.auto.service.AutoService;
// TODO rename
-@AutoService(ILoadable.class)
public abstract class QuickModule extends AbstractModule {
public static final int UNBOUND = InputMappings.UNKNOWN.getValue();
diff --git a/src/main/java/ftbsc/bscv/modules/hud/ActiveModules.java b/src/main/java/ftbsc/bscv/modules/hud/ActiveModules.java
index 1893f53..213eb54 100644
--- a/src/main/java/ftbsc/bscv/modules/hud/ActiveModules.java
+++ b/src/main/java/ftbsc/bscv/modules/hud/ActiveModules.java
@@ -19,7 +19,7 @@ public class ActiveModules extends HudModule implements ICommons {
if (event.getType() == ElementType.TEXT) {
int offset = 0;
for (IModule m : BoSCoVicino.modManager.mods) {
- if (m.isEnabled() && m.getGroup().equalsIgnoreCase("HUD")) {
+ if (m.isEnabled() && !m.getGroup().equalsIgnoreCase("HUD")) {
TextBuilder()
.txt(String.format("%s <", m.getName()))
.anchor(this.anchor.get())
diff --git a/src/main/java/ftbsc/bscv/system/ModManager.java b/src/main/java/ftbsc/bscv/system/ModManager.java
index b700d0a..e5f1c3c 100644
--- a/src/main/java/ftbsc/bscv/system/ModManager.java
+++ b/src/main/java/ftbsc/bscv/system/ModManager.java
@@ -23,7 +23,9 @@ public class ModManager {
this.dispatcher = Optional.of(dispatcher);
this.mods = new HashSet<>();
this.categories = new HashSet<>();
+ }
+ public void load() {
for (ILoadable module : ServiceLoader.load(ILoadable.class)) {
if(module instanceof IModule) {
IModule mod = (IModule) module;