Skip to content

Commit 60b7d5e

Browse files
authored
Add unsupported field to disable username validation (#7350)
* Add unsupported field to disable username validation * Add unsupported field to disable username validation
1 parent 6d67504 commit 60b7d5e

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

patches/server/0841-Validate-usernames.patch

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,18 @@ index d5aa95846e7f52108a03e3731023527281b21d73..1d3cc8836d2ccbec4a8660f86501be35
2222
public static int maxPlayerAutoSavePerTick = 10;
2323
private static void playerAutoSaveRate() {
2424
diff --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
+ }

patches/server/0851-Added-getHostname-to-AsyncPlayerPreLoginEvent.patch

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ Subject: [PATCH] Added getHostname to AsyncPlayerPreLoginEvent
55

66

77
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
8-
index 462d8c36166c63a4dc8fa74ac7f82859e6f4b83a..60ba196e17df34c3ae2a9883e5d28830a2243517 100644
8+
index bb70d2b4d284727aa5dc88dd99534d09c2e38657..368e32bc12a1a09bf7309f299a1a72554947f43b 100644
99
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
1010
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
11-
@@ -391,7 +391,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
11+
@@ -392,7 +392,7 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener
1212

1313
// Paper start
1414
PlayerProfile profile = CraftPlayerProfile.asBukkitMirror(ServerLoginPacketListenerImpl.this.gameProfile);

0 commit comments

Comments
 (0)