Skip to content

Commit

Permalink
Fix error thrown when plugin try to build player head with non-Englis…
Browse files Browse the repository at this point in the history
…h name
  • Loading branch information
Dreeam-qwq committed Jul 17, 2024
1 parent c62fc78 commit 7c70eca
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions patches/server/0015-Remove-vanilla-username-check.patch
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,19 @@ index 72cf1372a7e685b3ff4cc852c3d38f7d4f8fc5ad..cccf95f68b40b5fc1ac533e9d0d7d2c1
&& io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.performUsernameValidation
&& !this.iKnowThisMayNotBeTheBestIdeaButPleaseDisableUsernameValidation) {
Validate.validState(StringUtil.isReasonablePlayerName(packet.name()), "Invalid characters in username", me.titaniumtown.ArrayConstants.emptyObjectArray);
diff --git a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
index 0121c90dd7f57be5f484f970f78747a92a734611..86223b0c5ec585080ae90569fb2b52223bb7d6e6 100644
--- a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
+++ b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
@@ -65,7 +65,7 @@ public final class CraftPlayerProfile implements PlayerProfile, com.destroystoky
public CraftPlayerProfile(UUID uniqueId, String name) {
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(name == null || org.dreeam.leaf.config.modules.misc.RemoveVanillaUsernameCheck.enabled || net.minecraft.util.StringUtil.isValidPlayerName(name), "The name of the profile contains invalid characters: %s", name); // Paper - Validate // Leaf - Remove Vanilla username check
this.uniqueId = (uniqueId == null) ? Util.NIL_UUID : uniqueId;
this.name = (name == null) ? "" : name;
}
diff --git a/src/main/java/org/dreeam/leaf/config/modules/misc/RemoveVanillaUsernameCheck.java b/src/main/java/org/dreeam/leaf/config/modules/misc/RemoveVanillaUsernameCheck.java
new file mode 100644
index 0000000000000000000000000000000000000000..ecae8c5d114b2d0510b61c78e3fc705b61f6d126
Expand Down

0 comments on commit 7c70eca

Please sign in to comment.