aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost
diff options
context:
space:
mode:
authorWyvest <45589059+Wyvest@users.noreply.github.com>2022-06-05 15:27:36 +0700
committerGitHub <noreply@github.com>2022-06-05 10:27:36 +0200
commit44dfbbb419f1736530c04c02a651f7757cf83f3d (patch)
tree1e8171573680b9415cecf199d479d49f7ad1f48a /src/main/java/cc/polyfrost
parent494d4f0bd0856e8e8d373003c82729ca722c6ccf (diff)
downloadOneConfig-44dfbbb419f1736530c04c02a651f7757cf83f3d.tar.gz
OneConfig-44dfbbb419f1736530c04c02a651f7757cf83f3d.tar.bz2
OneConfig-44dfbbb419f1736530c04c02a651f7757cf83f3d.zip
rewrite command manager, stop using essential relocate, and reformat code (#34)
* reformat code * reformat code rewrite command manager stop using essential relocate
Diffstat (limited to 'src/main/java/cc/polyfrost')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/OneConfig.java8
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java14
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilanceConfig.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/core/OneColor.java52
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/core/OneKeyBind.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/data/Mod.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/interfaces/BasicOption.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/migration/VigilanceMigrator.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/events/EventManager.java12
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/events/event/ReceivePacketEvent.java1
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/events/event/SendPacketEvent.java1
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java6
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java15
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/animations/Animation.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java1
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/animations/DummyAnimation.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutQuad.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutQuart.java5
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java17
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java22
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java26
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java14
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigButton.java22
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java5
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java7
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/text/NumberInputField.java5
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java32
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java5
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/hud/TextHud.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/init/OneConfigInit.java1
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/BlurHandler.java10
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java6
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/image/ImageLoader.java23
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/scissor/ScissorManager.java13
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/mixin/MinecraftMixin.java24
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/plugin/OneConfigMixinPlugin.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/plugin/asm/tweakers/VigilantTransformer.java28
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/test/TestCommand.java (renamed from src/main/java/cc/polyfrost/oneconfig/test/TestCommand_Test.java)4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java1
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui_Test.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/GuiUtils.java19
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/InputUtils.java23
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/JsonUtils.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/Multithreading.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/NetworkUtils.java22
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/OneUIScreen.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/TextUtils.java14
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/TickDelay.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/commands/CommandHelper.java19
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/commands/CommandManager.java289
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Command.java6
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Main.java1
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Name.java1
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/SubCommand.java3
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/ArgumentParser.java30
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/Arguments.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/BooleanParser.java20
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/DoubleParser.java6
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/FloatParser.java6
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/IntegerParser.java6
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/hypixel/HypixelUtils.java13
69 files changed, 514 insertions, 414 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/OneConfig.java b/src/main/java/cc/polyfrost/oneconfig/OneConfig.java
index 977c53b..e8612b6 100644
--- a/src/main/java/cc/polyfrost/oneconfig/OneConfig.java
+++ b/src/main/java/cc/polyfrost/oneconfig/OneConfig.java
@@ -8,6 +8,7 @@ import cc.polyfrost.oneconfig.config.data.ModType;
import cc.polyfrost.oneconfig.events.EventManager;
import cc.polyfrost.oneconfig.hud.HudCore;
import cc.polyfrost.oneconfig.lwjgl.BlurHandler;
+import cc.polyfrost.oneconfig.test.TestCommand;
import cc.polyfrost.oneconfig.test.TestConfig;
import cc.polyfrost.oneconfig.utils.GuiUtils;
import cc.polyfrost.oneconfig.utils.commands.CommandManager;
@@ -28,10 +29,10 @@ import java.util.List;
@net.minecraftforge.fml.common.Mod(modid = "@ID@", name = "@NAME@", version = "@VER@")
public class OneConfig {
public static final File oneConfigDir = new File("./OneConfig");
- public static OneConfigConfig config;
- public static TestConfig testConfig;
public static final List<Mod> loadedMods = new ArrayList<>();
public static final List<ModMetadata> loadedOtherMods = new ArrayList<>();
+ public static OneConfigConfig config;
+ public static TestConfig testConfig;
private static boolean preLaunched = false;
private static boolean initialized = false;
@@ -60,7 +61,8 @@ public class OneConfig {
GuiUtils.getDeltaTime(); // called to make sure static initializer is called
BlurHandler.INSTANCE.load();
testConfig = new TestConfig();
- CommandManager.INSTANCE.registerCommand(new OneConfigCommand());
+ CommandManager.INSTANCE.registerCommand(OneConfigCommand.class);
+ CommandManager.INSTANCE.registerCommand(TestCommand.class);
EventManager.INSTANCE.register(new HudCore());
EventManager.INSTANCE.register(HypixelUtils.INSTANCE);
reloadModsList();
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java b/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java
index faeffff..b867bc0 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java
@@ -14,18 +14,10 @@ import java.util.ArrayList;
public class OneConfigConfig extends Config {
- public static String currentProfile = "Default Profile";
- public static ArrayList<String> favoriteMods = new ArrayList<>();
- public static ArrayList<OneColor> favoriteColors = new ArrayList<>();
- public static ArrayList<OneColor> recentColors = new ArrayList<>();
-
-
// the color library
public static final int TRANSPARENT = new Color(0, 0, 0, 0).getRGB(); // Transparent
-
public static final int BLACK = new Color(0, 0, 0, 255).getRGB(); // Black
public static final int GRAY_900 = new Color(13, 14, 15, 255).getRGB(); // Gray 900
-
public static final int GRAY_900_80 = new Color(13, 14, 15, 204).getRGB(); // Gray 900 80%
public static final int GRAY_800 = new Color(21, 22, 23, 255).getRGB(); // Gray 800
public static final int GRAY_800_95 = new Color(21, 22, 23, 242).getRGB();
@@ -59,8 +51,10 @@ public class OneConfigConfig extends Config {
public static final int ERROR_800_80 = new Color(145, 24, 24, 204).getRGB(); // Red 800
public static final int ERROR_300 = new Color(253, 155, 155).getRGB();
public static final int ERROR_300_80 = new Color(253, 155, 155, 204).getRGB();
-
-
+ public static String currentProfile = "Default Profile";
+ public static ArrayList<String> favoriteMods = new ArrayList<>();
+ public static ArrayList<OneColor> favoriteColors = new ArrayList<>();
+ public static ArrayList<OneColor> recentColors = new ArrayList<>();
public static boolean ROUNDED_CORNERS = true;
public static float CORNER_RADIUS_WIN = 20f;
public static float CORNER_RADIUS = 12f;
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilanceConfig.java b/src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilanceConfig.java
index 3115f3a..fa4f058 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilanceConfig.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/compatibility/VigilanceConfig.java
@@ -168,8 +168,8 @@ public class VigilanceConfig extends Config {
}
private static class CompatConfigColorElement extends ConfigColorElement {
- private Color prevColor = null;
private final Field color;
+ private Color prevColor = null;
private OneColor cachedColor = null;
public CompatConfigColorElement(Field color, Vigilant parent, String name, int size) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/core/OneColor.java b/src/main/java/cc/polyfrost/oneconfig/config/core/OneColor.java
index dbec72a..9ed1cd9 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/core/OneColor.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/core/OneColor.java
@@ -97,6 +97,27 @@ public final class OneColor {
// accessors
/**
+ * Get the RGBA color from the HSB color, and apply the alpha.
+ */
+ public static int HSBAtoRGBA(float hue, float saturation, float brightness, int alpha) {
+ int temp = Color.HSBtoRGB(hue / 360f, saturation / 100f, brightness / 100f);
+ return ((temp & 0x00ffffff) | (alpha << 24));
+ }
+
+ /**
+ * Get the HSBA color from the RGBA color.
+ */
+ public static short[] RGBAtoHSBA(int rgba) {
+ short[] hsb = new short[4];
+ float[] hsbArray = Color.RGBtoHSB((rgba >> 16 & 255), (rgba >> 8 & 255), (rgba & 255), null);
+ hsb[0] = (short) (hsbArray[0] * 360);
+ hsb[1] = (short) (hsbArray[1] * 100);
+ hsb[2] = (short) (hsbArray[2] * 100);
+ hsb[3] = (short) (rgba >> 24 & 255);
+ return hsb;
+ }
+
+ /**
* Get the red value of the color (0-255).
*/
public int getRed() {
@@ -145,6 +166,11 @@ public final class OneColor {
return hsba[3];
}
+ public void setAlpha(int alpha) {
+ this.hsba[3] = (short) alpha;
+ rgba = HSBAtoRGBA(this.hsba[0], this.hsba[1], this.hsba[2], this.hsba[3]);
+ }
+
/**
* Get the chroma speed of the color (1s-30s).
*/
@@ -221,27 +247,6 @@ public final class OneColor {
}
}
- /**
- * Get the RGBA color from the HSB color, and apply the alpha.
- */
- public static int HSBAtoRGBA(float hue, float saturation, float brightness, int alpha) {
- int temp = Color.HSBtoRGB(hue / 360f, saturation / 100f, brightness / 100f);
- return ((temp & 0x00ffffff) | (alpha << 24));
- }
-
- /**
- * Get the HSBA color from the RGBA color.
- */
- public static short[] RGBAtoHSBA(int rgba) {
- short[] hsb = new short[4];
- float[] hsbArray = Color.RGBtoHSB((rgba >> 16 & 255), (rgba >> 8 & 255), (rgba & 255), null);
- hsb[0] = (short) (hsbArray[0] * 360);
- hsb[1] = (short) (hsbArray[1] * 100);
- hsb[2] = (short) (hsbArray[2] * 100);
- hsb[3] = (short) (rgba >> 24 & 255);
- return hsb;
- }
-
public String getHex() {
return Integer.toHexString(0xff000000 | getRGB()).toUpperCase().substring(2);
}
@@ -273,11 +278,6 @@ public final class OneColor {
hsba = RGBAtoHSBA(rgba);
}
- public void setAlpha(int alpha) {
- this.hsba[3] = (short) alpha;
- rgba = HSBAtoRGBA(this.hsba[0], this.hsba[1], this.hsba[2], this.hsba[3]);
- }
-
private String charsToString(char... chars) {
StringBuilder sb = new StringBuilder();
for (char c : chars) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/core/OneKeyBind.java b/src/main/java/cc/polyfrost/oneconfig/config/core/OneKeyBind.java
index d62247c..d455411 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/core/OneKeyBind.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/core/OneKeyBind.java
@@ -1,6 +1,6 @@
package cc.polyfrost.oneconfig.config.core;
-import cc.polyfrost.oneconfig.libs.universal.UKeyboard;
+import gg.essential.universal.UKeyboard;
import java.util.ArrayList;
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/data/Mod.java b/src/main/java/cc/polyfrost/oneconfig/config/data/Mod.java
index 7849124..241dca7 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/data/Mod.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/data/Mod.java
@@ -9,8 +9,8 @@ public class Mod {
public final ModType modType;
public final String modIcon;
public final Migrator migrator;
- public Config config;
public final OptionPage defaultPage;
+ public Config config;
public boolean isShortCut = false;
/**
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/interfaces/BasicOption.java b/src/main/java/cc/polyfrost/oneconfig/config/interfaces/BasicOption.java
index 6fa3254..d4b4498 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/interfaces/BasicOption.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/interfaces/BasicOption.java
@@ -5,11 +5,11 @@ import java.util.function.Supplier;
@SuppressWarnings({"unused"})
public abstract class BasicOption {
+ public final int size;
protected final Field field;
protected final String name;
- public final int size;
- private Supplier<Boolean> dependency;
protected final Object parent;
+ private Supplier<Boolean> dependency;
/**
* Initialize option
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java b/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java
index 531c374..8eb5eb1 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java
@@ -22,10 +22,10 @@ import java.util.*;
import java.util.function.Supplier;
public class Config {
+ public final transient HashMap<String, BasicOption> optionNames = new HashMap<>();
transient protected final String configFile;
transient protected final Gson gson = new GsonBuilder().excludeFieldsWithModifiers(Modifier.TRANSIENT).setPrettyPrinting().create();
transient public Mod mod;
- public final transient HashMap<String, BasicOption> optionNames = new HashMap<>();
public transient boolean hasBeenInitialized = false;
public boolean enabled = true;
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/migration/VigilanceMigrator.java b/src/main/java/cc/polyfrost/oneconfig/config/migration/VigilanceMigrator.java
index 5573a3e..b45aeba 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/migration/VigilanceMigrator.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/migration/VigilanceMigrator.java
@@ -14,8 +14,8 @@ public class VigilanceMigrator implements Migrator {
private static final Pattern booleanPattern = Pattern.compile("\"?(?<name>[^\\s\"]+)\"? = (?<value>true|false)");
private static final Pattern numberPattern = Pattern.compile("\"?(?<name>[^\\s\"]+)\"? = (?<value>[\\d.]+)");
private static final Pattern stringPattern = Pattern.compile("\"?(?<name>[^\\s\"]+)\"? = \"(?<value>.+)\"");
- protected HashMap<String, HashMap<String, HashMap<String, Object>>> values = null;
protected final String filePath;
+ protected HashMap<String, HashMap<String, HashMap<String, Object>>> values = null;
public VigilanceMigrator(String filePath) {
this.filePath = filePath;
diff --git a/src/main/java/cc/polyfrost/oneconfig/events/EventManager.java b/src/main/java/cc/polyfrost/oneconfig/events/EventManager.java
index c758ec1..cb75a12 100644
--- a/src/main/java/cc/polyfrost/oneconfig/events/EventManager.java
+++ b/src/main/java/cc/polyfrost/oneconfig/events/EventManager.java
@@ -1,22 +1,22 @@
package cc.polyfrost.oneconfig.events;
-import cc.polyfrost.oneconfig.libs.eventbus.EventBus;
-import cc.polyfrost.oneconfig.libs.eventbus.invokers.LMFInvoker;
+import me.kbrewster.eventbus.EventBus;
+import me.kbrewster.eventbus.invokers.LMFInvoker;
/**
* Manages all events from OneConfig.
*/
public final class EventManager {
- private EventManager() {
-
- }
-
/**
* The instance of the {@link EventManager}.
*/
public static final EventManager INSTANCE = new EventManager();
private final EventBus eventBus = new EventBus(new LMFInvoker(), Throwable::printStackTrace);
+ private EventManager() {
+
+ }
+
/**
* Returns the {@link EventBus} instance.
*
diff --git a/src/main/java/cc/polyfrost/oneconfig/events/event/ReceivePacketEvent.java b/src/main/java/cc/polyfrost/oneconfig/events/event/ReceivePacketEvent.java
index 274f7a4..17bc16d 100644
--- a/src/main/java/cc/polyfrost/oneconfig/events/event/ReceivePacketEvent.java
+++ b/src/main/java/cc/polyfrost/oneconfig/events/event/ReceivePacketEvent.java
@@ -4,6 +4,7 @@ import net.minecraft.network.Packet;
public class ReceivePacketEvent extends CancellableEvent {
public final Packet<?> packet;
+
public ReceivePacketEvent(Packet<?> packet) {
this.packet = packet;
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/events/event/SendPacketEvent.java b/src/main/java/cc/polyfrost/oneconfig/events/event/SendPacketEvent.java
index f149d59..3cee784 100644
--- a/src/main/java/cc/polyfrost/oneconfig/events/event/SendPacketEvent.java
+++ b/src/main/java/cc/polyfrost/oneconfig/events/event/SendPacketEvent.java
@@ -4,6 +4,7 @@ import net.minecraft.network.Packet;
public class SendPacketEvent extends CancellableEvent {
public final Packet<?> packet;
+
public SendPacketEvent(Packet<?> packet) {
this.packet = packet;
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
index 72e8e58..52030fc 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
@@ -3,10 +3,10 @@ package cc.polyfrost.oneconfig.gui;
import cc.polyfrost.oneconfig.config.core.ConfigCore;
import cc.polyfrost.oneconfig.hud.BasicHud;
import cc.polyfrost.oneconfig.hud.HudCore;
-import cc.polyfrost.oneconfig.libs.universal.UKeyboard;
-import cc.polyfrost.oneconfig.libs.universal.UMatrixStack;
-import cc.polyfrost.oneconfig.libs.universal.UScreen;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
+import gg.essential.universal.UKeyboard;
+import gg.essential.universal.UMatrixStack;
+import gg.essential.universal.UScreen;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
index 5985d12..a9da8c2 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
@@ -9,14 +9,17 @@ import cc.polyfrost.oneconfig.gui.elements.ColorSelector;
import cc.polyfrost.oneconfig.gui.elements.text.TextInputField;
import cc.polyfrost.oneconfig.gui.pages.ModsPage;
import cc.polyfrost.oneconfig.gui.pages.Page;
-import cc.polyfrost.oneconfig.libs.universal.*;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
import cc.polyfrost.oneconfig.lwjgl.image.SVGs;
import cc.polyfrost.oneconfig.lwjgl.scissor.ScissorManager;
import cc.polyfrost.oneconfig.utils.GuiUtils;
-import cc.polyfrost.oneconfig.utils.color.ColorPalette;
import cc.polyfrost.oneconfig.utils.InputUtils;
+import cc.polyfrost.oneconfig.utils.color.ColorPalette;
+import gg.essential.universal.UKeyboard;
+import gg.essential.universal.UMatrixStack;
+import gg.essential.universal.UResolution;
+import gg.essential.universal.UScreen;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.input.Mouse;
@@ -25,9 +28,8 @@ import java.util.ArrayList;
public class OneConfigGui extends UScreen {
public static OneConfigGui INSTANCE;
+ public static OneConfigGui instanceToRestore = null;
private final SideBar sideBar = new SideBar();
- protected Page currentPage;
- protected Page prevPage;
private final TextInputField textInputField = new TextInputField(248, 40, "Search...", false, false, SVGs.MAGNIFYING_GLASS_BOLD);
private final ArrayList<Page> previousPages = new ArrayList<>();
private final ArrayList<Page> nextPages = new ArrayList<>();
@@ -36,9 +38,10 @@ public class OneConfigGui extends UScreen {
private final ArrayList<Page> parents = new ArrayList<>();
public ColorSelector currentColorSelector;
public boolean mouseDown;
- private float scale = 1f;
- public static OneConfigGui instanceToRestore = null;
public boolean allowClose = true;
+ protected Page currentPage;
+ protected Page prevPage;
+ private float scale = 1f;
private Animation animation;
public OneConfigGui() {
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/animations/Animation.java b/src/main/java/cc/polyfrost/oneconfig/gui/animations/Animation.java
index 069a807..3f2a552 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/animations/Animation.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/animations/Animation.java
@@ -3,11 +3,11 @@ package cc.polyfrost.oneconfig.gui.animations;
import cc.polyfrost.oneconfig.utils.GuiUtils;
public abstract class Animation {
+ protected final boolean reverse;
private final float duration;
private final float start;
private final float change;
private float timePassed = 0;
- protected final boolean reverse;
/**
* @param duration The duration of the animation
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java b/src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java
index a9ef863..2dcd634 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java
@@ -1,7 +1,6 @@
package cc.polyfrost.oneconfig.gui.animations;
import cc.polyfrost.oneconfig.utils.color.ColorPalette;
-import cc.polyfrost.oneconfig.utils.color.ColorUtils;
public class ColorAnimation {
private ColorPalette palette;
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/animations/DummyAnimation.java b/src/main/java/cc/polyfrost/oneconfig/gui/animations/DummyAnimation.java
index bc97aca..dc5bc26 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/animations/DummyAnimation.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/animations/DummyAnimation.java
@@ -1,6 +1,6 @@
package cc.polyfrost.oneconfig.gui.animations;
-public class DummyAnimation extends Animation{
+public class DummyAnimation extends Animation {
/**
* @param value The value that is returned
*/
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutQuad.java b/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutQuad.java
index 9af6557..f43c75d 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutQuad.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutQuad.java
@@ -1,6 +1,6 @@
package cc.polyfrost.oneconfig.gui.animations;
-public class EaseInOutQuad extends Animation{
+public class EaseInOutQuad extends Animation {
/**
* @param duration The duration of the animation
@@ -17,7 +17,7 @@ public class EaseInOutQuad extends Animation{
*/
@Override
protected float animate(float timePassed, float duration, float start, float change) {
- if ((timePassed /= duration / 2) < 1) return change / 2 * timePassed * timePassed + start;;
+ if ((timePassed /= duration / 2) < 1) return change / 2 * timePassed * timePassed + start;
return -change / 2 * ((--timePassed) * (timePassed - 2) - 1) + start;
}
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutQuart.java b/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutQuart.java
index a21aa73..9c3abe9 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutQuart.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/animations/EaseInOutQuart.java
@@ -1,6 +1,6 @@
package cc.polyfrost.oneconfig.gui.animations;
-public class EaseInOutQuart extends Animation{
+public class EaseInOutQuart extends Animation {
/**
* @param duration The duration of the animation
@@ -17,7 +17,8 @@ public class EaseInOutQuart extends Animation{
*/
@Override
protected float animate(float timePassed, float duration, float start, float change) {
- if ((timePassed /= duration / 2) < 1) return change / 2 * timePassed * timePassed * timePassed * timePassed + start;
+ if ((timePassed /= duration / 2) < 1)
+ return change / 2 * timePassed * timePassed * timePassed * timePassed + start;
return -change / 2 * ((timePassed -= 2) * timePassed * timePassed * timePassed - 2) + start;
}
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java
index 6d9f88c..40acff6 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java
@@ -1,6 +1,5 @@
package cc.polyfrost.oneconfig.gui.elements;
-import cc.polyfrost.oneconfig.config.OneConfigConfig;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
import cc.polyfrost.oneconfig.gui.pages.Page;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
@@ -11,23 +10,21 @@ import org.jetbrains.annotations.NotNull;
public class BasicButton extends BasicElement {
- protected String text;
- protected SVGs icon1, icon2;
- private final int alignment;
- private final float fontSize, cornerRadius;
- private final int xSpacing, xPadding;
- private final int iconSize;
- public int x, y;
public static final int ALIGNMENT_LEFT = 0;
public static final int ALIGNMENT_CENTER = 2;
public static final int ALIGNMENT_JUSTIFIED = 3;
-
public static final int SIZE_32 = 32;
public static final int SIZE_36 = 36;
public static final int SIZE_40 = 40;
public static final int SIZE_48 = 48;
-
public static final int CUSTOM_COLOR = -100;
+ private final int alignment;
+ private final float fontSize, cornerRadius;
+ private final int xSpacing, xPadding;
+ private final int iconSize;
+ public int x, y;
+ protected String text;
+ protected SVGs icon1, icon2;
private boolean toggleable = false;
private Page page;
private Runnable runnable;
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java
index 0e3fe23..aab94e5 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicElement.java
@@ -8,6 +8,8 @@ import org.jetbrains.annotations.NotNull;
import org.lwjgl.input.Mouse;
public class BasicElement {
+ protected final float radius;
+ public int currentColor;
protected int width, height;
protected ColorPalette colorPalette;
protected int hitBoxX, hitBoxY;
@@ -17,10 +19,8 @@ public class BasicElement {
protected boolean clicked = false;
protected boolean toggled = false;
protected boolean disabled = false;
- public int currentColor;
- protected final float radius;
- private boolean block = false;
protected ColorAnimation colorAnimation;
+ private boolean block = false;
public BasicElement(int width, int height, @NotNull ColorPalette colorPalette, boolean hoverFx) {
this(width, height, colorPalette, hoverFx, 12f);
@@ -79,14 +79,6 @@ public class BasicElement {
hitBoxY = y;
}
- public void setWidth(int width) {
- this.width = width;
- }
-
- public void setHeight(int height) {
- this.height = height;
- }
-
public void setColorPalette(ColorPalette colorPalette) {
if (this.colorPalette.equals(ColorPalette.TERTIARY) || this.colorPalette.equals(ColorPalette.TERTIARY_DESTRUCTIVE))
this.colorAnimation.setColors(colorPalette.getNormalColorf());
@@ -98,10 +90,18 @@ public class BasicElement {
return width;
}
+ public void setWidth(int width) {
+ this.width = width;
+ }
+
public int getHeight() {
return height;
}
+ public void setHeight(int height) {
+ this.height = height;
+ }
+
public boolean isHovered() {
return hovered;
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java
index 1a53564..683be1e 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ColorSelector.java
@@ -3,7 +3,10 @@ package cc.polyfrost.oneconfig.gui.elements;
import cc.polyfrost.oneconfig.config.OneConfigConfig;
import cc.polyfrost.oneconfig.config.core.OneColor;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
-import cc.polyfrost.oneconfig.gui.animations.*;
+import cc.polyfrost.oneconfig.gui.animations.Animation;
+import cc.polyfrost.oneconfig.gui.animations.DummyAnimation;
+import cc.polyfrost.oneconfig.gui.animations.EaseInOutCubic;
+import cc.polyfrost.oneconfig.gui.animations.EaseInOutQuad;
import cc.polyfrost.oneconfig.gui.elements.text.NumberInputField;
import cc.polyfrost.oneconfig.gui.elements.text.TextInputField;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
@@ -23,21 +26,14 @@ import java.awt.datatransfer.StringSelection;
import java.util.ArrayList;
public class ColorSelector {
- private int x;
- private int y;
private final OneColor color;
- private Animation barMoveAnimation = new DummyAnimation(18);
- private Animation moveAnimation = new DummyAnimation(1);
- private int mouseX, mouseY;
private final ArrayList<BasicElement> buttons = new ArrayList<>();
private final BasicElement closeBtn = new BasicElement(32, 32, false);
-
private final BasicButton copyBtn = new BasicButton(32, 32, SVGs.COPY, BasicButton.ALIGNMENT_CENTER, ColorPalette.SECONDARY);
private final BasicButton pasteBtn = new BasicButton(32, 32, SVGs.PASTE, BasicButton.ALIGNMENT_CENTER, ColorPalette.SECONDARY);
private final BasicButton guideBtn = new BasicButton(112, 32, "Guide", SVGs.HELP_CIRCLE, SVGs.POP_OUT, BasicButton.ALIGNMENT_CENTER, ColorPalette.SECONDARY);
private final BasicButton faveBtn = new BasicButton(32, 32, SVGs.HEART_OUTLINE, BasicButton.ALIGNMENT_CENTER, ColorPalette.SECONDARY);
private final BasicButton recentBtn = new BasicButton(32, 32, SVGs.HISTORY, BasicButton.ALIGNMENT_CENTER, ColorPalette.SECONDARY);
-
private final NumberInputField hueInput = new NumberInputField(90, 32, 0, 0, 360, 1);
private final NumberInputField saturationInput = new NumberInputField(90, 32, 100, 0, 100, 1);
private final NumberInputField brightnessInput = new NumberInputField(90, 32, 100, 0, 100, 1);
@@ -46,10 +42,14 @@ public class ColorSelector {
private final TextInputField hexInput = new TextInputField(88, 32, true, "");
private final ArrayList<ColorBox> favoriteColors = new ArrayList<>();
private final ArrayList<ColorBox> recentColors = new ArrayList<>();
-
private final ColorSlider topSlider = new ColorSlider(384, 0, 360, 127);
private final ColorSlider bottomSlider = new ColorSlider(384, 0, 255, 100);
private final Slider speedSlider = new Slider(296, 1, 32, 0);
+ private int x;
+ private int y;
+ private Animation barMoveAnimation = new DummyAnimation(18);
+ private Animation moveAnimation = new DummyAnimation(1);
+ private int mouseX, mouseY;
private int mode = 0, prevMode = 0;
private boolean dragging, mouseWasDown;
@@ -462,13 +462,13 @@ public class ColorSelector {
update(x, y);
}
- public void setColor(OneColor color) {
- this.color = color;
- }
-
public OneColor getColor() {
return color;
}
+
+ public void setColor(OneColor color) {
+ this.color = color;
+ }
}
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java
index e8d4b2d..863a72d 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java
@@ -6,12 +6,12 @@ import cc.polyfrost.oneconfig.config.data.Mod;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
import cc.polyfrost.oneconfig.gui.animations.ColorAnimation;
import cc.polyfrost.oneconfig.gui.pages.ModConfigPage;
-import cc.polyfrost.oneconfig.libs.universal.wrappers.UPlayer;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
import cc.polyfrost.oneconfig.lwjgl.image.SVGs;
-import cc.polyfrost.oneconfig.utils.color.ColorPalette;
import cc.polyfrost.oneconfig.utils.InputUtils;
+import cc.polyfrost.oneconfig.utils.color.ColorPalette;
+import gg.essential.universal.wrappers.UPlayer;
import net.minecraftforge.client.ClientCommandHandler;
import net.minecraftforge.fml.common.ModMetadata;
import org.jetbrains.annotations.NotNull;
@@ -22,9 +22,9 @@ import java.util.ArrayList;
public class ModCard extends BasicElement {
private final Mod modData;
private final BasicButton favoriteButton = new BasicButton(32, 32, SVGs.HEART_OUTLINE, BasicButton.ALIGNMENT_CENTER, ColorPalette.TERTIARY);
- private boolean active, disabled, favorite;
private final ColorAnimation colorFrame = new ColorAnimation(ColorPalette.SECONDARY);
private final ColorAnimation colorToggle = new ColorAnimation(ColorPalette.PRIMARY);
+ private boolean active, disabled, favorite;
private boolean isHoveredMain = false;
public ModCard(@NotNull Mod mod, boolean active, boolean disabled, boolean favorite) {
@@ -120,14 +120,14 @@ public class ModCard extends BasicElement {
return disabled;
}
- public boolean isActive() {
- return active;
- }
-
public void setDisabled(boolean disabled) {
this.disabled = disabled;
}
+ public boolean isActive() {
+ return active;
+ }
+
public boolean isFavorite() {
return favorite;
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigButton.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigButton.java
index d58852f..19bf058 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigButton.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigButton.java
@@ -24,6 +24,17 @@ public class ConfigButton extends BasicOption {
this.button.setClickAction(getRunnableFromField(field, parent));
}
+ private static Runnable getRunnableFromField(Field field, Object parent) {
+ Runnable runnable = () -> {
+ };
+ try {
+ runnable = (Runnable) field.get(parent);
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ return runnable;
+ }
+
@Override
public void draw(long vg, int x, int y) {
button.disable(!isEnabled());
@@ -37,15 +48,4 @@ public class ConfigButton extends BasicOption {
public int getHeight() {
return 32;
}
-
- private static Runnable getRunnableFromField(Field field, Object parent) {
- Runnable runnable = () -> {
- };
- try {
- runnable = (Runnable) field.get(parent);
- } catch (IllegalAccessException e) {
- e.printStackTrace();
- }
- return runnable;
- }
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java
index 16b1ea2..121416d 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java
@@ -29,7 +29,7 @@ public class ConfigColorElement extends BasicOption {
@Override
public void draw(long vg, int x, int y) {
- if(!isEnabled()) RenderManager.setAlpha(vg, 0.5f);
+ if (!isEnabled()) RenderManager.setAlpha(vg, 0.5f);
hexField.disable(!isEnabled());
alphaField.disable(!isEnabled());
element.disable(!isEnabled());
@@ -81,7 +81,7 @@ public class ConfigColorElement extends BasicOption {
open = !open;
OneConfigGui.INSTANCE.initColorSelector(new ColorSelector(color, InputUtils.mouseX(), InputUtils.mouseY()));
}
- if(OneConfigGui.INSTANCE.currentColorSelector == null) open = false;
+ if (OneConfigGui.INSTANCE.currentColorSelector == null) open = false;
if (OneConfigGui.INSTANCE.currentColorSelector != null && open) {
color = (OneConfigGui.INSTANCE.getColor());
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java
index 156f782..472f80e 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDropdown.java
@@ -6,9 +6,8 @@ import cc.polyfrost.oneconfig.gui.animations.ColorAnimation;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
import cc.polyfrost.oneconfig.lwjgl.image.SVGs;
-import cc.polyfrost.oneconfig.utils.color.ColorPalette;
-import cc.polyfrost.oneconfig.utils.color.ColorUtils;
import cc.polyfrost.oneconfig.utils.InputUtils;
+import cc.polyfrost.oneconfig.utils.color.ColorPalette;
import org.lwjgl.input.Mouse;
import java.awt.*;
@@ -18,7 +17,7 @@ import java.util.Arrays;
public class ConfigDropdown extends BasicOption {
private final String[] options;
private final ColorAnimation backgroundColor = new ColorAnimation(ColorPalette.SECONDARY);
- private final ColorAnimation atomColor = new ColorAnimation(new ColorPalette(OneConfigConfig.PRIMARY_600, OneConfigConfig.PRIMARY_500, OneConfigConfig.PRIMARY_500));
+ private final ColorAnimation atomColor = new ColorAnimation(new ColorPalette(OneConfigConfig.PRIMARY_600, OneConfigConfig.PRIMARY_500, OneConfigConfig.PRIMARY_500));
private boolean opened = false;
public ConfigDropdown(Field field, Object parent, String name, int size, String[] options) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java
index 7a458c8..e7b1083 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigDualOption.java
@@ -2,17 +2,18 @@ package cc.polyfrost.oneconfig.gui.elements.config;
import cc.polyfrost.oneconfig.config.OneConfigConfig;
import cc.polyfrost.oneconfig.config.interfaces.BasicOption;
-import cc.polyfrost.oneconfig.gui.animations.*;
+import cc.polyfrost.oneconfig.gui.animations.Animation;
+import cc.polyfrost.oneconfig.gui.animations.DummyAnimation;
+import cc.polyfrost.oneconfig.gui.animations.EaseInOutCubic;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
import cc.polyfrost.oneconfig.utils.InputUtils;
-import cc.polyfrost.oneconfig.utils.MathUtils;
import java.lang.reflect.Field;
public class ConfigDualOption extends BasicOption {
- private Animation posAnimation;
private final String left, right;
+ private Animation posAnimation;
public ConfigDualOption(Field field, Object parent, String name, int size, String[] options) {
super(field, parent, name, size);
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java
index d873006..a448b14 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java
@@ -5,11 +5,11 @@ import cc.polyfrost.oneconfig.config.core.OneKeyBind;
import cc.polyfrost.oneconfig.config.interfaces.BasicOption;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
import cc.polyfrost.oneconfig.gui.elements.BasicButton;
-import cc.polyfrost.oneconfig.libs.universal.UKeyboard;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
import cc.polyfrost.oneconfig.lwjgl.image.SVGs;
import cc.polyfrost.oneconfig.utils.color.ColorPalette;
+import gg.essential.universal.UKeyboard;
import java.lang.reflect.Field;
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java
index b464423..8b47045 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java
@@ -9,8 +9,8 @@ import cc.polyfrost.oneconfig.gui.pages.ModConfigPage;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
import cc.polyfrost.oneconfig.lwjgl.image.SVGs;
-import cc.polyfrost.oneconfig.utils.color.ColorPalette;
import cc.polyfrost.oneconfig.utils.InputUtils;
+import cc.polyfrost.oneconfig.utils.color.ColorPalette;
import org.lwjgl.input.Mouse;
import java.lang.reflect.Field;
@@ -18,7 +18,7 @@ import java.lang.reflect.Field;
public class ConfigPageButton extends BasicOption {
public final OptionPage page;
public final String description;
- private ColorAnimation backgroundColor = new ColorAnimation(ColorPalette.SECONDARY);
+ private final ColorAnimation backgroundColor = new ColorAnimation(ColorPalette.SECONDARY);
public ConfigPageButton(Field field, Object parent, String name, String description, OptionPage page) {
super(field, parent, name, 2);
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java
index 9a38b98..45217c0 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSlider.java
@@ -14,8 +14,8 @@ import java.lang.reflect.Field;
public class ConfigSlider extends BasicOption {
private final NumberInputField inputField;
private final float min, max;
- private boolean isFloat = true;
private final int step;
+ private boolean isFloat = true;
private boolean dragging = false;
private boolean mouseWasDown = false;
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java
index cb54f9b..090f5a6 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigSwitch.java
@@ -8,10 +8,8 @@ import cc.polyfrost.oneconfig.gui.animations.DummyAnimation;
import cc.polyfrost.oneconfig.gui.animations.EaseInOutQuad;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
-import cc.polyfrost.oneconfig.utils.color.ColorPalette;
-import cc.polyfrost.oneconfig.utils.color.ColorUtils;
import cc.polyfrost.oneconfig.utils.InputUtils;
-import cc.polyfrost.oneconfig.utils.MathUtils;
+import cc.polyfrost.oneconfig.utils.color.ColorPalette;
import org.lwjgl.input.Mouse;
import java.lang.reflect.Field;
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/NumberInputField.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/NumberInputField.java
index 69b1584..ed05760 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/NumberInputField.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/NumberInputField.java
@@ -6,16 +6,15 @@ import cc.polyfrost.oneconfig.gui.elements.BasicElement;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import cc.polyfrost.oneconfig.lwjgl.image.SVGs;
import cc.polyfrost.oneconfig.utils.color.ColorPalette;
-import cc.polyfrost.oneconfig.utils.color.ColorUtils;
public class NumberInputField extends TextInputField {
private final BasicElement upArrow = new BasicElement(12, 14, false);
private final BasicElement downArrow = new BasicElement(12, 14, false);
+ private final ColorAnimation colorTop = new ColorAnimation(ColorPalette.SECONDARY);
+ private final ColorAnimation colorBottom = new ColorAnimation(ColorPalette.SECONDARY);
private float min;
private float max;
private float step;
- private final ColorAnimation colorTop = new ColorAnimation(ColorPalette.SECONDARY);
- private final ColorAnimation colorBottom = new ColorAnimation(ColorPalette.SECONDARY);
private float current;
public NumberInputField(int width, int height, float defaultValue, float min, float max, float step) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java
index 91a8ff2..b16472d 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java
@@ -2,7 +2,6 @@ package cc.polyfrost.oneconfig.gui.elements.text;
import cc.polyfrost.oneconfig.config.OneConfigConfig;
import cc.polyfrost.oneconfig.gui.elements.BasicElement;
-import cc.polyfrost.oneconfig.libs.universal.UKeyboard;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
import cc.polyfrost.oneconfig.lwjgl.image.SVGs;
@@ -11,6 +10,7 @@ import cc.polyfrost.oneconfig.lwjgl.scissor.ScissorManager;
import cc.polyfrost.oneconfig.utils.InputUtils;
import cc.polyfrost.oneconfig.utils.MathUtils;
import cc.polyfrost.oneconfig.utils.TextUtils;
+import gg.essential.universal.UKeyboard;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
@@ -23,24 +23,24 @@ import java.util.ArrayList;
public class TextInputField extends BasicElement {
protected final String defaultText;
- protected String input, selectedText;
protected final boolean multiLine;
+ protected String input, selectedText;
protected boolean password;
protected int caretPos;
protected int x, y;
protected float start, end;
protected int startLine, endLine;
- private long clickTimeD1;
protected long vg;
protected int prevCaret = 0;
protected boolean isDoubleClick = false;
protected boolean onlyNums = false;
protected boolean errored = false;
protected boolean centered = false;
- private int lines = 1;
protected SVGs icon;
protected ArrayList<String> wrappedText = null;
+ private long clickTimeD1;
+ private int lines = 1;
public TextInputField(int width, int height, String defaultText, boolean multiLine, boolean password, SVGs icon) {
super(width, height, false);
@@ -60,28 +60,28 @@ public class TextInputField extends BasicElement {
this.centered = centered;
}
- public void onlyAcceptNumbers(boolean state) {
- onlyNums = state;
+ public static boolean isAllowedCharacter(char character) {
+ return character != 167 && character >= ' ' && character != 127;
}
- public void setInput(String input) {
- this.input = input;
+ public void onlyAcceptNumbers(boolean state) {
+ onlyNums = state;
}
public String getInput() {
return input;
}
- public void setPassword(boolean password) {
- this.password = password;
+ public void setInput(String input) {
+ this.input = input;
}
public boolean getPassword() {
return password;
}
- public void setErrored(boolean errored) {
- this.errored = errored;
+ public void setPassword(boolean password) {
+ this.password = password;
}
public void setCentered(boolean centered) {
@@ -92,6 +92,10 @@ public class TextInputField extends BasicElement {
return errored;
}
+ public void setErrored(boolean errored) {
+ this.errored = errored;
+ }
+
@Override
public void draw(long vg, int x, int y) {
this.x = x;
@@ -529,10 +533,6 @@ public class TextInputField extends BasicElement {
return 0;
}
- public static boolean isAllowedCharacter(char character) {
- return character != 167 && character >= ' ' && character != 127;
- }
-
public int getLines() {
return lines;
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java b/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java
index 2866008..3b8e172 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java
@@ -67,9 +67,9 @@ public class ModsPage extends Page {
for (BasicButton btn : modCategories) {
btn.draw(vg, iXCat, y + 16);
iXCat += btn.getWidth() + 8;
- if(btn.isToggled()) selected = true;
+ if (btn.isToggled()) selected = true;
}
- if(!selected) modCategories.get(0).setToggled(true);
+ if (!selected) modCategories.get(0).setToggled(true);
return 60;
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java b/src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java
index 4e85cf5..fda6ea2 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java
@@ -1,22 +1,19 @@
package cc.polyfrost.oneconfig.gui.pages;
import cc.polyfrost.oneconfig.gui.animations.Animation;
-import cc.polyfrost.oneconfig.gui.animations.EaseInOutQuad;
import cc.polyfrost.oneconfig.gui.animations.EaseOutQuad;
import cc.polyfrost.oneconfig.lwjgl.scissor.Scissor;
import cc.polyfrost.oneconfig.lwjgl.scissor.ScissorManager;
-import cc.polyfrost.oneconfig.utils.MathUtils;
import org.lwjgl.input.Mouse;
/**
* A page is a 1056x728 rectangle of the GUI. It is the main content of the gui, and can be switched back and forwards easily. All the content of OneConfig is in a page.
*/
public abstract class Page {
+ protected final String title;
private Animation scrollAnimation;
private float scrollTarget;
- protected final String title;
-
protected Page(String title) {
this.title = title;
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java b/src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java
index 200d403..c3e7f9b 100644
--- a/src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java
+++ b/src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java
@@ -1,8 +1,8 @@
package cc.polyfrost.oneconfig.hud;
import cc.polyfrost.oneconfig.events.event.HudRenderEvent;
-import cc.polyfrost.oneconfig.libs.eventbus.Subscribe;
-import cc.polyfrost.oneconfig.libs.universal.UResolution;
+import gg.essential.universal.UResolution;
+import me.kbrewster.eventbus.Subscribe;
import java.util.ArrayList;
diff --git a/src/main/java/cc/polyfrost/oneconfig/hud/TextHud.java b/src/main/java/cc/polyfrost/oneconfig/hud/TextHud.java
index 812ba50..9525ba4 100644
--- a/src/main/java/cc/polyfrost/oneconfig/hud/TextHud.java
+++ b/src/main/java/cc/polyfrost/oneconfig/hud/TextHud.java
@@ -1,7 +1,7 @@
package cc.polyfrost.oneconfig.hud;
-import cc.polyfrost.oneconfig.libs.universal.UMinecraft;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
+import gg.essential.universal.UMinecraft;
public abstract class TextHud extends BasicHud {
public TextHud(boolean enabled, int x, int y) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/init/OneConfigInit.java b/src/main/java/cc/polyfrost/oneconfig/init/OneConfigInit.java
index 6e0bab3..df424fd 100644
--- a/src/main/java/cc/polyfrost/oneconfig/init/OneConfigInit.java
+++ b/src/main/java/cc/polyfrost/oneconfig/init/OneConfigInit.java
@@ -13,6 +13,7 @@ public class OneConfigInit {
/**
* Initializes the OneConfig mod.
+ *
* @param args The arguments passed to the mod.
*/
public static void initialize(String[] args) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/BlurHandler.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/BlurHandler.java
index d2b4811..1219782 100644
--- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/BlurHandler.java
+++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/BlurHandler.java
@@ -5,10 +5,10 @@ import cc.polyfrost.oneconfig.events.event.RenderEvent;
import cc.polyfrost.oneconfig.events.event.ScreenOpenEvent;
import cc.polyfrost.oneconfig.events.event.Stage;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
-import cc.polyfrost.oneconfig.libs.eventbus.Subscribe;
-import cc.polyfrost.oneconfig.libs.universal.UMinecraft;
-import cc.polyfrost.oneconfig.libs.universal.UScreen;
import cc.polyfrost.oneconfig.mixin.ShaderGroupAccessor;
+import gg.essential.universal.UMinecraft;
+import gg.essential.universal.UScreen;
+import me.kbrewster.eventbus.Subscribe;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.shader.Shader;
@@ -33,14 +33,12 @@ import java.util.List;
* https://github.com/boomboompower/ToggleChat/blob/master/LICENSE
*/
public class BlurHandler {
+ public static BlurHandler INSTANCE = new BlurHandler();
private final ResourceLocation blurShader = new ResourceLocation("shaders/post/fade_in_blur.json");
private final Logger logger = LogManager.getLogger("OneConfig - Blur");
-
private long start;
private float lastProgress = 0;
- public static BlurHandler INSTANCE = new BlurHandler();
-
/**
* Simply initializes the blur mod so events are properly handled by forge.
*/
diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
index f366648..ef65ecf 100644
--- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
+++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
@@ -3,9 +3,6 @@ package cc.polyfrost.oneconfig.lwjgl;
import cc.polyfrost.oneconfig.config.OneConfigConfig;
import cc.polyfrost.oneconfig.config.data.InfoType;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
-import cc.polyfrost.oneconfig.libs.universal.UGraphics;
-import cc.polyfrost.oneconfig.libs.universal.UMinecraft;
-import cc.polyfrost.oneconfig.libs.universal.UResolution;
import cc.polyfrost.oneconfig.lwjgl.font.Font;
import cc.polyfrost.oneconfig.lwjgl.font.FontManager;
import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
@@ -14,6 +11,9 @@ import cc.polyfrost.oneconfig.lwjgl.image.Images;
import cc.polyfrost.oneconfig.lwjgl.image.SVGs;
import cc.polyfrost.oneconfig.utils.InputUtils;
import cc.polyfrost.oneconfig.utils.NetworkUtils;
+import gg.essential.universal.UGraphics;
+import gg.essential.universal.UMinecraft;
+import gg.essential.universal.UResolution;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.shader.Framebuffer;
import org.lwjgl.nanovg.NVGColor;
diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/image/ImageLoader.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/image/ImageLoader.java
index 289ab03..a0bb93c 100644
--- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/image/ImageLoader.java
+++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/image/ImageLoader.java
@@ -21,16 +21,18 @@ import java.util.HashMap;
* @see SVGs
*/
public final class ImageLoader {
+ public static ImageLoader INSTANCE = new ImageLoader();
+ private final HashMap<String, Integer> imageHashMap = new HashMap<>();
+ private final HashMap<String, Integer> svgHashMap = new HashMap<>();
+
private ImageLoader() {
}
- private final HashMap<String, Integer> imageHashMap = new HashMap<>();
- private final HashMap<String, Integer> svgHashMap = new HashMap<>();
- public static ImageLoader INSTANCE = new ImageLoader();
/**
* Loads an image from resources.
- * @param vg The NanoVG context.
+ *
+ * @param vg The NanoVG context.
* @param fileName The name of the file to load.
* @return Whether the image was loaded successfully.
*/
@@ -58,10 +60,11 @@ public final class ImageLoader {
/**
* Loads an SVG from resources.
- * @param vg The NanoVG context.
+ *
+ * @param vg The NanoVG context.
* @param fileName The name of the file to load.
- * @param width The width of the SVG.
- * @param height The height of the SVG.
+ * @param width The width of the SVG.
+ * @param height The height of the SVG.
* @return Whether the SVG was loaded successfully.
*/
public boolean loadSVG(long vg, String fileName, float width, float height) {
@@ -121,9 +124,8 @@ public final class ImageLoader {
* Remove an image from the cache, allowing the image to be garbage collected.
* Should be used when the GUI rendering the image is closed.
*
- * @param vg The NanoVG context.
+ * @param vg The NanoVG context.
* @param fileName The name of the file to remove.
- *
* @see ImageLoader#loadImage(long, String)
*/
public void removeImage(long vg, String fileName) {
@@ -162,9 +164,8 @@ public final class ImageLoader {
* Remove a SVG from the cache, allowing the SVG to be garbage collected.
* Should be used when the GUI rendering the SVG is closed.
*
- * @param vg The NanoVG context.
+ * @param vg The NanoVG context.
* @param fileName The name of the file to remove.
- *
* @see ImageLoader#loadSVG(long, String, float, float)
*/
public void removeSVG(long vg, String fileName, float width, float height) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/scissor/ScissorManager.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/scissor/ScissorManager.java
index 05747df..159de96 100644
--- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/scissor/ScissorManager.java
+++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/scissor/ScissorManager.java
@@ -12,10 +12,11 @@ public class ScissorManager {
/**
* Adds and applies a scissor rectangle to the list of scissor rectangles.
- * @param vg The NanoVG context.
- * @param x The x coordinate of the scissor rectangle.
- * @param y The y coordinate of the scissor rectangle.
- * @param width The width of the scissor rectangle.
+ *
+ * @param vg The NanoVG context.
+ * @param x The x coordinate of the scissor rectangle.
+ * @param y The y coordinate of the scissor rectangle.
+ * @param width The width of the scissor rectangle.
* @param height The height of the scissor rectangle.
* @return The scissor rectangle.
*/
@@ -29,7 +30,8 @@ public class ScissorManager {
/**
* Resets the scissor rectangle provided.
- * @param vg The NanoVG context.
+ *
+ * @param vg The NanoVG context.
* @param scissor The scissor rectangle to reset.
*/
public static void resetScissor(long vg, Scissor scissor) {
@@ -41,6 +43,7 @@ public class ScissorManager {
/**
* Clear all scissor rectangles.
+ *
* @param vg The NanoVG context.
*/
public static void clearScissors(long vg) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/mixin/MinecraftMixin.java b/src/main/java/cc/polyfrost/oneconfig/mixin/MinecraftMixin.java
index 5d11729..6618094 100644
--- a/src/main/java/cc/polyfrost/oneconfig/mixin/MinecraftMixin.java
+++ b/src/main/java/cc/polyfrost/oneconfig/mixin/MinecraftMixin.java
@@ -3,20 +3,22 @@ package cc.polyfrost.oneconfig.mixin;
import cc.polyfrost.oneconfig.OneConfig;
import cc.polyfrost.oneconfig.events.EventManager;
import cc.polyfrost.oneconfig.events.event.*;
-import cc.polyfrost.oneconfig.libs.mixinextras.injector.ModifyExpressionValue;
import net.minecraft.client.Minecraft;
import net.minecraft.util.Timer;
import net.minecraftforge.client.event.GuiOpenEvent;
+import net.minecraftforge.fml.common.eventhandler.Event;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
+import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(Minecraft.class)
public class MinecraftMixin {
- @Shadow private Timer timer;
+ @Shadow
+ private Timer timer;
@Inject(method = "startGame", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/client/FMLClientHandler;beginMinecraftLoading(Lnet/minecraft/client/Minecraft;Ljava/util/List;Lnet/minecraft/client/resources/IReloadableResourceManager;)V", remap = false), remap = true)
private void onPreLaunch(CallbackInfo ci) {
@@ -48,14 +50,18 @@ public class MinecraftMixin {
EventManager.INSTANCE.post(new TickEvent(Stage.END));
}
- @ModifyExpressionValue(method = "displayGuiScreen", at = @At(value = "NEW", target = "Lnet/minecraftforge/client/event/GuiOpenEvent;<init>(Lnet/minecraft/client/gui/GuiScreen;)V", remap = false), remap = true)
- private GuiOpenEvent onGuiOpenEvent(GuiOpenEvent screen) {
- ScreenOpenEvent event = new ScreenOpenEvent(screen.gui);
- EventManager.INSTANCE.post(event);
- if (event.isCancelled) {
- screen.setCanceled(true);
+ @ModifyArg(method = "displayGuiScreen", at = @At(value = "INVOKE", target = "Lnet/minecraftforge/fml/common/eventhandler/EventBus;post(Lnet/minecraftforge/fml/common/eventhandler/Event;)Z", remap = false), remap = true)
+ private Event onGuiOpenEvent(Event a) {
+ if (a instanceof GuiOpenEvent) {
+ GuiOpenEvent forgeEvent = (GuiOpenEvent) a;
+ ScreenOpenEvent event = new ScreenOpenEvent(forgeEvent.gui);
+ EventManager.INSTANCE.post(event);
+ if (event.isCancelled) {
+ forgeEvent.setCanceled(true);
+ }
+ return forgeEvent;
}
- return screen;
+ return a;
}
@Inject(method = "runGameLoop", at = @At(value = "FIELD", target = "Lnet/minecraft/util/Timer;renderPartialTicks:F", opcode = Opcodes.PUTFIELD, shift = At.Shift.AFTER))
diff --git a/src/main/java/cc/polyfrost/oneconfig/plugin/OneConfigMixinPlugin.java b/src/main/java/cc/polyfrost/oneconfig/plugin/OneConfigMixinPlugin.java
index f5cac15..951e942 100644
--- a/src/main/java/cc/polyfrost/oneconfig/plugin/OneConfigMixinPlugin.java
+++ b/src/main/java/cc/polyfrost/oneconfig/plugin/OneConfigMixinPlugin.java
@@ -1,6 +1,5 @@
package cc.polyfrost.oneconfig.plugin;
-import cc.polyfrost.oneconfig.libs.mixinextras.MixinExtrasBootstrap;
import org.spongepowered.asm.lib.tree.ClassNode;
import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin;
import org.spongepowered.asm.mixin.extensibility.IMixinInfo;
@@ -13,7 +12,6 @@ public class OneConfigMixinPlugin implements IMixinConfigPlugin {
@Override
public void onLoad(String mixinPackage) {
- MixinExtrasBootstrap.init();
try {
Class.forName("gg.essential.vigilance.Vigilant");
isVigilance = true;
diff --git a/src/main/java/cc/polyfrost/oneconfig/plugin/asm/tweakers/VigilantTransformer.java b/src/main/java/cc/polyfrost/oneconfig/plugin/asm/tweakers/VigilantTransformer.java
index fecdeed..29cf2fd 100644
--- a/src/main/java/cc/polyfrost/oneconfig/plugin/asm/tweakers/VigilantTransformer.java
+++ b/src/main/java/cc/polyfrost/oneconfig/plugin/asm/tweakers/VigilantTransformer.java
@@ -16,6 +16,20 @@ import org.objectweb.asm.tree.*;
import java.io.File;
public class VigilantTransformer implements ITransformer {
+ @SuppressWarnings("unused")
+ public static VigilanceConfig returnNewConfig(Vigilant vigilant, File file) {
+ if (vigilant != null && Minecraft.getMinecraft().isCallingFromMinecraftThread()) {
+ String name = !vigilant.getGuiTitle().equals("Settings") ? vigilant.getGuiTitle() : Loader.instance().activeModContainer() == null ? "Unknown" : Loader.instance().activeModContainer().getName();
+ if (name.equals("OneConfig")) name = "Essential";
+ String finalName = name;
+ // duplicate fix
+ if (ConfigCore.oneConfigMods.stream().anyMatch(mod -> mod.name.equals(finalName))) return null;
+ return new VigilanceConfig(new Mod(name, ModType.THIRD_PARTY), file.getAbsolutePath(), vigilant);
+ } else {
+ return null;
+ }
+ }
+
@Override
public String[] getClassName() {
return new String[]{"gg.essential.vigilance.Vigilant"};
@@ -88,18 +102,4 @@ public class VigilantTransformer implements ITransformer {
}
}
}
-
- @SuppressWarnings("unused")
- public static VigilanceConfig returnNewConfig(Vigilant vigilant, File file) {
- if (vigilant != null && Minecraft.getMinecraft().isCallingFromMinecraftThread()) {
- String name = !vigilant.getGuiTitle().equals("Settings") ? vigilant.getGuiTitle() : Loader.instance().activeModContainer() == null ? "Unknown" : Loader.instance().activeModContainer().getName();
- if (name.equals("OneConfig")) name = "Essential";
- String finalName = name;
- // duplicate fix
- if (ConfigCore.oneConfigMods.stream().anyMatch(mod -> mod.name.equals(finalName))) return null;
- return new VigilanceConfig(new Mod(name, ModType.THIRD_PARTY), file.getAbsolutePath(), vigilant);
- } else {
- return null;
- }
- }
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestCommand_Test.java b/src/main/java/cc/polyfrost/oneconfig/test/TestCommand.java
index d8c37f0..b757c73 100644
--- a/src/main/java/cc/polyfrost/oneconfig/test/TestCommand_Test.java
+++ b/src/main/java/cc/polyfrost/oneconfig/test/TestCommand.java
@@ -1,13 +1,13 @@
package cc.polyfrost.oneconfig.test;
-import cc.polyfrost.oneconfig.libs.universal.UChat;
import cc.polyfrost.oneconfig.utils.commands.annotations.Command;
import cc.polyfrost.oneconfig.utils.commands.annotations.Main;
import cc.polyfrost.oneconfig.utils.commands.annotations.Name;
import cc.polyfrost.oneconfig.utils.commands.annotations.SubCommand;
+import gg.essential.universal.UChat;
@Command(value = "test", aliases = {"t"})
-public class TestCommand_Test {
+public class TestCommand {
@Main
private static void main() { // /test
diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java b/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java
index 6ce55f4..e67d491 100644
--- a/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java
+++ b/src/main/java/cc/polyfrost/oneconfig/test/TestConfig.java
@@ -7,7 +7,6 @@ import cc.polyfrost.oneconfig.config.core.OneKeyBind;
import cc.polyfrost.oneconfig.config.data.*;
import cc.polyfrost.oneconfig.config.interfaces.Config;
import cc.polyfrost.oneconfig.config.migration.VigilanceMigrator;
-import cc.polyfrost.oneconfig.lwjgl.image.SVGs;
import net.minecraftforge.fml.common.FMLCommonHandler;
public class TestConfig extends Config {
diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui_Test.java b/src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui_Test.java
index f6ad3f5..504c12f 100644
--- a/src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui_Test.java
+++ b/src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui_Test.java
@@ -1,9 +1,9 @@
package cc.polyfrost.oneconfig.test;
-import cc.polyfrost.oneconfig.libs.universal.UMatrixStack;
-import cc.polyfrost.oneconfig.libs.universal.UScreen;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
+import gg.essential.universal.UMatrixStack;
+import gg.essential.universal.UScreen;
import org.jetbrains.annotations.NotNull;
import java.awt.*;
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/GuiUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/GuiUtils.java
index c6afb00..29c26fb 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/GuiUtils.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/GuiUtils.java
@@ -3,20 +3,21 @@ package cc.polyfrost.oneconfig.utils;
import cc.polyfrost.oneconfig.events.EventManager;
import cc.polyfrost.oneconfig.events.event.RenderEvent;
import cc.polyfrost.oneconfig.events.event.Stage;
-import cc.polyfrost.oneconfig.libs.eventbus.Subscribe;
-import cc.polyfrost.oneconfig.libs.universal.UMinecraft;
-import cc.polyfrost.oneconfig.libs.universal.UScreen;
+import gg.essential.universal.UMinecraft;
+import gg.essential.universal.UScreen;
+import me.kbrewster.eventbus.Subscribe;
import net.minecraft.client.gui.GuiScreen;
/**
* A class containing utility methods for working with GuiScreens.
*/
public final class GuiUtils {
+ private static long time = -1L;
+ private static long deltaTime = 17L;
+
static {
EventManager.INSTANCE.register(new GuiUtils());
}
- private static long time = -1L;
- private static long deltaTime = 17L;
/**
* Displays a screen after a tick, preventing mouse sync issues.
@@ -27,7 +28,9 @@ public final class GuiUtils {
new TickDelay(() -> UScreen.displayScreen(screen), 1);
}
- /** Close the current open GUI screen. */
+ /**
+ * Close the current open GUI screen.
+ */
public static void closeScreen() {
UScreen.displayScreen(null);
}
@@ -35,8 +38,8 @@ public final class GuiUtils {
/**
* Gets the delta time (in milliseconds) between frames.
* <p><b>
- * Not to be confused with Minecraft deltaTicks / renderPartialTicks, which can be gotten via
- * {@link cc.polyfrost.oneconfig.events.event.TimerUpdateEvent}
+ * Not to be confused with Minecraft deltaTicks / renderPartialTicks, which can be gotten via
+ * {@link cc.polyfrost.oneconfig.events.event.TimerUpdateEvent}
* </b></p>
*
* @return the delta time.
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/InputUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/InputUtils.java
index 0ba4c00..7ec5ee5 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/InputUtils.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/InputUtils.java
@@ -1,14 +1,14 @@
package cc.polyfrost.oneconfig.utils;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
-import cc.polyfrost.oneconfig.libs.universal.UResolution;
+import gg.essential.universal.UResolution;
import org.lwjgl.input.Mouse;
/**
* Various utility methods for input.
* <p>
* All values returned from this class are not scaled to Minecraft's GUI scale.
- * For scaled values, see {@link cc.polyfrost.oneconfig.libs.universal.UMouse}.
+ * For scaled values, see {@link gg.essential.universal.UMouse}.
* </p>
*/
public final class InputUtils {
@@ -28,10 +28,10 @@ public final class InputUtils {
/**
* Checks whether the mouse is currently over a specific region and clicked.
*
- * @param x the x position of the region
- * @param y the y position of the region
- * @param width the width of the region
- * @param height the height of the region
+ * @param x the x position of the region
+ * @param y the y position of the region
+ * @param width the width of the region
+ * @param height the height of the region
* @param ignoreBlock if true, will ignore {@link InputUtils#blockClicks(boolean)}
* @return true if the mouse is clicked and is over the region, false if not
* @see InputUtils#isAreaHovered(int, int, int, int)
@@ -43,9 +43,9 @@ public final class InputUtils {
/**
* Checks whether the mouse is currently over a specific region and clicked.
*
- * @param x the x position of the region
- * @param y the y position of the region
- * @param width the width of the region
+ * @param x the x position of the region
+ * @param y the y position of the region
+ * @param width the width of the region
* @param height the height of the region
* @return true if the mouse is clicked and is over the region, false if not
* @see InputUtils#isAreaClicked(int, int, int, int, boolean)
@@ -78,7 +78,7 @@ public final class InputUtils {
* Gets the current mouse X position.
* <p>
* All values returned from this class are not scaled to Minecraft's GUI scale.
- * For scaled values, see {@link cc.polyfrost.oneconfig.libs.universal.UMouse}.
+ * For scaled values, see {@link gg.essential.universal.UMouse}.
* </p>
*
* @return the current mouse X position
@@ -92,7 +92,7 @@ public final class InputUtils {
* Gets the current mouse Y position.
* <p>
* All values returned from this class are not scaled to Minecraft's GUI scale.
- * For scaled values, see {@link cc.polyfrost.oneconfig.libs.universal.UMouse}.
+ * For scaled values, see {@link gg.essential.universal.UMouse}.
* </p>
*
* @return the current mouse Y position
@@ -111,6 +111,7 @@ public final class InputUtils {
/**
* Whether clicks are blocked
+ *
* @return true if clicks are blocked, false if not
*/
public static boolean isBlockingClicks() {
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/JsonUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/JsonUtils.java
index 67881e9..320b630 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/JsonUtils.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/JsonUtils.java
@@ -16,7 +16,7 @@ public final class JsonUtils {
/**
* Parses a string into a {@link JsonElement}.
*
- * @param string The string to parse.
+ * @param string The string to parse.
* @param catchExceptions Whether to catch exceptions.
* @return The {@link JsonElement}.
* @see JsonParser#parse(String)
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/Multithreading.java b/src/main/java/cc/polyfrost/oneconfig/utils/Multithreading.java
index 518d699..745ded8 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/Multithreading.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/Multithreading.java
@@ -52,7 +52,7 @@ public class Multithreading {
* Schedules the runnable to run asynchronously after the specified delay.
*
* @param runnable The runnable to run.
- * @param delay The delay before the runnable is run.
+ * @param delay The delay before the runnable is run.
* @param timeUnit The {@link TimeUnit} of the delay.
* @see Multithreading#submitScheduled(Runnable, long, TimeUnit)
*/
@@ -64,7 +64,7 @@ public class Multithreading {
* Submits the Runnable to the executor after a delay, making it run asynchronously.
*
* @param runnable The runnable to run.
- * @param delay The delay before the runnable is run.
+ * @param delay The delay before the runnable is run.
* @param timeUnit The {@link TimeUnit} of the delay.
* @return The future representing the submitted runnable.
* @see ScheduledExecutorService#schedule(Runnable, long, TimeUnit)
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/NetworkUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/NetworkUtils.java
index 767f36f..5578e1e 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/NetworkUtils.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/NetworkUtils.java
@@ -1,7 +1,7 @@
package cc.polyfrost.oneconfig.utils;
-import cc.polyfrost.oneconfig.libs.universal.UDesktop;
import com.google.gson.JsonElement;
+import gg.essential.universal.UDesktop;
import org.apache.commons.io.IOUtils;
import java.io.*;
@@ -18,9 +18,10 @@ public final class NetworkUtils {
/**
* Gets the contents of a URL as a String.
- * @param url The URL to read.
+ *
+ * @param url The URL to read.
* @param userAgent The user agent to use.
- * @param timeout The timeout in milliseconds.
+ * @param timeout The timeout in milliseconds.
* @param useCaches Whether to use caches.
* @return The contents of the URL.
*/
@@ -47,9 +48,9 @@ public final class NetworkUtils {
/**
* Gets the contents of a URL as a JsonElement.
*
- * @param url The URL to read.
+ * @param url The URL to read.
* @param userAgent The user agent to use.
- * @param timeout The timeout in milliseconds.
+ * @param timeout The timeout in milliseconds.
* @param useCaches Whether to use caches.
* @return The contents of the URL.
* @see NetworkUtils#getString(String, String, int, boolean)
@@ -72,10 +73,11 @@ public final class NetworkUtils {
/**
* Downloads a file from a URL.
- * @param url The URL to download from.
- * @param file The file to download to.
+ *
+ * @param url The URL to download from.
+ * @param file The file to download to.
* @param userAgent The user agent to use.
- * @param timeout The timeout in milliseconds.
+ * @param timeout The timeout in milliseconds.
* @param useCaches Whether to use caches.
* @return Whether the download was successful.
*/
@@ -92,7 +94,8 @@ public final class NetworkUtils {
/**
* Downloads a file from a URL.
- * @param url The URL to download from.
+ *
+ * @param url The URL to download from.
* @param file The file to download to.
* @return Whether the download was successful.
* @see NetworkUtils#downloadFile(String, File, String, int, boolean)
@@ -103,6 +106,7 @@ public final class NetworkUtils {
/**
* Gets the SHA-256 hash of a file.
+ *
* @param file The file to hash.
* @return The SHA-256 hash of the file.
*/
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/OneUIScreen.java b/src/main/java/cc/polyfrost/oneconfig/utils/OneUIScreen.java
index 6aaec37..dac995d 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/OneUIScreen.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/OneUIScreen.java
@@ -1,8 +1,8 @@
package cc.polyfrost.oneconfig.utils;
-import cc.polyfrost.oneconfig.libs.universal.UMatrixStack;
-import cc.polyfrost.oneconfig.libs.universal.UScreen;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
+import gg.essential.universal.UMatrixStack;
+import gg.essential.universal.UScreen;
import net.minecraft.client.gui.GuiScreen;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.input.Mouse;
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/TextUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/TextUtils.java
index 4fa5125..df37aae 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/TextUtils.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/TextUtils.java
@@ -13,11 +13,12 @@ public final class TextUtils {
/**
* Wraps a string into an array of lines.
- * @param vg The NanoVG context.
- * @param text The text to wrap.
+ *
+ * @param vg The NanoVG context.
+ * @param text The text to wrap.
* @param maxWidth The maximum width of each line.
* @param fontSize The font size.
- * @param font The font to use.
+ * @param font The font to use.
* @return The array of lines.
*/
public static ArrayList<String> wrapText(long vg, String text, float maxWidth, float fontSize, Fonts font) {
@@ -26,11 +27,12 @@ public final class TextUtils {
/**
* Wraps a string into an array of lines.
- * @param vg The NanoVG context.
- * @param text The text to wrap.
+ *
+ * @param vg The NanoVG context.
+ * @param text The text to wrap.
* @param maxWidth The maximum width of each line.
* @param fontSize The font size.
- * @param font The font to use.
+ * @param font The font to use.
* @return The array of lines.
*/
public static ArrayList<String> wrapText(long vg, String text, float maxWidth, float fontSize, Font font) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/TickDelay.java b/src/main/java/cc/polyfrost/oneconfig/utils/TickDelay.java
index 35b7b8b..7b6be2c 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/TickDelay.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/TickDelay.java
@@ -3,14 +3,14 @@ package cc.polyfrost.oneconfig.utils;
import cc.polyfrost.oneconfig.events.EventManager;
import cc.polyfrost.oneconfig.events.event.Stage;
import cc.polyfrost.oneconfig.events.event.TickEvent;
-import cc.polyfrost.oneconfig.libs.eventbus.Subscribe;
+import me.kbrewster.eventbus.Subscribe;
/**
* Schedules a Runnable to be called after a certain amount of ticks.
*/
public class TickDelay {
- private int delay;
private final Runnable function;
+ private int delay;
public TickDelay(Runnable functionName, int ticks) {
EventManager.INSTANCE.register(this);
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/commands/CommandHelper.java b/src/main/java/cc/polyfrost/oneconfig/utils/commands/CommandHelper.java
deleted file mode 100644
index 3e7b7ea..0000000
--- a/src/main/java/cc/polyfrost/oneconfig/utils/commands/CommandHelper.java
+++ /dev/null
@@ -1,19 +0,0 @@
-package cc.polyfrost.oneconfig.utils.commands;
-
-/**
- * A helper class for commands.
- * Extend this class and run {@link CommandHelper#preload()} (which does nothing,
- * just makes loading look nicer lol)
- *
- * @see cc.polyfrost.oneconfig.utils.commands.annotations.Command
- */
-public abstract class CommandHelper {
-
- public CommandHelper() {
- CommandManager.INSTANCE.registerCommand(this);
- }
-
- public void preload() {
-
- }
-}
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/commands/CommandManager.java b/src/main/java/cc/polyfrost/oneconfig/utils/commands/CommandManager.java
index 913ee73..32bbf5d 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/commands/CommandManager.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/commands/CommandManager.java
@@ -1,12 +1,14 @@
package cc.polyfrost.oneconfig.utils.commands;
-import cc.polyfrost.oneconfig.libs.universal.ChatColor;
-import cc.polyfrost.oneconfig.libs.universal.UChat;
-import cc.polyfrost.oneconfig.utils.commands.annotations.*;
+import cc.polyfrost.oneconfig.utils.commands.annotations.Command;
+import cc.polyfrost.oneconfig.utils.commands.annotations.Greedy;
+import cc.polyfrost.oneconfig.utils.commands.annotations.Main;
+import cc.polyfrost.oneconfig.utils.commands.annotations.SubCommand;
import cc.polyfrost.oneconfig.utils.commands.arguments.*;
+import gg.essential.universal.ChatColor;
+import gg.essential.universal.UChat;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
-import net.minecraft.util.BlockPos;
import net.minecraftforge.client.ClientCommandHandler;
import java.lang.reflect.InvocationTargetException;
@@ -14,7 +16,6 @@ import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
import java.lang.reflect.Parameter;
import java.util.*;
-import java.util.stream.Collectors;
/**
* Handles the registration of OneConfig commands.
@@ -23,9 +24,9 @@ import java.util.stream.Collectors;
*/
public class CommandManager {
public static final CommandManager INSTANCE = new CommandManager();
- private final HashMap<Class<?>, ArgumentParser<?>> parsers = new HashMap<>();
private static final String NOT_FOUND_TEXT = "Command not found! Type /@ROOT_COMMAND@ help for help.";
private static final String METHOD_RUN_ERROR = "Error while running @ROOT_COMMAND@ method! Please report this to the developer.";
+ private final HashMap<Class<?>, ArgumentParser<?>> parsers = new HashMap<>();
private CommandManager() {
addParser(new StringParser());
@@ -61,22 +62,19 @@ public class CommandManager {
/**
* Registers the provided command.
*
- * @param command The command to register.
+ * @param clazz The command to register as a class.
*/
- public void registerCommand(Object command) {
- Class<?> clazz = command.getClass();
+ public void registerCommand(Class<?> clazz) {
if (clazz.isAnnotationPresent(Command.class)) {
final Command annotation = clazz.getAnnotation(Command.class);
- ArrayList<InternalCommand.InternalCommandInvoker> mainCommandFuncs = new ArrayList<>();
+ final InternalCommand root = new InternalCommand(annotation.value(), annotation.aliases(), annotation.description().trim().isEmpty() ? "Main command for " + annotation.value() : annotation.description(), null);
for (Method method : clazz.getDeclaredMethods()) {
if (method.isAnnotationPresent(Main.class) && method.getParameterCount() == 0) {
- mainCommandFuncs.add(new InternalCommand.InternalCommandInvoker(annotation.value(), annotation.aliases(), method));
+ root.invokers.add(new InternalCommand.InternalCommandInvoker(annotation.value(), annotation.aliases(), method, root));
break;
}
}
-
- final InternalCommand root = new InternalCommand(annotation.value(), annotation.aliases(), annotation.description().trim().isEmpty() ? "Main command for " + annotation.value() : annotation.description(), mainCommandFuncs);
addToInvokers(clazz.getDeclaredClasses(), root);
ClientCommandHandler.instance.registerCommand(new CommandBase() {
@Override
@@ -94,26 +92,57 @@ public class CommandManager {
if (args.length == 0) {
if (!root.invokers.isEmpty()) {
try {
- root.invokers.stream().findFirst().get().method.invoke(null);
+ root.invokers.get(0).method.invoke(null);
} catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException |
ExceptionInInitializerError e) {
+ e.printStackTrace();
UChat.chat(ChatColor.RED.toString() + ChatColor.BOLD + METHOD_RUN_ERROR);
}
}
} else {
if (annotation.helpCommand() && args[0].equalsIgnoreCase("help")) {
- UChat.chat(sendHelpCommand(root));
+ //UChat.chat(sendHelpCommand(root));
} else {
+ List<InternalCommand.InternalCommandInvoker> commands = new ArrayList<>();
+ int depth = 0;
for (InternalCommand command : root.children) {
- String result = runThroughCommands(command, 0, args);
- if (result == null) {
- return;
- } else if (!result.equals(NOT_FOUND_TEXT)) {
- UChat.chat(ChatColor.RED.toString() + ChatColor.BOLD + result.replace("@ROOT_COMMAND@", getCommandName()));
- return;
+ int newDepth = loopThroughCommands(commands, 0, command, args, true);
+ if (newDepth != -1) {
+ depth = newDepth;
+ break;
+ }
+ }
+ System.out.println(depth);
+ System.out.println(commands);
+ if (commands.isEmpty()) {
+ UChat.chat(ChatColor.RED.toString() + ChatColor.BOLD + NOT_FOUND_TEXT.replace("@ROOT_COMMAND@", annotation.value()));
+ } else {
+ List<CustomError> errors = new ArrayList<>();
+ for (InternalCommand.InternalCommandInvoker invoker : commands) {
+ try {
+ List<Object> params = getParametersForInvoker(invoker, depth, args);
+ if (params.size() == 1) {
+ Object first = params.get(0);
+ if (first instanceof CustomError) {
+ errors.add((CustomError) first);
+ continue;
+ }
+ }
+ invoker.method.invoke(null, params.toArray());
+ return;
+ } catch (Exception e) {
+ e.printStackTrace();
+ UChat.chat(ChatColor.RED.toString() + ChatColor.BOLD + METHOD_RUN_ERROR);
+ return;
+ }
+ }
+ if (!errors.isEmpty()) {
+ UChat.chat(ChatColor.RED.toString() + ChatColor.BOLD + "Multiple errors occurred:");
+ for (CustomError error : errors) {
+ UChat.chat(" " + ChatColor.RED + ChatColor.BOLD + error.message);
+ }
}
}
- UChat.chat(ChatColor.RED.toString() + ChatColor.BOLD + NOT_FOUND_TEXT.replace("@ROOT_COMMAND@", getCommandName()));
}
}
}
@@ -122,146 +151,142 @@ public class CommandManager {
public int getRequiredPermissionLevel() {
return -1;
}
- });
- }
- }
- private String sendHelpCommand(InternalCommand root) {
- StringBuilder builder = new StringBuilder();
- builder.append(ChatColor.GOLD.toString() + "Help for " + ChatColor.BOLD + root.name + ChatColor.RESET + ChatColor.GOLD + ":\n");
- builder.append("\n");
- for (InternalCommand command : root.children) {
- runThroughCommandsHelp(root.name, root, builder);
- }
- builder.append("\n" + ChatColor.GOLD + "Aliases: " + ChatColor.BOLD);
- int index = 0;
- for (String alias : root.aliases) {
- ++index;
- builder.append(alias + (index < root.aliases.length ? ", " : ""));
- }
- builder.append("\n");
- return builder.toString();
- }
+ /*/
+ @Override
+ public List<String> addTabCompletionOptions(ICommandSender sender, String[] args, BlockPos pos) {
+ List<InternalCommand.InternalCommandInvoker> commands = new ArrayList<>();
+ int depth = 0;
+ for (InternalCommand command : root.children) {
+ int newDepth = loopThroughCommands(commands, 0, command, args, false);
+ if (newDepth != -1) {
+ depth = newDepth;
+ break;
+ }
+ }
+ System.out.println(depth);
+ System.out.println(commands);
+ if (!commands.isEmpty()) {
+ for (InternalCommand.InternalCommandInvoker invoker : commands) {
+ try {
+ List<Object> params = getParametersForInvoker(invoker, depth, args);
+ invoker.method.invoke(null, params.toArray());
+ return;
+ } catch (Exception ignored) {
- private void runThroughCommandsHelp(String append, InternalCommand command, StringBuilder builder) {
- for (InternalCommand.InternalCommandInvoker invoker : command.invokers) {
- builder.append("\n" + ChatColor.GOLD + "/" + append + " " + command.name);
- for (Parameter parameter : invoker.method.getParameters()) {
- String name = parameter.getName();
- if (parameter.isAnnotationPresent(Name.class)) {
- name = parameter.getAnnotation(Name.class).value();
+ }
+ }
+ }
}
- builder.append(" <" + name + ">");
- }
- if (!command.description.trim().isEmpty()) {
- builder.append(": " + ChatColor.BOLD + command.description);
- }
- }
- for (InternalCommand subCommand : command.children) {
- runThroughCommandsHelp(append + " " + command.name, subCommand, builder);
+
+ */
+ });
}
}
- private String runThroughCommands(InternalCommand command, int layer, String[] args) {
- int newLayer = layer + 1;
- if (command.isEqual(args[layer]) && !command.invokers.isEmpty()) {
- Set<InternalCommand.InternalCommandInvoker> invokers = command.invokers.stream().filter(invoker -> newLayer == args.length - invoker.parameterTypes.length).sorted(Comparator.comparingInt((a) -> a.method.getAnnotation(Main.class).priority())).collect(Collectors.toSet());
- if (!invokers.isEmpty()) {
- for (InternalCommand.InternalCommandInvoker invoker : invokers) {
- try {
- String a = tryInvoker(invoker, newLayer, args);
- if (a == null) {
- return null;
- } else if (a.contains(METHOD_RUN_ERROR)) {
- return a;
- }
- } catch (Exception ignored) {
-
- }
- }
- } else {
- for (InternalCommand subCommand : command.children) {
- String result = runThroughCommands(subCommand, newLayer, args);
- if (result == null) {
- return null;
- } else if (!result.equals(NOT_FOUND_TEXT)) {
- return result;
+ private List<Object> getParametersForInvoker(InternalCommand.InternalCommandInvoker invoker, int depth, String[] args) {
+ List<Object> parameters = new ArrayList<>();
+ int processed = depth;
+ int currentParam = 0;
+ while (processed < args.length) {
+ Parameter param = invoker.method.getParameters()[currentParam];
+ if (param.isAnnotationPresent(Greedy.class) && currentParam + 1 != invoker.method.getParameterCount()) {
+ return Collections.singletonList(new CustomError("Parsing failed: Greedy parameter must be the last one."));
+ }
+ ArgumentParser<?> parser = parsers.get(param.getType());
+ if (parser == null) {
+ return Collections.singletonList(new CustomError("No parser for " + invoker.method.getParameterTypes()[currentParam].getSimpleName() + "! Please report this to the mod author."));
+ }
+ try {
+ Arguments arguments = new Arguments(Arrays.copyOfRange(args, processed, args.length), param.isAnnotationPresent(Greedy.class));
+ try {
+ Object a = parser.parse(arguments);
+ if (a != null) {
+ parameters.add(a);
+ processed += arguments.getPosition();
+ currentParam++;
+ } else {
+ return Collections.singletonList(new CustomError("Failed to parse " + param.getType().getSimpleName() + "! Please report this to the mod author."));
}
+ } catch (Exception e) {
+ return Collections.singletonList(new CustomError("A " + e.getClass().getSimpleName() + " has occured while try to parse " + param.getType().getSimpleName() + "! Please report this to the mod author."));
}
+ } catch (Exception e) {
+ return Collections.singletonList(new CustomError("A " + e.getClass().getSimpleName() + " has occured while try to parse " + param.getType().getSimpleName() + "! Please report this to the mod author."));
}
}
- return NOT_FOUND_TEXT;
+ return parameters;
}
- private String tryInvoker(InternalCommand.InternalCommandInvoker invoker, int newLayer, String[] args) {
- try {
- ArrayList<Object> params = new ArrayList<>();
- int processed = newLayer;
- int currentParam = 0;
- while (processed < args.length) {
- Parameter param = invoker.method.getParameters()[currentParam];
- if (param.isAnnotationPresent(Greedy.class) && currentParam + 1 != invoker.method.getParameterCount()) {
- return "Parsing failed: Greedy parameter must be the last one.";
+ private int loopThroughCommands(List<InternalCommand.InternalCommandInvoker> commands, int depth, InternalCommand command, String[] args, boolean checkParams) {
+ int nextDepth = depth + 1;
+ if (command.isEqual(args[depth])) {
+ for (InternalCommand child : command.children) {
+ if (args.length > nextDepth && child.isEqual(args[nextDepth])) {
+ int result = loopThroughCommands(commands, nextDepth, child, args, checkParams);
+ if (result != -1) {
+ return result;
+ }
}
- ArgumentParser<?> parser = parsers.get(param.getType());
- if (parser == null) {
- return "No parser for " + invoker.method.getParameterTypes()[currentParam].getSimpleName() + "! Please report this to the mod author.";
+ }
+ boolean added = false;
+ for (InternalCommand.InternalCommandInvoker invoker : command.invokers) {
+ if (!checkParams || args.length - nextDepth == invoker.method.getParameterCount()) {
+ commands.add(invoker);
+ added = true;
}
- try {
- Arguments arguments = new Arguments(Arrays.copyOfRange(args, processed, args.length), param.isAnnotationPresent(Greedy.class));
- try {
- Object a = parser.parse(arguments);
- if (a != null) {
- params.add(a);
- processed += arguments.getPosition();
- currentParam++;
- } else {
- return "Failed to parse " + param.getType().getSimpleName() + "! Please report this to the mod author.";
- }
- } catch (Exception e) {
- return "A " + e.getClass().getSimpleName() + " has occured while try to parse " + param.getType().getSimpleName() + "! Please report this to the mod author.";
- }
- } catch (Exception e) {
- return "A " + e.getClass().getSimpleName() + " has occured while try to parse " + param.getType().getSimpleName() + "! Please report this to the mod author.";
+ }
+ if (added) {
+ return nextDepth;
+ }
+ } else {
+ for (InternalCommand child : command.children) {
+ int childDepth = loopThroughCommands(commands, nextDepth, child, args, checkParams);
+ if (childDepth != -1) {
+ return childDepth;
}
}
- invoker.method.invoke(null, params.toArray());
- return null;
- } catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException |
- ExceptionInInitializerError e) {
- return ChatColor.RED.toString() + ChatColor.BOLD + METHOD_RUN_ERROR;
}
+ return -1;
}
private void addToInvokers(Class<?>[] classes, InternalCommand parent) {
for (Class<?> clazz : classes) {
if (clazz.isAnnotationPresent(SubCommand.class)) {
SubCommand annotation = clazz.getAnnotation(SubCommand.class);
- ArrayList<InternalCommand.InternalCommandInvoker> mainMethods = new ArrayList<>();
+ InternalCommand command = new InternalCommand(annotation.value(), annotation.aliases(), annotation.description(), parent);
for (Method method : clazz.getDeclaredMethods()) {
if (method.isAnnotationPresent(Main.class)) {
- mainMethods.add(new InternalCommand.InternalCommandInvoker(annotation.value(), annotation.aliases(), method));
+ command.invokers.add(new InternalCommand.InternalCommandInvoker(annotation.value(), annotation.aliases(), method, command));
}
}
- InternalCommand command = new InternalCommand(annotation.value(), annotation.aliases(), annotation.description(), mainMethods);
parent.children.add(command);
addToInvokers(clazz.getDeclaredClasses(), command);
}
}
}
+ private static class CustomError {
+ public String message;
+
+ public CustomError(String message) {
+ this.message = message;
+ }
+ }
+
private static class InternalCommand {
public final String name;
public final String[] aliases;
public final String description;
- public final ArrayList<InternalCommandInvoker> invokers;
+ public final ArrayList<InternalCommandInvoker> invokers = new ArrayList<>();
+ public final InternalCommand parent;
public final ArrayList<InternalCommand> children = new ArrayList<>();
- public InternalCommand(String name, String[] aliases, String description, ArrayList<InternalCommandInvoker> invokers) {
+ public InternalCommand(String name, String[] aliases, String description, InternalCommand parent) {
this.name = name;
this.aliases = aliases;
- this.invokers = invokers;
this.description = description;
+ this.parent = parent;
}
public boolean isEqual(String name) {
@@ -277,13 +302,24 @@ public class CommandManager {
return false;
}
+ @Override
+ public String toString() {
+ return "InternalCommand{" +
+ "name='" + name + '\'' +
+ ", aliases=" + Arrays.toString(aliases) +
+ ", description='" + description + '\'' +
+ ", invokers=" + invokers +
+ '}';
+ }
+
public static class InternalCommandInvoker {
public final String name;
public final String[] aliases;
public final Method method;
public final Parameter[] parameterTypes;
+ public final InternalCommand parent;
- public InternalCommandInvoker(String name, String[] aliases, Method method) {
+ public InternalCommandInvoker(String name, String[] aliases, Method method, InternalCommand parent) {
if (!Modifier.isStatic(method.getModifiers())) {
throw new IllegalArgumentException("All command methods must be static!");
}
@@ -291,10 +327,21 @@ public class CommandManager {
this.aliases = aliases;
this.method = method;
this.parameterTypes = method.getParameters().clone();
+ this.parent = parent;
if (Modifier.isPrivate(method.getModifiers()) || Modifier.isProtected(method.getModifiers())) {
method.setAccessible(true);
}
}
+
+ @Override
+ public String toString() {
+ return "InternalCommandInvoker{" +
+ "name='" + name + '\'' +
+ ", aliases=" + Arrays.toString(aliases) +
+ ", method=" + method +
+ ", parameterTypes=" + Arrays.toString(parameterTypes) +
+ '}';
+ }
}
}
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Command.java b/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Command.java
index b1a4ce5..deec7f1 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Command.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Command.java
@@ -1,6 +1,5 @@
package cc.polyfrost.oneconfig.utils.commands.annotations;
-import cc.polyfrost.oneconfig.utils.commands.CommandHelper;
import cc.polyfrost.oneconfig.utils.commands.CommandManager;
import cc.polyfrost.oneconfig.utils.commands.arguments.ArgumentParser;
@@ -72,9 +71,8 @@ import java.lang.annotation.Target;
* }
* }</pre>
* </p>
- *
- * To register commands, either extend {@link CommandHelper} and run {@link CommandHelper#preload()} (which does nothing,
- * just makes loading look nicer lol), or use {@link CommandManager#registerCommand(Object)}.
+ * <p>
+ * To register commands, use {@link CommandManager#registerCommand(Class)}.
*
* <p>
* Note: if you're viewing this in IntelliJ or just see the @literal tag everywhere, please ignore that.
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Main.java b/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Main.java
index 3c105c7..9b49fb4 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Main.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Main.java
@@ -16,5 +16,6 @@ import java.lang.annotation.Target;
@Target({ElementType.METHOD})
public @interface Main {
String description() default "";
+
int priority() default 1000;
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Name.java b/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Name.java
index ef178a0..f802697 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Name.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/Name.java
@@ -16,6 +16,7 @@ import java.lang.annotation.Target;
public @interface Name {
/**
* The name of the parameter.
+ *
* @return The name of the parameter.
*/
String value();
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/SubCommand.java b/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/SubCommand.java
index b1cf035..1bfbd53 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/SubCommand.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/commands/annotations/SubCommand.java
@@ -16,18 +16,21 @@ import java.lang.annotation.Target;
public @interface SubCommand {
/**
* The name of the command.
+ *
* @return The name of the command.
*/
String value();
/**
* The aliases of the command.
+ *
* @return The aliases of the command.
*/
String[] aliases() default {};
/**
* The description of the command.
+ *
* @return The description of the command.
*/
String description() default "";
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/ArgumentParser.java b/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/ArgumentParser.java
index d9d51b0..8bf811b 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/ArgumentParser.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/ArgumentParser.java
@@ -3,10 +3,36 @@ package cc.polyfrost.oneconfig.utils.commands.arguments;
import com.google.common.reflect.TypeToken;
import org.jetbrains.annotations.Nullable;
-@SuppressWarnings("unstable")
+import java.lang.reflect.Parameter;
+import java.util.Collections;
+import java.util.List;
+
+@SuppressWarnings("UnstableApiUsage")
public abstract class ArgumentParser<T> {
- private final TypeToken<T> type = new TypeToken<T>(getClass()) {};
+ private final TypeToken<T> type = new TypeToken<T>(getClass()) {
+ };
public final Class<?> typeClass = type.getRawType();
+
+ /**
+ * Parses the given string into an object of the type specified by this parser.
+ * Should return null if the string cannot be parsed.
+ *
+ * @param arguments The string to parse.
+ * @return The parsed object, or null if the string cannot be parsed.
+ */
@Nullable
public abstract T parse(Arguments arguments);
+
+ /**
+ * Returns possible completions for the given arguments.
+ * Should return an empty list or null if no completions are possible.
+ *
+ * @param arguments The arguments to complete.
+ * @param parameter The parameter to complete.
+ * @return A list of possible completions, or an empty list or null if no completions are possible.
+ */
+ @Nullable
+ public List<String> complete(Arguments arguments, Parameter parameter) {
+ return Collections.emptyList();
+ }
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/Arguments.java b/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/Arguments.java
index 74a0840..f35cf46 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/Arguments.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/Arguments.java
@@ -1,9 +1,9 @@
package cc.polyfrost.oneconfig.utils.commands.arguments;
public class Arguments {
- private int position = 0;
public final String[] args;
public final boolean greedy;
+ private int position = 0;
public Arguments(String[] args, boolean greedy) {
this.args = args;
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/BooleanParser.java b/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/BooleanParser.java
index dfdca2d..7411cbe 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/BooleanParser.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/BooleanParser.java
@@ -1,11 +1,31 @@
package cc.polyfrost.oneconfig.utils.commands.arguments;
+import com.google.common.collect.Lists;
import org.jetbrains.annotations.Nullable;
+import java.lang.reflect.Parameter;
+import java.util.List;
+import java.util.Locale;
+
public class BooleanParser extends ArgumentParser<Boolean> {
+ private static final List<String> VALUES = Lists.newArrayList("true", "false");
+
@Override
public @Nullable Boolean parse(Arguments arguments) {
return Boolean.parseBoolean(arguments.poll());
}
+
+ @Override
+ public @Nullable List<String> complete(Arguments arguments, Parameter parameter) {
+ String value = arguments.poll();
+ if (value != null && !value.trim().isEmpty()) {
+ for (String v : VALUES) {
+ if (v.startsWith(value.toLowerCase(Locale.ENGLISH))) {
+ return Lists.newArrayList(v);
+ }
+ }
+ }
+ return VALUES;
+ }
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/DoubleParser.java b/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/DoubleParser.java
index 8c85849..4379e3a 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/DoubleParser.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/DoubleParser.java
@@ -5,6 +5,10 @@ import org.jetbrains.annotations.Nullable;
public class DoubleParser extends ArgumentParser<Double> {
@Override
public @Nullable Double parse(Arguments arguments) {
- return Double.parseDouble(arguments.poll());
+ try {
+ return Double.parseDouble(arguments.poll());
+ } catch (NumberFormatException e) {
+ return null;
+ }
}
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/FloatParser.java b/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/FloatParser.java
index 7053fcb..08e0a45 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/FloatParser.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/FloatParser.java
@@ -6,6 +6,10 @@ public class FloatParser extends ArgumentParser<Float> {
@Override
public @Nullable Float parse(Arguments arguments) {
- return Float.parseFloat(arguments.poll());
+ try {
+ return Float.parseFloat(arguments.poll());
+ } catch (NumberFormatException e) {
+ return null;
+ }
}
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/IntegerParser.java b/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/IntegerParser.java
index 6910d4b..89f4eca 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/IntegerParser.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/commands/arguments/IntegerParser.java
@@ -3,6 +3,10 @@ package cc.polyfrost.oneconfig.utils.commands.arguments;
public class IntegerParser extends ArgumentParser<Integer> {
@Override
public Integer parse(Arguments arguments) {
- return Integer.parseInt(arguments.poll());
+ try {
+ return Integer.parseInt(arguments.poll());
+ } catch (NumberFormatException e) {
+ return null;
+ }
}
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/hypixel/HypixelUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/hypixel/HypixelUtils.java
index d7a9b0d..a952053 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/hypixel/HypixelUtils.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/hypixel/HypixelUtils.java
@@ -2,17 +2,17 @@ package cc.polyfrost.oneconfig.utils.hypixel;
import cc.polyfrost.oneconfig.events.EventManager;
import cc.polyfrost.oneconfig.events.event.*;
-import cc.polyfrost.oneconfig.libs.eventbus.Subscribe;
-import cc.polyfrost.oneconfig.libs.universal.UChat;
-import cc.polyfrost.oneconfig.libs.universal.UMinecraft;
-import cc.polyfrost.oneconfig.libs.universal.wrappers.UPlayer;
-import cc.polyfrost.oneconfig.libs.universal.wrappers.message.UTextComponent;
import cc.polyfrost.oneconfig.utils.JsonUtils;
import cc.polyfrost.oneconfig.utils.Multithreading;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
+import gg.essential.universal.UChat;
+import gg.essential.universal.UMinecraft;
+import gg.essential.universal.wrappers.UPlayer;
+import gg.essential.universal.wrappers.message.UTextComponent;
+import me.kbrewster.eventbus.Subscribe;
import java.util.Locale;
import java.util.concurrent.TimeUnit;
@@ -133,6 +133,7 @@ public class HypixelUtils {
/**
* Returns whether the player is in game.
+ *
* @return Whether the player is in game.
*/
public boolean isInGame() {
@@ -141,6 +142,7 @@ public class HypixelUtils {
/**
* Returns the current {@link LocrawInfo}.
+ *
* @return The current {@link LocrawInfo}.
* @see LocrawInfo
*/
@@ -150,6 +152,7 @@ public class HypixelUtils {
/**
* Returns the previous {@link LocrawInfo}.
+ *
* @return The previous {@link LocrawInfo}.
* @see LocrawInfo
*/