diff options
Diffstat (limited to 'src/main/java/at')
4 files changed, 26 insertions, 6 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/CustomScoreboardConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/CustomScoreboardConfig.java index 126d4646e..b6151bd85 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/CustomScoreboardConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/CustomScoreboardConfig.java @@ -9,6 +9,7 @@ import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean; import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDraggableList; import io.github.notenoughupdates.moulconfig.annotations.ConfigLink; import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; +import io.github.notenoughupdates.moulconfig.observer.Property; import java.util.ArrayList; import java.util.List; @@ -21,7 +22,7 @@ public class CustomScoreboardConfig { ) @ConfigEditorBoolean @FeatureToggle - public boolean enabled = false; + public Property<Boolean> enabled = Property.of(false); @Expose @ConfigOption( diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/DisplayConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/DisplayConfig.java index 1c04dacd6..30008a0d2 100644 --- a/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/DisplayConfig.java +++ b/src/main/java/at/hannibal2/skyhanni/config/features/gui/customscoreboard/DisplayConfig.java @@ -7,6 +7,7 @@ import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorBoolean; import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorDropdown; import io.github.notenoughupdates.moulconfig.annotations.ConfigEditorSlider; import io.github.notenoughupdates.moulconfig.annotations.ConfigOption; +import io.github.notenoughupdates.moulconfig.observer.Property; public class DisplayConfig { @@ -51,7 +52,7 @@ public class DisplayConfig { "\nĀ§cUsing mods that add their own scoreboard will not be affected by this setting!") @ConfigEditorBoolean @FeatureToggle - public boolean hideVanillaScoreboard = true; + public Property<Boolean> hideVanillaScoreboard = Property.of(true); @Expose @ConfigOption(name = "Display Numbers First", desc = "Determines whether the number or line name displays first. " + diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt index 957808fb5..4182b37bb 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/CustomScoreboard.kt @@ -21,11 +21,13 @@ package at.hannibal2.skyhanni.features.gui.customscoreboard import at.hannibal2.skyhanni.SkyHanniMod import at.hannibal2.skyhanni.config.ConfigUpdaterMigrator +import at.hannibal2.skyhanni.events.ConfigLoadEvent import at.hannibal2.skyhanni.events.DebugDataCollectEvent import at.hannibal2.skyhanni.events.GuiPositionMovedEvent import at.hannibal2.skyhanni.events.GuiRenderEvent import at.hannibal2.skyhanni.events.LorenzTickEvent import at.hannibal2.skyhanni.utils.ChatUtils +import at.hannibal2.skyhanni.utils.ConditionalUtils.onToggle import at.hannibal2.skyhanni.utils.LorenzUtils import at.hannibal2.skyhanni.utils.RenderUtils.HorizontalAlignment import at.hannibal2.skyhanni.utils.RenderUtils.renderStringsAlignedWidth @@ -142,11 +144,26 @@ class CustomScoreboard { return this } + private var dirty = false + // Thank you Apec for showing that the ElementType of the stupid scoreboard is FUCKING HELMET WTF @SubscribeEvent fun onRenderScoreboard(event: RenderGameOverlayEvent.Post) { if (event.type == RenderGameOverlayEvent.ElementType.HELMET) { - GuiIngameForge.renderObjective = !isHideVanillaScoreboardEnabled() + if (isHideVanillaScoreboardEnabled()) { + GuiIngameForge.renderObjective = false + } + if (dirty) { + GuiIngameForge.renderObjective = true + dirty = false + } + } + } + + @SubscribeEvent + fun onConfigLoad(event: ConfigLoadEvent) { + onToggle(config.enabled, displayConfig.hideVanillaScoreboard) { + if (!isHideVanillaScoreboardEnabled()) dirty = true } } @@ -154,7 +171,7 @@ class CustomScoreboard { fun onDebugDataCollect(event: DebugDataCollectEvent) { event.title("Custom Scoreboard") event.addIrrelevant { - if (!config.enabled) { + if (!config.enabled.get()) { add("Custom Scoreboard disabled.") } else { ScoreboardElement.entries.map { element -> @@ -168,8 +185,8 @@ class CustomScoreboard { } } - private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled - private fun isHideVanillaScoreboardEnabled() = isEnabled() && displayConfig.hideVanillaScoreboard + private fun isEnabled() = LorenzUtils.inSkyBlock && config.enabled.get() + private fun isHideVanillaScoreboardEnabled() = isEnabled() && displayConfig.hideVanillaScoreboard.get() @SubscribeEvent fun onConfigFix(event: ConfigUpdaterMigrator.ConfigFixEvent) { diff --git a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt index 41e946a17..e3569a856 100644 --- a/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt +++ b/src/main/java/at/hannibal2/skyhanni/features/gui/customscoreboard/ScoreboardElements.kt @@ -786,6 +786,7 @@ private fun getExtraDisplayPair(): List<ScoreboardElementType> { "Unknown Lines" to unknownLines, "Island" to HypixelData.skyBlockIsland, "Area" to HypixelData.skyBlockArea, + "Full Scoreboard" to ScoreboardData.sidebarLinesFormatted, noStackTrace = true, betaOnly = true, ) |