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

new: discord safety warning remover #81

Merged
merged 3 commits into from
Jun 29, 2023
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
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 links 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 links 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