aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/at/hannibal2/skyhanni
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2023-08-29 20:25:01 +0200
committerGitHub <noreply@github.com>2023-08-29 20:25:01 +0200
commit71a6b08b376be7d742107df982905cac0d7ecf70 (patch)
treea4b5f0cc511444ccd833c281b8600d9ff434231b /src/main/java/at/hannibal2/skyhanni
parent238085dd49de8bca06ed816bc7a8d369390cdf30 (diff)
downloadskyhanni-71a6b08b376be7d742107df982905cac0d7ecf70.tar.gz
skyhanni-71a6b08b376be7d742107df982905cac0d7ecf70.tar.bz2
skyhanni-71a6b08b376be7d742107df982905cac0d7ecf70.zip
Add default option selector #400
* Allow for update only options * Clean/Split up mass configuration options * Merge remote-tracking branch 'origin/beta' into feat/defaultoptions * Fix merge errors
Diffstat (limited to 'src/main/java/at/hannibal2/skyhanni')
-rw-r--r--src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/FeatureToggle.kt15
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/Storage.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt26
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.java4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/AshfangConfig.java9
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/BazaarConfig.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/BingoConfig.java6
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/ChatConfig.java27
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/CommandsConfig.java4
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/DamageIndicatorConfig.java2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/DianaConfig.java5
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/DungeonConfig.java20
-rw-r--r--src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java2
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigFeatures.kt112
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigOptionGui.kt193
-rw-r--r--src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/FeatureToggleProcessor.kt70
17 files changed, 504 insertions, 4 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
index 2c58985e8..6d60ebca7 100644
--- a/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
+++ b/src/main/java/at/hannibal2/skyhanni/SkyHanniMod.kt
@@ -7,6 +7,7 @@ import at.hannibal2.skyhanni.config.commands.Commands.init
import at.hannibal2.skyhanni.data.*
import at.hannibal2.skyhanni.data.repo.RepoManager
import at.hannibal2.skyhanni.events.LorenzTickEvent
+import at.hannibal2.skyhanni.features.misc.massconfiguration.DefaultConfigFeatures
import at.hannibal2.skyhanni.features.anvil.AnvilCombineHelper
import at.hannibal2.skyhanni.features.bazaar.BazaarApi
import at.hannibal2.skyhanni.features.bazaar.BazaarBestSellMethod
@@ -168,6 +169,7 @@ class SkyHanniMod {
loadModule(ProfileStorageData)
loadModule(TitleData())
loadModule(BlockData())
+ loadModule(DefaultConfigFeatures)
// APIs
loadModule(BazaarApi())
diff --git a/src/main/java/at/hannibal2/skyhanni/config/FeatureToggle.kt b/src/main/java/at/hannibal2/skyhanni/config/FeatureToggle.kt
new file mode 100644
index 000000000..bf9db0553
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/config/FeatureToggle.kt
@@ -0,0 +1,15 @@
+package at.hannibal2.skyhanni.config
+
+import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean
+
+/**
+ * Annotate a [ConfigEditorBoolean] to indicate that it is a feature toggle.
+ */
+@Retention(AnnotationRetention.RUNTIME)
+@Target(AnnotationTarget.FIELD)
+annotation class FeatureToggle(
+ /**
+ * Indicate that this field being true means the corresponding feature is enabled.
+ */
+ val trueIsEnabled: Boolean = true,
+)
diff --git a/src/main/java/at/hannibal2/skyhanni/config/Storage.java b/src/main/java/at/hannibal2/skyhanni/config/Storage.java
index a2af0ed79..f32c66220 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/Storage.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/Storage.java
@@ -21,6 +21,12 @@ import java.util.*;
public class Storage {
@Expose
+ public boolean hasPlayedBefore = false;
+
+ @Expose
+ public Map<String, List<String>> knownFeatureToggles = new HashMap<>();
+
+ @Expose
public Map<Long, List<CropType>> gardenJacobFarmingContestTimes = new HashMap<>();
@Expose
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
index b87961a2c..73b6cb46d 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
+++ b/src/main/java/at/hannibal2/skyhanni/config/commands/Commands.kt
@@ -27,6 +27,7 @@ import at.hannibal2.skyhanni.features.misc.CollectionTracker
import at.hannibal2.skyhanni.features.misc.MarkedPlayerManager
import at.hannibal2.skyhanni.features.misc.discordrpc.DiscordRPCManager
import at.hannibal2.skyhanni.features.misc.ghostcounter.GhostUtil
+import at.hannibal2.skyhanni.features.misc.massconfiguration.DefaultConfigFeatures
import at.hannibal2.skyhanni.features.slayer.SlayerItemProfitTracker
import at.hannibal2.skyhanni.test.PacketTest
import at.hannibal2.skyhanni.test.SkyHanniConfigSearchResetCommand
@@ -105,6 +106,11 @@ object Commands {
registerCommand("skyhanni", "Opens the main SkyHanni config", openMainMenu)
registerCommand("ff", "Opens the Farming Fortune Guide") { openFortuneGuide() }
registerCommand("shcommands", "Shows this list") { commandHelp(it) }
+ registerCommand0("shdefaultoptions", "Select default options", {
+ DefaultConfigFeatures.onCommand(
+ it.getOrNull(0) ?: "null", it.getOrNull(1) ?: "null"
+ )
+ }, DefaultConfigFeatures::onComplete)
}
private fun usersNormal() {
@@ -308,8 +314,24 @@ object Commands {
config.outdatedItems.clear()
}
- private fun registerCommand(name: String, description: String, function: (Array<String>) -> Unit) {
- ClientCommandHandler.instance.registerCommand(SimpleCommand(name, createCommand(function)))
+ private fun registerCommand(
+ name: String,
+ description: String,
+ function: (Array<String>) -> Unit
+ ) = registerCommand0(name, description, function)
+
+ private fun registerCommand0(
+ name: String,
+ description: String,
+ function: (Array<String>) -> Unit,
+ autoComplete: ((Array<String>) -> List<String>) = { listOf() }
+ ) {
+ ClientCommandHandler.instance.registerCommand(
+ SimpleCommand(
+ name,
+ createCommand(function),
+ { a, b, c -> autoComplete(b) })
+ )
commands.add(CommandInfo(name, description, currentCategory))
}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.java b/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.java
index fa2c310de..9ff8ade64 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/commands/SimpleCommand.java
@@ -32,9 +32,9 @@ public class SimpleCommand extends CommandBase {
public abstract void processCommand(ICommandSender sender, String[] args);
}
- public abstract static class TabCompleteRunnable {
+ public interface TabCompleteRunnable {
- public abstract List<String> tabComplete(ICommandSender sender, String[] args, BlockPos pos);
+ List<String> tabComplete(ICommandSender sender, String[] args, BlockPos pos);
}
public boolean canCommandSenderUseCommand(ICommandSender sender) {
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/AshfangConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/AshfangConfig.java
index 3515b9280..575a1987d 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/AshfangConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/AshfangConfig.java
@@ -1,5 +1,6 @@
package at.hannibal2.skyhanni.config.features;
+import at.hannibal2.skyhanni.config.FeatureToggle;
import at.hannibal2.skyhanni.config.core.config.Position;
import com.google.gson.annotations.Expose;
import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean;
@@ -11,6 +12,7 @@ public class AshfangConfig {
@Expose
@ConfigOption(name = "Freeze", desc = "Show the cooldown for how long Ashfang blocks your abilities.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean freezeCooldown = false;
@Expose
@@ -19,6 +21,7 @@ public class AshfangConfig {
@Expose
@ConfigOption(name = "Reset Time", desc = "Show the cooldown until Ashfang pulls his underlings back.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean nextResetCooldown = false;
@Expose
@@ -27,6 +30,7 @@ public class AshfangConfig {
@Expose
@ConfigOption(name = "Gravity Orbs", desc = "Shows the Gravity Orbs more clearly.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean gravityOrbs = false;
@Expose
@@ -37,6 +41,7 @@ public class AshfangConfig {
@Expose
@ConfigOption(name = "Blazing Souls", desc = "Shows the Blazing Souls more clearly.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean blazingSouls = false;
@Expose
@@ -47,20 +52,24 @@ public class AshfangConfig {
@Expose
@ConfigOption(name = "Highlight Blazes", desc = "Highlight the different blazes in their respective colors.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean highlightBlazes = false;
@Expose
@ConfigOption(name = "Hide Particles", desc = "Hide particles around the Ashfang boss.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean hideParticles = false;
@Expose
@ConfigOption(name = "Hide Names", desc = "Hide the names of full health blazes around Ashfang (only useful when highlight blazes is enabled)")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean hideNames = false;
@Expose
@ConfigOption(name = "Hide Damage", desc = "Hide damage splashes around Ashfang.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean hideDamageSplash = false;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/BazaarConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/BazaarConfig.java
index 8f12ba667..8d3565765 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/BazaarConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/BazaarConfig.java
@@ -1,5 +1,6 @@
package at.hannibal2.skyhanni.config.features;
+import at.hannibal2.skyhanni.config.FeatureToggle;
import at.hannibal2.skyhanni.config.core.config.Position;
import com.google.gson.annotations.Expose;
import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean;
@@ -10,16 +11,19 @@ public class BazaarConfig {
@Expose
@ConfigOption(name = "Purchase Helper", desc = "Highlights the item you are trying to buy in the Bazaar.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean purchaseHelper = true;
@Expose
@ConfigOption(name = "Order Helper", desc = "Show visual hints inside the Bazaar Manage Order view when items are ready to pickup or outbid.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean orderHelper = false;
@Expose
@ConfigOption(name = "Best Sell Method", desc = "Show the price difference between sell instantly and sell offer.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean bestSellMethod = false;
@Expose
@@ -28,5 +32,6 @@ public class BazaarConfig {
@Expose
@ConfigOption(name = "Cancelled Buy Order Clipboard", desc = "Saves missing items from cancelled buy orders to clipboard for faster re-entry.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean cancelledBuyOrderClipboard = false;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/BingoConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/BingoConfig.java
index e083fbcbe..4be6eeb41 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/BingoConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/BingoConfig.java
@@ -1,5 +1,6 @@
package at.hannibal2.skyhanni.config.features;
+import at.hannibal2.skyhanni.config.FeatureToggle;
import at.hannibal2.skyhanni.config.core.config.Position;
import com.google.gson.annotations.Expose;
import io.github.moulberry.moulconfig.annotations.Accordion;
@@ -18,6 +19,7 @@ public class BingoConfig {
@Expose
@ConfigOption(name = "Enable", desc = "Displays the bingo card.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean enabled = true;
@Expose
@ConfigOption(name = "Quick Toggle", desc = "Quickly toggle the bingo card or the step helper by sneaking with SkyBlock menu in hand.")
@@ -42,6 +44,7 @@ public class BingoConfig {
"§eData from Bingo Splash Community§7, made by §cMayxo"
)
@ConfigEditorBoolean
+ @FeatureToggle
public boolean bingoSplashGuide = true;
@Expose
@@ -59,11 +62,13 @@ public class BingoConfig {
@ConfigOption(name = "Enable", desc = "Shortens chat messages about skill level ups, collection gains, " +
"new area discoveries and skyblock level up messages while on bingo.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean enabled = true;
@Expose
@ConfigOption(name = "Hide Border", desc = "Hide the border messages before and after the compact level up messages.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean hideBorder = true;
@Expose
@@ -75,6 +80,7 @@ public class BingoConfig {
@Expose
@ConfigOption(name = "Minion Craft Helper", desc = "Show how many more items you need to upgrade the minion in your inventory. Especially useful for bingo.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean minionCraftHelperEnabled = true;
@Expose
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/ChatConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/ChatConfig.java
index ee46054f6..425cd9d07 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/ChatConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/ChatConfig.java
@@ -1,5 +1,6 @@
package at.hannibal2.skyhanni.config.features;
+import at.hannibal2.skyhanni.config.FeatureToggle;
import com.google.gson.annotations.Expose;
import io.github.moulberry.moulconfig.annotations.*;
import org.lwjgl.input.Keyboard;
@@ -21,36 +22,49 @@ public class ChatConfig {
@ConfigOption(name = "Hypixel Hub", desc = "Block messages outside SkyBlock in the Hypixel lobby: player joins, loot boxes, prototype lobby messages, radiating generosity and Hypixel tournaments.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
+ @FeatureToggle
public boolean hypixelHub = true;
@Expose
@ConfigOption(name = "Empty", desc = "Hide all the empty messages from the chat.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
+ @FeatureToggle
public boolean empty = true;
@Expose
@ConfigOption(name = "Warping", desc = "Block 'sending request to join...' and 'warping...' messages.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
+ @FeatureToggle
public boolean warping = true;
@Expose
@ConfigOption(name = "Welcome", desc = "Hide the 'welcome to SkyBlock' message.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
+ @FeatureToggle
public boolean welcome = true;
@Expose
@ConfigOption(name = "Guild Exp", desc = "Hide guild exp messages.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
+ @FeatureToggle
public boolean guildExp = true;
@Expose
+ @ConfigOption(name = "Friend Join Left", desc = "Hide friend join/left messages.")
+ @ConfigEditorBoolean
+ @ConfigAccordionId(id = 0)
+ @FeatureToggle
+ public boolean friendJoinLeft = false;
+
+ @Expose
@ConfigOption(name = "Winter Gifts", desc = "Hide useless winter gift messages.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
+ @FeatureToggle
public boolean winterGift = false;
@Expose
@@ -58,24 +72,28 @@ public class ChatConfig {
"(Except powder numbers over 1k, Prehistoric Egg and Automaton Parts)")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
+ @FeatureToggle
public boolean powderMining = true;
@Expose
@ConfigOption(name = "Kill Combo", desc = "Hide messages about the current kill combo from the Grandma Wolf Pet.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
+ @FeatureToggle
public boolean killCombo = false;
@Expose
@ConfigOption(name = "Watchdog", desc = "Hide the message where Hypixel is flexing how many players they have banned over the last week.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
+ @FeatureToggle
public boolean watchDog = true;
@Expose
@ConfigOption(name = "Profile Join", desc = "Hide 'You are playing on profile' and 'Profile ID' chat messages")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
+ @FeatureToggle
public boolean profileJoin = true;
//TODO remove
@@ -83,6 +101,7 @@ public class ChatConfig {
@ConfigOption(name = "Others", desc = "Hide other annoying messages.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
+ @FeatureToggle
public boolean others = false;
@Expose
@@ -94,44 +113,52 @@ public class ChatConfig {
@ConfigOption(name = "Player Rank Hider", desc = "Hide player ranks in all chat messages.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 1)
+ @FeatureToggle
public boolean playerRankHider = false;
@Expose
@ConfigOption(name = "Chat Filter", desc = "Scan messages sent by players for blacklisted words and grey out the message if any are found.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 1)
+ @FeatureToggle
public boolean chatFilter = false;
@Expose
@ConfigOption(name = "Dungeon Filter", desc = "Hide annoying messages in dungeons.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean dungeonMessages = true;
@Expose
@ConfigOption(name = "Dungeon Boss Messages", desc = "Hide messages from the watcher and bosses in the dungeon.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean dungeonBossMessages = false;
@Expose
@ConfigOption(name = "Hide Far Deaths", desc = "Hide other players' death messages, " +
"except for players who are nearby or during dungeons/a Kuudra fight.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean hideFarDeathMessages = false;
//TODO jawbus + thunder
@Expose
@ConfigOption(name = "Compact Potion Message", desc = "Shorten chat messages about player potion effects.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean compactPotionMessage = true;
@Expose
@ConfigOption(name = "Compact Bestiary Message", desc = "Shorten the bestiary level up message, showing additional information when hovering.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean compactBestiaryMessage = true;
@Expose
@ConfigOption(name = "Arachne Hider", desc = "Hide chat messages about the Arachne Fight while outside of §eArachne's Sanctuary§7.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean hideArachneMessages = false;
@Expose
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/CommandsConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/CommandsConfig.java
index dd0668743..0c29f707e 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/CommandsConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/CommandsConfig.java
@@ -1,5 +1,6 @@
package at.hannibal2.skyhanni.config.features;
+import at.hannibal2.skyhanni.config.FeatureToggle;
import com.google.gson.annotations.Expose;
import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean;
import io.github.moulberry.moulconfig.annotations.ConfigOption;
@@ -9,16 +10,19 @@ public class CommandsConfig {
@Expose
@ConfigOption(name = "Fandom Wiki", desc = "Use Fandom wiki (§ehypixel-skyblock.fandom.com§7) instead of the Hypixel wiki (§ewiki.hypixel.net§7).")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean useFandomWiki = false;
@Expose
@ConfigOption(name = "Party transfer", desc = "Allows §e/pt <player> §7as alias for §e/party transfer§7.\n" +
"§7SkyBlock command §e/pt §7to check the play time still works.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean usePartyTransferAlias = true;
@Expose
@ConfigOption(name = "Replace Warp Is", desc = "Replaces §e/warp is §7with §e/is§7. Idk why. Ask §cKaeso")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean replaceWarpIs = false;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/DamageIndicatorConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/DamageIndicatorConfig.java
index af72333b9..94ff6f497 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/DamageIndicatorConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/DamageIndicatorConfig.java
@@ -1,5 +1,6 @@
package at.hannibal2.skyhanni.config.features;
+import at.hannibal2.skyhanni.config.FeatureToggle;
import com.google.gson.annotations.Expose;
import io.github.moulberry.moulconfig.annotations.*;
@@ -12,6 +13,7 @@ public class DamageIndicatorConfig {
@Expose
@ConfigOption(name = "Damage Indicator Enabled", desc = "Show the boss' remaining health.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean enabled = false;
@Expose
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/DianaConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/DianaConfig.java
index 99437bb83..d5d46a0b1 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/DianaConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/DianaConfig.java
@@ -1,5 +1,6 @@
package at.hannibal2.skyhanni.config.features;
+import at.hannibal2.skyhanni.config.FeatureToggle;
import com.google.gson.annotations.Expose;
import io.github.moulberry.moulconfig.annotations.*;
import org.lwjgl.input.Keyboard;
@@ -9,11 +10,13 @@ public class DianaConfig {
@Expose
@ConfigOption(name = "Soopy Guess", desc = "Uses §eSoopy's Guess Logic §7to find the next burrow. Does not require SoopyV2 or ChatTriggers to be installed.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean burrowsSoopyGuess = false;
@Expose
@ConfigOption(name = "Nearby Detection", desc = "Show burrows near you.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean burrowsNearbyDetection = false;
@Expose
@@ -42,6 +45,7 @@ public class DianaConfig {
@Expose
@ConfigOption(name = "Enabled", desc = "Shares your Inquisitor and receiving other Inquisitors via Party Chat.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean enabled = true;
@Expose
@@ -68,5 +72,6 @@ public class DianaConfig {
@Expose
@ConfigOption(name = "Griffin Pet Warning", desc = "Warn when holding an Ancestral Spade while no Griffin pet is selected.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean petWarning = true;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/DungeonConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/DungeonConfig.java
index 3e086812e..b0677f462 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/DungeonConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/DungeonConfig.java
@@ -1,5 +1,6 @@
package at.hannibal2.skyhanni.config.features;
+import at.hannibal2.skyhanni.config.FeatureToggle;
import at.hannibal2.skyhanni.config.core.config.Position;
import com.google.gson.annotations.Expose;
import io.github.moulberry.moulconfig.annotations.ConfigAccordionId;
@@ -12,11 +13,13 @@ public class DungeonConfig {
@Expose
@ConfigOption(name = "Clicked Blocks", desc = "Highlight levers, chests, and wither essence when clicked in dungeons.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean highlightClickedBlocks = false;
@Expose
@ConfigOption(name = "Milestones Display", desc = "Show the current milestone in dungeons.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean showMilestonesDisplay = false;
@Expose
@@ -25,6 +28,7 @@ public class DungeonConfig {
@Expose
@ConfigOption(name = "Death Counter Display", desc = "Display the total amount of deaths in the current dungeon.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean deathCounterDisplay = false;
@Expose
@@ -39,6 +43,7 @@ public class DungeonConfig {
"particles are no longer displayed and the music stops playing, but the loot chests are still displayed.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 2)
+ @FeatureToggle
public boolean cleanEndToggle = false;
@Expose
@@ -51,11 +56,13 @@ public class DungeonConfig {
@Expose
@ConfigOption(name = "Boss Damage Splash", desc = "Hides damage splashes while inside the boss room (fixes a Skytils feature).")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean damageSplashBoss = false;
@Expose
@ConfigOption(name = "Highlight Deathmites", desc = "Highlight deathmites in dungeon in red color.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean highlightDeathmites = true;
@ConfigOption(name = "Object Hider", desc = "Hide various things in dungeons.")
@@ -66,48 +73,56 @@ public class DungeonConfig {
@ConfigOption(name = "Hide Superboom TNT", desc = "Hide Superboom TNT laying around in dungeons.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 3)
+ @FeatureToggle
public boolean hideSuperboomTNT = false;
@Expose
@ConfigOption(name = "Hide Blessings", desc = "Hide Blessings laying around in dungeons.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 3)
+ @FeatureToggle
public boolean hideBlessing = false;
@Expose
@ConfigOption(name = "Hide Revive Stones", desc = "Hide Revive Stones laying around in dungeons.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 3)
+ @FeatureToggle
public boolean hideReviveStone = false;
@Expose
@ConfigOption(name = "Hide Premium Flesh", desc = "Hide Premium Flesh laying around in dungeons.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 3)
+ @FeatureToggle
public boolean hidePremiumFlesh = false;
@Expose
@ConfigOption(name = "Hide Journal Entry", desc = "Hide Journal Entry pages laying around in dungeons.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 3)
+ @FeatureToggle
public boolean hideJournalEntry = false;
@Expose
@ConfigOption(name = "Hide Skeleton Skull", desc = "Hide Skeleton Skulls laying around in dungeons.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 3)
+ @FeatureToggle
public boolean hideSkeletonSkull = true;
@Expose
@ConfigOption(name = "Hide Healer Orbs", desc = "Hides the damage, ability damage and defensive orbs that spawn when the healer kills mobs.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 3)
+ @FeatureToggle
public boolean hideHealerOrbs = false;
@Expose
@ConfigOption(name = "Hide Healer Fairy", desc = "Hide the golden fairy that follows the healer in dungeons.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 3)
+ @FeatureToggle
public boolean hideHealerFairy = false;
@ConfigOption(name = "Message Filter", desc = "")
@@ -118,6 +133,7 @@ public class DungeonConfig {
@ConfigOption(name = "Keys and Doors", desc = "Hides the chat message when picking up keys or opening doors in dungeons.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 4)
+ @FeatureToggle
public boolean messageFilterKeysAndDoors = false;
@ConfigOption(name = "Dungeon Copilot", desc = "")
@@ -128,6 +144,7 @@ public class DungeonConfig {
@ConfigOption(name = "Copilot Enabled", desc = "Suggests what to do next in dungeons.")
@ConfigEditorBoolean
@ConfigAccordionId(id = 5)
+ @FeatureToggle
public boolean copilotEnabled = false;
@Expose
@@ -141,17 +158,20 @@ public class DungeonConfig {
@ConfigOption(name = "Colored Class Level", desc = "Color class levels in party finder.")
@ConfigAccordionId(id = 6)
@ConfigEditorBoolean
+ @FeatureToggle
public boolean partyFinderColoredClassLevel = true;
@Expose
@ConfigOption(name = "Moving Skeleton Skulls", desc = "Highlight Skeleton Skulls when combining into an " +
"orange Skeletor (not useful when combined with feature Hide Skeleton Skull).")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean highlightSkeletonSkull = true;
@Expose
@ConfigOption(name = "Croesus Chest", desc = "Adds a visual highlight to the Croesus inventory that " +
"shows unopened chests.")
@ConfigEditorBoolean
+ @FeatureToggle
public boolean croesusUnopenedChestTracker = true;
}
diff --git a/src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java b/src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java
index 80c7e33cd..472a0a50d 100644
--- a/src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java
+++ b/src/main/java/at/hannibal2/skyhanni/config/features/FishingConfig.java
@@ -1,5 +1,6 @@
package at.hannibal2.skyhanni.config.features;
+import at.hannibal2.skyhanni.config.FeatureToggle;
import at.hannibal2.skyhanni.config.core.config.Position;
import com.google.gson.annotations.Expose;
import io.github.moulberry.moulconfig.annotations.*;
@@ -19,6 +20,7 @@ public class FishingConfig {
)
@ConfigEditorBoolean
@ConfigAccordionId(id = 0)
+ @FeatureToggle
public boolean trophyCounter = false;
@Expose
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigFeatures.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigFeatures.kt
new file mode 100644
index 000000000..72f205b5e
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigFeatures.kt
@@ -0,0 +1,112 @@
+package at.hannibal2.skyhanni.features.misc.massconfiguration
+
+import at.hannibal2.skyhanni.SkyHanniMod
+import at.hannibal2.skyhanni.utils.LorenzUtils
+import io.github.moulberry.moulconfig.processor.ConfigProcessorDriver
+import net.minecraft.client.Minecraft
+import net.minecraft.command.CommandBase
+import net.minecraft.event.ClickEvent
+import net.minecraft.util.ChatComponentText
+import net.minecraft.util.ChatStyle
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent
+import net.minecraftforge.fml.common.gameevent.TickEvent
+
+object DefaultConfigFeatures {
+ var didNotifyOnce = false
+
+ @SubscribeEvent
+ fun onTick(event: TickEvent) {
+ if (didNotifyOnce) return
+ val player = Minecraft.getMinecraft().thePlayer ?: return
+ didNotifyOnce = true
+ val knownToggles = SkyHanniMod.feature.storage.knownFeatureToggles
+ val updated = SkyHanniMod.version !in knownToggles
+ val processor = FeatureToggleProcessor()
+ ConfigProcessorDriver.processConfig(SkyHanniMod.feature.javaClass, SkyHanniMod.feature, processor)
+ knownToggles[SkyHanniMod.version] = processor.allOptions.map { it.path }
+ SkyHanniMod.configManager.saveConfig("Updated known feature flags")
+ if (!SkyHanniMod.feature.storage.hasPlayedBefore) {
+ SkyHanniMod.feature.storage.hasPlayedBefore = true
+ player.addChatMessage(
+ ChatComponentText(
+ "§e[SkyHanni] Looks like this is the first time you are using SkyHanni." +
+ " Click here to configure default options, or run /shdefaultoptions."
+ ).setChatStyle(
+ ChatStyle().setChatClickEvent(
+ ClickEvent(
+ ClickEvent.Action.RUN_COMMAND,
+ "/shdefaultoptions"
+ )
+ )
+ )
+ )
+
+ } else if (updated) {
+ val mostFeatureFulOldVersion = knownToggles.maxByOrNull { if (it.key != SkyHanniMod.version) it.value.size else -1 }
+ val command = "/shdefaultoptions ${mostFeatureFulOldVersion?.key} ${SkyHanniMod.version}"
+ player.addChatMessage(
+ ChatComponentText(
+ "§e[SkyHanni] Looks like you updated SkyHanni." +
+ " Click here to configure the newly introduced options, or run $command."
+ ).setChatStyle(
+ ChatStyle().setChatClickEvent(
+ ClickEvent(
+ ClickEvent.Action.RUN_COMMAND,
+ command
+ )
+ )
+ )
+ )
+ }
+ }
+
+ fun onCommand(old: String, new: String) {
+ val processor = FeatureToggleProcessor()
+ ConfigProcessorDriver.processConfig(SkyHanniMod.feature.javaClass, SkyHanniMod.feature, processor)
+ var optionList = processor.orderedOptions
+ val knownToggles = SkyHanniMod.feature.storage.knownFeatureToggles
+ val togglesInNewVersion = knownToggles[new]
+ if (new != "null" && togglesInNewVersion == null) {
+ LorenzUtils.chat("§e[SkyHanni] Unknown version $new")
+ return
+ }
+ val togglesInOldVersion = knownToggles[old]
+ if (old != "null" && togglesInOldVersion == null) {
+ LorenzUtils.chat("§e[SkyHanni] Unknown version $old")
+ return
+ }
+ optionList = optionList.mapValues { it.value.filter { (togglesInNewVersion == null || it.path in togglesInNewVersion) && (togglesInOldVersion == null || it.path !in togglesInOldVersion) } }
+ .filter { it.value.isNotEmpty() }
+ SkyHanniMod.screenToOpen = DefaultConfigOptionGui(optionList, old, new)
+ }
+
+ fun applyCategorySelections(
+ resetSuggestionState: MutableMap<FeatureToggleProcessor.Category, DefaultConfigOptionGui.ResetSuggestionState>,
+ orderedOptions: Map<FeatureToggleProcessor.Category, List<FeatureToggleProcessor.FeatureToggleableOption>>
+ ) {
+ orderedOptions.forEach { cat, options ->
+ for (option in options) {
+ val resetState = option.toggleOverride ?: resetSuggestionState[cat]!!
+ if (resetState == DefaultConfigOptionGui.ResetSuggestionState.LEAVE_DEFAULTS) continue
+ val onState = option.isTrueEnabled
+ val setTo = if (resetState == DefaultConfigOptionGui.ResetSuggestionState.TURN_ALL_ON) {
+ onState
+ } else {
+ !onState
+ }
+ option.setter(setTo)
+ }
+ }
+ }
+
+ fun onComplete(strings: Array<String>): List<String> {
+ if (strings.size <= 2)
+ return CommandBase.getListOfStringsMatchingLastWord(
+ strings,
+ SkyHanniMod.feature.storage.knownFeatureToggles.keys + listOf("null")
+ )
+ return listOf()
+ }
+
+
+}
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigOptionGui.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigOptionGui.kt
new file mode 100644
index 000000000..00fc88dd4
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/DefaultConfigOptionGui.kt
@@ -0,0 +1,193 @@
+package at.hannibal2.skyhanni.features.misc.massconfiguration
+
+import io.github.moulberry.moulconfig.internal.GlScissorStack
+import io.github.moulberry.moulconfig.internal.RenderUtils
+import io.github.moulberry.moulconfig.internal.TextRenderUtils
+import io.github.moulberry.notenoughupdates.util.Utils
+import net.minecraft.client.gui.GuiScreen
+import net.minecraft.client.gui.ScaledResolution
+import net.minecraft.client.renderer.GlStateManager
+import org.lwjgl.input.Mouse
+
+class DefaultConfigOptionGui(
+ val orderedOptions: Map<FeatureToggleProcessor.Category, List<FeatureToggleProcessor.FeatureToggleableOption>>,
+ old: String,
+ new: String
+) :
+ GuiScreen() {
+ val title = if (old == "null") {
+ if (new == "null")
+ "§5SkyHanni Default Options"
+ else
+ "§5SkyHanni Options In Version $new"
+ } else {
+ if (new == "null") {
+ "§5SkyHanni Options since $old"
+ } else {
+ "§5SkyHanni Options $old → $new"
+ }
+ }
+ val xSize = 400
+ val ySize = 300
+ val barSize = 40
+ val padding = 10
+ var wasMouseDown = false
+ val cardHeight = 30
+
+ var currentScrollOffset = 0
+
+ enum class ResetSuggestionState(val label: String) {
+ TURN_ALL_OFF("§c§lTurn all off"),
+ TURN_ALL_ON("§a§lTurn all on"),
+ LEAVE_DEFAULTS("§b§lLeave unchanged"), ;
+
+ val next get() = entries[(ordinal + 1) % entries.size]
+ }
+
+ val resetSuggestionState =
+ orderedOptions.keys.associateWith { ResetSuggestionState.LEAVE_DEFAULTS }.toMutableMap()
+
+ override fun drawScreen(mouseX: Int, mouseY: Int, partialTicks: Float) {
+ super.drawScreen(mouseX, mouseY, partialTicks)
+ drawDefaultBackground()
+ RenderUtils.drawFloatingRectDark((width - xSize) / 2, (height - ySize) / 2, xSize, ySize)
+ val sr = ScaledResolution(mc)
+ var hoveringTextToDraw: List<String>? = null
+ var mx = mouseX - ((width - xSize) / 2) - padding
+ val isMouseDown = Mouse.isButtonDown(0)
+ val shouldClick = isMouseDown && !wasMouseDown
+ wasMouseDown = isMouseDown
+ val isMouseInScrollArea =
+ mx in 0..xSize && mouseY in ((height - ySize) / 2) + barSize..((height + ySize) / 2 - barSize)
+ var my = mouseY - ((height - ySize) / 2 + barSize) + currentScrollOffset
+
+ GlStateManager.pushMatrix()
+ GlStateManager.translate(width / 2F, (height - ySize) / 2F, 0F)
+ GlStateManager.scale(2f, 2f, 1f)
+ TextRenderUtils.drawStringCenteredScaledMaxWidth(
+ title,
+ mc.fontRendererObj,
+ 0F,
+ mc.fontRendererObj.FONT_HEIGHT.toFloat(),
+ false,
+ xSize / 2 - padding,
+ -1
+ )
+ GlStateManager.popMatrix()
+
+ GlStateManager.pushMatrix()
+ GlStateManager.translate(
+ (width - xSize) / 2F + padding,
+ (height + ySize) / 2F - mc.fontRendererObj.FONT_HEIGHT * 2,
+ 0F
+ )
+ var i = 0
+ fun bt(title: String, tooltip: List<String>, func: () -> Unit) {
+ val lw = mc.fontRendererObj.getStringWidth(title)
+ var s = false
+ if (mouseX - ((width - xSize) / 2 + padding) in i..(i + lw)
+ && mouseY - (height + ySize) / 2 in -barSize..0
+ ) {
+ s = true
+ hoveringTextToDraw = tooltip
+ if (shouldClick) {
+ func()
+ }
+ }
+ RenderUtils.drawFloatingRectDark(i - 1, -3, lw + 4, 14)
+ mc.fontRendererObj.drawString(title, 2 + i.toFloat(), 0F, if (s) 0xFF00FF00.toInt() else -1, s)
+ i += lw + 12
+ }
+ bt("Apply choices", listOf()) {
+ DefaultConfigFeatures.applyCategorySelections(resetSuggestionState, orderedOptions)
+ mc.displayGuiScreen(null)
+ }
+ bt("Turn all on", listOf()) {
+ resetSuggestionState.entries.forEach {
+ it.setValue(ResetSuggestionState.TURN_ALL_ON);
+ orderedOptions[it.key]!!.forEach { it.toggleOverride = null }
+ }
+ }
+ bt("Turn all off", listOf()) {
+ resetSuggestionState.entries.forEach {
+ it.setValue(ResetSuggestionState.TURN_ALL_OFF)
+ orderedOptions[it.key]!!.forEach { it.toggleOverride = null }
+ }
+ }
+ bt("Leave all untouched", listOf()) {
+ resetSuggestionState.entries.forEach {
+ it.setValue(ResetSuggestionState.LEAVE_DEFAULTS)
+ orderedOptions[it.key]!!.forEach { it.toggleOverride = null }
+ }
+ }
+ bt("Cancel", listOf()) {
+ mc.displayGuiScreen(null)
+ }
+ GlStateManager.popMatrix()
+
+ GlStateManager.pushMatrix()
+ GlScissorStack.push(
+ (width - xSize) / 2,
+ (height - ySize) / 2 + barSize,
+ (width + xSize) / 2,
+ (height + ySize) / 2 - barSize,
+ sr
+ )
+ GlStateManager.translate(
+ (width - xSize) / 2F + padding,
+ (height - ySize) / 2F + barSize - currentScrollOffset,
+ 0F
+ )
+
+ for ((cat) in orderedOptions.entries) {
+ val suggestionState = resetSuggestionState[cat]!!
+ drawRect(0, 0, xSize - padding * 2, 1, 0xFF808080.toInt())
+ drawRect(0, 30, xSize - padding * 2, cardHeight + 1, 0xFF808080.toInt())
+ drawRect(0, 0, 1, cardHeight, 0xFF808080.toInt())
+ drawRect(xSize - padding * 2 - 1, 0, xSize - padding * 2, cardHeight, 0xFF808080.toInt())
+ mc.fontRendererObj.drawString("§e${cat.name} ${suggestionState.label}", 4, 4, -1)
+ mc.fontRendererObj.drawSplitString("§7${cat.description}", 4, 14, xSize - padding * 2 - 8, -1)
+ if (isMouseInScrollArea && my in 0..cardHeight) {
+ hoveringTextToDraw =
+ listOf(
+ "§e${cat.name}",
+ "§7${cat.description}",
+ "§7Current plan: ${suggestionState.label}",
+ "§aClick to toggle!",
+ "§7Hold shift to show all options"
+ )
+ if (isShiftKeyDown()) {
+ hoveringTextToDraw = listOf(
+ "§e${cat.name}",
+ "§7${cat.description}",
+ ) + orderedOptions[cat]!!.map { "§7 - §a" + it.name }
+ }
+ if (shouldClick) {
+ resetSuggestionState[cat] = suggestionState.next
+ orderedOptions[cat]!!.forEach { it.toggleOverride = null }
+ }
+ }
+ my -= cardHeight
+ GlStateManager.translate(0F, cardHeight.toFloat(), 0F)
+ }
+
+
+ GlStateManager.popMatrix()
+ GlScissorStack.pop(sr)
+ if (hoveringTextToDraw != null) {
+ Utils.drawHoveringText(hoveringTextToDraw, mouseX, mouseY, width, height, 100, mc.fontRendererObj)
+ }
+
+ }
+
+ fun scroll(s: Int) {
+ currentScrollOffset =
+ Math.max(0, Math.min(s, (orderedOptions.size + 1) * cardHeight - ySize + barSize + padding * 2))
+ }
+
+ override fun handleMouseInput() {
+ super.handleMouseInput()
+ if (Mouse.getEventDWheel() != 0)
+ scroll(currentScrollOffset - Mouse.getEventDWheel())
+ }
+} \ No newline at end of file
diff --git a/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/FeatureToggleProcessor.kt b/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/FeatureToggleProcessor.kt
new file mode 100644
index 000000000..c6b1beea5
--- /dev/null
+++ b/src/main/java/at/hannibal2/skyhanni/features/misc/massconfiguration/FeatureToggleProcessor.kt
@@ -0,0 +1,70 @@
+package at.hannibal2.skyhanni.features.misc.massconfiguration
+
+import at.hannibal2.skyhanni.config.FeatureToggle
+import io.github.moulberry.moulconfig.annotations.ConfigEditorBoolean
+import io.github.moulberry.moulconfig.annotations.ConfigOption
+import io.github.moulberry.moulconfig.processor.ConfigStructureReader
+import java.lang.reflect.Field
+import java.util.*
+
+class FeatureToggleProcessor : ConfigStructureReader {
+
+ var latestCategory: Category? = null
+ val pathStack = Stack<String>()
+
+ val allOptions = mutableListOf<FeatureToggleableOption>()
+ val orderedOptions by lazy {
+ allOptions.groupBy { it.category }
+ }
+
+ data class FeatureToggleableOption(
+ val name: String, val description: String, val previouslyEnabled: Boolean,
+ val isTrueEnabled: Boolean, val category: Category,
+ val setter: (Boolean) -> Unit,
+ val path: String,
+ var toggleOverride: DefaultConfigOptionGui.ResetSuggestionState? = null
+ )
+
+ data class Category(val name: String, val description: String)
+
+ override fun beginCategory(baseObject: Any?, field: Field?, name: String, description: String) {
+ latestCategory = Category(name, description)
+ }
+
+ override fun endCategory() {
+ }
+
+ override fun beginAccordion(baseObject: Any?, field: Field?, option: ConfigOption?, id: Int) {
+ }
+
+ override fun endAccordion() {
+ }
+
+ override fun pushPath(fieldPath: String) {
+ pathStack.push(fieldPath)
+ }
+
+ override fun popPath() {
+ pathStack.pop()
+ }
+
+ override fun emitOption(baseObject: Any, field: Field, option: ConfigOption) {
+ val featureToggle = field.getAnnotation(FeatureToggle::class.java) ?: return
+ field.getAnnotation(ConfigEditorBoolean::class.java)
+ ?: error("Feature toggle found without ConfigEditorBoolean: $field")
+ allOptions.add(
+ FeatureToggleableOption(
+ option.name,
+ option.desc,
+ field.getBoolean(baseObject),
+ featureToggle.trueIsEnabled,
+ latestCategory!!,
+ { field.setBoolean(baseObject, it) },
+ pathStack.joinToString(".") + "." + field.name
+ )
+ )
+ }
+
+ override fun emitGuiOverlay(baseObject: Any?, field: Field?, option: ConfigOption?) {
+ }
+} \ No newline at end of file