mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2026-01-06 15:51:31 +00:00
Upstream has released updates that appear to apply and compile correctly Paper Changes: PaperMC/Paper@b0da38c2 Repository details in RuntimeException for MavenLibraryResolver#addRepository (#12939) PaperMC/Paper@1922be90 Update custom tags (#12183) PaperMC/Paper@79cf1353 Ignore HopperInventorySearchEvent when it has no listeners (#13009) PaperMC/Paper@ea014f7a feat: add stuckEntityPoiRetryDelay config (#12949) PaperMC/Paper@a9e76749 Support for showNotification in PlayerRecipeDiscoverEvent (#12992) PaperMC/Paper@5622c9dd Expose attribute sentiment (#12974) PaperMC/Paper@42b653b1 Expose more argument types (#12665) PaperMC/Paper@52d9a221 [ci/skip] Fix typo in Display javadoc (#13010) PaperMC/Paper@614e9acf Improve APIs around riptide tridents (#12996) PaperMC/Paper@51706e5a Fixed DyeItem sheep dye hunk
51 lines
3.3 KiB
Diff
51 lines
3.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Dreeam <61569423+Dreeam-qwq@users.noreply.github.com>
|
|
Date: Wed, 12 Oct 2022 14:36:58 -0400
|
|
Subject: [PATCH] Remove vanilla username check
|
|
|
|
|
|
diff --git a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
index 6d320ed179393e47398c44f2ba2b2285016f349e..79534beb5f4a3427078541fda287d9c950999c96 100644
|
|
--- a/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
+++ b/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
|
|
@@ -163,7 +163,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
|
|
public void handleHello(ServerboundHelloPacket packet) {
|
|
Validate.validState(this.state == ServerLoginPacketListenerImpl.State.HELLO, "Unexpected hello packet");
|
|
// Paper start - Validate usernames
|
|
- if (io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()
|
|
+ if (!org.dreeam.leaf.config.modules.misc.RemoveVanillaUsernameCheck.enabled // Leaf - Remove vanilla username check
|
|
+ && io.papermc.paper.configuration.GlobalConfiguration.get().proxies.isProxyOnlineMode()
|
|
&& io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation
|
|
&& !this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation) {
|
|
Validate.validState(StringUtil.isReasonablePlayerName(packet.name()), "Invalid characters in username");
|
|
diff --git a/net/minecraft/server/players/GameProfileCache.java b/net/minecraft/server/players/GameProfileCache.java
|
|
index 066f84df5c31242ab542932f1e243369d0e766e2..4faa87d18c2e55d6320f9e8ec91862b9e58d26b5 100644
|
|
--- a/net/minecraft/server/players/GameProfileCache.java
|
|
+++ b/net/minecraft/server/players/GameProfileCache.java
|
|
@@ -75,7 +75,7 @@ public class GameProfileCache {
|
|
}
|
|
|
|
private static Optional<GameProfile> lookupGameProfile(GameProfileRepository profileRepo, String name) {
|
|
- if (!StringUtil.isValidPlayerName(name)) {
|
|
+ if (!StringUtil.isValidPlayerName(name, false)) { // Leaf start - Remove vanilla username check - Directly return, skip unnecessary following logic
|
|
return createUnknownProfile(name);
|
|
} else {
|
|
final boolean shouldLookup = !org.apache.commons.lang3.StringUtils.isBlank(name) // Paper - Don't lookup a profile with a blank name
|
|
diff --git a/net/minecraft/util/StringUtil.java b/net/minecraft/util/StringUtil.java
|
|
index c3a99fe7b49858bc0ca9a7f800b0db40465f6901..863c62f076723a4c71a1d07bdc9cc8f9f1739886 100644
|
|
--- a/net/minecraft/util/StringUtil.java
|
|
+++ b/net/minecraft/util/StringUtil.java
|
|
@@ -64,6 +64,12 @@ public class StringUtil {
|
|
}
|
|
|
|
public static boolean isValidPlayerName(String playerName) {
|
|
+ // Leaf start - Remove vanilla username check
|
|
+ return isValidPlayerName(playerName, org.dreeam.leaf.config.modules.misc.RemoveVanillaUsernameCheck.enabled);
|
|
+ }
|
|
+ public static boolean isValidPlayerName(String playerName, boolean bypassCheck) {
|
|
+ if (bypassCheck) return playerName.length() <= 16;
|
|
+ // Leaf end- Remove vanilla username check
|
|
return playerName.length() <= 16 && playerName.chars().filter(i -> i <= 32 || i >= 127).findAny().isEmpty();
|
|
}
|
|
|