Skip to content

Commit

Permalink
fix up the feature
Browse files Browse the repository at this point in the history
  • Loading branch information
MicrocontrollersDev committed Jun 18, 2024
1 parent b503bca commit 4687cc7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
11 changes: 2 additions & 9 deletions src/main/java/org/polyfrost/hytils/config/HytilsConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -172,19 +172,12 @@ public class HytilsConfig extends Config {
public static boolean autoPartyWarpConfirm;

@Switch(
name = "Auto Reply when AFK",
description = "Automatically sends a reply of your choosing when you are AFK in Limbo.",
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;

@Text(
name = "Auto Reply Message",
category = "Chat", subcategory = "Automatic",
size = 2
)
public static String autoReplyAfkMessage = "Hey, I am currently AFK!";

@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.",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@
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.getFormattedText();
String message = event.message.getUnformattedText();
Matcher matcher = getLanguage().autoAfkReplyPatternRegex.matcher(message);
if (matcher.find(0)) {
UChat.say("/r " + HytilsConfig.autoReplyAfkMessage);
if (matcher.matches()) {
UChat.say("/msg " + matcher.group(2) + " Hey " + matcher.group(2) + ", I am currently AFK!");
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +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 (?<name>.+)\\[ACCEPT] - \\[DENY] - \\[IGNORE].*";
private String autoAfkReplyPattern = "^§dFrom (?<prefix>.+): §r(?<message>§7.*)(?:§r)?$";
private String autoAfkReplyPattern = "^From (\\[.+?] )?(.+?): .+$";

private String chatCleanerJoin = "(?:sled into|slid into|joined|spooked into) the lobby";
private String chatCleanerTicketAnnouncer = "^(?<player>(?!You )\\w{1,16} )has found an? .+$";
Expand Down

0 comments on commit 4687cc7

Please sign in to comment.