Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
arlomcwalter committed Sep 8, 2022
1 parent bedca7c commit 88a991a
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@ public class BetterChat extends Module {
.build()
);

private static final Pattern antiSpamRegex = Pattern.compile(".*(\\([0-9]+\\)$)");
private static final Pattern timestampRegex = Pattern.compile("^(<[0-9]{2}:[0-9]{2}>\\s)");

private final Char2CharMap SMALL_CAPS = new Char2CharOpenHashMap();
private final SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm");

Expand All @@ -211,8 +214,6 @@ public BetterChat() {
compileFilterRegexList();
}

private static final Pattern timestampRegex = Pattern.compile("^(<[0-9]{2}:[0-9]{2}>\\s)");

@EventHandler
private void onMessageReceive(ReceiveMessageEvent event) {
Text message = event.getMessage();
Expand Down Expand Up @@ -250,8 +251,6 @@ private void onMessageReceive(ReceiveMessageEvent event) {
event.setMessage(message);
}

private static final Pattern antiSpamRegex = Pattern.compile(".*(\\([0-9]+\\)$)");

/**
* @author Crosby
* Adding author tag because this is spaghetti code
Expand All @@ -274,7 +273,8 @@ private Text appendAntiSpam(Text text) {
messageIndex = i;
returnText = message.append(Text.literal(" (2)").formatted(Formatting.GRAY));
break;
} else {
}
else {
Matcher matcher = antiSpamRegex.matcher(oldMessage);

if (!matcher.matches()) continue;
Expand Down

0 comments on commit 88a991a

Please sign in to comment.