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
This commit is contained in:
Kristian Knarvik 2021-08-17 01:07:20 +02:00
parent 5030b4932b
commit c2f12a1a49

View File

@ -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);