summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/ftbsc/bscv/Boscovicino.java2
-rw-r--r--src/main/java/ftbsc/bscv/system/ModManager.java30
2 files changed, 17 insertions, 15 deletions
diff --git a/src/main/java/ftbsc/bscv/Boscovicino.java b/src/main/java/ftbsc/bscv/Boscovicino.java
index 4754182..d54a3d4 100644
--- a/src/main/java/ftbsc/bscv/Boscovicino.java
+++ b/src/main/java/ftbsc/bscv/Boscovicino.java
@@ -52,6 +52,8 @@ public class Boscovicino implements ICommons {
Boscovicino.modManager = new ModManager(cfg, dp);
Boscovicino.modManager.load();
+ Boscovicino.modManager.finish();
+
Boscovicino.spec = cfg.build();
ForgeConfigSpec.Builder friendSpec = new ForgeConfigSpec.Builder();
diff --git a/src/main/java/ftbsc/bscv/system/ModManager.java b/src/main/java/ftbsc/bscv/system/ModManager.java
index e5f1c3c..2668a79 100644
--- a/src/main/java/ftbsc/bscv/system/ModManager.java
+++ b/src/main/java/ftbsc/bscv/system/ModManager.java
@@ -4,23 +4,23 @@ import com.mojang.brigadier.CommandDispatcher;
import ftbsc.bscv.api.ILoadable;
import ftbsc.bscv.api.IModule;
import net.minecraft.command.CommandSource;
-import net.minecraftforge.common.ForgeConfigSpec;
+import net.minecraftforge.common.ForgeConfigSpec.Builder;
+import org.checkerframework.checker.nullness.qual.Nullable;
import java.util.HashSet;
-import java.util.Optional;
import java.util.ServiceLoader;
import java.util.Set;
public class ModManager {
- private Optional<ForgeConfigSpec.Builder> cfgBuilder;
- private Optional<CommandDispatcher<CommandSource>> dispatcher;
+ private Builder cfgBuilder;
+ private CommandDispatcher<CommandSource> dispatcher;
public final Set<IModule> mods;
public final Set<String> categories;
- public ModManager(ForgeConfigSpec.Builder cfgBuilder, CommandDispatcher<CommandSource> dispatcher) {
- this.cfgBuilder = Optional.of(cfgBuilder);
- this.dispatcher = Optional.of(dispatcher);
+ public ModManager(Builder cfgBuilder, CommandDispatcher<CommandSource> dispatcher) {
+ this.cfgBuilder = cfgBuilder;
+ this.dispatcher = dispatcher;
this.mods = new HashSet<>();
this.categories = new HashSet<>();
}
@@ -31,21 +31,21 @@ public class ModManager {
IModule mod = (IModule) module;
this.mods.add(mod);
this.categories.add(mod.getGroup());
- this.cfgBuilder.get().pop(); // TODO solved by AutoService, soon TM
+ this.cfgBuilder.pop(); // TODO
}
}
}
- public void finalize() {
- this.cfgBuilder = Optional.empty();
- this.dispatcher = Optional.empty();
+ public void finish() {
+ this.cfgBuilder = null;
+ this.dispatcher = null;
}
- public ForgeConfigSpec.Builder getCfgBuilder() {
- return cfgBuilder.get();
+ public @Nullable Builder getCfgBuilder() {
+ return cfgBuilder;
}
- public CommandDispatcher<CommandSource> getDispatcher() {
- return dispatcher.get();
+ public @Nullable CommandDispatcher<CommandSource> getDispatcher() {
+ return dispatcher;
}
}