diff --git a/src/main/java/cc/woverflow/hytils/config/HytilsConfig.java b/src/main/java/cc/woverflow/hytils/config/HytilsConfig.java index d81bc98..090a44a 100644 --- a/src/main/java/cc/woverflow/hytils/config/HytilsConfig.java +++ b/src/main/java/cc/woverflow/hytils/config/HytilsConfig.java @@ -553,6 +553,13 @@ public class HytilsConfig extends Config { ) public static boolean hotPotato; + @Switch( + name = "Remove Discord Safety Warning Messages", + description = "Removes \"ยง4Please be mindful of Discord link in chat as they may pose a security risk\"", + category = "Chat", subcategory = "Toggles" + ) + public static boolean discordSafetyWarning; + // AutoWB @Switch( diff --git a/src/main/java/cc/woverflow/hytils/handlers/chat/ChatHandler.java b/src/main/java/cc/woverflow/hytils/handlers/chat/ChatHandler.java index 362a332..eeba6e7 100644 --- a/src/main/java/cc/woverflow/hytils/handlers/chat/ChatHandler.java +++ b/src/main/java/cc/woverflow/hytils/handlers/chat/ChatHandler.java @@ -56,6 +56,7 @@ public ChatHandler() { this.registerModule(new ConnectedMessage()); this.registerModule(new ConnectionStatusRemover()); this.registerModule(new CurseOfSpamRemover()); + this.registerModule(new DiscordSafetyWarningRemover()); this.registerModule(new DuelsBlockTrail()); this.registerModule(new DuelsNoStatsChange()); this.registerModule(new EarnedCoinsAndExpRemover()); diff --git a/src/main/java/cc/woverflow/hytils/handlers/chat/modules/blockers/DiscordSafetyWarningRemover.java b/src/main/java/cc/woverflow/hytils/handlers/chat/modules/blockers/DiscordSafetyWarningRemover.java new file mode 100644 index 0000000..ace724c --- /dev/null +++ b/src/main/java/cc/woverflow/hytils/handlers/chat/modules/blockers/DiscordSafetyWarningRemover.java @@ -0,0 +1,45 @@ +/* + * Hytils Reborn - Hypixel focused Quality of Life mod. + * Copyright (C) 2020, 2021, 2022, 2023 Polyfrost, Sk1er LLC and contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package cc.woverflow.hytils.handlers.chat.modules.blockers; + +import cc.woverflow.hytils.config.HytilsConfig; +import cc.woverflow.hytils.handlers.chat.ChatReceiveModule; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.client.event.ClientChatReceivedEvent; +import org.jetbrains.annotations.NotNull; + +public class DiscordSafetyWarningRemover implements ChatReceiveModule { + @Override + public void onMessageReceived(@NotNull ClientChatReceivedEvent event) { + String message = EnumChatFormatting.getTextWithoutFormattingCodes(event.message.getUnformattedText()); + if (message.equals(getLanguage().chatDiscordSafetyWarning)) { + event.setCanceled(true); + } + } + + @Override + public boolean isEnabled() { + return HytilsConfig.discordSafetyWarning; + } + + @Override + public int getPriority() { + return -1; + } +} diff --git a/src/main/java/cc/woverflow/hytils/handlers/language/LanguageData.java b/src/main/java/cc/woverflow/hytils/handlers/language/LanguageData.java index d96b76e..9bbe354 100644 --- a/src/main/java/cc/woverflow/hytils/handlers/language/LanguageData.java +++ b/src/main/java/cc/woverflow/hytils/handlers/language/LanguageData.java @@ -62,6 +62,7 @@ public class LanguageData { public String chatCleanerCurseOfSpam = "KALI HAS STRIKEN YOU WITH THE CURSE OF SPAM"; public String chatCleanerDuelsBlockTrail = "Your block trail aura is disabled in this mode!"; public String chatCleanerSkyblockWelcome = "Welcome to Hypixel SkyBlock!"; + public String chatDiscordSafetyWarning = "Please be mindful of Discord link in chat as they may pose a security risk"; private String achievementPattern = "a>> {3}Achievement Unlocked: (?.+) {3}<