chore: checkerframework

This commit is contained in:
zaaarf 2023-03-02 10:43:58 +01:00
parent eb5ee8e453
commit 8127c30fc7
No known key found for this signature in database
GPG key ID: 82240E075E31FA4C
4 changed files with 21 additions and 16 deletions

View file

@ -3,6 +3,7 @@ plugins {
id 'eclipse' id 'eclipse'
alias libs.plugins.forgeGradle; alias libs.plugins.forgeGradle;
alias libs.plugins.gitVersion; alias libs.plugins.gitVersion;
alias libs.plugins.checkerFramework
} }
version = gitVersion() version = gitVersion()

View file

@ -7,10 +7,12 @@ autoService = "1.0.1"
javaPoet = "1.13.0" javaPoet = "1.13.0"
lillero = "0.3.0" lillero = "0.3.0"
lilleroProcessor = "0.2.1" lilleroProcessor = "0.2.1"
checkerFramework = "0.6.24"
[plugins] [plugins]
forgeGradle = { id = "net.minecraftforge.gradle", version.ref = "forgeGradle" } forgeGradle = { id = "net.minecraftforge.gradle", version.ref = "forgeGradle" }
gitVersion = { id = "com.palantir.git-version", version.ref = "gitVersion" } gitVersion = { id = "com.palantir.git-version", version.ref = "gitVersion" }
checkerFramework = { id = "org.checkerframework", version.ref = "checkerFramework"}
[libraries] [libraries]
minecraftForge = { group = "net.minecraftforge", name = "forge", version.ref = "forge" } minecraftForge = { group = "net.minecraftforge", name = "forge", version.ref = "forge" }

View file

@ -52,6 +52,8 @@ public class Boscovicino implements ICommons {
Boscovicino.modManager = new ModManager(cfg, dp); Boscovicino.modManager = new ModManager(cfg, dp);
Boscovicino.modManager.load(); Boscovicino.modManager.load();
Boscovicino.modManager.finish();
Boscovicino.spec = cfg.build(); Boscovicino.spec = cfg.build();
ForgeConfigSpec.Builder friendSpec = new ForgeConfigSpec.Builder(); ForgeConfigSpec.Builder friendSpec = new ForgeConfigSpec.Builder();

View file

@ -4,23 +4,23 @@ import com.mojang.brigadier.CommandDispatcher;
import ftbsc.bscv.api.ILoadable; import ftbsc.bscv.api.ILoadable;
import ftbsc.bscv.api.IModule; import ftbsc.bscv.api.IModule;
import net.minecraft.command.CommandSource; 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.HashSet;
import java.util.Optional;
import java.util.ServiceLoader; import java.util.ServiceLoader;
import java.util.Set; import java.util.Set;
public class ModManager { public class ModManager {
private Optional<ForgeConfigSpec.Builder> cfgBuilder; private Builder cfgBuilder;
private Optional<CommandDispatcher<CommandSource>> dispatcher; private CommandDispatcher<CommandSource> dispatcher;
public final Set<IModule> mods; public final Set<IModule> mods;
public final Set<String> categories; public final Set<String> categories;
public ModManager(ForgeConfigSpec.Builder cfgBuilder, CommandDispatcher<CommandSource> dispatcher) { public ModManager(Builder cfgBuilder, CommandDispatcher<CommandSource> dispatcher) {
this.cfgBuilder = Optional.of(cfgBuilder); this.cfgBuilder = cfgBuilder;
this.dispatcher = Optional.of(dispatcher); this.dispatcher = dispatcher;
this.mods = new HashSet<>(); this.mods = new HashSet<>();
this.categories = new HashSet<>(); this.categories = new HashSet<>();
} }
@ -31,21 +31,21 @@ public class ModManager {
IModule mod = (IModule) module; IModule mod = (IModule) module;
this.mods.add(mod); this.mods.add(mod);
this.categories.add(mod.getGroup()); this.categories.add(mod.getGroup());
this.cfgBuilder.get().pop(); // TODO solved by AutoService, soon TM this.cfgBuilder.pop(); // TODO
} }
} }
} }
public void finalize() { public void finish() {
this.cfgBuilder = Optional.empty(); this.cfgBuilder = null;
this.dispatcher = Optional.empty(); this.dispatcher = null;
} }
public ForgeConfigSpec.Builder getCfgBuilder() { public @Nullable Builder getCfgBuilder() {
return cfgBuilder.get(); return cfgBuilder;
} }
public CommandDispatcher<CommandSource> getDispatcher() { public @Nullable CommandDispatcher<CommandSource> getDispatcher() {
return dispatcher.get(); return dispatcher;
} }
} }