aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authormartimavocado <39881008+martimavocado@users.noreply.github.com>2024-03-03 21:47:48 +0000
committerGitHub <noreply@github.com>2024-03-03 22:47:48 +0100
commit2e9f4daf224e6d44eea52fefb2da9dc554cc324e (patch)
tree5bb3cdd5a76b7d996c7aa29a0b06fc0779c599f4 /src/main/java
parentee91823cf0c408784fd76c641714927d0aca34d3 (diff)
downloadskyhanni-2e9f4daf224e6d44eea52fefb2da9dc554cc324e.tar.gz
skyhanni-2e9f4daf224e6d44eea52fefb2da9dc554cc324e.tar.bz2
skyhanni-2e9f4daf224e6d44eea52fefb2da9dc554cc324e.zip
Feature: Toggle to only render Custom Text Box while in GUIs (#1099)
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/gui/TextBoxConfig.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt10
2 files changed, 15 insertions, 0 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/gui/TextBoxConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/gui/TextBoxConfig.java
index 134732465..2089fc88e 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/gui/TextBoxConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/gui/TextBoxConfig.java
@@ -15,6 +15,11 @@ public class TextBoxConfig {
public boolean enabled = false;
@Expose
+ @ConfigOption(name = "Only in GUI", desc = "Only show the textbox while an Inventory is open.")
+ @ConfigEditorBoolean
+ public boolean onlyInGUI = false;
+
+ @Expose
@ConfigOption(name = "Text", desc = "Enter text you want to display here.\n" +
"§eUse '&' as the colour code character.\n" +
"§eUse '\\n' as the line break character.")
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt
index ffe6a79ae..a2369fc38 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt
@@ -26,8 +26,18 @@ class CustomTextBox {
private fun String.format() = replace("&", "§").split("\\n").toList()
@SubscribeEvent
+ fun onRenderGUIOverlay(event: GuiRenderEvent.ChestGuiOverlayRenderEvent) {
+ if (!config.enabled) return
+ if (!config.onlyInGUI) return
+ if (!LorenzUtils.inSkyBlock) return
+
+ config.position.renderStrings(display, posLabel = "Custom Text Box")
+ }
+
+ @SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent.GuiOverlayRenderEvent) {
if (!config.enabled) return
+ if (config.onlyInGUI) return
if (!LorenzUtils.inSkyBlock) return
config.position.renderStrings(display, posLabel = "Custom Text Box")