diff --git a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java index 4acb8064b3..808d4dbab9 100644 --- a/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java +++ b/src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java @@ -618,6 +618,9 @@ public static class Locations { @SerialEntry public SpidersDen spidersDen = new SpidersDen(); + + @SerialEntry + public Garden garden = new Garden(); } public static class Dungeons { @@ -986,6 +989,11 @@ public static class Relics { public boolean highlightFoundRelics = true; } + public static class Garden { + @SerialEntry + public boolean dicerTitlePrevent = true; + } + public static class Slayer { @SerialEntry public EndermanSlayer endermanSlayer = new EndermanSlayer(); @@ -1082,6 +1090,9 @@ public static class Messages { @SerialEntry public boolean hideMana = false; + + @SerialEntry + public ChatFilterResult hideDicer = ChatFilterResult.PASS; } public enum Info { diff --git a/src/main/java/de/hysky/skyblocker/config/categories/LocationsCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/LocationsCategory.java index 0b388d164b..9bdcf2e992 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/LocationsCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/LocationsCategory.java @@ -98,6 +98,19 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig .controller(ConfigUtils::createBooleanController) .build()) .build()) + + //Garden + .group(OptionGroup.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.locations.garden")) + .collapsed(false) + .option(Option.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.locations.garden.dicerTitlePrevent")) + .binding(defaults.locations.garden.dicerTitlePrevent, + () -> config.locations.garden.dicerTitlePrevent, + newValue -> config.locations.garden.dicerTitlePrevent = newValue) + .controller(ConfigUtils::createBooleanController) + .build()) + .build()) .build(); } } diff --git a/src/main/java/de/hysky/skyblocker/config/categories/MessageFilterCategory.java b/src/main/java/de/hysky/skyblocker/config/categories/MessageFilterCategory.java index ce34904979..acdc816967 100644 --- a/src/main/java/de/hysky/skyblocker/config/categories/MessageFilterCategory.java +++ b/src/main/java/de/hysky/skyblocker/config/categories/MessageFilterCategory.java @@ -118,6 +118,14 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig newValue -> config.messages.hideDeath = newValue) .controller(ConfigUtils::createEnumCyclingListController) .build()) + .option(Option.createBuilder() + .name(Text.translatable("text.autoconfig.skyblocker.option.messages.hideDicer")) + .description(OptionDescription.of(Text.translatable("text.autoconfig.skyblocker.option.messages.hideDicer.@Tooltip"))) + .binding(defaults.messages.hideDicer, + () -> config.messages.hideDicer, + newValue -> config.messages.hideDicer = newValue) + .controller(ConfigUtils::createEnumCyclingListController) + .build()) .build(); } } diff --git a/src/main/java/de/hysky/skyblocker/mixin/InGameHudMixin.java b/src/main/java/de/hysky/skyblocker/mixin/InGameHudMixin.java index c8f6f2724f..88be60cd32 100644 --- a/src/main/java/de/hysky/skyblocker/mixin/InGameHudMixin.java +++ b/src/main/java/de/hysky/skyblocker/mixin/InGameHudMixin.java @@ -19,9 +19,11 @@ import net.minecraft.client.gui.hud.InGameHud; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; +import net.minecraft.text.Text; import net.minecraft.util.Identifier; import java.util.function.Supplier; +import java.util.regex.Pattern; import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; @@ -36,6 +38,9 @@ public abstract class InGameHudMixin { @Unique private static final Supplier SLOT_LOCK_ICON = () -> SkyblockerConfigManager.get().general.itemProtection.slotLockStyle.tex; + @Unique + private static final Pattern DICER_TITLE_BLACKLIST = Pattern.compile(".+? DROP!"); + @Unique private final FancyStatusBars statusBars = new FancyStatusBars(); @@ -101,4 +106,11 @@ public abstract class InGameHudMixin { return cooldownProgress; } + + @Inject(method = "setTitle", at = @At("HEAD"), cancellable = true) + private void skyblocker$dicerTitlePrevent(Text title, CallbackInfo ci) { + if (Utils.isOnSkyblock() && SkyblockerConfigManager.get().locations.garden.dicerTitlePrevent && title != null && DICER_TITLE_BLACKLIST.matcher(title.getString()).matches()) { + ci.cancel(); + } + } } diff --git a/src/main/java/de/hysky/skyblocker/skyblock/filters/DicerFilter.java b/src/main/java/de/hysky/skyblocker/skyblock/filters/DicerFilter.java new file mode 100644 index 0000000000..a3f7868473 --- /dev/null +++ b/src/main/java/de/hysky/skyblocker/skyblock/filters/DicerFilter.java @@ -0,0 +1,15 @@ +package de.hysky.skyblocker.skyblock.filters; + +import de.hysky.skyblocker.config.SkyblockerConfigManager; +import de.hysky.skyblocker.utils.chat.ChatFilterResult; + +public class DicerFilter extends SimpleChatFilter { + public DicerFilter() { + super("[A-Z]+ DROP! .*Dicer dropped [0-9]+x.+!$"); + } + + @Override + public ChatFilterResult state() { + return SkyblockerConfigManager.get().messages.hideDicer; + } +} diff --git a/src/main/java/de/hysky/skyblocker/utils/chat/ChatMessageListener.java b/src/main/java/de/hysky/skyblocker/utils/chat/ChatMessageListener.java index ee43bc4cf0..bdff2d948e 100644 --- a/src/main/java/de/hysky/skyblocker/utils/chat/ChatMessageListener.java +++ b/src/main/java/de/hysky/skyblocker/utils/chat/ChatMessageListener.java @@ -56,7 +56,8 @@ static void init() { new ShowOffFilter(), new ToggleSkyMallFilter(), new MimicFilter(), - new DeathFilter() + new DeathFilter(), + new DicerFilter() }; // Register all listeners to EVENT for (ChatMessageListener listener : listeners) { diff --git a/src/main/resources/assets/skyblocker/lang/en_us.json b/src/main/resources/assets/skyblocker/lang/en_us.json index f17f109eb0..7402b15916 100644 --- a/src/main/resources/assets/skyblocker/lang/en_us.json +++ b/src/main/resources/assets/skyblocker/lang/en_us.json @@ -167,7 +167,9 @@ "text.autoconfig.skyblocker.option.locations.spidersDen": "Spider's Den", "text.autoconfig.skyblocker.option.locations.spidersDen.relics": "Hidden Relics Helper", "text.autoconfig.skyblocker.option.locations.spidersDen.relics.enableRelicsHelper": "Enable Hidden Relics Helper", - "text.autoconfig.skyblocker.option.locations.spidersDen.relics.highlightFoundRelics": "Highlight found relics", + "text.autoconfig.skyblocker.option.locations.spidersDen.relics.highlightFoundRelics": "Highlight Found Relics", + "text.autoconfig.skyblocker.option.locations.garden": "Garden", + "text.autoconfig.skyblocker.option.locations.garden.dicerTitlePrevent": "Enable Dicer Title Prevent", "text.autoconfig.skyblocker.option.locations.dungeons": "Dungeons", "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints": "Dungeon Secret Waypoints", "text.autoconfig.skyblocker.option.locations.dungeons.secretWaypoints.enableRoomMatching": "Enable Room Matching", @@ -324,6 +326,8 @@ "text.autoconfig.skyblocker.option.messages.hideMimicKill.@Tooltip": "Filters the \"Mimic dead!\" and \"Mimic killed!\" messages from chat.", "text.autoconfig.skyblocker.option.messages.hideDeath": "Hide Player Death Messages", "text.autoconfig.skyblocker.option.messages.hideDeath.@Tooltip": "Filters the player death messages from chat.", + "text.autoconfig.skyblocker.option.messages.hideDicer": "Hide Dicer Messages", + "text.autoconfig.skyblocker.option.messages.hideDicer.@Tooltip": "Filters the Dicer messages from chat.", "text.autoconfig.skyblocker.category.slayer": "Slayers", "text.autoconfig.skyblocker.option.slayer.endermanSlayer": "[Beta] Enderman Slayer", "text.autoconfig.skyblocker.option.slayer.endermanSlayer.highlightNukekubiHeads": "Nukekubi Head Highlighting",