Skip to content

Commit

Permalink
Fix config for username checks
Browse files Browse the repository at this point in the history
  • Loading branch information
MrHua269 committed Nov 30, 2024
1 parent ff4fdcc commit 6a8df37
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion patches/server/0011-Add-config-for-username-check.patch
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ index 0000000000000000000000000000000000000000..c7e4724cc4ab8d911bcaf0106c098b26
+ }
+}
diff --git a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
index 8098b1a447a7c054e15edc09d2fa50e48f73e926..b6a65bdddc8eaf64931d9aa3f4801dc8e128801b 100644
index 227d62a69a453d49c28568ecb41ecef85a35405b..d1f70437eb43dd536e7b3dac7a770525eff55318 100644
--- a/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerLoginPacketListenerImpl.java
@@ -178,7 +178,8 @@ public class ServerLoginPacketListenerImpl implements ServerLoginPacketListener,
Expand All @@ -44,3 +44,25 @@ index 8098b1a447a7c054e15edc09d2fa50e48f73e926..b6a65bdddc8eaf64931d9aa3f4801dc8
&& io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation
&& !this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation) {
Validate.validState(StringUtil.isReasonablePlayerName(packet.name()), "Invalid characters in username", new Object[0]);
diff --git a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
index f58dec12326734c61f4bc2298a87fb38f1ac1dc4..249ecfb1b1830befa43ba172c65527b077bb8f4e 100644
--- a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
+++ b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
@@ -42,7 +42,7 @@ public final class CraftPlayerProfile implements PlayerProfile, com.destroystoky
Preconditions.checkArgument(isValidSkullProfile, "The skull profile is missing a name or textures!");
// Paper start - Validate
Preconditions.checkArgument(gameProfile.getName().length() <= 16, "The name of the profile is longer than 16 characters");
- Preconditions.checkArgument(net.minecraft.util.StringUtil.isValidPlayerName(gameProfile.getName()), "The name of the profile contains invalid characters: %s", gameProfile.getName());
+ Preconditions.checkArgument(!me.earthme.luminol.config.modules.misc.UsernameCheckConfig.enabled || net.minecraft.util.StringUtil.isValidPlayerName(gameProfile.getName()), "The name of the profile contains invalid characters: %s", gameProfile.getName()); // Luminol - Add config for username checks
final PropertyMap properties = gameProfile.getProperties();
Preconditions.checkArgument(properties.size() <= 16, "The profile contains more than 16 properties");
for (final Property property : properties.values()) {
@@ -79,7 +79,7 @@ public final class CraftPlayerProfile implements PlayerProfile, com.destroystoky
Preconditions.checkArgument((uniqueId != null) || !StringUtils.isBlank(name), "uniqueId is null or name is blank");
}
Preconditions.checkArgument(name == null || name.length() <= 16, "The name of the profile is longer than 16 characters"); // Paper - Validate
- Preconditions.checkArgument(name == null || net.minecraft.util.StringUtil.isValidPlayerName(name), "The name of the profile contains invalid characters: %s", name); // Paper - Validate
+ Preconditions.checkArgument(!me.earthme.luminol.config.modules.misc.UsernameCheckConfig.enabled || name == null || net.minecraft.util.StringUtil.isValidPlayerName(name), "The name of the profile contains invalid characters: %s", name); // Paper - Validate // Luminol - Add config for username checks
this.uniqueId = uniqueId;
this.name = name;
}

0 comments on commit 6a8df37

Please sign in to comment.