Skip to content

Commit

Permalink
Optimize pattern match
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq committed Oct 7, 2024
1 parent c6fd06f commit 7b3b818
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
public class DiscordSRVExtension {

private static final FileSettings<Config> config = FileStore.INSTANCE.getCONFIG();
private static final Pattern STRIP_COLOR_PATTERN = Pattern.compile("(?i)" + "§" + "[0-9A-FK-ORX]");

public DiscordSRVExtension() {
}
Expand Down Expand Up @@ -62,7 +63,6 @@ public void sendDiscordMessage(PlayerManager pm, MessageType messageType, String

// Try to strip Minecraft format code to plain text
if (message.contains("§")) {
final Pattern STRIP_COLOR_PATTERN = Pattern.compile("(?i)" + "§" + "[0-9A-FK-ORX]");
message = STRIP_COLOR_PATTERN.matcher(message).replaceAll("");
}

Expand Down

0 comments on commit 7b3b818

Please sign in to comment.