From 756c3377eae8f4b5622aee9e26f87ec4b6bf14bc Mon Sep 17 00:00:00 2001 From: Camotoy <20743703+Camotoy@users.noreply.github.com> Date: Mon, 17 Jan 2022 22:52:47 -0500 Subject: [PATCH] Add unsupported field to disable username validation (#7350) * Add unsupported field to disable username validation * Add unsupported field to disable username validation --- patches/server/Validate-usernames.patch | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/patches/server/Validate-usernames.patch b/patches/server/Validate-usernames.patch index d227e3750a..ddf18ae8bc 100644 --- a/patches/server/Validate-usernames.patch +++ b/patches/server/Validate-usernames.patch @@ -25,6 +25,14 @@ diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListene index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +@@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener + private ServerPlayer delayedAcceptPlayer; + public String hostname = ""; // CraftBukkit - add field + private int velocityLoginMessageId = -1; // Paper - Velocity support ++ public boolean iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation = false; // Paper - username validation overriding + + public ServerLoginPacketListenerImpl(MinecraftServer server, Connection connection) { + this.state = ServerLoginPacketListenerImpl.State.HELLO; @@ -0,0 +0,0 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener // Paper end } @@ -55,7 +63,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 this.gameProfile = packet.getGameProfile(); + // Paper start - validate usernames + if (com.destroystokyo.paper.PaperConfig.isProxyOnlineMode() && com.destroystokyo.paper.PaperConfig.performUsernameValidation) { -+ if (!validateUsername(this.gameProfile.getName())) { ++ if (!this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation && !validateUsername(this.gameProfile.getName())) { + ServerLoginPacketListenerImpl.this.disconnect("Failed to verify username!"); + return; + }