From c2f12a1a4974082158d8f2d42843381b3a227327 Mon Sep 17 00:00:00 2001 From: EpicKnarvik97 Date: Tue, 17 Aug 2021 01:07:20 +0200 Subject: [PATCH] Adds the underscore character to regexes for player detection This fixes a bug where players with underscores in their names won't be added to the player list --- .../knarcraft/minecraftserverlauncher/server/Server.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main/java/net/knarcraft/minecraftserverlauncher/server/Server.java b/src/main/java/net/knarcraft/minecraftserverlauncher/server/Server.java index dabbf09..5956dc6 100644 --- a/src/main/java/net/knarcraft/minecraftserverlauncher/server/Server.java +++ b/src/main/java/net/knarcraft/minecraftserverlauncher/server/Server.java @@ -529,11 +529,11 @@ public class Server { private String getPlayer(String text, boolean joined) { String playerName; - String loginPattern1 = " ([A-Z0-9a-z]+)\\[/[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+:[0-9]+] logged in"; - String loginPattern2 = "UUID of player ([A-Z0-9a-z]+) is"; + String loginPattern1 = " ([A-Z0-9a-z_]+)\\[/[0-9]+\\.[0-9]+\\.[0-9]+\\.[0-9]+:[0-9]+] logged in"; + String loginPattern2 = "UUID of player ([A-Z0-9a-z_]+) is"; - String logoutPattern1 = "INFO]: ([A-Z0-9a-z]+) lost connection"; - String logoutPattern2 = " ([A-Z0-9a-z]+) left the game"; + String logoutPattern1 = "INFO]: ([A-Z0-9a-z_]+) lost connection"; + String logoutPattern2 = " ([A-Z0-9a-z_]+) left the game"; if (joined) { playerName = getFirstRegexCaptureGroup(loginPattern1, text);