Paper/CraftBukkit-Patches/0135-Don-t-special-case-invalid-usernames-for-UUIDs.patch

35 lines
1.6 KiB
Diff

From cb7d74c21d70f489a2a9031d63ab929370ae98d0 Mon Sep 17 00:00:00 2001
From: md_5 <git@md-5.net>
Date: Sun, 20 Apr 2014 18:58:00 +1000
Subject: [PATCH] Don't special case 'invalid' usernames for UUIDs.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 56ed950..c5268f1 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -229,8 +229,6 @@ public final class CraftServer implements Server {
private boolean printSaveWarning;
private CraftIconCache icon;
private boolean overrideAllCommandBlockCommands = false;
- private final Pattern validUserPattern = Pattern.compile("^[a-zA-Z0-9_]{2,16}$");
- private final UUID invalidUserUUID = UUID.nameUUIDFromBytes("InvalidUsername".getBytes(Charsets.UTF_8));
private final class BooleanWrapper {
private boolean value = true;
@@ -1325,11 +1323,6 @@ public final class CraftServer implements Server {
Validate.notNull(name, "Name cannot be null");
com.google.common.base.Preconditions.checkArgument( !org.apache.commons.lang.StringUtils.isBlank( name ), "Name cannot be blank" ); // Spigot
- // If the name given cannot ever be a valid username give a dummy return, for scoreboard plugins
- if (!validUserPattern.matcher(name).matches()) {
- return new CraftOfflinePlayer(this, new GameProfile(invalidUserUUID, name));
- }
-
OfflinePlayer result = getPlayerExact(name);
if (result == null) {
// This is potentially blocking :(
--
1.9.1