diff --git a/patches/server/Validate-usernames.patch b/patches/server/Validate-usernames.patch index 893b551577..d227e3750a 100644 --- a/patches/server/Validate-usernames.patch +++ b/patches/server/Validate-usernames.patch @@ -4,6 +4,23 @@ Date: Sat, 1 Jan 2022 05:19:37 -0800 Subject: [PATCH] Validate usernames +diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java +index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 +--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java ++++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java +@@ -0,0 +0,0 @@ public class PaperConfig { + set("settings.unsupported-settings.allow-tnt-duplication", null); + } + ++ public static boolean performUsernameValidation; ++ private static void performUsernameValidation() { ++ performUsernameValidation = getBoolean("settings.unsupported-settings.perform-username-validation", true); ++ } ++ ++ + public static int playerAutoSaveRate = -1; + 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644 --- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java @@ -37,7 +54,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet", new Object[0]); this.gameProfile = packet.getGameProfile(); + // Paper start - validate usernames -+ if (com.destroystokyo.paper.PaperConfig.isProxyOnlineMode()) { ++ if (com.destroystokyo.paper.PaperConfig.isProxyOnlineMode() && com.destroystokyo.paper.PaperConfig.performUsernameValidation) { + if (!validateUsername(this.gameProfile.getName())) { + ServerLoginPacketListenerImpl.this.disconnect("Failed to verify username!"); + return;