diff --git a/patches/server/0841-Validate-usernames.patch b/patches/server/0841-Validate-usernames.patch index e26aff06d..2b31764c5 100644 --- a/patches/server/0841-Validate-usernames.patch +++ b/patches/server/0841-Validate-usernames.patch @@ -22,10 +22,18 @@ index d5aa95846e7f52108a03e3731023527281b21d73..1d3cc8836d2ccbec4a8660f86501be35 public static int maxPlayerAutoSavePerTick = 10; private static void playerAutoSaveRate() { diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 33a29890435d6065a2cc4f8e8bf8209c01d5d114..462d8c36166c63a4dc8fa74ac7f82859e6f4b83a 100644 +index 33a29890435d6065a2cc4f8e8bf8209c01d5d114..bb70d2b4d284727aa5dc88dd99534d09c2e38657 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -230,10 +230,38 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -65,6 +65,7 @@ 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; +@@ -230,10 +231,38 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener // Paper end } @@ -55,7 +63,7 @@ index 33a29890435d6065a2cc4f8e8bf8209c01d5d114..462d8c36166c63a4dc8fa74ac7f82859 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; + } diff --git a/patches/server/0851-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch b/patches/server/0851-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch index cdd2a16b1..0a68f370f 100644 --- a/patches/server/0851-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch +++ b/patches/server/0851-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch @@ -5,10 +5,10 @@ Subject: [PATCH] Added getHostname to AsyncPlayerPreLoginEvent diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -index 462d8c36166c63a4dc8fa74ac7f82859e6f4b83a..60ba196e17df34c3ae2a9883e5d28830a2243517 100644 +index bb70d2b4d284727aa5dc88dd99534d09c2e38657..368e32bc12a1a09bf7309f299a1a72554947f43b 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java -@@ -391,7 +391,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener +@@ -392,7 +392,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener // Paper start PlayerProfile profile = CraftPlayerProfile.asBukkitMirror(ServerLoginPacketListenerImpl.this.gameProfile);