From 3a87e4779615221be655c54fcd9f95db19e3d244 Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Mon, 17 Dec 2018 15:35:05 -0500 Subject: [PATCH] Remove validation check since these usernames exist anyway. --- .../proxy/connection/client/LoginSessionHandler.java | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/LoginSessionHandler.java b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/LoginSessionHandler.java index d8ebb72e4..e4fa11540 100644 --- a/proxy/src/main/java/com/velocitypowered/proxy/connection/client/LoginSessionHandler.java +++ b/proxy/src/main/java/com/velocitypowered/proxy/connection/client/LoginSessionHandler.java @@ -43,7 +43,6 @@ import java.util.Arrays; import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ThreadLocalRandom; -import java.util.regex.Pattern; import net.kyori.text.Component; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -54,7 +53,6 @@ public class LoginSessionHandler implements MinecraftSessionHandler { private static final Logger logger = LogManager.getLogger(LoginSessionHandler.class); private static final String MOJANG_HASJOINED_URL = "https://sessionserver.mojang.com/session/minecraft/hasJoined?username=%s&serverId=%s&ip=%s"; - private static final Pattern VALID_MINECRAFT_USERNAME = Pattern.compile("^[a-zA-Z0-9_]{1,16}$"); private final VelocityServer server; private final MinecraftConnection inbound; @@ -73,15 +71,6 @@ public class LoginSessionHandler implements MinecraftSessionHandler { @Override public boolean handle(ServerLogin packet) { - // Disallow logins from invalid usernames. - if (server.getConfiguration().isOnlineMode()) { - // In online-mode, follow Mojang's username rules. - if (!VALID_MINECRAFT_USERNAME.matcher(packet.getUsername()).matches()) { - inbound.closeWith(Disconnect.create(VelocityMessages.INVALID_USERNAME)); - return true; - } - } - this.login = packet; if (inbound.getProtocolVersion().compareTo(MINECRAFT_1_13) >= 0) { playerInfoId = ThreadLocalRandom.current().nextInt();