diff options
author | Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> | 2023-06-17 16:35:36 +0800 |
---|---|---|
committer | Kevinthegreat <92656833+kevinthegreat1@users.noreply.github.com> | 2023-06-24 12:57:16 +0800 |
commit | 2825aa0dd980f1909941cea87e37d47b9c80efab (patch) | |
tree | f0b7814675ccc4ca6f0332236d16aa3fe7eb8c24 /src/main/java/me/xmrvizzy/skyblocker/gui | |
parent | 28699078b09780e9447b72b2859bba46b0e8dca9 (diff) | |
download | Skyblocker-2825aa0dd980f1909941cea87e37d47b9c80efab.tar.gz Skyblocker-2825aa0dd980f1909941cea87e37d47b9c80efab.tar.bz2 Skyblocker-2825aa0dd980f1909941cea87e37d47b9c80efab.zip |
Refactor ColorHighlight
Diffstat (limited to 'src/main/java/me/xmrvizzy/skyblocker/gui')
-rw-r--r-- | src/main/java/me/xmrvizzy/skyblocker/gui/ColorHighlight.java | 13 | ||||
-rw-r--r-- | src/main/java/me/xmrvizzy/skyblocker/gui/ContainerSolver.java | 10 |
2 files changed, 12 insertions, 11 deletions
diff --git a/src/main/java/me/xmrvizzy/skyblocker/gui/ColorHighlight.java b/src/main/java/me/xmrvizzy/skyblocker/gui/ColorHighlight.java index d0bd68ae..4367e6e7 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/gui/ColorHighlight.java +++ b/src/main/java/me/xmrvizzy/skyblocker/gui/ColorHighlight.java @@ -1,19 +1,24 @@ package me.xmrvizzy.skyblocker.gui; public record ColorHighlight(int slot, int color) { + private static final int RED_HIGHLIGHT = 64 << 24 | 255 << 16; + private static final int YELLOW_HIGHLIGHT = 128 << 24 | 255 << 16 | 255 << 8; + private static final int GREEN_HIGHLIGHT = 128 << 24 | 64 << 16 | 196 << 8 | 64; + private static final int GRAY_HIGHLIGHT = 128 << 24 | 64 << 16 | 64 << 8 | 64; + public static ColorHighlight red(int slot) { - return new ColorHighlight(slot, ContainerSolver.RED_HIGHLIGHT); + return new ColorHighlight(slot, RED_HIGHLIGHT); } public static ColorHighlight yellow(int slot) { - return new ColorHighlight(slot, ContainerSolver.YELLOW_HIGHLIGHT); + return new ColorHighlight(slot, YELLOW_HIGHLIGHT); } public static ColorHighlight green(int slot) { - return new ColorHighlight(slot, ContainerSolver.GREEN_HIGHLIGHT); + return new ColorHighlight(slot, GREEN_HIGHLIGHT); } public static ColorHighlight gray(int slot) { - return new ColorHighlight(slot, ContainerSolver.GRAY_HIGHLIGHT); + return new ColorHighlight(slot, GRAY_HIGHLIGHT); } }
\ No newline at end of file diff --git a/src/main/java/me/xmrvizzy/skyblocker/gui/ContainerSolver.java b/src/main/java/me/xmrvizzy/skyblocker/gui/ContainerSolver.java index e52855a2..c5e3cf09 100644 --- a/src/main/java/me/xmrvizzy/skyblocker/gui/ContainerSolver.java +++ b/src/main/java/me/xmrvizzy/skyblocker/gui/ContainerSolver.java @@ -11,20 +11,16 @@ import java.util.regex.Pattern; * Abstract class for gui solvers. Extend this class to add a new gui solver, like terminal solvers or experiment solvers. */ public abstract class ContainerSolver { - private final Pattern CONTAINER_NAME; - protected static final int RED_HIGHLIGHT = 64 << 24 | 255 << 16; - protected static final int YELLOW_HIGHLIGHT = 128 << 24 | 255 << 16 | 255 << 8; - protected static final int GREEN_HIGHLIGHT = 128 << 24 | 64 << 16 | 196 << 8 | 64; - protected static final int GRAY_HIGHLIGHT = 128 << 24 | 64 << 16 | 64 << 8 | 64; + private final Pattern containerName; protected ContainerSolver(String containerName) { - CONTAINER_NAME = Pattern.compile(containerName); + this.containerName = Pattern.compile(containerName); } protected abstract boolean isEnabled(); public Pattern getName() { - return CONTAINER_NAME; + return containerName; } protected void start(GenericContainerScreen screen) { |