@@ -22,10 +22,18 @@ index d5aa95846e7f52108a03e3731023527281b21d73..1d3cc8836d2ccbec4a8660f86501be35
2222 public static int maxPlayerAutoSavePerTick = 10;
2323 private static void playerAutoSaveRate() {
2424diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
25- index 33a29890435d6065a2cc4f8e8bf8209c01d5d114..462d8c36166c63a4dc8fa74ac7f82859e6f4b83a 100644
25+ index 33a29890435d6065a2cc4f8e8bf8209c01d5d114..bb70d2b4d284727aa5dc88dd99534d09c2e38657 100644
2626--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
2727+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
28- @@ -230,10 +230,38 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
28+ @@ -65,6 +65,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
29+ private ServerPlayer delayedAcceptPlayer;
30+ public String hostname = ""; // CraftBukkit - add field
31+ private int velocityLoginMessageId = -1; // Paper - Velocity support
32+ + public boolean iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation = false; // Paper - username validation overriding
33+
34+ public ServerLoginPacketListenerImpl(MinecraftServer server, Connection connection) {
35+ this.state = ServerLoginPacketListenerImpl.State.HELLO;
36+ @@ -230,10 +231,38 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
2937 // Paper end
3038 }
3139
@@ -55,7 +63,7 @@ index 33a29890435d6065a2cc4f8e8bf8209c01d5d114..462d8c36166c63a4dc8fa74ac7f82859
5563 this.gameProfile = packet.getGameProfile();
5664+ // Paper start - validate usernames
5765+ if (com.destroystokyo.paper.PaperConfig.isProxyOnlineMode() && com.destroystokyo.paper.PaperConfig.performUsernameValidation) {
58- + if (!validateUsername(this.gameProfile.getName())) {
66+ + if (!this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation && ! validateUsername(this.gameProfile.getName())) {
5967+ ServerLoginPacketListenerImpl.this.disconnect("Failed to verify username!");
6068+ return;
6169+ }
0 commit comments