Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable title and chat messages for Melon/Pumpkin Dicer #534

Merged
merged 4 commits into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/main/java/de/hysky/skyblocker/config/SkyblockerConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -618,6 +618,9 @@ public static class Locations {

@SerialEntry
public SpidersDen spidersDen = new SpidersDen();

@SerialEntry
public Garden garden = new Garden();
}

public static class Dungeons {
Expand Down Expand Up @@ -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();
Expand Down Expand Up @@ -1082,6 +1090,9 @@ public static class Messages {

@SerialEntry
public boolean hideMana = false;

@SerialEntry
public ChatFilterResult hideDicer = ChatFilterResult.PASS;
}

public enum Info {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.<Boolean>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();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ public static ConfigCategory create(SkyblockerConfig defaults, SkyblockerConfig
newValue -> config.messages.hideDeath = newValue)
.controller(ConfigUtils::createEnumCyclingListController)
.build())
.option(Option.<ChatFilterResult>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();
}
}
12 changes: 12 additions & 0 deletions src/main/java/de/hysky/skyblocker/mixin/InGameHudMixin.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -36,6 +38,9 @@
public abstract class InGameHudMixin {
@Unique
private static final Supplier<Identifier> 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();

Expand Down Expand Up @@ -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();
}
}
}
Original file line number Diff line number Diff line change
@@ -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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
6 changes: 5 additions & 1 deletion src/main/resources/assets/skyblocker/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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",
Expand Down
Loading