diff --git a/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java b/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java
index fa13ae0..c3b6da8 100644
--- a/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java
+++ b/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java
@@ -128,6 +128,66 @@ public class HytilsConfig extends Config {
// Chat
+ @Switch(
+ name = "Auto GG",
+ description = "Send a \"gg\" message at the end of a game.",
+ category = "Chat", subcategory = "Automatic"
+ )
+ public static boolean autoGG;
+
+ @Switch(
+ name = "Auto GG Second Message",
+ description = "Enable a secondary message to send after your first GG.",
+ category = "Chat", subcategory = "Automatic"
+ )
+ public static boolean autoGGSecondMessage;
+
+ @Switch(
+ name = "Casual Auto GG",
+ description = "Send a \"gg\" message at the end of minigames/events that don't give out Karma, such as SkyBlock and The Pit events.",
+ category = "Chat", subcategory = "Automatic"
+ )
+ public static boolean casualAutoGG;
+
+ @Switch(
+ name = "Anti GG",
+ description = "Remove GG messages from chat.",
+ category = "Chat", subcategory = "Automatic"
+ )
+ public static boolean antiGG;
+
+ @Dropdown(
+ name = "Auto GG First Message",
+ description = "Choose what message is said on game completion.",
+ category = "Chat", subcategory = "Automatic",
+ options = {"gg", "GG", "gf", "Good Game", "Good Fight", "Good Round! :D"}
+ )
+ public static int autoGGMessage = 0;
+
+ @Slider(
+ name = "Auto GG First Phrase Delay",
+ description = "Delay after the game ends to say the first message in seconds.",
+ category = "Chat", subcategory = "Automatic",
+ min = 0, max = 5
+ )
+ public static int autoGGFirstPhraseDelay = 1;
+
+ @Dropdown(
+ name = "Auto GG Second Message",
+ description = "Send a secondary message sent after the first GG message.",
+ category = "Chat", subcategory = "Automatic",
+ options = {"Have a good day!", "<3", "AutoGG By Hytils!", "gf", "Good Fight", "Good Round", ":D", "Well played!", "wp"}
+ )
+ public static int autoGGMessage2 = 0;
+
+ @Slider(
+ name = "Auto GG Second Phrase Delay",
+ description = "Delay after the game ends to say the second message in seconds.",
+ category = "Chat", subcategory = "Automatic",
+ min = 0, max = 5
+ )
+ public static int autoGGSecondPhraseDelay = 1;
+
@Switch(
name = "Auto GL",
description = "Send a message 5 seconds before a Hypixel game starts.",
@@ -339,6 +399,13 @@ public class HytilsConfig extends Config {
)
public static boolean preventShoutingOnCooldown = true;
+ @Switch(
+ name = "Hide Karma Messages",
+ description = "Remove Karma messages from the chat.",
+ category = "Chat", subcategory = "Toggles"
+ )
+ public static boolean hideKarmaMessages;
+
@Switch(
name = "Hide Locraw Messages",
description = "Hide locraw messages in chat (e.g {\"server\": \"something\"}).",
@@ -1065,6 +1132,13 @@ public HytilsConfig() {
addDependency("gexpMode", "autoGetGEXP");
+ addDependency("autoGGSecondMessage", "autoGG");
+ addDependency("casualAutoGG", "autoGG");
+ addDependency("autoGGMessage", "autoGG");
+ addDependency("autoGGFirstPhraseDelay", "autoGG");
+ addDependency("autoGGMessage2", "autoGG");
+ addDependency("autoGGSecondPhraseDelay", "autoGG");
+
addDependency("glPhrase", "autoGL");
addDependency("guildAutoWB", "autoWB");
diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/ChatHandler.java b/src/main/java/org/polyfrost/hytils/handlers/chat/ChatHandler.java
index 3b6b270..065212b 100644
--- a/src/main/java/org/polyfrost/hytils/handlers/chat/ChatHandler.java
+++ b/src/main/java/org/polyfrost/hytils/handlers/chat/ChatHandler.java
@@ -49,6 +49,7 @@ public ChatHandler() {
// Blockers
this.registerModule(new AdBlocker());
+ this.registerModule(new AntiGG());
this.registerModule(new AntiGL());
this.registerModule(new AutoWB());
this.registerModule(new BedwarsAdvertisementsRemover());
@@ -66,6 +67,7 @@ public ChatHandler() {
this.registerModule(new GuildMOTD());
this.registerModule(new HotPotatoRemover());
this.registerModule(new HypeLimitReminderRemover());
+ this.registerModule(new KarmaRemover());
this.registerModule(new LobbyFishingAnnouncementRemover());
this.registerModule(new LobbyStatusRemover());
this.registerModule(new MvpEmotesRemover());
@@ -98,6 +100,7 @@ public ChatHandler() {
this.registerModule(new AutoChatReportConfirm());
this.registerModule(new AutoChatSwapper());
this.registerModule(new AutoFriend());
+ this.registerModule(new AutoGG());
this.registerModule(new AutoGL());
this.registerModule(new AutoPartyWarpConfirm());
this.registerModule(new AutoVictory());
diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/blockers/AntiGG.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/blockers/AntiGG.java
new file mode 100644
index 0000000..fe995a8
--- /dev/null
+++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/blockers/AntiGG.java
@@ -0,0 +1,48 @@
+/*
+ * 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 org.polyfrost.hytils.handlers.chat.modules.blockers;
+
+import cc.polyfrost.oneconfig.utils.hypixel.LocrawUtil;
+import net.minecraft.client.Minecraft;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.client.event.ClientChatReceivedEvent;
+import org.jetbrains.annotations.NotNull;
+import org.polyfrost.hytils.config.HytilsConfig;
+import org.polyfrost.hytils.handlers.chat.ChatReceiveModule;
+
+public class AntiGG implements ChatReceiveModule {
+ @Override
+ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
+ String message = EnumChatFormatting.getTextWithoutFormattingCodes(event.message.getUnformattedText().toLowerCase());
+ if ((message.startsWith("-") && message.endsWith("-")) || (message.startsWith("▬") && message.endsWith("▬")) || (message.startsWith("≡") && message.endsWith("≡")) || (!message.contains(": ")) || (message.contains(Minecraft.getMinecraft().getSession().getUsername().toLowerCase())) || (LocrawUtil.INSTANCE.getLocrawInfo() != null && !LocrawUtil.INSTANCE.isInGame())) return;
+ if (getLanguage().cancelGgMessagesRegex.matcher(message).matches()) {
+ event.setCanceled(true);
+ }
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return HytilsConfig.antiGG;
+ }
+
+ @Override
+ public int getPriority() {
+ return -3;
+ }
+}
diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/blockers/KarmaRemover.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/blockers/KarmaRemover.java
new file mode 100644
index 0000000..5229d77
--- /dev/null
+++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/blockers/KarmaRemover.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 org.polyfrost.hytils.handlers.chat.modules.blockers;
+
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.client.event.ClientChatReceivedEvent;
+import org.jetbrains.annotations.NotNull;
+import org.polyfrost.hytils.config.HytilsConfig;
+import org.polyfrost.hytils.handlers.chat.ChatReceiveModule;
+
+public class KarmaRemover implements ChatReceiveModule {
+ @Override
+ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
+ String message = EnumChatFormatting.getTextWithoutFormattingCodes(event.message.getUnformattedText());
+ if (getLanguage().cancelKarmaMessagesRegex.matcher(message).matches()) {
+ event.setCanceled(true);
+ }
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return HytilsConfig.hideKarmaMessages;
+ }
+
+ @Override
+ public int getPriority() {
+ return -1;
+ }
+}
diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoGG.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoGG.java
new file mode 100644
index 0000000..f2ff72f
--- /dev/null
+++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoGG.java
@@ -0,0 +1,73 @@
+/*
+ * 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 org.polyfrost.hytils.handlers.chat.modules.triggers;
+
+import cc.polyfrost.oneconfig.libs.universal.UChat;
+import cc.polyfrost.oneconfig.utils.Multithreading;
+import net.minecraft.util.EnumChatFormatting;
+import net.minecraftforge.client.event.ClientChatReceivedEvent;
+import org.jetbrains.annotations.NotNull;
+import org.polyfrost.hytils.config.HytilsConfig;
+import org.polyfrost.hytils.handlers.cache.PatternHandler;
+import org.polyfrost.hytils.handlers.chat.ChatReceiveModule;
+
+import java.util.concurrent.TimeUnit;
+import java.util.regex.Pattern;
+
+public class AutoGG implements ChatReceiveModule {
+ private static final String[] ggMessagesOne = {"gg", "GG", "gf", "Good Game", "Good Fight", "Good Round! :D"};
+ private static final String[] ggMessagesTwo = {"Have a good day!", "<3", "AutoGG By Hytils!", "gf", "Good Fight", "Good Round", ":D", "Well played!", "wp"};
+
+ private static String getGGMessageOne() {
+ return ggMessagesOne[HytilsConfig.autoGGMessage];
+ }
+ private static String getGGMessageTwo() {
+ return ggMessagesTwo[HytilsConfig.autoGGMessage2];
+ }
+
+ @Override
+ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
+ String message = EnumChatFormatting.getTextWithoutFormattingCodes(event.message.getUnformattedText()).trim();
+ if (!hasGameEnded(message)) return;
+ Multithreading.schedule(() -> UChat.say("/ac " + getGGMessageOne()), HytilsConfig.autoGGFirstPhraseDelay, TimeUnit.SECONDS);
+ if (HytilsConfig.autoGGSecondMessage)
+ Multithreading.schedule(() -> UChat.say("/ac " + getGGMessageTwo()), HytilsConfig.autoGGSecondPhraseDelay, TimeUnit.SECONDS);
+ }
+
+ private boolean hasGameEnded(String message) {
+ if (!PatternHandler.INSTANCE.gameEnd.isEmpty()) {
+ for (Pattern triggers : PatternHandler.INSTANCE.gameEnd) {
+ if (triggers.matcher(message).matches()) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return HytilsConfig.autoGG;
+ }
+
+ @Override
+ public int getPriority() {
+ return 3;
+ }
+}
diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoVictory.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoVictory.java
index 0d07a1f..3fba4b2 100644
--- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoVictory.java
+++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoVictory.java
@@ -49,7 +49,7 @@ public AutoVictory() {
@Override
public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
String unformattedText = UTextComponent.Companion.stripFormatting(event.message.getUnformattedText());
- if (PatternHandler.INSTANCE.gameEnd.size() != 0) {
+ if (!PatternHandler.INSTANCE.gameEnd.isEmpty()) {
if (!victoryDetected) { // prevent victories being detected twice
Multithreading.runAsync(() -> { //run this async as getting from the API normally would freeze minecraft
for (Pattern triggers : PatternHandler.INSTANCE.gameEnd) {
diff --git a/src/main/java/org/polyfrost/hytils/handlers/language/LanguageData.java b/src/main/java/org/polyfrost/hytils/handlers/language/LanguageData.java
index 1ef7d1c..079acca 100644
--- a/src/main/java/org/polyfrost/hytils/handlers/language/LanguageData.java
+++ b/src/main/java/org/polyfrost/hytils/handlers/language/LanguageData.java
@@ -98,6 +98,8 @@ public class LanguageData {
private String hypixelLevelUp = "You are now Hypixel Level (?\\d+)!";
+ private String cancelGgMessages = "^(?:.* )?(?:\\\\[.+] )?\\\\w{1,16}(?: .+)?: (?:❤|gg|GG|gf|Good Game|Good Fight|Good Round! :D|Have a good day!|<3|AutoGG By Sk1er|AutoGG By Hytils|gf|Good Fight|Good Round|:D|Well Played!|wp)$";
+ private String cancelKarmaMessages = "^\\+(?\\d)+ Karma!$";
private String cancelGlMessages = "(?!.+: )(gl|glhf|good luck|have a good game|autogl by sk1er)";
public String autoChatReportConfirm = "Please type /report confirm to log your report for staff review.";
@@ -164,6 +166,8 @@ public class LanguageData {
public Pattern hypixelLevelUpRegex;
+ public Pattern cancelGgMessagesRegex;
+ public Pattern cancelKarmaMessagesRegex;
public Pattern cancelGlMessagesRegex;
public Pattern gameBossbarAdvertisementRegex;
@@ -227,6 +231,8 @@ public void initialize() {
hypixelLevelUpRegex = Pattern.compile(hypixelLevelUp);
+ cancelGgMessagesRegex = Pattern.compile(cancelGgMessages);
+ cancelKarmaMessagesRegex = Pattern.compile(cancelKarmaMessages);
cancelGlMessagesRegex = Pattern.compile(cancelGlMessages, Pattern.CASE_INSENSITIVE);
gameBossbarAdvertisementRegex = Pattern.compile(gameBossbarAdvertisement);