Check for more correct profile validation (#10730)
This commit is contained in:
parent
3fb22e8951
commit
763f42fc65
4 changed files with 19 additions and 8 deletions
|
@ -33,6 +33,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+import net.minecraft.Util;
|
||||
+import net.minecraft.server.MinecraftServer;
|
||||
+import net.minecraft.server.players.GameProfileCache;
|
||||
+import net.minecraft.util.StringUtil;
|
||||
+import org.apache.commons.lang3.StringUtils;
|
||||
+import org.apache.commons.lang3.Validate;
|
||||
+import org.bukkit.configuration.serialization.SerializableAs;
|
||||
|
@ -292,6 +293,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+
|
||||
+ private static GameProfile createAuthLibProfile(UUID uniqueId, String name) {
|
||||
+ Preconditions.checkArgument(name == null || name.length() <= 16, "Name cannot be longer than 16 characters");
|
||||
+ Preconditions.checkArgument(name == null || StringUtil.isValidPlayerName(name), "The name of the profile contains invalid characters: %s", name);
|
||||
+ return new GameProfile(
|
||||
+ uniqueId != null ? uniqueId : Util.NIL_UUID,
|
||||
+ name != null ? name : ""
|
||||
|
@ -678,12 +680,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
|||
+ return new com.destroystokyo.paper.profile.CraftPlayerProfile((CraftPlayer) player);
|
||||
+ }
|
||||
+
|
||||
+ final com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile(
|
||||
+ uuid != null ? uuid : net.minecraft.Util.NIL_UUID,
|
||||
+ name != null ? name : ""
|
||||
+ );
|
||||
+ profile.getProperties().putAll(((CraftPlayer) player).getHandle().getGameProfile().getProperties());
|
||||
+ return new com.destroystokyo.paper.profile.CraftPlayerProfile(profile);
|
||||
+ final com.destroystokyo.paper.profile.CraftPlayerProfile profile = new com.destroystokyo.paper.profile.CraftPlayerProfile(uuid, name);
|
||||
+ profile.getGameProfile().getProperties().putAll(((CraftPlayer) player).getHandle().getGameProfile().getProperties());
|
||||
+ return profile;
|
||||
+ }
|
||||
// Paper end
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue