Skip to content

Commit

Permalink
new: discord safety warning remover
Browse files Browse the repository at this point in the history
  • Loading branch information
MicrocontrollersDev committed Jun 27, 2023
1 parent 7664ceb commit e14f08e
Show file tree
Hide file tree
Showing 4 changed files with 54 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/main/java/cc/woverflow/hytils/config/HytilsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
Original file line number Diff line number Diff line change
@@ -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 <https://www.gnu.org/licenses/>.
*/

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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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: (?<achievement>.+) {3}<<a";
private String levelUpPattern = "You are now Hypixel Level (?<level>\\d+)!";
Expand Down

0 comments on commit e14f08e

Please sign in to comment.