aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-17 10:54:24 +0200
committerhannibal2 <24389977+hannibal00212@users.noreply.github.com>2023-09-17 10:54:24 +0200
commitdc337e273420fbc987fabdfb07f42a78116da164 (patch)
tree077648c22dcf785b5ffc0f9fe392f634bdd67ed3
parente55b901cf4368f030dd10519946e54f1129ab78a (diff)
downloadskyhanni-dc337e273420fbc987fabdfb07f42a78116da164.tar.gz
skyhanni-dc337e273420fbc987fabdfb07f42a78116da164.tar.bz2
skyhanni-dc337e273420fbc987fabdfb07f42a78116da164.zip
migrate city project config into event and real time, tps display, and custom text box config into gui
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/EventConfig.java29
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/GUIConfig.java49
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java85
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt8
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt7
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt19
7 files changed, 107 insertions, 98 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/EventConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/EventConfig.java
index a76c49858..79224ce80 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/EventConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/EventConfig.java
@@ -277,6 +277,35 @@ public class EventConfig {
}
+ @ConfigOption(name = "City Project", desc = "")
+ @Accordion
+ @Expose
+ public CityProjectConfig cityProject = new CityProjectConfig();
+
+ public static class CityProjectConfig {
+
+ @Expose
+ @ConfigOption(name = "Show Materials", desc = "Show materials needed for contributing to the City Project.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean showMaterials = true;
+
+ @Expose
+ @ConfigOption(name = "Show Ready", desc = "Mark contributions that are ready to participate.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean showReady = true;
+
+ @Expose
+ @ConfigOption(name = "Daily Reminder", desc = "Remind every 24 hours to participate.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean dailyReminder = true;
+
+ @Expose
+ public Position pos = new Position(150, 150, false, true);
+ }
+
// comment in if the event is needed again
// @ConfigOption(name = "300þ Anniversary Celebration", desc = "Features for the 300þ year of SkyBlock")
@Accordion
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/GUIConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/GUIConfig.java
index cf9f0cc39..f885bfc82 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/GUIConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/GUIConfig.java
@@ -1,11 +1,11 @@
package at.hannibal2.skyhanni.config.features;
+import at.hannibal2.skyhanni.config.FeatureToggle;
+import at.hannibal2.skyhanni.config.core.config.Position;
import at.hannibal2.skyhanni.data.GuiEditManager;
import com.google.gson.annotations.Expose;
-import io.github.moulberry.moulconfig.annotations.ConfigEditorButton;
-import io.github.moulberry.moulconfig.annotations.ConfigEditorKeybind;
-import io.github.moulberry.moulconfig.annotations.ConfigEditorSlider;
-import io.github.moulberry.moulconfig.annotations.ConfigOption;
+import io.github.moulberry.moulconfig.annotations.*;
+import io.github.moulberry.moulconfig.observer.Property;
import org.lwjgl.input.Keyboard;
public class GUIConfig {
@@ -23,4 +23,45 @@ public class GUIConfig {
@ConfigOption(name = "Global GUI scale", desc = "Globally scale all SkyHanni GUIs")
@ConfigEditorSlider(minValue = 0.1F, maxValue = 10, minStep = 0.05F)
public float globalScale = 1F;
+
+ @Expose
+ @ConfigOption(name = "Custom Text box", desc = "")
+ @Accordion
+ public TextBoxConfig customTextBox = new TextBoxConfig();
+
+ public static class TextBoxConfig {
+
+ @Expose
+ @ConfigOption(name = "Enabled", desc = "Enables showing the textbox while in SkyBlock.")
+ @ConfigEditorBoolean
+ public boolean enabled = 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.")
+ @ConfigEditorText
+ public Property<String> text = Property.of("&aYour Text Here\\n&bYour new line here");
+
+ @Expose
+ public Position position = new Position(10, 80, false, true);
+ }
+
+ @Expose
+ @ConfigOption(name = "Real Time", desc = "Display the current computer time, a handy feature when playing in full-screen mode.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean realTime = false;
+
+ @Expose
+ public Position realTimePosition = new Position(10, 10, false, true);
+
+ @Expose
+ @ConfigOption(name = "Tps Display", desc = "Show the TPS of the current server, like in Soopy.")
+ @ConfigEditorBoolean
+ @FeatureToggle
+ public boolean tpsDisplay = false;
+
+ @Expose
+ public Position tpsDisplayPosition = new Position(10, 10, false, true);
}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java
index bd231257d..d29b14f9b 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/MiscConfig.java
@@ -54,24 +54,6 @@ public class MiscConfig {
@Expose
public Position petDisplayPos = new Position(-330, -15, false, true);
- // rename this to just "time will cause a config reset
- @ConfigOption(name = "Time Features", desc = "")
- @Accordion
- @Expose
- public TimeConfig timeConfigs = new TimeConfig();
-
- public static class TimeConfig {
-
- @Expose
- @ConfigOption(name = "Real Time", desc = "Display the current computer time, a handy feature when playing in full-screen mode.")
- @ConfigEditorBoolean
- @FeatureToggle
- public boolean realTime = false;
-
- @Expose
- public Position realTimePos = new Position(10, 10, false, true);
- }
-
@ConfigOption(name = "Hide Armor", desc = "")
@Accordion
@Expose
@@ -116,21 +98,6 @@ public class MiscConfig {
public Position nonGodPotEffectPos = new Position(10, 10, false, true);
@Expose
- @ConfigOption(name = "Tps Display", desc = "")
- @ConfigEditorAccordion(id = 8)
- public boolean tpsDisplay = false;
-
- @Expose
- @ConfigOption(name = "Tps Display", desc = "Show the TPS of the current server, like in Soopy.")
- @ConfigEditorBoolean
- @ConfigAccordionId(id = 8)
- @FeatureToggle
- public boolean tpsDisplayEnabled = false;
-
- @Expose
- public Position tpsDisplayPosition = new Position(10, 10, false, true);
-
- @Expose
@ConfigOption(name = "Particle Hider", desc = "")
@ConfigEditorAccordion(id = 9)
public boolean particleHider = false;
@@ -378,35 +345,6 @@ public class MiscConfig {
public boolean inventoryNumbers = false;
}
- @ConfigOption(name = "City Project", desc = "")
- @Accordion
- @Expose
- public CityProject cityProject = new CityProject();
-
- public static class CityProject {
-
- @Expose
- @ConfigOption(name = "Show Materials", desc = "Show materials needed for contributing to the City Project.")
- @ConfigEditorBoolean
- @FeatureToggle
- public boolean showMaterials = true;
-
- @Expose
- @ConfigOption(name = "Show Ready", desc = "Mark contributions that are ready to participate.")
- @ConfigEditorBoolean
- @FeatureToggle
- public boolean showReady = true;
-
- @Expose
- @ConfigOption(name = "Daily Reminder", desc = "Remind every 24 hours to participate.")
- @ConfigEditorBoolean
- @FeatureToggle
- public boolean dailyReminder = true;
-
- @Expose
- public Position pos = new Position(150, 150, false, true);
- }
-
@ConfigOption(name = "Pocket Sack-In-A-Sack", desc = "")
@Accordion
@Expose
@@ -511,29 +449,6 @@ public class MiscConfig {
}
@Expose
- @ConfigOption(name = "Custom Text box", desc = "")
- @Accordion
- public TextBox textBox = new TextBox();
-
- public static class TextBox {
-
- @Expose
- @ConfigOption(name = "Enabled", desc = "Enables showing the textbox while in SkyBlock.")
- @ConfigEditorBoolean
- public boolean enabled = 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.")
- @ConfigEditorText
- public Property<String> text = Property.of("&aYour Text Here\\n&bYour new line here");
-
- @Expose
- public Position position = new Position(10, 80, false, true);
- }
-
- @Expose
@ConfigOption(name = "Cosmetic", desc = "")
@Accordion
public CosmeticConfig cosmeticConfig = new CosmeticConfig();
diff --git a/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt
index 706de6807..2e8154d6a 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/fame/CityProjectFeatures.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.fame
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.data.ProfileStorageData
import at.hannibal2.skyhanni.events.*
import at.hannibal2.skyhanni.features.bazaar.BazaarApi
@@ -27,7 +28,7 @@ class CityProjectFeatures {
private val contributeAgainPattern = "§7Contribute again: §e(?<time>.*)".toPattern()
companion object {
- private val config get() = SkyHanniMod.feature.misc.cityProject
+ private val config get() = SkyHanniMod.feature.event.cityProject
fun disable() {
config.dailyReminder = false
LorenzUtils.chat("§c[SkyHanni] Disabled city project reminder messages!")
@@ -188,4 +189,9 @@ class CityProjectFeatures {
}
}
}
+
+ @SubscribeEvent
+ fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
+ event.move(2, "misc.cityProject", "event.cityProject")
+ }
}
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 7c05c6af1..eb78def01 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/CustomTextBox.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.misc
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.events.ConfigLoadEvent
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.utils.LorenzUtils
@@ -9,7 +10,7 @@ import at.hannibal2.skyhanni.utils.RenderUtils.renderStrings
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
class CustomTextBox {
- private val config get() = SkyHanniMod.feature.misc.textBox
+ private val config get() = SkyHanniMod.feature.gui.customTextBox
private var display = listOf<String>()
@SubscribeEvent
@@ -30,4 +31,9 @@ class CustomTextBox {
config.position.renderStrings(display, posLabel = "Custom Text Box")
}
+
+ @SubscribeEvent
+ fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
+ event.move(2, "misc.textBox", "gui.customTextBox")
+ }
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt
index 0ec010924..4f23411a0 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TimeFeatures.kt
@@ -17,7 +17,7 @@ import kotlin.time.Duration.Companion.days
import kotlin.time.Duration.Companion.seconds
class TimeFeatures {
- private val config get() = SkyHanniMod.feature.misc.timeConfigs
+ private val config get() = SkyHanniMod.feature.gui
private val winterConfig get() = SkyHanniMod.feature.event.winter
private val format = SimpleDateFormat("HH:mm:ss")
@@ -31,7 +31,7 @@ class TimeFeatures {
if (!LorenzUtils.inSkyBlock) return
if (config.realTime) {
- config.realTimePos.renderString(format.format(System.currentTimeMillis()), posLabel = "Real Time")
+ config.realTimePosition.renderString(format.format(System.currentTimeMillis()), posLabel = "Real Time")
}
if (winterConfig.islandCloseTime && IslandType.WINTER.isInIsland()) {
@@ -50,5 +50,8 @@ class TimeFeatures {
fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
event.move(2, "misc.timeConfigs.winterTime", "event.winter.islandCloseTime")
event.move(2, "misc.timeConfigs.winterTimePos", "event.winter.islandCloseTimePosition")
+
+ event.move(2, "misc.timeConfigs.realTime", "gui.realTime")
+ event.move(2, "misc.timeConfigs.realTimePos", "gui.realTimePosition")
}
} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt
index 864bdde72..726771f8c 100644
--- a/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/TpsCounter.kt
@@ -1,6 +1,7 @@
package at.hannibal2.skyhanni.features.misc
import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator
import at.hannibal2.skyhanni.events.GuiRenderEvent
import at.hannibal2.skyhanni.events.LorenzWorldChangeEvent
import at.hannibal2.skyhanni.events.PacketEvent
@@ -12,6 +13,8 @@ import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
import kotlin.concurrent.fixedRateTimer
class TpsCounter {
+ private val config get() = SkyHanniMod.feature.gui
+
companion object {
private const val minDataAmount = 5
private const val waitAfterWorldSwitch = 6
@@ -27,7 +30,7 @@ class TpsCounter {
init {
fixedRateTimer(name = "skyhanni-tps-counter-seconds", period = 1000L) {
if (!LorenzUtils.inSkyBlock) return@fixedRateTimer
- if (!SkyHanniMod.feature.misc.tpsDisplayEnabled) return@fixedRateTimer
+ if (!config.tpsDisplay) return@fixedRateTimer
if (packetsFromLastSecond == 0) return@fixedRateTimer
if (ignoreFirstTicks > 0) {
@@ -57,7 +60,7 @@ class TpsCounter {
}
fixedRateTimer(name = "skyhanni-tps-counter-ticks", period = 50L) {
if (!LorenzUtils.inSkyBlock) return@fixedRateTimer
- if (!SkyHanniMod.feature.misc.tpsDisplayEnabled) return@fixedRateTimer
+ if (!config.tpsDisplay) return@fixedRateTimer
if (hasPacketReceived) {
hasPacketReceived = false
@@ -76,16 +79,22 @@ class TpsCounter {
@SubscribeEvent(priority = EventPriority.LOW, receiveCanceled = true)
fun onChatPacket(event: PacketEvent.ReceiveEvent) {
- if (!SkyHanniMod.feature.misc.tpsDisplayEnabled) return
+ if (!config.tpsDisplay) return
hasPacketReceived = true
}
@SubscribeEvent
fun onRenderOverlay(event: GuiRenderEvent.GameOverlayRenderEvent) {
if (!LorenzUtils.inSkyBlock) return
- if (!SkyHanniMod.feature.misc.tpsDisplayEnabled) return
+ if (!config.tpsDisplay) return
+
+ config.tpsDisplayPosition.renderString(display, posLabel = "Tps Display")
+ }
- SkyHanniMod.feature.misc.tpsDisplayPosition.renderString(display, posLabel = "Tps Display")
+ @SubscribeEvent
+ fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) {
+ event.move(2, "misc.tpsDisplayEnabled", "gui.tpsDisplay")
+ event.move(2, "misc.tpsDisplayPosition", "gui.tpsDisplayPosition")
}
private fun getColor(tps: Double): String {