From 73a735388599bce465b054a7eb597994d6cf2295 Mon Sep 17 00:00:00 2001 From: hashalite Date: Sun, 3 Sep 2023 22:14:54 -0400 Subject: [PATCH] Updated YACL to 3.1.1 (no longer supports 1.19.2) Updated to 1.20.1 Fixed an incompatibility with Xaero's Minimap/Xaero's Worldmap You can no longer add more than 2 auto private names through the gui Fixed server detection (AutoAdvert and AutoRaffle should now work as expected on economy) Join commands will now only be executed on Skyblock/Economy/Classic (not in hub or other servers) Mention highlighting/sounds can now be enabled independently (Mention sounds no longer have to be enabled in order for highlighting to work) --- README.md | 4 +- build.gradle | 3 +- gradle.properties | 14 +- .../net/xolt/sbutils/config/ConfigGui.java | 596 +++++++++--------- .../net/xolt/sbutils/config/ModConfig.java | 11 +- .../sbutils/config/ModConfigInstance.java | 7 +- .../net/xolt/sbutils/features/AutoAdvert.java | 22 +- .../xolt/sbutils/features/AutoPrivate.java | 4 +- .../net/xolt/sbutils/features/AutoRaffle.java | 8 +- .../xolt/sbutils/features/JoinCommands.java | 3 +- .../net/xolt/sbutils/features/Mentions.java | 14 +- .../features/common/ServerDetector.java | 90 ++- .../mixins/ClientPlayNetworkHandlerMixin.java | 47 +- .../mixins/CommandDispatcherMixin.java | 30 + .../sbutils/mixins/MessageHandlerMixin.java | 2 - .../java/net/xolt/sbutils/util/Messenger.java | 6 +- .../net/xolt/sbutils/util/RegexFilters.java | 10 +- .../resources/assets/sbutils/lang/en_us.json | 12 +- src/main/resources/fabric.mod.json | 2 +- src/main/resources/sbutils.mixins.json | 1 + 20 files changed, 491 insertions(+), 395 deletions(-) create mode 100644 src/main/java/net/xolt/sbutils/mixins/CommandDispatcherMixin.java diff --git a/README.md b/README.md index 0f6ca77..2082f4c 100644 --- a/README.md +++ b/README.md @@ -10,7 +10,7 @@ I am always looking for ways to improve the mod. If you have any feature request |----------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | Auto Advert | Automatically sends messages from a specified file. | **Skyblock Advert File** - The txt file containing your /skyblock advertisements.
**Economy Advert File** - The txt file containing your /economy advertisements.
**Classic Advert File** - The txt file containing your /classic advertisements.
**Advert Delay** - The delay between messages. (Seconds)
**Advert Initial Delay** - The delay between joining and sending an advert. (Seconds)
**Use Advert Whitelist** - Only sends adverts from the accounts specified in the whitelist.
**Advert Whitelist** - A list of accounts that may send adverts if 'Use Advert Whitelist' is enabled. | | Join Commands | Automatically sends commands when you join the server.

If you would like to set a join command for all accounts, add it to global.txt in .minecraft/sbutils/joincommands.

