Properly create profiles with custom name/uuid (#7558)

This commit is contained in:
Bjarne Koll 2022-03-19 14:39:38 +01:00 committed by GitHub
parent 5eb61dd432
commit 7b46444bea
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 77 additions and 52 deletions

View file

@ -289,16 +289,20 @@ index 0000000000000000000000000000000000000000..7b3b6ef533d32169fbeca389bd61cfc6
+ }
+}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index b175f07b99a07ba50c4721c38f9e6330f02942f8..aae3eec8d28a0047bc590ecc55d87d11ee6d08f0 100644
index b175f07b99a07ba50c4721c38f9e6330f02942f8..88720b2fa92f387714c11a11cba8c9bf0a25e797 100644
--- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2080,6 +2080,40 @@ public final class Bukkit {
@@ -2080,6 +2080,50 @@ public final class Bukkit {
public static boolean suggestPlayerNamesWhenNullTabCompletions() {
return server.suggestPlayerNamesWhenNullTabCompletions();
}
+
+ /**
+ * Creates a PlayerProfile for the specified uuid, with name as null
+ * 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.
+ *
+ * @param uuid UUID to create profile for
+ * @return A PlayerProfile object
+ */
@ -308,7 +312,11 @@ index b175f07b99a07ba50c4721c38f9e6330f02942f8..aae3eec8d28a0047bc590ecc55d87d11
+ }
+
+ /**
+ * Creates a PlayerProfile for the specified name, with UUID as null
+ * 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.
+ *
+ * @param name Name to create profile for
+ * @return A PlayerProfile object
+ */
@ -321,6 +329,8 @@ index b175f07b99a07ba50c4721c38f9e6330f02942f8..aae3eec8d28a0047bc590ecc55d87d11
+ * Creates a 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.
+ *
+ * @param uuid UUID to create profile for
+ * @param name Name to create profile for
@ -334,16 +344,20 @@ index b175f07b99a07ba50c4721c38f9e6330f02942f8..aae3eec8d28a0047bc590ecc55d87d11
@NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 24e68d5cb4f713984b25ab19330cb77f1eddb5cf..51c96a0b6645cf31f4ca051f6a8c75b5f188484c 100644
index 24e68d5cb4f713984b25ab19330cb77f1eddb5cf..29886928ab33edf9965b93e89482a84bd82e4fd2 100644
--- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java
@@ -1825,5 +1825,33 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@@ -1825,5 +1825,43 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @return true if player names should be suggested
*/
boolean suggestPlayerNamesWhenNullTabCompletions();
+
+ /**
+ * Creates a PlayerProfile for the specified uuid, with name as null
+ * 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.
+ *
+ * @param uuid UUID to create profile for
+ * @return A PlayerProfile object
+ */
@ -351,7 +365,11 @@ index 24e68d5cb4f713984b25ab19330cb77f1eddb5cf..51c96a0b6645cf31f4ca051f6a8c75b5
+ com.destroystokyo.paper.profile.PlayerProfile createProfile(@NotNull UUID uuid);
+
+ /**
+ * Creates a PlayerProfile for the specified name, with UUID as null
+ * 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.
+ *
+ * @param name Name to create profile for
+ * @return A PlayerProfile object
+ */
@ -362,6 +380,8 @@ index 24e68d5cb4f713984b25ab19330cb77f1eddb5cf..51c96a0b6645cf31f4ca051f6a8c75b5
+ * Creates a 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.
+ *
+ * @param uuid UUID to create profile for
+ * @param name Name to create profile for