diff --git a/patches/api/Basic-PlayerProfile-API.patch b/patches/api/Basic-PlayerProfile-API.patch index 8723ca669a..477d39fa80 100644 --- a/patches/api/Basic-PlayerProfile-API.patch +++ b/patches/api/Basic-PlayerProfile-API.patch @@ -301,7 +301,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * Creates a PlayerProfile for the specified uuid, with name as null. + * + * If a player with the passed uuid exists on the server at the time of creation, the returned player profile will -+ * be populated with the properties of said player. ++ * be populated with the properties of said player (including their uuid and name). + * + * @param uuid UUID to create profile for + * @return A PlayerProfile object @@ -315,7 +315,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * Creates a PlayerProfile for the specified name, with UUID as null. + * + * If a player with the passed name exists on the server at the time of creation, the returned player profile will -+ * be populated with the properties of said player. ++ * be populated with the properties of said player (including their uuid and name). ++ *

++ * E.g. if the player 'jeb_' is currently playing on the server, calling {@code createProfile("JEB_")} will ++ * yield a profile with the name 'jeb_', their uuid and their textures. ++ * To bypass this pre-population on a case-insensitive name match, see {@link #createProfileExact(UUID, String)}. ++ *

+ * + * @param name Name to create profile for + * @return A PlayerProfile object @@ -330,7 +335,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * Both UUID and Name can not be null at same time. One must be supplied. + * If a player with the passed uuid or name exists on the server at the time of creation, the returned player -+ * profile will be populated with the properties of said player. ++ * profile will be populated with the properties of said player (including their uuid and name). ++ *

++ * E.g. if the player 'jeb_' is currently playing on the server, calling {@code createProfile(null, "JEB_")} will ++ * yield a profile with the name 'jeb_', their uuid and their textures. ++ * To bypass this pre-population on an case-insensitive name match, see {@link #createProfileExact(UUID, String)}. ++ *

++ * ++ * The name comparison will compare the {@link String#toLowerCase()} version of both the passed name parameter and ++ * a players name to honour the case-insensitive nature of a mojang profile lookup. + * + * @param uuid UUID to create profile for + * @param name Name to create profile for @@ -339,6 +352,26 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @NotNull + public static com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name) { + return server.createProfile(uuid, name); ++ } ++ ++ /** ++ * Creates an exact PlayerProfile for the specified name/uuid ++ * ++ * Both UUID and Name can not be null at same time. One must be supplied. ++ * If a player with the passed uuid or name exists on the server at the time of creation, the returned player ++ * profile will be populated with the properties of said player. ++ *

++ * Compared to {@link #createProfile(UUID, String)}, this method will never mutate the passed uuid or name. ++ * If a player with either the same uuid or a matching name (case-insensitive) is found on the server, their ++ * properties, such as textures, will be pre-populated in the profile, however the passed uuid and name stay intact. ++ * ++ * @param uuid UUID to create profile for ++ * @param name Name to create profile for ++ * @return A PlayerProfile object ++ */ ++ @NotNull ++ public static com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name) { ++ return server.createProfileExact(uuid, name); + } // Paper end @@ -356,7 +389,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * Creates a PlayerProfile for the specified uuid, with name as null. + * + * If a player with the passed uuid exists on the server at the time of creation, the returned player profile will -+ * be populated with the properties of said player. ++ * be populated with the properties of said player (including their uuid and name). + * + * @param uuid UUID to create profile for + * @return A PlayerProfile object @@ -368,7 +401,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * Creates a PlayerProfile for the specified name, with UUID as null. + * + * If a player with the passed name exists on the server at the time of creation, the returned player profile will -+ * be populated with the properties of said player. ++ * be populated with the properties of said player (including their uuid and name). ++ *

++ * E.g. if the player 'jeb_' is currently playing on the server, calling {@code createProfile("JEB_")} will ++ * yield a profile with the name 'jeb_', their uuid and their textures. ++ * To bypass this pre-population on a case-insensitive name match, see {@link #createProfileExact(UUID, String)}. ++ *

+ * + * @param name Name to create profile for + * @return A PlayerProfile object @@ -381,7 +419,15 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + * + * Both UUID and Name can not be null at same time. One must be supplied. + * If a player with the passed uuid or name exists on the server at the time of creation, the returned player -+ * profile will be populated with the properties of said player. ++ * profile will be populated with the properties of said player (including their uuid and name). ++ *

++ * E.g. if the player 'jeb_' is currently playing on the server, calling {@code createProfile(null, "JEB_")} will ++ * yield a profile with the name 'jeb_', their uuid and their textures. ++ * To bypass this pre-population on an case-insensitive name match, see {@link #createProfileExact(UUID, String)}. ++ *

++ * ++ * The name comparison will compare the {@link String#toLowerCase()} version of both the passed name parameter and ++ * a players name to honour the case-insensitive nature of a mojang profile lookup. + * + * @param uuid UUID to create profile for + * @param name Name to create profile for @@ -389,5 +435,23 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + */ + @NotNull + com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name); ++ ++ /** ++ * Creates an exact PlayerProfile for the specified name/uuid ++ * ++ * Both UUID and Name can not be null at same time. One must be supplied. ++ * If a player with the passed uuid or name exists on the server at the time of creation, the returned player ++ * profile will be populated with the properties of said player. ++ *

++ * Compared to {@link #createProfile(UUID, String)}, this method will never mutate the passed uuid or name. ++ * If a player with either the same uuid or a matching name (case-insensitive) is found on the server, their ++ * properties, such as textures, will be pre-populated in the profile, however the passed uuid and name stay intact. ++ * ++ * @param uuid UUID to create profile for ++ * @param name Name to create profile for ++ * @return A PlayerProfile object ++ */ ++ @NotNull ++ com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name); // Paper end } diff --git a/patches/api/Expose-the-internal-current-tick.patch b/patches/api/Expose-the-internal-current-tick.patch index 91eaba901e..2f30a2ee5e 100644 --- a/patches/api/Expose-the-internal-current-tick.patch +++ b/patches/api/Expose-the-internal-current-tick.patch @@ -9,8 +9,8 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 --- a/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java @@ -0,0 +0,0 @@ public final class Bukkit { - public static com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name) { - return server.createProfile(uuid, name); + public static com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name) { + return server.createProfileExact(uuid, name); } + + public static int getCurrentTick() { @@ -26,7 +26,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 @@ -0,0 +0,0 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi */ @NotNull - com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name); + com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name); + + /** + * Get the current internal server tick diff --git a/patches/server/Basic-PlayerProfile-API.patch b/patches/server/Basic-PlayerProfile-API.patch index c8c9654bb8..3d95a70c40 100644 --- a/patches/server/Basic-PlayerProfile-API.patch +++ b/patches/server/Basic-PlayerProfile-API.patch @@ -660,6 +660,14 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000 + @Override + public com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name) { + Player player = uuid != null ? Bukkit.getPlayer(uuid) : (name != null ? Bukkit.getPlayerExact(name) : null); ++ if (player != null) return new com.destroystokyo.paper.profile.CraftPlayerProfile((CraftPlayer) player); ++ ++ return new com.destroystokyo.paper.profile.CraftPlayerProfile(uuid, name); ++ } ++ ++ @Override ++ public com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name) { ++ Player player = uuid != null ? Bukkit.getPlayer(uuid) : (name != null ? Bukkit.getPlayerExact(name) : null); + if (player == null) return new com.destroystokyo.paper.profile.CraftPlayerProfile(uuid, name); + + if (Objects.equals(uuid, player.getUniqueId()) && Objects.equals(name, player.getName())) {