aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-06-06 14:54:56 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-06-06 14:54:56 +0200
commitf4c6691b628cca146ddb44e77f54cb46387aa15d (patch)
treeb20b519e654a472fdeeaa440939ac716e4ee1bf1 /src
parentda3bf748fb4cca62236922fc35be50133b1bb96a (diff)
downloadOneConfig-f4c6691b628cca146ddb44e77f54cb46387aa15d.tar.gz
OneConfig-f4c6691b628cca146ddb44e77f54cb46387aa15d.tar.bz2
OneConfig-f4c6691b628cca146ddb44e77f54cb46387aa15d.zip
internalizing
Diffstat (limited to 'src')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/Config.java9
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilanceConfig.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/core/ConfigUtils.java (renamed from src/main/java/cc/polyfrost/oneconfig/config/core/ConfigCore.java)21
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/profiles/Profiles.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/internal/config/ConfigCore.java25
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/internal/hud/HudCore.java (renamed from src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java)3
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/internal/plugin/asm/tweakers/VigilantTransformer.java2
9 files changed, 40 insertions, 32 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/Config.java b/src/main/java/cc/polyfrost/oneconfig/config/Config.java
index 65d6b00..2c51387 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/Config.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/Config.java
@@ -2,7 +2,8 @@ package cc.polyfrost.oneconfig.config;
import cc.polyfrost.oneconfig.config.annotations.ConfigPage;
import cc.polyfrost.oneconfig.config.annotations.Option;
-import cc.polyfrost.oneconfig.config.core.ConfigCore;
+import cc.polyfrost.oneconfig.config.core.ConfigUtils;
+import cc.polyfrost.oneconfig.internal.config.ConfigCore;
import cc.polyfrost.oneconfig.config.data.*;
import cc.polyfrost.oneconfig.config.elements.BasicOption;
import cc.polyfrost.oneconfig.config.elements.OptionCategory;
@@ -13,7 +14,7 @@ import cc.polyfrost.oneconfig.gui.OneConfigGui;
import cc.polyfrost.oneconfig.gui.elements.config.*;
import cc.polyfrost.oneconfig.gui.pages.ModConfigPage;
import cc.polyfrost.oneconfig.hud.BasicHud;
-import cc.polyfrost.oneconfig.hud.HudCore;
+import cc.polyfrost.oneconfig.internal.hud.HudCore;
import cc.polyfrost.oneconfig.utils.gui.GuiUtils;
import com.google.gson.*;
@@ -144,7 +145,7 @@ public class Config {
HudCore.huds.add(hud);
options.add(new ConfigHeader(field, hud, option.name(), 1));
options.add(new ConfigSwitch(hud.getClass().getField("enabled"), hud, "Enabled", 1));
- options.addAll(ConfigCore.getClassOptions(hud));
+ options.addAll(ConfigUtils.getClassOptions(hud));
options.add(new ConfigCheckbox(hud.getClass().getField("rounded"), hud, "Rounded corners", 1));
options.get(options.size() - 1).setDependency(() -> hud.enabled);
options.add(new ConfigCheckbox(hud.getClass().getField("border"), hud, "Outline/border", 1));
@@ -165,7 +166,7 @@ public class Config {
e.printStackTrace();
}
} else {
- options.add(ConfigCore.getOption(option, field, instance));
+ options.add(ConfigUtils.getOption(option, field, instance));
}
if (!option.type().equals(OptionType.HUD))
optionNames.put(pagePrefix + field.getName(), options.get(options.size() - 1));
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilanceConfig.java b/src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilanceConfig.java
index cfa717f..3b0fcd6 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilanceConfig.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/compatibility/vigilance/VigilanceConfig.java
@@ -1,6 +1,6 @@
package cc.polyfrost.oneconfig.config.compatibility.vigilance;
-import cc.polyfrost.oneconfig.config.core.ConfigCore;
+import cc.polyfrost.oneconfig.internal.config.ConfigCore;
import cc.polyfrost.oneconfig.config.core.OneColor;
import cc.polyfrost.oneconfig.config.data.Mod;
import cc.polyfrost.oneconfig.config.elements.OptionCategory;
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/core/ConfigCore.java b/src/main/java/cc/polyfrost/oneconfig/config/core/ConfigUtils.java
index f1aa1ab..d44488d 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/core/ConfigCore.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/core/ConfigUtils.java
@@ -1,32 +1,13 @@
package cc.polyfrost.oneconfig.config.core;
import cc.polyfrost.oneconfig.config.annotations.Option;
-import cc.polyfrost.oneconfig.config.data.Mod;
import cc.polyfrost.oneconfig.config.elements.BasicOption;
import cc.polyfrost.oneconfig.gui.elements.config.*;
-import cc.polyfrost.oneconfig.hud.HudCore;
import java.lang.reflect.Field;
import java.util.ArrayList;
-public class ConfigCore {
- public static ArrayList<Mod> oneConfigMods = new ArrayList<>();
-
- public static void saveAll() {
- for (Mod modData : oneConfigMods) {
- modData.config.save();
- }
- }
-
- public static void reInitAll() {
- ArrayList<Mod> data = new ArrayList<>(oneConfigMods);
- oneConfigMods.clear();
- HudCore.huds.clear();
- for (Mod modData : data) {
- modData.config.init(modData);
- }
- }
-
+public class ConfigUtils {
public static BasicOption getOption(Option option, Field field, Object instance) {
switch (option.type()) {
case SWITCH:
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/profiles/Profiles.java b/src/main/java/cc/polyfrost/oneconfig/config/profiles/Profiles.java
index 006fea9..2b0a97e 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/profiles/Profiles.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/profiles/Profiles.java
@@ -1,7 +1,7 @@
package cc.polyfrost.oneconfig.config.profiles;
import cc.polyfrost.oneconfig.internal.OneConfig;
-import cc.polyfrost.oneconfig.config.core.ConfigCore;
+import cc.polyfrost.oneconfig.internal.config.ConfigCore;
import cc.polyfrost.oneconfig.internal.config.OneConfigConfig;
import org.apache.commons.io.FileUtils;
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
index 1b172d0..7f3bf15 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
@@ -1,8 +1,8 @@
package cc.polyfrost.oneconfig.gui;
-import cc.polyfrost.oneconfig.config.core.ConfigCore;
+import cc.polyfrost.oneconfig.internal.config.ConfigCore;
import cc.polyfrost.oneconfig.hud.BasicHud;
-import cc.polyfrost.oneconfig.hud.HudCore;
+import cc.polyfrost.oneconfig.internal.hud.HudCore;
import cc.polyfrost.oneconfig.renderer.RenderManager;
import gg.essential.universal.UKeyboard;
import gg.essential.universal.UMatrixStack;
diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java b/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java
index 3a00e06..7f0882a 100644
--- a/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java
+++ b/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java
@@ -1,10 +1,10 @@
package cc.polyfrost.oneconfig.internal;
-import cc.polyfrost.oneconfig.config.core.ConfigCore;
+import cc.polyfrost.oneconfig.internal.config.ConfigCore;
import cc.polyfrost.oneconfig.config.data.Mod;
import cc.polyfrost.oneconfig.config.data.ModType;
import cc.polyfrost.oneconfig.events.EventManager;
-import cc.polyfrost.oneconfig.hud.HudCore;
+import cc.polyfrost.oneconfig.internal.hud.HudCore;
import cc.polyfrost.oneconfig.internal.config.OneConfigConfig;
import cc.polyfrost.oneconfig.internal.command.OneConfigCommand;
import cc.polyfrost.oneconfig.internal.gui.BlurHandler;
diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/config/ConfigCore.java b/src/main/java/cc/polyfrost/oneconfig/internal/config/ConfigCore.java
new file mode 100644
index 0000000..f41b74e
--- /dev/null
+++ b/src/main/java/cc/polyfrost/oneconfig/internal/config/ConfigCore.java
@@ -0,0 +1,25 @@
+package cc.polyfrost.oneconfig.internal.config;
+
+import cc.polyfrost.oneconfig.config.data.Mod;
+import cc.polyfrost.oneconfig.internal.hud.HudCore;
+
+import java.util.ArrayList;
+
+public class ConfigCore {
+ public static ArrayList<Mod> oneConfigMods = new ArrayList<>();
+
+ public static void saveAll() {
+ for (Mod modData : oneConfigMods) {
+ modData.config.save();
+ }
+ }
+
+ public static void reInitAll() {
+ ArrayList<Mod> data = new ArrayList<>(oneConfigMods);
+ oneConfigMods.clear();
+ HudCore.huds.clear();
+ for (Mod modData : data) {
+ modData.config.init(modData);
+ }
+ }
+}
diff --git a/src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java b/src/main/java/cc/polyfrost/oneconfig/internal/hud/HudCore.java
index c3e7f9b..7c92799 100644
--- a/src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java
+++ b/src/main/java/cc/polyfrost/oneconfig/internal/hud/HudCore.java
@@ -1,6 +1,7 @@
-package cc.polyfrost.oneconfig.hud;
+package cc.polyfrost.oneconfig.internal.hud;
import cc.polyfrost.oneconfig.events.event.HudRenderEvent;
+import cc.polyfrost.oneconfig.hud.BasicHud;
import gg.essential.universal.UResolution;
import me.kbrewster.eventbus.Subscribe;
diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/plugin/asm/tweakers/VigilantTransformer.java b/src/main/java/cc/polyfrost/oneconfig/internal/plugin/asm/tweakers/VigilantTransformer.java
index f241c74..09f40e7 100644
--- a/src/main/java/cc/polyfrost/oneconfig/internal/plugin/asm/tweakers/VigilantTransformer.java
+++ b/src/main/java/cc/polyfrost/oneconfig/internal/plugin/asm/tweakers/VigilantTransformer.java
@@ -1,7 +1,7 @@
package cc.polyfrost.oneconfig.internal.plugin.asm.tweakers;
import cc.polyfrost.oneconfig.config.compatibility.vigilance.VigilanceConfig;
-import cc.polyfrost.oneconfig.config.core.ConfigCore;
+import cc.polyfrost.oneconfig.internal.config.ConfigCore;
import cc.polyfrost.oneconfig.config.data.Mod;
import cc.polyfrost.oneconfig.config.data.ModType;
import cc.polyfrost.oneconfig.internal.plugin.asm.ITransformer;