diff --git a/src/main/java/tk/avicia/avomod/Avomod.java b/src/main/java/tk/avicia/avomod/Avomod.java index 3538010..d13f939 100644 --- a/src/main/java/tk/avicia/avomod/Avomod.java +++ b/src/main/java/tk/avicia/avomod/Avomod.java @@ -71,6 +71,8 @@ public class Avomod { new ConfigToggle("General", "Notify for avomod BETA Version (may have bugs)", "Disabled", "betaNotification"), new ConfigToggle("Guild", "Filter Out Bank Messages", "Disabled", "filterBankMessages"), new ConfigToggle("Guild", "Filter Out All Resource Messages", "Disabled", "filterResourceMessages"), + new ConfigToggle("Chat", "Filter Out All Shouts", "Disabled", "filterShoutMessages"), + new ConfigToggle("Chat", "Make Shouts Orange", "Enabled", "makeShoutsOrange"), new ConfigToggle("Chat", "Reveal Nicknames", "Enabled", "revealNicks"), new ConfigToggle("Chat", "Auto Skip Quest Dialogue", "Disabled", "skipDialogue"), new ConfigToggle("Chat", "Click to Say Congrats Message", "Enabled", "clickToSayCongrats"), diff --git a/src/main/java/tk/avicia/avomod/features/EventHandlerClass.java b/src/main/java/tk/avicia/avomod/features/EventHandlerClass.java index e277426..e4bbca9 100644 --- a/src/main/java/tk/avicia/avomod/features/EventHandlerClass.java +++ b/src/main/java/tk/avicia/avomod/features/EventHandlerClass.java @@ -13,6 +13,8 @@ import net.minecraftforge.fml.common.gameevent.TickEvent; import tk.avicia.avomod.Avomod; +import java.util.Arrays; + public class EventHandlerClass { private int tick = 0; @@ -50,6 +52,18 @@ public void onChatEvent(ClientChatReceivedEvent event) { event.setCanceled(true); } + // shout management + if (message.contains(":") && message.split(":")[0].endsWith("shouts") && !message.split(":")[0].startsWith("[")) { + if (Avomod.getConfigBoolean("filterShoutMessages")) + event.setCanceled(true); + + if (Avomod.getConfigBoolean("makeShoutsOrange")) { + String start = event.getMessage().getUnformattedText().split(":")[0] + ":"; + String end = String.join(":", Arrays.copyOfRange(event.getMessage().getUnformattedText().split(":"), 1, event.getMessage().getUnformattedText().split(":").length)); + event.setMessage(new TextComponentString(TextFormatting.GOLD + start + TextFormatting.YELLOW + end)); + } + } + if (message.trim().startsWith("Loading Resource Pack...")) { new Thread(() -> { UpdateChecker.checkStableUpdate();