diff options
Diffstat (limited to 'src/oneconfig/java')
2 files changed, 26 insertions, 34 deletions
diff --git a/src/oneconfig/java/io/github/moulberry/notenoughupdates/compat/oneconfig/OneConfigCompat.java b/src/oneconfig/java/io/github/moulberry/notenoughupdates/compat/oneconfig/OneConfigCompat.java index b80db70a..069c3d6a 100644 --- a/src/oneconfig/java/io/github/moulberry/notenoughupdates/compat/oneconfig/OneConfigCompat.java +++ b/src/oneconfig/java/io/github/moulberry/notenoughupdates/compat/oneconfig/OneConfigCompat.java @@ -21,14 +21,9 @@ package io.github.moulberry.notenoughupdates.compat.oneconfig; import cc.polyfrost.oneconfig.config.data.Mod; import cc.polyfrost.oneconfig.config.data.ModType; -import io.github.moulberry.notenoughupdates.core.config.Config; +import io.github.moulberry.moulconfig.Config; import io.github.moulberry.notenoughupdates.oneconfig.IOneConfigCompat; -import java.lang.invoke.MethodHandle; -import java.lang.invoke.MethodHandles; -import java.lang.reflect.Field; -import java.util.ArrayList; - public class OneConfigCompat extends IOneConfigCompat { Mod mod = new Mod("NotEnoughUpdates", ModType.SKYBLOCK, "/assets/notenoughupdates/logo.png"); @@ -36,7 +31,7 @@ public class OneConfigCompat extends IOneConfigCompat { OneMoulConfig omc; @Override - public void initConfig(Config moulConfig, Runnable saveCallback) { - omc = new OneMoulConfig(mod, moulConfig, saveCallback); + public void initConfig(Config moulConfig) { + omc = new OneMoulConfig(mod, moulConfig); } } diff --git a/src/oneconfig/java/io/github/moulberry/notenoughupdates/compat/oneconfig/OneMoulConfig.java b/src/oneconfig/java/io/github/moulberry/notenoughupdates/compat/oneconfig/OneMoulConfig.java index 59aa25d1..3e37f12a 100644 --- a/src/oneconfig/java/io/github/moulberry/notenoughupdates/compat/oneconfig/OneMoulConfig.java +++ b/src/oneconfig/java/io/github/moulberry/notenoughupdates/compat/oneconfig/OneMoulConfig.java @@ -26,21 +26,20 @@ import cc.polyfrost.oneconfig.config.elements.OptionSubcategory; import cc.polyfrost.oneconfig.gui.elements.config.ConfigButton; import cc.polyfrost.oneconfig.gui.elements.config.ConfigDropdown; import cc.polyfrost.oneconfig.gui.elements.config.ConfigInfo; -import cc.polyfrost.oneconfig.gui.elements.config.ConfigSlider; import cc.polyfrost.oneconfig.gui.elements.config.ConfigSwitch; import cc.polyfrost.oneconfig.gui.elements.config.ConfigTextBox; -import io.github.moulberry.notenoughupdates.core.config.Config; -import io.github.moulberry.notenoughupdates.core.config.annotations.Category; -import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorBoolean; -import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorButton; -import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorColour; -import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorDraggableList; -import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorDropdown; -import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorFSR; -import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorKeybind; -import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorSlider; -import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigEditorText; -import io.github.moulberry.notenoughupdates.core.config.annotations.ConfigOption; +import io.github.moulberry.moulconfig.Config; +import io.github.moulberry.moulconfig.annotations.Category; +import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean; +import io.github.moulberry.moulconfig.annotations.ConfigEditorButton; +import io.github.moulberry.moulconfig.annotations.ConfigEditorColour; +import io.github.moulberry.moulconfig.annotations.ConfigEditorDraggableList; +import io.github.moulberry.moulconfig.annotations.ConfigEditorDropdown; +import io.github.moulberry.moulconfig.annotations.ConfigEditorInfoText; +import io.github.moulberry.moulconfig.annotations.ConfigEditorKeybind; +import io.github.moulberry.moulconfig.annotations.ConfigEditorSlider; +import io.github.moulberry.moulconfig.annotations.ConfigEditorText; +import io.github.moulberry.moulconfig.annotations.ConfigOption; import io.github.moulberry.notenoughupdates.core.util.StringUtils; import java.lang.reflect.Field; @@ -48,25 +47,23 @@ import java.lang.reflect.Field; public class OneMoulConfig extends cc.polyfrost.oneconfig.config.Config { final Config moulConfig; - private final Runnable saveCallback; - public OneMoulConfig(Mod modData, Config moulConfig, Runnable saveCallback) { + public OneMoulConfig(Mod modData, Config moulConfig) { super(modData, "_SHOULD_NOT_BE_WRITTEN.json"); if (moulConfig == null) throw new IllegalArgumentException("mfw no moulconfig"); this.moulConfig = moulConfig; - this.saveCallback = saveCallback; initialize(); } @Override public void initialize() { - mod.config = this; + mod.config = this; - try { - processMoulConfig(); - } catch (IllegalAccessException e) { - e.printStackTrace(); - } + try { + processMoulConfig(); + } catch (IllegalAccessException e) { + e.printStackTrace(); + } cc.polyfrost.oneconfig.config.Config.register(mod); } @@ -86,8 +83,8 @@ public class OneMoulConfig extends cc.polyfrost.oneconfig.config.Config { if (annotation == null) continue; String cat = category.getName(); String subcategory = ""; - String annotationName = StringUtils.cleanColour( annotation.name()); - String annotationDesc = StringUtils.cleanColour( annotation.desc()); + String annotationName = StringUtils.cleanColour(annotation.name()); + String annotationDesc = StringUtils.cleanColour(annotation.desc()); ConfigEditorBoolean configEditorBoolean = optionField.getAnnotation(ConfigEditorBoolean.class); if (configEditorBoolean != null) { category.options.add(new ConfigSwitch( @@ -174,7 +171,7 @@ public class OneMoulConfig extends cc.polyfrost.oneconfig.config.Config { cat, subcategory, 2, InfoType.ERROR )); } - ConfigEditorFSR configEditorFSR = optionField.getAnnotation(ConfigEditorFSR.class); + ConfigEditorInfoText configEditorFSR = optionField.getAnnotation(ConfigEditorInfoText.class); if (configEditorFSR != null) { category.options.add(new ConfigInfo( optionField, categoryInstance, @@ -186,7 +183,7 @@ public class OneMoulConfig extends cc.polyfrost.oneconfig.config.Config { @Override public void save() { - saveCallback.run(); + moulConfig.saveNow(); } @Override |