If you would like to set a join command for one account, create a txt file with either the name or UUID of the account, and add the command. | **Initial Delay** - The delay between joining the server and sending the commands. (Seconds)
**Delay** - The delay between each command. (Seconds) | -| Mentions | Notifies you with a sound when something is mentioned in chat. | **Exclude Server Messages** - Doesn't notify you about server messages.
**Exclude Self Messages** - Doesn't notify you about your own messages.
**Mention Sound** - The sound played when something is mentioned in chat.
**Mention Highlighting** - Whether to change the color of mentions in chat.
**Highlight Color** - The color to highlight mentions with.
**Current Account Mentions** - Notifies you when your username is mentioned in chat.
**Aliases** - A list of strings you would like to be notified for. | +| Mentions | Notifies you with a sound when something is mentioned in chat. | **Play Mention Sound** - Notifies you with a sound when something is mentioned in chat.
**Mention Sound** - The sound played when something is mentioned in chat.
**Mention Highlighting** - Whether to change the color of mentions in chat.
**Highlight Color** - The color to highlight mentions with.
**Exclude Server Messages** - Doesn't notify you about server messages.
**Exclude Self Messages** - Doesn't notify you about your own messages.
**Current Account Mentions** - Notifies you when your username is mentioned in chat.
**Aliases** - A list of strings you would like to be notified for. | | Enchant All | Enchants either your held item, or all items in your inventory. Can also be used to unenchant. | **Enchant Mode** - Whether to use the built in /enchantall command, or send enchants individually.
**Enchant Delay** - The delay between sending enchant commands. (Seconds)
**Cooldown Frequency** - The number of commands to be executed before a cooldown is initiated. (To avoid spam kick)
**Cooldown Time** - The length of the cooldown. (Seconds)
**Exclude Frost** - Excludes Frost Walker from /enchantall. | | Chat Append | Adds a prefix and/or suffix to the messages you send. | **Add Prefix** - Adds the specified prefix to all the messages you send.
**Chat Prefix** - The prefix to add to your messages.
**Add Suffix** - Adds the specified suffix to all the messages you send.
**Chat Suffix** - The suffix to add to your messages. | | Chat Filters | Filters certain messages from chat. | **Filter Tips** - Whether tip messages should be filtered from chat.
**Filter Advancements** - Whether advancement messages should be filtered from chat.
**Filter Welcome Messages** - Whether player welcome messages should be filtered from chat.
**Filter Friend Joins** - Whether friend join messages should be filtered from chat.
**Filter Island MOTDs** - Whether island MOTD messages should be filtered from chat.
**Filter Votes** - Whether player vote messages should be filtered from chat.
**Filter Vote Rewards** - Whether player vote reward messages should be filtered from chat.
**Filter Raffle Messages** - Whether raffle messages should be filtered from chat.
**Filter Crate Messages** - Whether crate opening messages should be filtered from chat.
**Filter ClearLag Messages** - Whether ClearLag messages should be filtered from chat.
**Filter Perished In Void Messages** - Whether 'perished in void' messages should be filtered from chat.
**Filter SkyChats** - Whether SkyChat messages should be filtered from chat." | @@ -50,7 +50,7 @@ I am always looking for ways to improve the mod. If you have any feature request |------------------|------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | `/autoadvert` | `/advert` | `/advert` - Toggles Auto Advert.
`/advert info` - If Auto Advert is enabled, tells you how long until the next ad is sent, and the ad index.
`/advert ` - Tells you the current advert file for the specified server.
`/advert ` - Sets the advert file for the specified server.
`/advert ads list` - Lists the ads in the current advert file, with their indexes.
`/advert ads add ` - Adds the specified advert to the current advert file.
`/advert ads del ` - Removes the advert at the specified index from the current advert file.
`/advert ads insert ` - Inserts the advert at the specified index in the advert file.
`/advert ads toggle ` - Enables or disables the advert at the specified index.
`/advert delay` - Tells you what the current advert delay is.
`/advert delay ` - Sets the advert delay.
`/advert initialDelay` - Tells you what the current initial delay is.
`/advert initialDelay ` - Sets the initial delay.
`/advert whitelist` - Tells you if whitelist is enabled and lists the current whitelist.
`/advert whitelist ` - Enables or disables advert whitelist.
`/advert whitelist ` - Adds or removes an account from the advert whitelist.
`/advert reset` - Resets remaining delay to 0 and returns to the first ad index. | | `/joincmds` | `/jc` | `/jc` - Toggles Join Commands.
`/jc ` - Lists your global or account join commands.
`/jc add ` - Adds the specified command to global commands or the current account's commands.
`/jc del ` - Removes the command at the specified index from global commands or the current account's commands.
`/jc insert ` - Inserts the command at the specified index in global commands or the current accounts commands.
`/jc delay` - Tells you the current command delay.
`/jc delay ` - Sets join command delay.
`/jc initialDelay` - Tells you the current initial delay.
`/jc initialDelay ` - Sets initial delay. | -| `/mentions` | `/ment` | `/ment` - Toggles Mentions.
`/ment excludeServer` - Tells you if server messages are being ignored by Mentions.
`/ment excludeServer ` - Enables or disables server message exclusion.
`/ment excludeSelf` - Tells you if your own messages are being ignored by Mentions.
`/ment excludeSelf ` - Enables or disables self message exclusion.
`/ment currentAccount` - Tells you if current account mentions are enabled.
`/ment currentAccount ` - Enables or disables current account mentions.
`/ment aliases` - Lists the current mention aliases.
`/ment aliases ` - Adds or removes a mention alias.
`/ment sound` - Tells you what the current notification sound is.
`/ment sound ` - Sets the notification sound.
`/ment highlight` - Tells you if mention highlighting is enabled.
`/ment highlight ` - Enables or disables mention highlighting.
`/ment highlight color` - Tells you the current highlight color.
`/ment highlight color ` - Sets the highlight color. | +| `/mentions` | `/ment` | `/ment` - Toggles Mentions.
`/ment excludeServer` - Tells you if server messages are being ignored by Mentions.
`/ment excludeServer ` - Enables or disables server message exclusion.
`/ment excludeSelf` - Tells you if your own messages are being ignored by Mentions.
`/ment excludeSelf ` - Enables or disables self message exclusion.
`/ment currentAccount` - Tells you if current account mentions are enabled.
`/ment currentAccount ` - Enables or disables current account mentions.
`/ment aliases` - Lists the current mention aliases.
`/ment aliases ` - Adds or removes a mention alias.
`/ment sound` - Tells you what the current notification sound is.
`/ment playSound ` - Enables or disables mention sounds.
`/ment sound ` - Sets the notification sound.
`/ment highlight` - Tells you if mention highlighting is enabled.
`/ment highlight ` - Enables or disables mention highlighting.
`/ment highlight color` - Tells you the current highlight color.
`/ment highlight color ` - Sets the highlight color. | | `/enchantall` | `/eall` | `/eall` - Enchants your held item with all possible enchants.
`/eall inv` - Enchants all items in your inventory with all possible enchants.
`/eall mode` - Tells you the current enchant mode.
`/eall mode ` - Sets the enchant mode.
`/eall delay` - Tells you the current delay between enchantments.
`/eall delay ` - Sets the delay between enchantments.
`/eall cooldownFrequency` - Tells you the current cooldown frequency.
`/eall cooldownFrequency ` - Sets the cooldown frequency.
`/eall cooldownTime` - Tells you the current cooldown time.
`/eall cooldownTime ` - Sets the cooldown time.
`/eall excludeFrost` - Tells you whether exlude frost walker is enabled.
`/eall excludeFrost ` - Enables or disables exclude frost walker. | | `/unenchantall` | `/ueall` | `/ueall` - Unenchants your held item.
`/ueall inv` - Unenchants all items in your inventory.
`/ueall delay` - Tells you the current delay between enchantments.
`/ueall delay ` - Sets the delay between enchantments.
`/ueall cooldownFrequency` - Tells you the current cooldown frequency.
`/ueall cooldownFrequency ` - Sets the cooldown frequency.
`/ueall cooldownTime` - Tells you the current cooldown time.
`/ueall cooldownTime ` - Sets the cooldown time. | | `/chatappend` | `/append` | `/append prefix` - Tells you whether add prefix is enabled.
`/append prefix ` - Enables or disables add prefix.
`/append prefix set ` - Sets your chat prefix.
`/append suffix` - Tells you whether add suffix is enabled.
`/append suffix ` - Enables or disables add suffix.
`/append suffix set ` - Sets your chat suffix. | diff --git a/build.gradle b/build.gradle index a9effcd..1e0cab8 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,5 @@ plugins { - id 'fabric-loom' version '1.0-SNAPSHOT' + id 'fabric-loom' version '1.3-SNAPSHOT' id 'maven-publish' } @@ -13,6 +13,7 @@ group = project.maven_group repositories { maven { url "https://maven.isxander.dev/releases" } maven { url "https://maven.terraformersmc.com/" } + maven {url "https://oss.sonatype.org/content/repositories/snapshots/"} } dependencies { diff --git a/gradle.properties b/gradle.properties index e2e861e..c0f0db6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -2,16 +2,16 @@ org.gradle.jvmargs=-Xmx2G # Fabric Properties # check these on https://modmuss50.me/fabric.html -mc_version=1.19.4 -yarn_mappings=1.19.4+build.2 -loader_version=0.14.19 +mc_version=1.20.1 +yarn_mappings=1.20.1+build.10 +loader_version=0.14.22 # Mod Properties -mod_version=1.1.6 +mod_version=1.1.7 maven_group=net.xolt archives_base_name=sbutils # Dependencies # check this on https://modmuss50.me/fabric.html -fabric_version=0.80.0+1.19.4 -modmenu_version=6.2.0 -yacl_version=2.5.0+1.19.4 +fabric_version=0.88.1+1.20.1 +modmenu_version=7.2.1 +yacl_version=3.1.1+1.20 exp4j_version = 0.4.8 diff --git a/src/main/java/net/xolt/sbutils/config/ConfigGui.java b/src/main/java/net/xolt/sbutils/config/ConfigGui.java index 836b758..0e90f34 100644 --- a/src/main/java/net/xolt/sbutils/config/ConfigGui.java +++ b/src/main/java/net/xolt/sbutils/config/ConfigGui.java @@ -1,12 +1,8 @@ package net.xolt.sbutils.config; -import dev.isxander.yacl.api.*; -import dev.isxander.yacl.gui.controllers.TickBoxController; -import dev.isxander.yacl.gui.controllers.cycling.EnumController; -import dev.isxander.yacl.gui.controllers.slider.IntegerSliderController; -import dev.isxander.yacl.gui.controllers.string.StringController; -import dev.isxander.yacl.gui.controllers.string.number.DoubleFieldController; -import dev.isxander.yacl.gui.controllers.string.number.IntegerFieldController; +import dev.isxander.yacl3.api.*; +import dev.isxander.yacl3.api.controller.*; +import dev.isxander.yacl3.gui.controllers.slider.IntegerSliderController; import net.minecraft.client.gui.screen.Screen; import net.minecraft.text.Text; import net.xolt.sbutils.util.LimitedList; @@ -45,55 +41,55 @@ private static ConfigCategory buildSbutilsCategory(ModConfig defaults, ModConfig .name(Text.translatable("text.sbutils.config.category.default")) .group(OptionGroup.createBuilder() .name(Text.translatable("text.sbutils.config.group.sbutils")) - .option(Option.createBuilder(String.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.messagePrefix")) - .tooltip(Text.translatable("text.sbutils.config.option.messagePrefix.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.messagePrefix.tooltip"))) .binding( defaults.messagePrefix, () -> config.messagePrefix, (value) -> config.messagePrefix = value ) - .controller(StringController::new) + .controller(StringControllerBuilder::create) .build()) - .option(Option.createBuilder(ModConfig.Color.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.sbutilsColor")) - .tooltip(Text.translatable("text.sbutils.config.option.sbutilsColor.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.sbutilsColor.tooltip"))) .binding( defaults.sbutilsColor, () -> config.sbutilsColor, (value) -> config.sbutilsColor = value ) - .controller(EnumController::new) + .controller(option -> EnumControllerBuilder.create(option).enumClass(ModConfig.Color.class)) .build()) - .option(Option.createBuilder(ModConfig.Color.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.prefixColor")) - .tooltip(Text.translatable("text.sbutils.config.option.prefixColor.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.prefixColor.tooltip"))) .binding( defaults.prefixColor, () -> config.prefixColor, (value) -> config.prefixColor = value ) - .controller(EnumController::new) + .controller(option -> EnumControllerBuilder.create(option).enumClass(ModConfig.Color.class)) .build()) - .option(Option.createBuilder(ModConfig.Color.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.messageColor")) - .tooltip(Text.translatable("text.sbutils.config.option.messageColor.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.messageColor.tooltip"))) .binding( defaults.messageColor, () -> config.messageColor, (value) -> config.messageColor = value ) - .controller(EnumController::new) + .controller(option -> EnumControllerBuilder.create(option).enumClass(ModConfig.Color.class)) .build()) - .option(Option.createBuilder(ModConfig.Color.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.valueColor")) - .tooltip(Text.translatable("text.sbutils.config.option.valueColor.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.valueColor.tooltip"))) .binding( defaults.valueColor, () -> config.valueColor, (value) -> config.valueColor = value ) - .controller(EnumController::new) + .controller(option -> EnumControllerBuilder.create(option).enumClass(ModConfig.Color.class)) .build()) .build()) .build(); @@ -104,86 +100,86 @@ private static ConfigCategory buildAutoAdvertCategory(ModConfig defaults, ModCon .name(Text.translatable("text.sbutils.config.category.autoadvert")) .group(OptionGroup.createBuilder() .name(Text.translatable("text.sbutils.config.group.autoAdvert")) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.autoAdvert")) - .tooltip(Text.translatable("text.sbutils.config.option.autoAdvert.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.autoAdvert.tooltip"))) .binding( defaults.autoAdvert, () -> config.autoAdvert, (value) -> config.autoAdvert = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(String.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.skyblockAdFile")) - .tooltip(Text.translatable("text.sbutils.config.option.skyblockAdFile.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.skyblockAdFile.tooltip"))) .binding( defaults.skyblockAdFile, () -> config.skyblockAdFile, (value) -> config.skyblockAdFile = value ) - .controller(StringController::new) + .controller(StringControllerBuilder::create) .build()) - .option(Option.createBuilder(String.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.economyAdFile")) - .tooltip(Text.translatable("text.sbutils.config.option.economyAdFile.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.economyAdFile.tooltip"))) .binding( defaults.economyAdFile, () -> config.economyAdFile, (value) -> config.economyAdFile = value ) - .controller(StringController::new) + .controller(StringControllerBuilder::create) .build()) - .option(Option.createBuilder(String.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.classicAdFile")) - .tooltip(Text.translatable("text.sbutils.config.option.classicAdFile.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.classicAdFile.tooltip"))) .binding( defaults.classicAdFile, () -> config.classicAdFile, (value) -> config.classicAdFile = value ) - .controller(StringController::new) + .controller(StringControllerBuilder::create) .build()) - .option(Option.createBuilder(double.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.advertDelay")) - .tooltip(Text.translatable("text.sbutils.config.option.advertDelay.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.advertDelay.tooltip"))) .binding( defaults.advertDelay, () -> config.advertDelay, (value) -> config.advertDelay = value ) - .controller(DoubleFieldController::new) + .controller(DoubleFieldControllerBuilder::create) .build()) - .option(Option.createBuilder(double.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.advertInitialDelay")) - .tooltip(Text.translatable("text.sbutils.config.option.advertInitialDelay.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.advertInitialDelay.tooltip"))) .binding( defaults.advertInitialDelay, () -> config.advertInitialDelay, (value) -> config.advertInitialDelay = value ) - .controller(DoubleFieldController::new) + .controller(DoubleFieldControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.advertUseWhitelist")) - .tooltip(Text.translatable("text.sbutils.config.option.advertUseWhitelist.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.advertUseWhitelist.tooltip"))) .binding( defaults.advertUseWhitelist, () -> config.advertUseWhitelist, (value) -> config.advertUseWhitelist = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) .build()) - .group(ListOption.createBuilder(String.class) + .group(ListOption.createBuilder() .name(Text.translatable("text.sbutils.config.option.advertWhitelist")) - .tooltip(Text.translatable("text.sbutils.config.option.advertWhitelist.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.advertWhitelist.tooltip"))) .binding( defaults.advertWhitelist, () -> config.advertWhitelist, (value) -> config.advertWhitelist = value ) - .controller(StringController::new) + .controller(StringControllerBuilder::create) .initial("") .build()) .build(); @@ -194,35 +190,35 @@ private static ConfigCategory buildJoinCommandsCategory(ModConfig defaults, ModC .name(Text.translatable("text.sbutils.config.category.joincommands")) .group(OptionGroup.createBuilder() .name(Text.translatable("text.sbutils.config.group.joinCmds")) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.joinCmdsEnabled")) - .tooltip(Text.translatable("text.sbutils.config.option.joinCmdsEnabled.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.joinCmdsEnabled.tooltip"))) .binding( defaults.joinCmdsEnabled, () -> config.joinCmdsEnabled, (value) -> config.joinCmdsEnabled = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(double.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.joinCmdInitialDelay")) - .tooltip(Text.translatable("text.sbutils.config.option.joinCmdInitialDelay.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.joinCmdInitialDelay.tooltip"))) .binding( defaults.joinCmdInitialDelay, () -> config.joinCmdInitialDelay, (value) -> config.joinCmdInitialDelay = value ) - .controller(DoubleFieldController::new) + .controller(DoubleFieldControllerBuilder::create) .build()) - .option(Option.createBuilder(double.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.joinCmdDelay")) - .tooltip(Text.translatable("text.sbutils.config.option.joinCmdDelay.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.joinCmdDelay.tooltip"))) .binding( defaults.joinCmdDelay, () -> config.joinCmdDelay, (value) -> config.joinCmdDelay = value ) - .controller(DoubleFieldController::new) + .controller(DoubleFieldControllerBuilder::create) .build()) .build()) .build(); @@ -233,86 +229,96 @@ private static ConfigCategory buildMentionsCategory(ModConfig defaults, ModConfi .name(Text.translatable("text.sbutils.config.category.mentions")) .group(OptionGroup.createBuilder() .name(Text.translatable("text.sbutils.config.group.mentions")) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.mentions")) - .tooltip(Text.translatable("text.sbutils.config.option.mentions.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.mentions.tooltip"))) .binding( defaults.mentions, () -> config.mentions, (value) -> config.mentions = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) - .name(Text.translatable("text.sbutils.config.option.excludeServerMsgs")) - .tooltip(Text.translatable("text.sbutils.config.option.excludeServerMsgs.tooltip")) + .option(Option.createBuilder() + .name(Text.translatable("text.sbutils.config.option.playMentionSound")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.playMentionSound.tooltip"))) .binding( - defaults.excludeServerMsgs, - () -> config.excludeServerMsgs, - (value) -> config.excludeServerMsgs = value + defaults.playMentionSound, + () -> config.playMentionSound, + (value) -> config.playMentionSound = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) - .name(Text.translatable("text.sbutils.config.option.excludeSelfMsgs")) - .tooltip(Text.translatable("text.sbutils.config.option.excludeSelfMsgs.tooltip")) - .binding( - defaults.excludeSelfMsgs, - () -> config.excludeSelfMsgs, - (value) -> config.excludeSelfMsgs = value - ) - .controller(TickBoxController::new) - .build()) - .option(Option.createBuilder(ModConfig.NotifSound.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.mentionSound")) - .tooltip(Text.translatable("text.sbutils.config.option.mentionSound.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.mentionSound.tooltip"))) .binding( defaults.mentionSound, () -> config.mentionSound, (value) -> config.mentionSound = value ) - .controller(EnumController::new) + .controller(option -> EnumControllerBuilder.create(option).enumClass(ModConfig.NotifSound.class)) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.mentionHighlight")) - .tooltip(Text.translatable("text.sbutils.config.option.mentionHighlight.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.mentionHighlight.tooltip"))) .binding( defaults.mentionHighlight, () -> config.mentionHighlight, (value) -> config.mentionHighlight = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(ModConfig.Color.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.highlightColor")) - .tooltip(Text.translatable("text.sbutils.config.option.highlightColor.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.highlightColor.tooltip"))) .binding( defaults.highlightColor, () -> config.highlightColor, (value) -> config.highlightColor = value ) - .controller(EnumController::new) + .controller(option -> EnumControllerBuilder.create(option).enumClass(ModConfig.Color.class)) + .build()) + .option(Option.createBuilder() + .name(Text.translatable("text.sbutils.config.option.excludeServerMsgs")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.excludeServerMsgs.tooltip"))) + .binding( + defaults.excludeServerMsgs, + () -> config.excludeServerMsgs, + (value) -> config.excludeServerMsgs = value + ) + .controller(TickBoxControllerBuilder::create) + .build()) + .option(Option.createBuilder() + .name(Text.translatable("text.sbutils.config.option.excludeSelfMsgs")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.excludeSelfMsgs.tooltip"))) + .binding( + defaults.excludeSelfMsgs, + () -> config.excludeSelfMsgs, + (value) -> config.excludeSelfMsgs = value + ) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.mentionsCurrentAccount")) - .tooltip(Text.translatable("text.sbutils.config.option.mentionsCurrentAccount.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.mentionsCurrentAccount.tooltip"))) .binding( defaults.mentionsCurrentAccount, () -> config.mentionsCurrentAccount, (value) -> config.mentionsCurrentAccount = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) .build()) - .group(ListOption.createBuilder(String.class) + .group(ListOption.createBuilder() .name(Text.translatable("text.sbutils.config.option.mentionsAliases")) - .tooltip(Text.translatable("text.sbutils.config.option.mentionsAliases.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.mentionsAliases.tooltip"))) .binding( defaults.mentionsAliases, () -> config.mentionsAliases, (value) -> config.mentionsAliases = value ) - .controller(StringController::new) + .controller(StringControllerBuilder::create) .initial("") .build()) .build(); @@ -323,55 +329,55 @@ private static ConfigCategory buildEnchantAllCategory(ModConfig defaults, ModCon .name(Text.translatable("text.sbutils.config.category.enchantall")) .group(OptionGroup.createBuilder() .name(Text.translatable("text.sbutils.config.group.enchantAll")) - .option(Option.createBuilder(ModConfig.EnchantMode.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.enchantMode")) - .tooltip(Text.translatable("text.sbutils.config.option.enchantMode.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.enchantMode.tooltip"))) .binding( defaults.enchantMode, () -> config.enchantMode, (value) -> config.enchantMode = value ) - .controller(EnumController::new) + .controller(option -> EnumControllerBuilder.create(option).enumClass(ModConfig.EnchantMode.class)) .build()) - .option(Option.createBuilder(double.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.enchantDelay")) - .tooltip(Text.translatable("text.sbutils.config.option.enchantDelay.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.enchantDelay.tooltip"))) .binding( defaults.enchantDelay, () -> config.enchantDelay, (value) -> config.enchantDelay = value ) - .controller(DoubleFieldController::new) + .controller(DoubleFieldControllerBuilder::create) .build()) - .option(Option.createBuilder(int.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.cooldownFrequency")) - .tooltip(Text.translatable("text.sbutils.config.option.cooldownFrequency.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.cooldownFrequency.tooltip"))) .binding( defaults.cooldownFrequency, () -> config.cooldownFrequency, (value) -> config.cooldownFrequency = value ) - .controller(IntegerFieldController::new) + .controller(IntegerFieldControllerBuilder::create) .build()) - .option(Option.createBuilder(double.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.cooldownTime")) - .tooltip(Text.translatable("text.sbutils.config.option.cooldownTime.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.cooldownTime.tooltip"))) .binding( defaults.cooldownTime, () -> config.cooldownTime, (value) -> config.cooldownTime = value ) - .controller(DoubleFieldController::new) + .controller(DoubleFieldControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.excludeFrost")) - .tooltip(Text.translatable("text.sbutils.config.option.excludeFrost.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.excludeFrost.tooltip"))) .binding( defaults.excludeFrost, () -> config.excludeFrost, (value) -> config.excludeFrost = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) .build()) .build(); @@ -382,45 +388,45 @@ private static ConfigCategory buildChatAppendCategory(ModConfig defaults, ModCon .name(Text.translatable("text.sbutils.config.category.chatappend")) .group(OptionGroup.createBuilder() .name(Text.translatable("text.sbutils.config.group.chatAppend")) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.addPrefix")) - .tooltip(Text.translatable("text.sbutils.config.option.addPrefix.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.addPrefix.tooltip"))) .binding( defaults.addPrefix, () -> config.addPrefix, (value) -> config.addPrefix = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(String.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.chatPrefix")) - .tooltip(Text.translatable("text.sbutils.config.option.chatPrefix.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.chatPrefix.tooltip"))) .binding( defaults.chatPrefix, () -> config.chatPrefix, (value) -> config.chatPrefix = value ) - .controller(StringController::new) + .controller(StringControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.addSuffix")) - .tooltip(Text.translatable("text.sbutils.config.option.addSuffix.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.addSuffix.tooltip"))) .binding( defaults.addSuffix, () -> config.addSuffix, (value) -> config.addSuffix = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(String.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.chatSuffix")) - .tooltip(Text.translatable("text.sbutils.config.option.chatSuffix.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.chatSuffix.tooltip"))) .binding( defaults.chatSuffix, () -> config.chatSuffix, (value) -> config.chatSuffix = value ) - .controller(StringController::new) + .controller(StringControllerBuilder::create) .build()) .build()) .build(); @@ -431,115 +437,115 @@ private static ConfigCategory buildChatFiltersCategory(ModConfig defaults, ModCo .name(Text.translatable("text.sbutils.config.category.chatfilters")) .group(OptionGroup.createBuilder() .name(Text.translatable("text.sbutils.config.group.chatFilters")) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.tipsFilterEnabled")) - .tooltip(Text.translatable("text.sbutils.config.option.tipsFilterEnabled.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.tipsFilterEnabled.tooltip"))) .binding( defaults.tipsFilterEnabled, () -> config.tipsFilterEnabled, (value) -> config.tipsFilterEnabled = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.advancementsFilterEnabled")) - .tooltip(Text.translatable("text.sbutils.config.option.advancementsFilterEnabled.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.advancementsFilterEnabled.tooltip"))) .binding( defaults.advancementsFilterEnabled, () -> config.advancementsFilterEnabled, (value) -> config.advancementsFilterEnabled = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.welcomeFilterEnabled")) - .tooltip(Text.translatable("text.sbutils.config.option.welcomeFilterEnabled.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.welcomeFilterEnabled.tooltip"))) .binding( defaults.welcomeFilterEnabled, () -> config.welcomeFilterEnabled, (value) -> config.welcomeFilterEnabled = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.friendJoinFilterEnabled")) - .tooltip(Text.translatable("text.sbutils.config.option.friendJoinFilterEnabled.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.friendJoinFilterEnabled.tooltip"))) .binding( defaults.friendJoinFilterEnabled, () -> config.friendJoinFilterEnabled, (value) -> config.friendJoinFilterEnabled = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.motdFilterEnabled")) - .tooltip(Text.translatable("text.sbutils.config.option.motdFilterEnabled.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.motdFilterEnabled.tooltip"))) .binding( defaults.motdFilterEnabled, () -> config.motdFilterEnabled, (value) -> config.motdFilterEnabled = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.voteFilterEnabled")) - .tooltip(Text.translatable("text.sbutils.config.option.voteFilterEnabled.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.voteFilterEnabled.tooltip"))) .binding( defaults.voteFilterEnabled, () -> config.voteFilterEnabled, (value) -> config.voteFilterEnabled = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.voteRewardFilterEnabled")) - .tooltip(Text.translatable("text.sbutils.config.option.voteRewardFilterEnabled.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.voteRewardFilterEnabled.tooltip"))) .binding( defaults.voteRewardFilterEnabled, () -> config.voteRewardFilterEnabled, (value) -> config.voteRewardFilterEnabled = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.raffleFilterEnabled")) - .tooltip(Text.translatable("text.sbutils.config.option.raffleFilterEnabled.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.raffleFilterEnabled.tooltip"))) .binding( defaults.raffleFilterEnabled, () -> config.raffleFilterEnabled, (value) -> config.raffleFilterEnabled = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.cratesFilterEnabled")) - .tooltip(Text.translatable("text.sbutils.config.option.cratesFilterEnabled.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.cratesFilterEnabled.tooltip"))) .binding( defaults.cratesFilterEnabled, () -> config.cratesFilterEnabled, (value) -> config.cratesFilterEnabled = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.perishedInVoidFilterEnabled")) - .tooltip(Text.translatable("text.sbutils.config.option.perishedInVoidFilterEnabled.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.perishedInVoidFilterEnabled.tooltip"))) .binding( defaults.perishedInVoidFilterEnabled, () -> config.perishedInVoidFilterEnabled, (value) -> config.perishedInVoidFilterEnabled = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.skyChatFilterEnabled")) - .tooltip(Text.translatable("text.sbutils.config.option.skyChatFilterEnabled.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.skyChatFilterEnabled.tooltip"))) .binding( defaults.skyChatFilterEnabled, () -> config.skyChatFilterEnabled, (value) -> config.skyChatFilterEnabled = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) .build()) .build(); @@ -550,65 +556,65 @@ private static ConfigCategory buildChatLoggerCategory(ModConfig defaults, ModCon .name(Text.translatable("text.sbutils.config.category.chatlogger")) .group(OptionGroup.createBuilder() .name(Text.translatable("text.sbutils.config.group.chatLogger")) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.shopLoggerIncoming")) - .tooltip(Text.translatable("text.sbutils.config.option.shopLoggerIncoming.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.shopLoggerIncoming.tooltip"))) .binding( defaults.shopLoggerIncoming, () -> config.shopLoggerIncoming, (value) -> config.shopLoggerIncoming = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.shopLoggerOutgoing")) - .tooltip(Text.translatable("text.sbutils.config.option.shopLoggerOutgoing.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.shopLoggerOutgoing.tooltip"))) .binding( defaults.shopLoggerOutgoing, () -> config.shopLoggerOutgoing, (value) -> config.shopLoggerOutgoing = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.msgLoggerIncoming")) - .tooltip(Text.translatable("text.sbutils.config.option.msgLoggerIncoming.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.msgLoggerIncoming.tooltip"))) .binding( defaults.msgLoggerIncoming, () -> config.msgLoggerIncoming, (value) -> config.msgLoggerIncoming = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.msgLoggerOutgoing")) - .tooltip(Text.translatable("text.sbutils.config.option.msgLoggerOutgoing.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.msgLoggerOutgoing.tooltip"))) .binding( defaults.msgLoggerOutgoing, () -> config.msgLoggerOutgoing, (value) -> config.msgLoggerOutgoing = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.visitLogger")) - .tooltip(Text.translatable("text.sbutils.config.option.visitLogger.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.visitLogger.tooltip"))) .binding( defaults.visitLogger, () -> config.visitLogger, (value) -> config.visitLogger = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.dpLogger")) - .tooltip(Text.translatable("text.sbutils.config.option.dpLogger.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.dpLogger.tooltip"))) .binding( defaults.dpLogger, () -> config.dpLogger, (value) -> config.dpLogger = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) .build()) .build(); @@ -619,65 +625,65 @@ private static ConfigCategory buildEventNotifierCategory(ModConfig defaults, Mod .name(Text.translatable("text.sbutils.config.category.eventnotifier")) .group(OptionGroup.createBuilder() .name(Text.translatable("text.sbutils.config.group.eventNotifier")) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.showLlamaTitle")) - .tooltip(Text.translatable("text.sbutils.config.option.showLlamaTitle.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.showLlamaTitle.tooltip"))) .binding( defaults.showLlamaTitle, () -> config.showLlamaTitle, (value) -> config.showLlamaTitle = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.playLlamaSound")) - .tooltip(Text.translatable("text.sbutils.config.option.playLlamaSound.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.playLlamaSound.tooltip"))) .binding( defaults.playLlamaSound, () -> config.playLlamaSound, (value) -> config.playLlamaSound = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(ModConfig.NotifSound.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.llamaSound")) - .tooltip(Text.translatable("text.sbutils.config.option.llamaSound.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.llamaSound.tooltip"))) .binding( defaults.llamaSound, () -> config.llamaSound, (value) -> config.llamaSound = value ) - .controller(EnumController::new) + .controller(option -> EnumControllerBuilder.create(option).enumClass(ModConfig.NotifSound.class)) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.showTraderTitle")) - .tooltip(Text.translatable("text.sbutils.config.option.showTraderTitle.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.showTraderTitle.tooltip"))) .binding( defaults.showTraderTitle, () -> config.showTraderTitle, (value) -> config.showTraderTitle = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.playTraderSound")) - .tooltip(Text.translatable("text.sbutils.config.option.playTraderSound.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.playTraderSound.tooltip"))) .binding( defaults.playTraderSound, () -> config.playTraderSound, (value) -> config.playTraderSound = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(ModConfig.NotifSound.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.traderSound")) - .tooltip(Text.translatable("text.sbutils.config.option.traderSound.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.traderSound.tooltip"))) .binding( defaults.traderSound, () -> config.traderSound, (value) -> config.traderSound = value ) - .controller(EnumController::new) + .controller(option -> EnumControllerBuilder.create(option).enumClass(ModConfig.NotifSound.class)) .build()) .build()) .build(); @@ -688,35 +694,35 @@ private static ConfigCategory buildAutoMineCategory(ModConfig defaults, ModConfi .name(Text.translatable("text.sbutils.config.category.automine")) .group(OptionGroup.createBuilder() .name(Text.translatable("text.sbutils.config.group.autoMine")) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.autoMine")) - .tooltip(Text.translatable("text.sbutils.config.option.autoMine.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.autoMine.tooltip"))) .binding( defaults.autoMine, () -> config.autoMine, (value) -> config.autoMine = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.autoSwitch")) - .tooltip(Text.translatable("text.sbutils.config.option.autoSwitch.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.autoSwitch.tooltip"))) .binding( defaults.autoSwitch, () -> config.autoSwitch, (value) -> config.autoSwitch = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(int.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.switchDurability")) - .tooltip(Text.translatable("text.sbutils.config.option.switchDurability.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.switchDurability.tooltip"))) .binding( defaults.switchDurability, () -> config.switchDurability, (value) -> config.switchDurability = value ) - .controller(IntegerFieldController::new) + .controller(IntegerFieldControllerBuilder::create) .build()) .build()) .build(); @@ -727,65 +733,65 @@ private static ConfigCategory buildAutoFixCategory(ModConfig defaults, ModConfig .name(Text.translatable("text.sbutils.config.category.autofix")) .group(OptionGroup.createBuilder() .name(Text.translatable("text.sbutils.config.group.autoFix")) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.autoFix")) - .tooltip(Text.translatable("text.sbutils.config.option.autoFix.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.autoFix.tooltip"))) .binding( defaults.autoFix, () -> config.autoFix, (value) -> config.autoFix = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(ModConfig.FixMode.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.autoFixMode")) - .tooltip(Text.translatable("text.sbutils.config.option.autoFixMode.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.autoFixMode.tooltip"))) .binding( defaults.autoFixMode, () -> config.autoFixMode, (value) -> config.autoFixMode = value ) - .controller(EnumController::new) + .controller(option -> EnumControllerBuilder.create(option).enumClass(ModConfig.FixMode.class)) .build()) - .option(Option.createBuilder(double.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.maxFixPercent")) - .tooltip(Text.translatable("text.sbutils.config.option.maxFixPercent.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.maxFixPercent.tooltip"))) .binding( defaults.maxFixPercent, () -> config.maxFixPercent, (value) -> config.maxFixPercent = value ) - .controller(DoubleFieldController::new) + .controller(DoubleFieldControllerBuilder::create) .build()) - .option(Option.createBuilder(double.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.autoFixDelay")) - .tooltip(Text.translatable("text.sbutils.config.option.autoFixDelay.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.autoFixDelay.tooltip"))) .binding( defaults.autoFixDelay, () -> config.autoFixDelay, (value) -> config.autoFixDelay = value ) - .controller(DoubleFieldController::new) + .controller(DoubleFieldControllerBuilder::create) .build()) - .option(Option.createBuilder(double.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.fixRetryDelay")) - .tooltip(Text.translatable("text.sbutils.config.option.fixRetryDelay.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.fixRetryDelay.tooltip"))) .binding( defaults.fixRetryDelay, () -> config.fixRetryDelay, (value) -> config.fixRetryDelay = value ) - .controller(DoubleFieldController::new) + .controller(DoubleFieldControllerBuilder::create) .build()) - .option(Option.createBuilder(int.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.maxFixRetries")) - .tooltip(Text.translatable("text.sbutils.config.option.maxFixRetries.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.maxFixRetries.tooltip"))) .binding( defaults.maxFixRetries, () -> config.maxFixRetries, (value) -> config.maxFixRetries = value ) - .controller(IntegerFieldController::new) + .controller(IntegerFieldControllerBuilder::create) .build()) .build()) .build(); @@ -796,25 +802,25 @@ private static ConfigCategory buildToolSaverCategory(ModConfig defaults, ModConf .name(Text.translatable("text.sbutils.config.category.toolsaver")) .group(OptionGroup.createBuilder() .name(Text.translatable("text.sbutils.config.group.toolSaver")) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.toolSaver")) - .tooltip(Text.translatable("text.sbutils.config.option.toolSaver.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.toolSaver.tooltip"))) .binding( defaults.toolSaver, () -> config.toolSaver, (value) -> config.toolSaver = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(int.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.toolSaverDurability")) - .tooltip(Text.translatable("text.sbutils.config.option.toolSaverDurability.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.toolSaverDurability.tooltip"))) .binding( defaults.toolSaverDurability, () -> config.toolSaverDurability, (value) -> config.toolSaverDurability = value ) - .controller(IntegerFieldController::new) + .controller(IntegerFieldControllerBuilder::create) .build()) .build()) .build(); @@ -825,25 +831,25 @@ public static ConfigCategory buildAntiPlaceCategory(ModConfig defaults, ModConfi .name(Text.translatable("text.sbutils.config.category.antiplace")) .group(OptionGroup.createBuilder() .name(Text.translatable("text.sbutils.config.group.antiPlace")) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.antiPlaceHeads")) - .tooltip(Text.translatable("text.sbutils.config.option.antiPlaceHeads.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.antiPlaceHeads.tooltip"))) .binding( defaults.antiPlaceHeads, () -> config.antiPlaceHeads, (value) -> config.antiPlaceHeads = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.antiPlaceGrass")) - .tooltip(Text.translatable("text.sbutils.config.option.antiPlaceGrass.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.antiPlaceGrass.tooltip"))) .binding( defaults.antiPlaceGrass, () -> config.antiPlaceGrass, (value) -> config.antiPlaceGrass = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) .build()) .build(); @@ -854,35 +860,35 @@ public static ConfigCategory buildAutoCommandCategory(ModConfig defaults, ModCon .name(Text.translatable("text.sbutils.config.category.autocommand")) .group(OptionGroup.createBuilder() .name(Text.translatable("text.sbutils.config.group.autoCommand")) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.autoCommandEnabled")) - .tooltip(Text.translatable("text.sbutils.config.option.autoCommandEnabled.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.autoCommandEnabled.tooltip"))) .binding( defaults.autoCommandEnabled, () -> config.autoCommandEnabled, (value) -> config.autoCommandEnabled = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(String.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.autoCommand")) - .tooltip(Text.translatable("text.sbutils.config.option.autoCommand.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.autoCommand.tooltip"))) .binding( defaults.autoCommand, () -> config.autoCommand, (value) -> config.autoCommand = value ) - .controller(StringController::new) + .controller(StringControllerBuilder::create) .build()) - .option(Option.createBuilder(double.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.autoCommandDelay")) - .tooltip(Text.translatable("text.sbutils.config.option.autoCommandDelay.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.autoCommandDelay.tooltip"))) .binding( defaults.autoCommandDelay, () -> config.autoCommandDelay, (value) -> config.autoCommandDelay = value ) - .controller(DoubleFieldController::new) + .controller(DoubleFieldControllerBuilder::create) .build()) .build()) .build(); @@ -893,35 +899,35 @@ private static ConfigCategory buildAutoReplyCategory(ModConfig defaults, ModConf .name(Text.translatable("text.sbutils.config.category.autoreply")) .group(OptionGroup.createBuilder() .name(Text.translatable("text.sbutils.config.group.autoReply")) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.autoReply")) - .tooltip(Text.translatable("text.sbutils.config.option.autoReply.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.autoReply.tooltip"))) .binding( defaults.autoReply, () -> config.autoReply, (value) -> config.autoReply = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(String.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.autoResponse")) - .tooltip(Text.translatable("text.sbutils.config.option.autoResponse.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.autoResponse.tooltip"))) .binding( defaults.autoResponse, () -> config.autoResponse, (value) -> config.autoResponse = value ) - .controller(StringController::new) + .controller(StringControllerBuilder::create) .build()) - .option(Option.createBuilder(double.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.autoReplyDelay")) - .tooltip(Text.translatable("text.sbutils.config.option.autoReplyDelay.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.autoReplyDelay.tooltip"))) .binding( defaults.autoReplyDelay, () -> config.autoReplyDelay, (value) -> config.autoReplyDelay = value ) - .controller(DoubleFieldController::new) + .controller(DoubleFieldControllerBuilder::create) .build()) .build()) .build(); @@ -932,45 +938,45 @@ private static ConfigCategory buildAutoRaffleCategory(ModConfig defaults, ModCon .name(Text.translatable("text.sbutils.config.category.autoraffle")) .group(OptionGroup.createBuilder() .name(Text.translatable("text.sbutils.config.group.autoRaffle")) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.autoRaffle")) - .tooltip(Text.translatable("text.sbutils.config.option.autoRaffle.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.autoRaffle.tooltip"))) .binding( defaults.autoRaffle, () -> config.autoRaffle, (value) -> config.autoRaffle = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(int.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.skyblockRaffleTickets")) - .tooltip(Text.translatable("text.sbutils.config.option.skyblockRaffleTickets.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.skyblockRaffleTickets.tooltip"))) .binding( defaults.skyblockRaffleTickets, () -> config.skyblockRaffleTickets, (value) -> config.skyblockRaffleTickets = value ) - .controller(integerOption -> new IntegerSliderController(integerOption, 1, 2, 1)) + .customController(integerOption -> new IntegerSliderController(integerOption, 1, 2, 1)) .build()) - .option(Option.createBuilder(int.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.economyRaffleTickets")) - .tooltip(Text.translatable("text.sbutils.config.option.economyRaffleTickets.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.economyRaffleTickets.tooltip"))) .binding( defaults.economyRaffleTickets, () -> config.economyRaffleTickets, (value) -> config.economyRaffleTickets = value ) - .controller(integerOption -> new IntegerSliderController(integerOption, 1, 5, 1)) + .customController(integerOption -> new IntegerSliderController(integerOption, 1, 2, 1)) .build()) - .option(Option.createBuilder(double.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.grassCheckDelay")) - .tooltip(Text.translatable("text.sbutils.config.option.grassCheckDelay.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.grassCheckDelay.tooltip"))) .binding( defaults.grassCheckDelay, () -> config.grassCheckDelay, (value) -> config.grassCheckDelay = value ) - .controller(DoubleFieldController::new) + .controller(DoubleFieldControllerBuilder::create) .build()) .build()) .build(); @@ -981,26 +987,28 @@ private static ConfigCategory buildAutoPrivateCategory(ModConfig defaults, ModCo .name(Text.translatable("text.sbutils.config.category.autoprivate")) .group(OptionGroup.createBuilder() .name(Text.translatable("text.sbutils.config.group.autoPrivate")) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.autoPrivate")) - .tooltip(Text.translatable("text.sbutils.config.option.autoPrivate.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.autoPrivate.tooltip"))) .binding( defaults.autoPrivate, () -> config.autoPrivate, (value) -> config.autoPrivate = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) .build()) - .group(ListOption.createBuilder(String.class) + .group(ListOption.createBuilder() .name(Text.translatable("text.sbutils.config.option.autoPrivateNames")) - .tooltip(Text.translatable("text.sbutils.config.option.autoPrivateNames.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.autoPrivateNames.tooltip"))) + .maximumNumberOfEntries(2) + .insertEntriesAtEnd(true) .binding( defaults.autoPrivateNames, () -> config.autoPrivateNames, (value) -> config.autoPrivateNames = new LimitedList<>(2, value) ) - .controller(StringController::new) + .controller(StringControllerBuilder::create) .initial("") .build()) .build(); @@ -1011,35 +1019,35 @@ private static ConfigCategory buildAutoSilkCategory(ModConfig defaults, ModConfi .name(Text.translatable("text.sbutils.config.category.autosilk")) .group(OptionGroup.createBuilder() .name(Text.translatable("text.sbutils.config.group.autoSilk")) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.autoSilk")) - .tooltip(Text.translatable("text.sbutils.config.option.autoSilk.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.autoSilk.tooltip"))) .binding( defaults.autoSilk, () -> config.autoSilk, (value) -> config.autoSilk = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(ModConfig.SilkTarget.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.targetTool")) - .tooltip(Text.translatable("text.sbutils.config.option.targetTool.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.targetTool.tooltip"))) .binding( defaults.targetTool, () -> config.targetTool, (value) -> config.targetTool = value ) - .controller(EnumController::new) + .controller(option -> EnumControllerBuilder.create(option).enumClass(ModConfig.SilkTarget.class)) .build()) - .option(Option.createBuilder(double.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.autoSilkDelay")) - .tooltip(Text.translatable("text.sbutils.config.option.autoSilkDelay.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.autoSilkDelay.tooltip"))) .binding( defaults.autoSilkDelay, () -> config.autoSilkDelay, (value) -> config.autoSilkDelay = value ) - .controller(DoubleFieldController::new) + .controller(DoubleFieldControllerBuilder::create) .build()) .build()) .build(); @@ -1050,45 +1058,45 @@ private static ConfigCategory buildAutoCrateCategory(ModConfig defaults, ModConf .name(Text.translatable("text.sbutils.config.category.autocrate")) .group(OptionGroup.createBuilder() .name(Text.translatable("text.sbutils.config.group.autoCrate")) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.autoCrate")) - .tooltip(Text.translatable("text.sbutils.config.option.autoCrate.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.autoCrate.tooltip"))) .binding( defaults.autoCrate, () -> config.autoCrate, (value) -> config.autoCrate = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(ModConfig.CrateMode.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.crateMode")) - .tooltip(Text.translatable("text.sbutils.config.option.crateMode.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.crateMode.tooltip"))) .binding( defaults.crateMode, () -> config.crateMode, (value) -> config.crateMode = value ) - .controller(EnumController::new) + .controller(option -> EnumControllerBuilder.create(option).enumClass(ModConfig.CrateMode.class)) .build()) - .option(Option.createBuilder(double.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.crateDelay")) - .tooltip(Text.translatable("text.sbutils.config.option.crateDelay.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.crateDelay.tooltip"))) .binding( defaults.crateDelay, () -> config.crateDelay, (value) -> config.crateDelay = value ) - .controller(DoubleFieldController::new) + .controller(DoubleFieldControllerBuilder::create) .build()) - .option(Option.createBuilder(double.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.crateDistance")) - .tooltip(Text.translatable("text.sbutils.config.option.crateDistance.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.crateDistance.tooltip"))) .binding( defaults.crateDistance, () -> config.crateDistance, (value) -> config.crateDistance = value ) - .controller(DoubleFieldController::new) + .controller(DoubleFieldControllerBuilder::create) .build()) .build()) .build(); @@ -1099,45 +1107,45 @@ private static ConfigCategory buildStaffDetectorCategory(ModConfig defaults, Mod .name(Text.translatable("text.sbutils.config.category.staffdetector")) .group(OptionGroup.createBuilder() .name(Text.translatable("text.sbutils.config.group.staffDetector")) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.detectStaffJoin")) - .tooltip(Text.translatable("text.sbutils.config.option.detectStaffJoin.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.detectStaffJoin.tooltip"))) .binding( defaults.detectStaffJoin, () -> config.detectStaffJoin, (value) -> config.detectStaffJoin = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.detectStaffLeave")) - .tooltip(Text.translatable("text.sbutils.config.option.detectStaffLeave.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.detectStaffLeave.tooltip"))) .binding( defaults.detectStaffLeave, () -> config.detectStaffLeave, (value) -> config.detectStaffLeave = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(boolean.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.playStaffSound")) - .tooltip(Text.translatable("text.sbutils.config.option.playStaffSound.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.playStaffSound.tooltip"))) .binding( defaults.playStaffSound, () -> config.playStaffSound, (value) -> config.playStaffSound = value ) - .controller(TickBoxController::new) + .controller(TickBoxControllerBuilder::create) .build()) - .option(Option.createBuilder(ModConfig.NotifSound.class) + .option(Option.createBuilder() .name(Text.translatable("text.sbutils.config.option.staffDetectSound")) - .tooltip(Text.translatable("text.sbutils.config.option.staffDetectSound.tooltip")) + .description(OptionDescription.of(Text.translatable("text.sbutils.config.option.staffDetectSound.tooltip"))) .binding( defaults.staffDetectSound, () -> config.staffDetectSound, (value) -> config.staffDetectSound = value ) - .controller(EnumController::new) + .controller(option -> EnumControllerBuilder.create(option).enumClass(ModConfig.NotifSound.class)) .build()) .build()) .build(); diff --git a/src/main/java/net/xolt/sbutils/config/ModConfig.java b/src/main/java/net/xolt/sbutils/config/ModConfig.java index 9b59f70..94c0efb 100644 --- a/src/main/java/net/xolt/sbutils/config/ModConfig.java +++ b/src/main/java/net/xolt/sbutils/config/ModConfig.java @@ -1,9 +1,9 @@ package net.xolt.sbutils.config; import com.mojang.brigadier.context.CommandContext; -import dev.isxander.yacl.api.NameableEnum; -import dev.isxander.yacl.config.ConfigEntry; -import dev.isxander.yacl.config.ConfigInstance; +import dev.isxander.yacl3.api.NameableEnum; +import dev.isxander.yacl3.config.ConfigEntry; +import dev.isxander.yacl3.config.ConfigInstance; import net.minecraft.command.argument.EnumArgumentType; import net.minecraft.item.Item; import net.minecraft.item.Items; @@ -53,11 +53,12 @@ public class ModConfig { // Mentions Settings @ConfigEntry public boolean mentions = false; - @ConfigEntry public boolean excludeServerMsgs = true; - @ConfigEntry public boolean excludeSelfMsgs = true; + @ConfigEntry public boolean playMentionSound = true; @ConfigEntry public NotifSound mentionSound = NotifSound.EXPERIENCE; @ConfigEntry public boolean mentionHighlight = true; @ConfigEntry public Color highlightColor = Color.GOLD; + @ConfigEntry public boolean excludeServerMsgs = true; + @ConfigEntry public boolean excludeSelfMsgs = true; @ConfigEntry public boolean mentionsCurrentAccount = true; @ConfigEntry public List mentionsAliases = List.of(); diff --git a/src/main/java/net/xolt/sbutils/config/ModConfigInstance.java b/src/main/java/net/xolt/sbutils/config/ModConfigInstance.java index c994bf9..2456648 100644 --- a/src/main/java/net/xolt/sbutils/config/ModConfigInstance.java +++ b/src/main/java/net/xolt/sbutils/config/ModConfigInstance.java @@ -1,15 +1,14 @@ package net.xolt.sbutils.config; import com.google.gson.*; -import dev.isxander.yacl.config.ConfigEntry; -import dev.isxander.yacl.config.ConfigInstance; import java.awt.*; import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.StandardOpenOption; - -import dev.isxander.yacl.config.GsonConfigInstance; +import dev.isxander.yacl3.config.ConfigEntry; +import dev.isxander.yacl3.config.ConfigInstance; +import dev.isxander.yacl3.config.GsonConfigInstance; import net.minecraft.text.Style; import net.minecraft.text.Text; import net.xolt.sbutils.SbUtils; diff --git a/src/main/java/net/xolt/sbutils/features/AutoAdvert.java b/src/main/java/net/xolt/sbutils/features/AutoAdvert.java index 657592f..b32eef5 100644 --- a/src/main/java/net/xolt/sbutils/features/AutoAdvert.java +++ b/src/main/java/net/xolt/sbutils/features/AutoAdvert.java @@ -42,7 +42,7 @@ public static void registerCommand(CommandDispatcher }) .then(ClientCommandManager.literal("info") .executes(context -> { - Messenger.printAutoAdvertInfo(ModConfig.INSTANCE.getConfig().autoAdvert, ServerDetector.currentServer == null, getUpdatedAdIndex(getAdList()), delayLeft(), userWhitelisted(), ModConfig.INSTANCE.getConfig().advertUseWhitelist); + Messenger.printAutoAdvertInfo(ModConfig.INSTANCE.getConfig().autoAdvert, ServerDetector.isOnSkyblock(), getUpdatedAdIndex(getAdList()), delayLeft(), userWhitelisted(), ModConfig.INSTANCE.getConfig().advertUseWhitelist); return Command.SINGLE_SUCCESS; })) .then(ClientCommandManager.literal("sbFile") @@ -169,7 +169,7 @@ public static void registerCommand(CommandDispatcher } private static int onListCommand() { - if (ServerDetector.currentServer == null) { + if (!ServerDetector.isOnSkyblock()) { Messenger.printMessage("message.sbutils.autoAdvert.notOnSkyblock"); return Command.SINGLE_SUCCESS; } @@ -179,7 +179,7 @@ private static int onListCommand() { } private static int onAddCommand(String advert) { - if (ServerDetector.currentServer == null) { + if (!ServerDetector.isOnSkyblock()) { Messenger.printMessage("message.sbutils.autoAdvert.notOnSkyblock"); return Command.SINGLE_SUCCESS; } @@ -194,7 +194,7 @@ private static int onAddCommand(String advert) { } private static int onDelCommand(int index) { - if (ServerDetector.currentServer == null) { + if (!ServerDetector.isOnSkyblock()) { Messenger.printMessage("message.sbutils.autoAdvert.notOnSkyblock"); return Command.SINGLE_SUCCESS; } @@ -217,7 +217,7 @@ private static int onDelCommand(int index) { } private static int onInsertCommand(int index, String advert) { - if (ServerDetector.currentServer == null) { + if (!ServerDetector.isOnSkyblock()) { Messenger.printMessage("message.sbutils.autoAdvert.notOnSkyblock"); return Command.SINGLE_SUCCESS; } @@ -240,7 +240,7 @@ private static int onInsertCommand(int index, String advert) { } private static int onToggleCommand(int index) { - if (ServerDetector.currentServer == null) { + if (!ServerDetector.isOnSkyblock()) { Messenger.printMessage("message.sbutils.autoAdvert.notOnSkyblock"); return Command.SINGLE_SUCCESS; } @@ -306,7 +306,7 @@ public static void tick() { joinedAt = System.currentTimeMillis(); } - if (ServerDetector.currentServer == null || (ModConfig.INSTANCE.getConfig().advertUseWhitelist && !userWhitelisted())) { + if (!ServerDetector.isOnSkyblock() || (ModConfig.INSTANCE.getConfig().advertUseWhitelist && !userWhitelisted())) { return; } @@ -398,10 +398,13 @@ private static List formatAdList(List ads) { private static String getAdFile() { String adFile; - if (ServerDetector.currentServer == null) { + if (!ServerDetector.isOnSkyblock()) { return null; } else { switch (ServerDetector.currentServer) { + case SKYBLOCK: + adFile = ModConfig.INSTANCE.getConfig().skyblockAdFile; + break; case ECONOMY: adFile = ModConfig.INSTANCE.getConfig().economyAdFile; break; @@ -409,8 +412,7 @@ private static String getAdFile() { adFile = ModConfig.INSTANCE.getConfig().classicAdFile; break; default: - adFile = ModConfig.INSTANCE.getConfig().skyblockAdFile; - break; + return null; } } diff --git a/src/main/java/net/xolt/sbutils/features/AutoPrivate.java b/src/main/java/net/xolt/sbutils/features/AutoPrivate.java index 98a1d04..7c9f0e4 100644 --- a/src/main/java/net/xolt/sbutils/features/AutoPrivate.java +++ b/src/main/java/net/xolt/sbutils/features/AutoPrivate.java @@ -95,7 +95,7 @@ private static int onDelNameCommand(String name) { } public static boolean onSignEditorOpen(SignEditorOpenS2CPacket packet) { - if (!ModConfig.INSTANCE.getConfig().autoPrivate) { + if (!ModConfig.INSTANCE.getConfig().autoPrivate || !packet.isFront()) { return false; } return updateSign(packet); @@ -113,7 +113,7 @@ private static boolean updateSign(SignEditorOpenS2CPacket packet) { lines[i] = names.get(i); } - MC.getNetworkHandler().sendPacket(new UpdateSignC2SPacket(packet.getPos(), "[private]", "", lines[0], lines[1])); + MC.getNetworkHandler().sendPacket(new UpdateSignC2SPacket(packet.getPos(), true, "[private]", "", lines[0], lines[1])); return true; } } diff --git a/src/main/java/net/xolt/sbutils/features/AutoRaffle.java b/src/main/java/net/xolt/sbutils/features/AutoRaffle.java index 6a5acc2..13452cd 100644 --- a/src/main/java/net/xolt/sbutils/features/AutoRaffle.java +++ b/src/main/java/net/xolt/sbutils/features/AutoRaffle.java @@ -111,17 +111,17 @@ public static void onJoinGame() { } public static void buyTickets() { - if (ServerDetector.currentServer == null) { + if (!ServerDetector.isOnSkyblock()) { return; } else { switch (ServerDetector.currentServer) { + case SKYBLOCK: + buySkyblockTickets(); + break; case ECONOMY: buyEconomyTickets(); break; - case CLASSIC: - break; default: - buySkyblockTickets(); break; } } diff --git a/src/main/java/net/xolt/sbutils/features/JoinCommands.java b/src/main/java/net/xolt/sbutils/features/JoinCommands.java index ab3c7ab..c51813e 100644 --- a/src/main/java/net/xolt/sbutils/features/JoinCommands.java +++ b/src/main/java/net/xolt/sbutils/features/JoinCommands.java @@ -10,6 +10,7 @@ import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource; import net.xolt.sbutils.SbUtils; import net.xolt.sbutils.config.ModConfig; +import net.xolt.sbutils.features.common.ServerDetector; import net.xolt.sbutils.util.IOHandler; import net.xolt.sbutils.util.Messenger; @@ -115,7 +116,7 @@ public static void registerCommand(CommandDispatcher } public static void tick() { - if (!ModConfig.INSTANCE.getConfig().joinCmdsEnabled || !waitingToSend) { + if (!ModConfig.INSTANCE.getConfig().joinCmdsEnabled || !ServerDetector.isOnSkyblock() || !waitingToSend) { return; } diff --git a/src/main/java/net/xolt/sbutils/features/Mentions.java b/src/main/java/net/xolt/sbutils/features/Mentions.java index 5f64443..7e32720 100644 --- a/src/main/java/net/xolt/sbutils/features/Mentions.java +++ b/src/main/java/net/xolt/sbutils/features/Mentions.java @@ -34,6 +34,18 @@ public static void registerCommand(CommandDispatcher Messenger.printChangedSetting("text.sbutils.config.category.mentions", ModConfig.INSTANCE.getConfig().mentions); return Command.SINGLE_SUCCESS; }) + .then(ClientCommandManager.literal("playSound") + .executes(context -> { + Messenger.printSetting("text.sbutils.config.option.playMentionSound", ModConfig.INSTANCE.getConfig().playMentionSound); + return Command.SINGLE_SUCCESS; + }) + .then(ClientCommandManager.argument("enabled", BoolArgumentType.bool()) + .executes(context -> { + ModConfig.INSTANCE.getConfig().playMentionSound = BoolArgumentType.getBool(context, "enabled"); + ModConfig.INSTANCE.save(); + Messenger.printChangedSetting("text.sbutils.config.option.playMentionSound", ModConfig.INSTANCE.getConfig().playMentionSound); + return Command.SINGLE_SUCCESS; + }))) .then(ClientCommandManager.literal("excludeServer") .executes(context -> { Messenger.printSetting("text.sbutils.config.option.excludeServerMsgs", ModConfig.INSTANCE.getConfig().excludeServerMsgs); @@ -160,7 +172,7 @@ private static int onDelAliasCommand(String name) { } public static void processMessage(Text message) { - if (!ModConfig.INSTANCE.getConfig().mentions || !isValidMessage(message)) { + if (!ModConfig.INSTANCE.getConfig().mentions || !ModConfig.INSTANCE.getConfig().playMentionSound || !isValidMessage(message)) { return; } diff --git a/src/main/java/net/xolt/sbutils/features/common/ServerDetector.java b/src/main/java/net/xolt/sbutils/features/common/ServerDetector.java index 7f0b04d..24275ac 100644 --- a/src/main/java/net/xolt/sbutils/features/common/ServerDetector.java +++ b/src/main/java/net/xolt/sbutils/features/common/ServerDetector.java @@ -1,43 +1,80 @@ package net.xolt.sbutils.features.common; -import net.minecraft.text.Text; -import net.minecraft.text.TextColor; -import net.minecraft.util.Formatting; +import com.mojang.brigadier.tree.CommandNode; +import net.minecraft.command.CommandSource; import net.xolt.sbutils.features.AutoAdvert; import net.xolt.sbutils.util.RegexFilters; -import java.util.List; +import static net.xolt.sbutils.SbUtils.MC; public class ServerDetector { public static SbServer currentServer; + private static boolean receivedCommandTree = false; + private static boolean receivedTabHeader = false; + private static String tabHeader; - public static void processMessage(Text message) { - if (RegexFilters.skyblockJoinFilter.matcher(message.getString()).matches()) { - List siblings = message.getSiblings(); - if (siblings.size() < 1) { - return; - } + public static void onPlayerListHeader(String header) { + tabHeader = header; + receivedTabHeader = true; + if (receivedCommandTree) { + determineServer(); + } + } + + public static void afterCommandTree() { + receivedCommandTree = true; + if (receivedTabHeader) { + determineServer(); + } + } + + private static void determineServer() { + if (!receivedCommandTree || !receivedTabHeader || MC.getNetworkHandler() == null + || !RegexFilters.addressFilter.matcher(MC.getNetworkHandler().getConnection().getAddress().toString()).matches()) { + currentServer = null; + onSwitchServer(); + return; + } - TextColor serverColor = siblings.get(siblings.size() - 1).getStyle().getColor(); - if (serverColor.equals(TextColor.fromFormatting(Formatting.GREEN))) { - currentServer = SbServer.SKYBLOCK; - onSwitchServer(); - } else if (serverColor.equals(TextColor.fromFormatting(Formatting.LIGHT_PURPLE))) { - currentServer = SbServer.ECONOMY; - onSwitchServer(); - } else if (serverColor.equals(TextColor.fromFormatting(Formatting.YELLOW))) { - currentServer = SbServer.CLASSIC; - onSwitchServer(); + for (CommandNode node : MC.getNetworkHandler().getCommandDispatcher().getRoot().getChildren()) { + switch (node.getName()) { + case "crophoppers:crophoppers": + currentServer = SbServer.ECONOMY; + onSwitchServer(); + return; + case "mineversesidebar:sidebar": + currentServer = SbServer.HUB; + onSwitchServer(); + return; + case "plugman:plugman": + currentServer = SbServer.SKYBLOCK; + onSwitchServer(); + return; } } + + if (tabHeader.contains("Skyblock Classic")) { + currentServer = SbServer.CLASSIC; + onSwitchServer(); + return; + } + + if (tabHeader.contains("SkyWars")) { + currentServer = SbServer.SKYWARS; + onSwitchServer(); + return; + } + + currentServer = null; + onSwitchServer(); } - public static void onJoinGame() { + public static void onDisconnect() { resetServer(); } - public static void onDisconnect() { + public static void onJoinGame() { resetServer(); } @@ -45,11 +82,20 @@ public static void onSwitchServer() { AutoAdvert.refreshPrevAdlist(); } + public static boolean isOnSkyblock() { + return currentServer == SbServer.SKYBLOCK || currentServer == SbServer.ECONOMY || currentServer == SbServer.CLASSIC; + } + private static void resetServer() { currentServer = null; + receivedCommandTree = false; + receivedTabHeader = false; + tabHeader = null; } public enum SbServer { + HUB, + SKYWARS, SKYBLOCK, ECONOMY, CLASSIC; diff --git a/src/main/java/net/xolt/sbutils/mixins/ClientPlayNetworkHandlerMixin.java b/src/main/java/net/xolt/sbutils/mixins/ClientPlayNetworkHandlerMixin.java index e3e447e..cbc28f1 100644 --- a/src/main/java/net/xolt/sbutils/mixins/ClientPlayNetworkHandlerMixin.java +++ b/src/main/java/net/xolt/sbutils/mixins/ClientPlayNetworkHandlerMixin.java @@ -1,23 +1,18 @@ package net.xolt.sbutils.mixins; -import com.mojang.brigadier.tree.CommandNode; -import com.mojang.brigadier.tree.RootCommandNode; import net.minecraft.client.gui.screen.ingame.EnchantmentScreen; -import net.minecraft.client.network.ClientDynamicRegistryType; import net.minecraft.client.network.ClientPlayNetworkHandler; import net.minecraft.client.network.PlayerListEntry; -import net.minecraft.command.CommandRegistryAccess; -import net.minecraft.command.CommandSource; +import net.minecraft.network.ClientConnection; import net.minecraft.network.packet.Packet; import net.minecraft.network.packet.c2s.play.ChatMessageC2SPacket; import net.minecraft.network.packet.c2s.play.ClickSlotC2SPacket; import net.minecraft.network.packet.s2c.play.*; -import net.minecraft.registry.CombinedDynamicRegistries; -import net.minecraft.registry.RegistryWrapper; +import net.minecraft.registry.DynamicRegistryManager; import net.minecraft.resource.featuretoggle.FeatureSet; -import net.xolt.sbutils.SbUtils; import net.xolt.sbutils.features.*; import net.xolt.sbutils.features.common.ServerDetector; +import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; @@ -26,9 +21,7 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.LocalCapture; -import java.util.Collection; -import java.util.Iterator; -import java.util.UUID; +import java.util.*; import static net.xolt.sbutils.SbUtils.MC; @@ -36,10 +29,16 @@ public abstract class ClientPlayNetworkHandlerMixin { @Shadow - private CombinedDynamicRegistries combinedDynamicRegistries; + private FeatureSet enabledFeatures; @Shadow - private FeatureSet enabledFeatures; + @Final + private ClientConnection connection; + + @Shadow + public abstract void onCommandTree(CommandTreeS2CPacket packet); + + @Shadow public abstract DynamicRegistryManager getRegistryManager(); @Inject(method = "onGameJoin", at = @At("TAIL")) private void onGameJoin(GameJoinS2CPacket packet, CallbackInfo ci) { @@ -88,6 +87,11 @@ private void onHandlePlayerListActionTail(PlayerListS2CPacket.Action action, Pla } } + @Inject(method = "onPlayerListHeader", at = @At("HEAD")) + private void onPlayerListHeader(PlayerListHeaderS2CPacket packet, CallbackInfo ci) { + ServerDetector.onPlayerListHeader(packet.getHeader().getString()); + } + @Inject(method = "onSignEditorOpen", at = @At("HEAD"), cancellable = true) private void onSignEditorOpen(SignEditorOpenS2CPacket packet, CallbackInfo ci) { if (AutoPrivate.onSignEditorOpen(packet)) { @@ -108,20 +112,9 @@ private void onScreenHandlerSlotUpdate(ScreenHandlerSlotUpdateS2CPacket packet, AutoSilk.onInventoryUpdate(packet); } - // Remove conflicting server commands from command tree - // Prevents server command suggestions from interfering with sbutils command suggestions - @ModifyVariable(method = "onCommandTree", at = @At("HEAD"), argsOnly = true) - private CommandTreeS2CPacket onCommandTree(CommandTreeS2CPacket packet) { - RootCommandNode rootNode = packet.getCommandTree(CommandRegistryAccess.of((RegistryWrapper.WrapperLookup)this.combinedDynamicRegistries.getCombinedRegistryManager(), this.enabledFeatures)); - Collection> nodes = rootNode.getChildren(); - - nodes.removeIf((node) -> SbUtils.commands.contains(node.getName())); - - RootCommandNode newRootNode = new RootCommandNode<>(); - - nodes.forEach(newRootNode::addChild); - - return new CommandTreeS2CPacket(newRootNode); + @Inject(method = "onCommandTree", at = @At("TAIL")) + private void afterCommandTree(CommandTreeS2CPacket packet, CallbackInfo ci) { + ServerDetector.afterCommandTree(); } @Inject(method = "sendPacket", at = @At("HEAD")) diff --git a/src/main/java/net/xolt/sbutils/mixins/CommandDispatcherMixin.java b/src/main/java/net/xolt/sbutils/mixins/CommandDispatcherMixin.java new file mode 100644 index 0000000..4a76b41 --- /dev/null +++ b/src/main/java/net/xolt/sbutils/mixins/CommandDispatcherMixin.java @@ -0,0 +1,30 @@ +package net.xolt.sbutils.mixins; + +import com.mojang.brigadier.CommandDispatcher; +import com.mojang.brigadier.tree.CommandNode; +import com.mojang.brigadier.tree.RootCommandNode; +import net.minecraft.command.CommandSource; +import net.xolt.sbutils.SbUtils; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.ModifyVariable; + +import java.util.Collection; + +@Mixin(CommandDispatcher.class) +public class CommandDispatcherMixin { + + // Remove conflicting server commands from command tree + @ModifyVariable(method = "(Lcom/mojang/brigadier/tree/RootCommandNode;)V", at = @At("HEAD"), argsOnly = true) + private static RootCommandNode onInitCommandDispatcher(final RootCommandNode root) { + Collection> nodes = root.getChildren(); + + nodes.removeIf((node) -> SbUtils.commands.contains(node.getName())); + + RootCommandNode newRootNode = new RootCommandNode<>(); + + nodes.forEach(newRootNode::addChild); + + return root; + } +} diff --git a/src/main/java/net/xolt/sbutils/mixins/MessageHandlerMixin.java b/src/main/java/net/xolt/sbutils/mixins/MessageHandlerMixin.java index aeb07ac..5539bcd 100644 --- a/src/main/java/net/xolt/sbutils/mixins/MessageHandlerMixin.java +++ b/src/main/java/net/xolt/sbutils/mixins/MessageHandlerMixin.java @@ -6,7 +6,6 @@ import net.minecraft.network.message.SignedMessage; import net.minecraft.text.Text; import net.xolt.sbutils.features.*; -import net.xolt.sbutils.features.common.ServerDetector; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -52,7 +51,6 @@ private void onGameMessage(Text message, boolean overlay, CallbackInfo ci) { } private static void preFilterMessage(Text message) { - ServerDetector.processMessage(message); ChatLogger.processMessage(message); AutoFix.processMessage(message); AutoRaffle.processMessage(message); diff --git a/src/main/java/net/xolt/sbutils/util/Messenger.java b/src/main/java/net/xolt/sbutils/util/Messenger.java index 10ceddc..5a80c36 100644 --- a/src/main/java/net/xolt/sbutils/util/Messenger.java +++ b/src/main/java/net/xolt/sbutils/util/Messenger.java @@ -1,6 +1,6 @@ package net.xolt.sbutils.util; -import dev.isxander.yacl.api.NameableEnum; +import dev.isxander.yacl3.api.NameableEnum; import net.minecraft.client.network.PlayerListEntry; import net.minecraft.text.MutableText; import net.minecraft.text.Style; @@ -129,13 +129,13 @@ public static void printSetting(String setting, Object value) { printSetting(setting, value, false); } - public static void printAutoAdvertInfo(boolean enabled, boolean serverNull, int adIndex, int remainingDelay, boolean userWhitelisted, boolean whitelistEnabled) { + public static void printAutoAdvertInfo(boolean enabled, boolean onSkyblock, int adIndex, int remainingDelay, boolean userWhitelisted, boolean whitelistEnabled) { if (!enabled) { printSetting("text.sbutils.config.category.autoadvert", false); return; } - if (serverNull) { + if (onSkyblock) { printMessage("message.sbutils.autoAdvert.notOnSkyblock"); return; } diff --git a/src/main/java/net/xolt/sbutils/util/RegexFilters.java b/src/main/java/net/xolt/sbutils/util/RegexFilters.java index de9c9a0..35423fd 100644 --- a/src/main/java/net/xolt/sbutils/util/RegexFilters.java +++ b/src/main/java/net/xolt/sbutils/util/RegexFilters.java @@ -4,10 +4,6 @@ public class RegexFilters { - // Auto Advert - - public static final Pattern skyblockJoinFilter = Pattern.compile("Welcome [\u00a7_a-zA-Z0-9]+, to Skyblock!"); - // Mentions @@ -82,4 +78,10 @@ public class RegexFilters { // Staff Detector public static final Pattern staffFilter = Pattern.compile("\\[Helper\\].*|\\[Mod\\].*|\\[Dev\\].*|\\[Manager\\].*|\\[Admin\\].*"); + + + + // Server Detector + + public static final Pattern addressFilter = Pattern.compile("server.(skyblock.net|skywars.com)\\./.*"); } diff --git a/src/main/resources/assets/sbutils/lang/en_us.json b/src/main/resources/assets/sbutils/lang/en_us.json index cb0d7e7..73fb6b9 100644 --- a/src/main/resources/assets/sbutils/lang/en_us.json +++ b/src/main/resources/assets/sbutils/lang/en_us.json @@ -201,17 +201,19 @@ "text.sbutils.config.group.mentions": "Mentions Settings", "text.sbutils.config.option.mentions": "Mentions Enabled", - "text.sbutils.config.option.mentions.tooltip": "Notifies you with a sound when something is mentioned in chat.", - "text.sbutils.config.option.excludeServerMsgs": "Exclude Server Messages", - "text.sbutils.config.option.excludeServerMsgs.tooltip": "Doesn't notify you about server messages.", - "text.sbutils.config.option.excludeSelfMsgs": "Exclude Self Messages", - "text.sbutils.config.option.excludeSelfMsgs.tooltip": "Doesn't notify you about your own messages.", + "text.sbutils.config.option.mentions.tooltip": "Detects mentions of words/phrases in chat.", + "text.sbutils.config.option.playMentionSound": "Play Mention Sound", + "text.sbutils.config.option.playMentionSound.tooltip": "Notifies you with a sound when something is mentioned in chat.", "text.sbutils.config.option.mentionSound": "Mention Sound", "text.sbutils.config.option.mentionSound.tooltip": "The sound played when something is mentioned in chat.", "text.sbutils.config.option.mentionHighlight": "Mention Highlighting", "text.sbutils.config.option.mentionHighlight.tooltip": "Whether to change the color of mentions in chat.", "text.sbutils.config.option.highlightColor": "Highlight Color", "text.sbutils.config.option.highlightColor.tooltip": "The color to highlight mentions with.", + "text.sbutils.config.option.excludeServerMsgs": "Exclude Server Messages", + "text.sbutils.config.option.excludeServerMsgs.tooltip": "Doesn't notify you about server messages.", + "text.sbutils.config.option.excludeSelfMsgs": "Exclude Self Messages", + "text.sbutils.config.option.excludeSelfMsgs.tooltip": "Doesn't notify you about your own messages.", "text.sbutils.config.option.mentionsCurrentAccount": "Current Account Mentions", "text.sbutils.config.option.mentionsCurrentAccount.tooltip": "Notifies you when your username is mentioned in chat.", "text.sbutils.config.option.mentionsAliases": "Aliases", diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 81c5786..d00f797 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -26,6 +26,6 @@ "depends": { "fabricloader": ">=0.12.11", "fabric": "*", - "minecraft": "1.19.4" + "minecraft": "1.20.x" } } diff --git a/src/main/resources/sbutils.mixins.json b/src/main/resources/sbutils.mixins.json index fb7ea69..bc9e31a 100644 --- a/src/main/resources/sbutils.mixins.json +++ b/src/main/resources/sbutils.mixins.json @@ -8,6 +8,7 @@ "ClientPlayerEntityMixin", "ClientPlayerInteractionManagerMixin", "ClientPlayNetworkHandlerMixin", + "CommandDispatcherMixin", "GameRendererMixin", "MessageHandlerMixin", "MinecraftClientMixin"