diff --git a/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java b/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java
index 59bb780..fa13ae0 100644
--- a/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java
+++ b/src/main/java/org/polyfrost/hytils/config/HytilsConfig.java
@@ -171,6 +171,13 @@ public class HytilsConfig extends Config {
)
public static boolean autoPartyWarpConfirm;
+ @Switch(
+ name = "Auto Reply When AFK",
+ description = "Automatically sends a reply to anyone who PMs you when you are AFK in Limbo.",
+ category = "Chat", subcategory = "Automatic"
+ )
+ public static boolean autoReplyAfk;
+
@Switch(
name = "Game Status Restyle",
description = "Replace common game status messages with a new style.\n§eExamples:\n§a§l+ §bSteve §e(§b1§e/§b12§e)\n§c§l- §bSteve§r\n§e§l* §aGame starts in §b§l5 §aseconds.",
diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoAfkReply.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoAfkReply.java
new file mode 100644
index 0000000..aeae401
--- /dev/null
+++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoAfkReply.java
@@ -0,0 +1,50 @@
+/*
+ * 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 net.minecraftforge.client.event.ClientChatReceivedEvent;
+import org.jetbrains.annotations.NotNull;
+import org.polyfrost.hytils.config.HytilsConfig;
+import org.polyfrost.hytils.handlers.chat.ChatReceiveModule;
+
+import java.util.regex.Matcher;
+
+public class AutoAfkReply implements ChatReceiveModule {
+ // TODO: maybe write a general afk checker for skyblock afkers, as they won't be in limbo
+ @Override
+ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
+ if (getLocraw() != null && !getLocraw().getServerId().equals("limbo")) return;
+ String message = event.message.getUnformattedText();
+ Matcher matcher = getLanguage().autoAfkReplyPatternRegex.matcher(message);
+ if (matcher.matches()) {
+ UChat.say("/msg " + matcher.group(2) + " Hey " + matcher.group(2) + ", I am currently AFK!");
+ }
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return HytilsConfig.autoReplyAfk;
+ }
+
+ @Override
+ public int getPriority() {
+ return -1;
+ }
+}
diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoChatReportConfirm.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoChatReportConfirm.java
index e04156b..0260e6e 100644
--- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoChatReportConfirm.java
+++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoChatReportConfirm.java
@@ -28,12 +28,6 @@
import java.util.concurrent.TimeUnit;
public class AutoChatReportConfirm implements ChatReceiveModule {
-
- @Override
- public int getPriority() {
- return 3;
- }
-
@Override
public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
if (event.message.getUnformattedText().equals(getLanguage().autoChatReportConfirm)) {
@@ -46,4 +40,9 @@ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
public boolean isEnabled() {
return HytilsConfig.autoChatReportConfirm;
}
+
+ @Override
+ public int getPriority() {
+ return 3;
+ }
}
diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoChatSwapper.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoChatSwapper.java
index bc5eadc..4fed004 100644
--- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoChatSwapper.java
+++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoChatSwapper.java
@@ -40,12 +40,6 @@
import java.util.regex.Matcher;
public class AutoChatSwapper implements ChatReceiveModule {
-
- @Override
- public int getPriority() {
- return 3;
- }
-
@SuppressWarnings("all")
@Override
public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
@@ -118,6 +112,11 @@ public boolean isEnabled() {
return HytilsConfig.chatSwapper;
}
+ @Override
+ public int getPriority() {
+ return 3;
+ }
+
public static class ChatChannelMessagePreventer {
private boolean hasDetected;
diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoGL.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoGL.java
index c3e6dec..eaabb62 100644
--- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoGL.java
+++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoGL.java
@@ -33,8 +33,12 @@ private static String getGLMessage() {
}
@Override
- public int getPriority() {
- return 3;
+ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
+ String message = EnumChatFormatting.getTextWithoutFormattingCodes(event.message.getUnformattedText()).trim();
+ if (message.contains(": ")) return;
+ if (message.endsWith("The game starts in 5 seconds!")) {
+ Minecraft.getMinecraft().thePlayer.sendChatMessage("/ac " + getGLMessage());
+ }
}
@Override
@@ -43,11 +47,7 @@ public boolean isEnabled() {
}
@Override
- public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
- String message = EnumChatFormatting.getTextWithoutFormattingCodes(event.message.getUnformattedText()).trim();
- if (message.contains(": ")) return;
- if (message.endsWith("The game starts in 5 seconds!")) {
- Minecraft.getMinecraft().thePlayer.sendChatMessage("/ac " + getGLMessage());
- }
+ public int getPriority() {
+ return 3;
}
}
diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoPartyWarpConfirm.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoPartyWarpConfirm.java
index c645a0d..f9d2ca0 100644
--- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoPartyWarpConfirm.java
+++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoPartyWarpConfirm.java
@@ -29,7 +29,6 @@
import java.util.concurrent.TimeUnit;
public class AutoPartyWarpConfirm implements ChatReceiveModule {
-
@Override
public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
final String message = EnumChatFormatting.getTextWithoutFormattingCodes(event.message.getUnformattedText());
@@ -40,12 +39,12 @@ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
}
@Override
- public int getPriority() {
- return 3;
+ public boolean isEnabled() {
+ return HytilsConfig.autoPartyWarpConfirm;
}
@Override
- public boolean isEnabled() {
- return HytilsConfig.autoPartyWarpConfirm;
+ public int getPriority() {
+ return 3;
}
}
diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoQueue.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoQueue.java
index 6ca7e07..425b2e1 100644
--- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoQueue.java
+++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoQueue.java
@@ -36,14 +36,6 @@ public class AutoQueue implements ChatReceiveModule {
private String command = null;
private boolean sentCommand;
- /**
- * We want this to activate early so that it catches the queue message.
- */
- @Override
- public int getPriority() {
- return -11;
- }
-
@Override
public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
if (!HytilsConfig.autoQueue) {
@@ -62,11 +54,6 @@ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
}
}
- @Override
- public boolean isEnabled() {
- return HytilsConfig.autoQueue;
- }
-
@SubscribeEvent
public void onKeyInput(InputEvent.KeyInputEvent event) {
if (this.command != null) {
@@ -99,4 +86,17 @@ private void switchGame() {
}, HytilsConfig.autoQueueDelay, TimeUnit.SECONDS);
}
+
+ @Override
+ public boolean isEnabled() {
+ return HytilsConfig.autoQueue;
+ }
+
+ /**
+ * We want this to activate early so that it catches the queue message.
+ */
+ @Override
+ public int getPriority() {
+ return -11;
+ }
}
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 f8e8029..0d07a1f 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
@@ -46,16 +46,6 @@ public AutoVictory() {
MinecraftForge.EVENT_BUS.register(this);
}
- @Override
- public int getPriority() {
- return 3;
- }
-
- @Override
- public boolean isEnabled() {
- return HytilsConfig.autoGetWinstreak || HytilsConfig.autoGetGEXP;
- }
-
@Override
public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
String unformattedText = UTextComponent.Companion.stripFormatting(event.message.getUnformattedText());
@@ -153,4 +143,15 @@ private boolean isSupportedMode(LocrawInfo locraw) {
}
return false;
}
+
+ @Override
+ public boolean isEnabled() {
+ return HytilsConfig.autoGetWinstreak || HytilsConfig.autoGetGEXP;
+ }
+
+ @Override
+ public int getPriority() {
+ return 3;
+ }
+
}
diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoWB.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoWB.java
index 6f4725d..33249ee 100644
--- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoWB.java
+++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoWB.java
@@ -33,17 +33,6 @@
import java.util.regex.Matcher;
public class AutoWB implements ChatReceiveModule {
-
- @Override
- public int getPriority() {
- return -6;
- }
-
- @Override
- public boolean isEnabled() {
- return HytilsConfig.autoWB;
- }
-
@Override
public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
String msg = event.message.getFormattedText().trim();
@@ -95,4 +84,14 @@ private String getNextMessage(String name) {
return newMessage.replace("%player%", name);
}
}
+
+ @Override
+ public boolean isEnabled() {
+ return HytilsConfig.autoWB;
+ }
+
+ @Override
+ public int getPriority() {
+ return -6;
+ }
}
diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoWarn.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoWarn.java
index fbef735..cc5dd7a 100644
--- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoWarn.java
+++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/AutoWarn.java
@@ -27,8 +27,10 @@
public class AutoWarn implements ChatReceiveModule {
@Override
- public int getPriority() {
- return 3;
+ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
+ if (UTextComponent.Companion.stripFormatting(event.message.getUnformattedText()).startsWith("A kick")) {
+ UChat.say(HytilsConfig.putInCaps ? "/pc ---------REQUEUE, I'VE BEEN KICKED!---------" : "/pc ---------I've been kicked, please requeue!---------");
+ }
}
@Override
@@ -37,9 +39,7 @@ public boolean isEnabled() {
}
@Override
- public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
- if (UTextComponent.Companion.stripFormatting(event.message.getUnformattedText()).startsWith("A kick")) {
- UChat.say(HytilsConfig.putInCaps ? "/pc ---------REQUEUE, I'VE BEEN KICKED!---------" : "/pc ---------I've been kicked, please requeue!---------");
- }
+ public int getPriority() {
+ return 3;
}
}
diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/GuildWelcomer.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/GuildWelcomer.java
index 952f87c..64d1fb3 100644
--- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/GuildWelcomer.java
+++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/GuildWelcomer.java
@@ -27,12 +27,6 @@
import java.util.regex.Matcher;
public class GuildWelcomer implements ChatReceiveModule {
-
- @Override
- public int getPriority() {
- return 1;
- }
-
@Override
public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
final String text = event.message.getUnformattedText();
@@ -46,4 +40,9 @@ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
public boolean isEnabled() {
return HytilsConfig.guildWelcomeMessage;
}
+
+ @Override
+ public int getPriority() {
+ return 1;
+ }
}
diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/SilentRemoval.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/SilentRemoval.java
index c23ed88..3d29ff9 100644
--- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/SilentRemoval.java
+++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/SilentRemoval.java
@@ -30,7 +30,6 @@
import java.util.regex.Matcher;
public class SilentRemoval implements ChatReceiveModule {
-
private static final Set silentUsers = new HashSet<>();
@Override
diff --git a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/ThankWatchdog.java b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/ThankWatchdog.java
index 0423fc1..d0cc1dc 100644
--- a/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/ThankWatchdog.java
+++ b/src/main/java/org/polyfrost/hytils/handlers/chat/modules/triggers/ThankWatchdog.java
@@ -25,12 +25,6 @@
import org.jetbrains.annotations.NotNull;
public class ThankWatchdog implements ChatReceiveModule {
-
- @Override
- public int getPriority() {
- return 3;
- }
-
@Override
public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
if (event.message.getUnformattedText().equals("[WATCHDOG ANNOUNCEMENT]") || event.message.getUnformattedText().startsWith("A player has been removed from your")) {
@@ -42,4 +36,9 @@ public void onMessageReceived(@NotNull ClientChatReceivedEvent event) {
public boolean isEnabled() {
return HytilsConfig.thankWatchdog;
}
+
+ @Override
+ public int getPriority() {
+ return 3;
+ }
}
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 986df72..1ef7d1c 100644
--- a/src/main/java/org/polyfrost/hytils/handlers/language/LanguageData.java
+++ b/src/main/java/org/polyfrost/hytils/handlers/language/LanguageData.java
@@ -35,6 +35,7 @@ public class LanguageData {
private String autoQueuePrefixGlobal = "^(?:You died! .+|YOU DIED! .+|You have been eliminated!|You won! .+|YOU WON! .+)$";
private String autoFriendPattern = "Friend request from (?.+)\\[ACCEPT] - \\[DENY] - \\[IGNORE].*";
+ private String autoAfkReplyPattern = "^From (\\[.+?] )?(.+?): .+$";
private String chatCleanerJoin = "(?:sled into|slid into|joined|spooked into) the lobby";
private String chatCleanerTicketAnnouncer = "^(?(?!You )\\w{1,16} )has found an? .+$";
@@ -114,6 +115,7 @@ public class LanguageData {
public Pattern autoQueuePrefixGlobalRegex;
public Pattern autoFriendPatternRegex;
+ public Pattern autoAfkReplyPatternRegex;
public Pattern chatCleanerJoinRegex;
public Pattern chatCleanerTicketAnnouncerRegex;
@@ -176,6 +178,7 @@ public void initialize() {
autoQueuePrefixGlobalRegex = Pattern.compile(autoQueuePrefixGlobal);
autoFriendPatternRegex = Pattern.compile(autoFriendPattern);
+ autoAfkReplyPatternRegex = Pattern.compile(autoAfkReplyPattern);
chatCleanerJoinRegex = Pattern.compile(chatCleanerJoin);
chatCleanerTicketAnnouncerRegex = Pattern.compile(chatCleanerTicketAnnouncer);