From ead404e7e2c54a36f0dddbf87ab26a5342851f0f Mon Sep 17 00:00:00 2001 From: nextdaydelivery <79922345+nxtdaydelivery@users.noreply.github.com> Date: Thu, 21 Jul 2022 13:30:05 +0100 Subject: a couple fixes (#63) --- src/main/java/cc/polyfrost/oneconfig/config/core/OneColor.java | 6 +++--- src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java | 1 + .../polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) (limited to 'src/main/java/cc/polyfrost') 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 5a06637..8333269 100644 --- a/src/main/java/cc/polyfrost/oneconfig/config/core/OneColor.java +++ b/src/main/java/cc/polyfrost/oneconfig/config/core/OneColor.java @@ -133,21 +133,21 @@ public final class OneColor { * Get the red value of the color (0-255). */ public int getRed() { - return argb >> 16 & 255; + return getRGB() >> 16 & 255; } /** * Get the green value of the color (0-255). */ public int getGreen() { - return argb >> 8 & 255; + return getRGB() >> 8 & 255; } /** * Get the blue value of the color (0-255). */ public int getBlue() { - return argb & 255; + return getRGB() & 255; } /** 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 1691eca..afe899d 100644 --- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java +++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/BasicButton.java @@ -115,6 +115,7 @@ public class BasicButton extends BasicElement { @Override public void onClick() { + if(disabled) return; if (this.page != null && OneConfigGui.INSTANCE != null) { OneConfigGui.INSTANCE.openPage(page); } else if (this.runnable != null) { 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 16796e9..a3b45bf 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 @@ -37,6 +37,7 @@ public class ConfigColorElement extends BasicOption { @Override public void draw(long vg, int x, int y) { + if(OneConfigGui.INSTANCE == null) return; if (!isEnabled()) RenderManager.setAlpha(vg, 0.5f); hexField.disable(!isEnabled()); alphaField.disable(!isEnabled() || !allowAlpha); -- cgit