Check for more correct profile validation (#10730)

This commit is contained in:
Jake Potrebic 2024-05-19 17:45:43 -07:00 committed by GitHub
parent b3b340617e
commit 591521e697
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
16 changed files with 71 additions and 60 deletions

View File

@ -330,7 +330,7 @@ diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Buk
index 53f56d95bdf484caed9effbedfe507f6745bb8c0..5aa1aafddd28a5aa52274f37c09bf0fda75f7ea3 100644 index 53f56d95bdf484caed9effbedfe507f6745bb8c0..5aa1aafddd28a5aa52274f37c09bf0fda75f7ea3 100644
--- a/src/main/java/org/bukkit/Bukkit.java --- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2385,6 +2385,83 @@ public final class Bukkit { @@ -2385,6 +2385,89 @@ public final class Bukkit {
public static boolean suggestPlayerNamesWhenNullTabCompletions() { public static boolean suggestPlayerNamesWhenNullTabCompletions() {
return server.suggestPlayerNamesWhenNullTabCompletions(); return server.suggestPlayerNamesWhenNullTabCompletions();
} }
@ -362,6 +362,8 @@ index 53f56d95bdf484caed9effbedfe507f6745bb8c0..5aa1aafddd28a5aa52274f37c09bf0fd
+ * + *
+ * @param name Name to create profile for + * @param name Name to create profile for
+ * @return A PlayerProfile object + * @return A PlayerProfile object
+ * @throws IllegalArgumentException if the name is longer than 16 characters
+ * @throws IllegalArgumentException if the name contains invalid characters
+ */ + */
+ @NotNull + @NotNull
+ public static com.destroystokyo.paper.profile.PlayerProfile createProfile(@NotNull String name) { + public static com.destroystokyo.paper.profile.PlayerProfile createProfile(@NotNull String name) {
@ -386,6 +388,8 @@ index 53f56d95bdf484caed9effbedfe507f6745bb8c0..5aa1aafddd28a5aa52274f37c09bf0fd
+ * @param uuid UUID to create profile for + * @param uuid UUID to create profile for
+ * @param name Name to create profile for + * @param name Name to create profile for
+ * @return A PlayerProfile object + * @return A PlayerProfile object
+ * @throws IllegalArgumentException if the name is longer than 16 characters
+ * @throws IllegalArgumentException if the name contains invalid characters
+ */ + */
+ @NotNull + @NotNull
+ public static com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name) { + public static com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name) {
@ -406,6 +410,8 @@ index 53f56d95bdf484caed9effbedfe507f6745bb8c0..5aa1aafddd28a5aa52274f37c09bf0fd
+ * @param uuid UUID to create profile for + * @param uuid UUID to create profile for
+ * @param name Name to create profile for + * @param name Name to create profile for
+ * @return A PlayerProfile object + * @return A PlayerProfile object
+ * @throws IllegalArgumentException if the name is longer than 16 characters
+ * @throws IllegalArgumentException if the name contains invalid characters
+ */ + */
+ @NotNull + @NotNull
+ public static com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name) { + public static com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name) {
@ -418,7 +424,7 @@ diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Ser
index b0734f8253ed540916db7bc75cd7dd24e86031c7..c2cf0e547137b8a023ea009c7a5d0080def5f5f8 100644 index b0734f8253ed540916db7bc75cd7dd24e86031c7..c2cf0e547137b8a023ea009c7a5d0080def5f5f8 100644
--- a/src/main/java/org/bukkit/Server.java --- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java
@@ -2077,5 +2077,76 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -2077,5 +2077,80 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @return true if player names should be suggested * @return true if player names should be suggested
*/ */
boolean suggestPlayerNamesWhenNullTabCompletions(); boolean suggestPlayerNamesWhenNullTabCompletions();
@ -448,6 +454,8 @@ index b0734f8253ed540916db7bc75cd7dd24e86031c7..c2cf0e547137b8a023ea009c7a5d0080
+ * + *
+ * @param name Name to create profile for + * @param name Name to create profile for
+ * @return A PlayerProfile object + * @return A PlayerProfile object
+ * @throws IllegalArgumentException if the name is longer than 16 characters
+ * @throws IllegalArgumentException if the name contains invalid characters
+ */ + */
+ @NotNull + @NotNull
+ com.destroystokyo.paper.profile.PlayerProfile createProfile(@NotNull String name); + com.destroystokyo.paper.profile.PlayerProfile createProfile(@NotNull String name);
@ -471,6 +479,7 @@ index b0734f8253ed540916db7bc75cd7dd24e86031c7..c2cf0e547137b8a023ea009c7a5d0080
+ * @param name Name to create profile for + * @param name Name to create profile for
+ * @return A PlayerProfile object + * @return A PlayerProfile object
+ * @throws IllegalArgumentException if the name is longer than 16 characters + * @throws IllegalArgumentException if the name is longer than 16 characters
+ * @throws IllegalArgumentException if the name contains invalid characters
+ */ + */
+ @NotNull + @NotNull
+ com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name); + com.destroystokyo.paper.profile.PlayerProfile createProfile(@Nullable UUID uuid, @Nullable String name);
@ -490,6 +499,7 @@ index b0734f8253ed540916db7bc75cd7dd24e86031c7..c2cf0e547137b8a023ea009c7a5d0080
+ * @param name Name to create profile for + * @param name Name to create profile for
+ * @return A PlayerProfile object + * @return A PlayerProfile object
+ * @throws IllegalArgumentException if the name is longer than 16 characters + * @throws IllegalArgumentException if the name is longer than 16 characters
+ * @throws IllegalArgumentException if the name contains invalid characters
+ */ + */
+ @NotNull + @NotNull
+ com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name); + com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name);

View File

@ -5,10 +5,10 @@ Subject: [PATCH] Expose the internal current tick
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index cddf3250c4a7efe239248b5e9662f33f5c0b702f..836b5d1363ffcff08708b6b4721253ade99eb987 100644 index 2f023dcab9fe1ea220ba04e575bb5efe78adbd45..5d927fe08057d7fe2016f5b019dbbaa647b3ad0e 100644
--- a/src/main/java/org/bukkit/Bukkit.java --- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2507,6 +2507,10 @@ public final class Bukkit { @@ -2513,6 +2513,10 @@ public final class Bukkit {
public static com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name) { public static com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name) {
return server.createProfileExact(uuid, name); return server.createProfileExact(uuid, name);
} }
@ -20,10 +20,10 @@ index cddf3250c4a7efe239248b5e9662f33f5c0b702f..836b5d1363ffcff08708b6b4721253ad
@NotNull @NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 6412546d84874cb93fcdc8426a402bec4e276057..387478b3e4ad9877f3338b719ff447126ef16285 100644 index 6d72b50b12315caf29842b5cf52e67715de8877d..309191a5346ed9b17cf8f3aac9d587400972fda6 100644
--- a/src/main/java/org/bukkit/Server.java --- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java
@@ -2186,5 +2186,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -2190,5 +2190,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/ */
@NotNull @NotNull
com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name); com.destroystokyo.paper.profile.PlayerProfile createProfileExact(@Nullable UUID uuid, @Nullable String name);

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Expose MinecraftServer#isRunning
This allows for plugins to detect if the server is actually turning off in onDisable rather than just plugins reloading. This allows for plugins to detect if the server is actually turning off in onDisable rather than just plugins reloading.
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 1a8f4e122b84b423fe19bfafad56d6d3df9ec134..1c30e523d08250c8a5477fe4d749b779223f069a 100644 index c0f8a858b26768f078ca079010af5544fe6199be..14dee17cfdfcc507d60ba10de3fe6d429dd67654 100644
--- a/src/main/java/org/bukkit/Bukkit.java --- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2530,6 +2530,15 @@ public final class Bukkit { @@ -2536,6 +2536,15 @@ public final class Bukkit {
public static int getCurrentTick() { public static int getCurrentTick() {
return server.getCurrentTick(); return server.getCurrentTick();
} }
@ -26,10 +26,10 @@ index 1a8f4e122b84b423fe19bfafad56d6d3df9ec134..1c30e523d08250c8a5477fe4d749b779
@NotNull @NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index fc4e259e5ca7a4b25f276bda7f2f5ea022d0c552..1f4ebdaf9cfd14de9ff2d0cea7d110fe7630dc9a 100644 index e3fbaecb6f50e4daccde3df3657ae0a4dadf5688..5846bcd03e34b02b0c4dc0a1edca37cc62d0ac29 100644
--- a/src/main/java/org/bukkit/Server.java --- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java
@@ -2208,5 +2208,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -2212,5 +2212,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @return Current tick * @return Current tick
*/ */
int getCurrentTick(); int getCurrentTick();

View File

@ -226,10 +226,10 @@ index 0000000000000000000000000000000000000000..e21f7574763dd4f13794f91bbef192ef
+ <T extends Mob> Collection<Goal<T>> getRunningGoalsWithout(@NotNull T mob, @NotNull GoalType type); + <T extends Mob> Collection<Goal<T>> getRunningGoalsWithout(@NotNull T mob, @NotNull GoalType type);
+} +}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 1c30e523d08250c8a5477fe4d749b779223f069a..f2fa4c419f212ea5d7ca0aab4ead4bd44dac5947 100644 index 14dee17cfdfcc507d60ba10de3fe6d429dd67654..bd711e43abb012065dbefa911347a47c2aa4933a 100644
--- a/src/main/java/org/bukkit/Bukkit.java --- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2539,6 +2539,16 @@ public final class Bukkit { @@ -2545,6 +2545,16 @@ public final class Bukkit {
public static boolean isStopping() { public static boolean isStopping() {
return server.isStopping(); return server.isStopping();
} }
@ -247,10 +247,10 @@ index 1c30e523d08250c8a5477fe4d749b779223f069a..f2fa4c419f212ea5d7ca0aab4ead4bd4
@NotNull @NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 1f4ebdaf9cfd14de9ff2d0cea7d110fe7630dc9a..711de014b7cf69459526e6c20c94f29ee4db11c4 100644 index 5846bcd03e34b02b0c4dc0a1edca37cc62d0ac29..755d68961171fc6c520e9f8ee908c99c1f404584 100644
--- a/src/main/java/org/bukkit/Server.java --- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java
@@ -2215,5 +2215,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -2219,5 +2219,13 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
* @return true if server is in the process of being shutdown * @return true if server is in the process of being shutdown
*/ */
boolean isStopping(); boolean isStopping();

View File

@ -70,7 +70,7 @@ index 0000000000000000000000000000000000000000..58f78d5e91beacaf710f62461cf869f7
+ +
+} +}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 94abdf67a057ef02fc98b61c1b9376454cc5b4c8..e5a9b816b281017a08959d8e61acf59574dc1c50 100644 index 149c1a1cc39f79ca03e1f02cf2751885e0428895..4d8ff5b400a17fadefc25b3bf602eadb12cae4e9 100644
--- a/src/main/java/org/bukkit/Bukkit.java --- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java
@@ -327,9 +327,11 @@ public final class Bukkit { @@ -327,9 +327,11 @@ public final class Bukkit {
@ -85,7 +85,7 @@ index 94abdf67a057ef02fc98b61c1b9376454cc5b4c8..e5a9b816b281017a08959d8e61acf595
public static DataPackManager getDataPackManager() { public static DataPackManager getDataPackManager() {
return server.getDataPackManager(); return server.getDataPackManager();
} }
@@ -2585,6 +2587,14 @@ public final class Bukkit { @@ -2591,6 +2593,14 @@ public final class Bukkit {
public static com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() { public static com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() {
return server.getMobGoals(); return server.getMobGoals();
} }
@ -101,7 +101,7 @@ index 94abdf67a057ef02fc98b61c1b9376454cc5b4c8..e5a9b816b281017a08959d8e61acf595
@NotNull @NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index e1ab2090c1b219f12af382079907e440e9cf4379..e3a494b9d3727973d225de3042da93594f36ca12 100644 index 0c71aa3b5758dbfdce8782e02772f9450901adbd..2fa562ca863810cbba82d43bf452f61d9e02cfdb 100644
--- a/src/main/java/org/bukkit/Server.java --- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java
@@ -266,9 +266,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -266,9 +266,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
@ -116,7 +116,7 @@ index e1ab2090c1b219f12af382079907e440e9cf4379..e3a494b9d3727973d225de3042da9359
public DataPackManager getDataPackManager(); public DataPackManager getDataPackManager();
/** /**
@@ -2256,5 +2258,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -2260,5 +2262,11 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/ */
@NotNull @NotNull
com.destroystokyo.paper.entity.ai.MobGoals getMobGoals(); com.destroystokyo.paper.entity.ai.MobGoals getMobGoals();

View File

@ -155,10 +155,10 @@ index 0000000000000000000000000000000000000000..3ede1e8f7bf0436fdc5bf395c0f9eaf1
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index f11b60d888e8f3a0c6213078cb5db35eafb82e3f..84d43e24a69352e2715935fd7ce3fd05aaca8601 100644 index e224a28f1c81ca3439c9618d46ad53f8af8c760c..93012c264b6a509b0c3df26896136cb5c1ffc264 100644
--- a/src/main/java/org/bukkit/Bukkit.java --- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2627,6 +2627,15 @@ public final class Bukkit { @@ -2633,6 +2633,15 @@ public final class Bukkit {
public static io.papermc.paper.datapack.DatapackManager getDatapackManager() { public static io.papermc.paper.datapack.DatapackManager getDatapackManager() {
return server.getDatapackManager(); return server.getDatapackManager();
} }
@ -175,10 +175,10 @@ index f11b60d888e8f3a0c6213078cb5db35eafb82e3f..84d43e24a69352e2715935fd7ce3fd05
@NotNull @NotNull
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index 31eaec316e0ee4021d0a67301d1bc91a2d3524d9..88ad9e596f801c2c137fe2d31653a841b9c01683 100644 index d1fb5010a8a1526a24be26c0d6330800fd54e184..082969ca7babe5f1158a11a7f6f2fb220eb912eb 100644
--- a/src/main/java/org/bukkit/Server.java --- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java
@@ -2292,5 +2292,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -2296,5 +2296,12 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/ */
@NotNull @NotNull
io.papermc.paper.datapack.DatapackManager getDatapackManager(); io.papermc.paper.datapack.DatapackManager getDatapackManager();

View File

@ -499,10 +499,10 @@ index 0000000000000000000000000000000000000000..a6b50c9d8af589cc4747e14d343d2045
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java diff --git a/src/main/java/org/bukkit/Bukkit.java b/src/main/java/org/bukkit/Bukkit.java
index 49c027f2c78660594caa51341291b1bcd35b8993..290d692fccf63c5f109b8a3f1de726a12a20ddc9 100644 index 74ae33a6465f0a63b599527e9b7b3ed2d388d624..37b3d1aceaf6522f712cb6ec8a8b7f5689eb1852 100644
--- a/src/main/java/org/bukkit/Bukkit.java --- a/src/main/java/org/bukkit/Bukkit.java
+++ b/src/main/java/org/bukkit/Bukkit.java +++ b/src/main/java/org/bukkit/Bukkit.java
@@ -2658,6 +2658,141 @@ public final class Bukkit { @@ -2664,6 +2664,141 @@ public final class Bukkit {
} }
// Paper end // Paper end
@ -645,10 +645,10 @@ index 49c027f2c78660594caa51341291b1bcd35b8993..290d692fccf63c5f109b8a3f1de726a1
public static Server.Spigot spigot() { public static Server.Spigot spigot() {
return server.spigot(); return server.spigot();
diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java diff --git a/src/main/java/org/bukkit/Server.java b/src/main/java/org/bukkit/Server.java
index c1a46d13e61140c851f73f2ee7c6cec24ba8b3fa..954c8422567edcf6bf6db153b65dad776eea654f 100644 index e9a97ee5c086ebb48ebc3d9bca406f32380d28cb..871696b6c7363efc7020f4ac7f6b7437f06191ae 100644
--- a/src/main/java/org/bukkit/Server.java --- a/src/main/java/org/bukkit/Server.java
+++ b/src/main/java/org/bukkit/Server.java +++ b/src/main/java/org/bukkit/Server.java
@@ -2321,4 +2321,119 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi @@ -2325,4 +2325,119 @@ public interface Server extends PluginMessageRecipient, net.kyori.adventure.audi
*/ */
@NotNull org.bukkit.potion.PotionBrewer getPotionBrewer(); @NotNull org.bukkit.potion.PotionBrewer getPotionBrewer();
// Paper end // Paper end

View File

@ -264,15 +264,16 @@ index 9e23cdef8bd166937093452009f50b86e683cc57..a052c2dab5af99355737a88f75cb0b2e
+ +
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java diff --git a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
index 358af0121ce3d87a9f51da2bae0699034c1560b4..44174c5a7b255af489c1e4bf589299e6bdbb90a3 100644 index 358af0121ce3d87a9f51da2bae0699034c1560b4..94cae8f3c13d0afcbe97478fba34ff4f12f8c7ee 100644
--- a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java --- a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
+++ b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java +++ b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
@@ -37,6 +37,16 @@ public final class CraftPlayerProfile implements PlayerProfile { @@ -37,6 +37,17 @@ public final class CraftPlayerProfile implements PlayerProfile {
boolean isValidSkullProfile = (gameProfile.getName() != null) boolean isValidSkullProfile = (gameProfile.getName() != null)
|| gameProfile.getProperties().containsKey(CraftPlayerTextures.PROPERTY_NAME); || gameProfile.getProperties().containsKey(CraftPlayerTextures.PROPERTY_NAME);
Preconditions.checkArgument(isValidSkullProfile, "The skull profile is missing a name or textures!"); Preconditions.checkArgument(isValidSkullProfile, "The skull profile is missing a name or textures!");
+ // Paper start - Validate + // Paper start - Validate
+ Preconditions.checkArgument(gameProfile.getName().length() <= 16, "The name of the profile is longer than 16 characters"); + Preconditions.checkArgument(gameProfile.getName().length() <= 16, "The name of the profile is longer than 16 characters");
+ Preconditions.checkArgument(net.minecraft.util.StringUtil.isValidPlayerName(gameProfile.getName()), "The name of the profile contains invalid characters: %s", gameProfile.getName());
+ final PropertyMap properties = gameProfile.getProperties(); + final PropertyMap properties = gameProfile.getProperties();
+ Preconditions.checkArgument(properties.size() <= 16, "The profile contains more than 16 properties"); + Preconditions.checkArgument(properties.size() <= 16, "The profile contains more than 16 properties");
+ for (final Property property : properties.values()) { + for (final Property property : properties.values()) {
@ -284,15 +285,16 @@ index 358af0121ce3d87a9f51da2bae0699034c1560b4..44174c5a7b255af489c1e4bf589299e6
return gameProfile; return gameProfile;
} }
@@ -53,6 +63,7 @@ public final class CraftPlayerProfile implements PlayerProfile { @@ -53,6 +64,8 @@ public final class CraftPlayerProfile implements PlayerProfile {
public CraftPlayerProfile(UUID uniqueId, String name) { public CraftPlayerProfile(UUID uniqueId, String name) {
Preconditions.checkArgument((uniqueId != null) || !StringUtils.isBlank(name), "uniqueId is null or name is blank"); 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 || 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
this.uniqueId = (uniqueId == null) ? Util.NIL_UUID : uniqueId; this.uniqueId = (uniqueId == null) ? Util.NIL_UUID : uniqueId;
this.name = (name == null) ? "" : name; this.name = (name == null) ? "" : name;
} }
@@ -89,6 +100,7 @@ public final class CraftPlayerProfile implements PlayerProfile { @@ -89,6 +102,7 @@ public final class CraftPlayerProfile implements PlayerProfile {
// Assert: (property == null) || property.getName().equals(propertyName) // Assert: (property == null) || property.getName().equals(propertyName)
this.removeProperty(propertyName); this.removeProperty(propertyName);
if (property != null) { if (property != null) {

View File

@ -66,7 +66,7 @@ diff --git a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.jav
index 44174c5a7b255af489c1e4bf589299e6bdbb90a3..ab18b1d480f7ecc0ad9a51471d8f45b0da74d8cf 100644 index 44174c5a7b255af489c1e4bf589299e6bdbb90a3..ab18b1d480f7ecc0ad9a51471d8f45b0da74d8cf 100644
--- a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java --- a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
+++ b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java +++ b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
@@ -134,7 +134,7 @@ public final class CraftPlayerProfile implements PlayerProfile { @@ -136,7 +136,7 @@ public final class CraftPlayerProfile implements PlayerProfile {
@Override @Override
public CompletableFuture<PlayerProfile> update() { public CompletableFuture<PlayerProfile> update() {

View File

@ -16,10 +16,10 @@ public org.bukkit.craftbukkit.profile.CraftPlayerProfile setProperty(Ljava/lang/
diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java diff --git a/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..72e232791efa2154c6c95d2158734a86480cb40d index 0000000000000000000000000000000000000000..cbe2789f8a055550dd7840a7bed980efd65eb9a1
--- /dev/null --- /dev/null
+++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java +++ b/src/main/java/com/destroystokyo/paper/profile/CraftPlayerProfile.java
@@ -0,0 +1,420 @@ @@ -0,0 +1,422 @@
+package com.destroystokyo.paper.profile; +package com.destroystokyo.paper.profile;
+ +
+import com.google.common.base.Preconditions; +import com.google.common.base.Preconditions;
@ -33,6 +33,7 @@ index 0000000000000000000000000000000000000000..72e232791efa2154c6c95d2158734a86
+import net.minecraft.Util; +import net.minecraft.Util;
+import net.minecraft.server.MinecraftServer; +import net.minecraft.server.MinecraftServer;
+import net.minecraft.server.players.GameProfileCache; +import net.minecraft.server.players.GameProfileCache;
+import net.minecraft.util.StringUtil;
+import org.apache.commons.lang3.StringUtils; +import org.apache.commons.lang3.StringUtils;
+import org.apache.commons.lang3.Validate; +import org.apache.commons.lang3.Validate;
+import org.bukkit.configuration.serialization.SerializableAs; +import org.bukkit.configuration.serialization.SerializableAs;
@ -292,6 +293,7 @@ index 0000000000000000000000000000000000000000..72e232791efa2154c6c95d2158734a86
+ +
+ private static GameProfile createAuthLibProfile(UUID uniqueId, String name) { + 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 || 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( + return new GameProfile(
+ uniqueId != null ? uniqueId : Util.NIL_UUID, + uniqueId != null ? uniqueId : Util.NIL_UUID,
+ name != null ? name : "" + name != null ? name : ""
@ -644,7 +646,7 @@ index 02308021712a2e947bd389e625b5d93e62f5024b..f7c258b6f0f4eb6094828da20e4a5af2
CraftItemFactory.instance(); CraftItemFactory.instance();
CraftEntityFactory.instance(); CraftEntityFactory.instance();
} }
@@ -2804,5 +2808,42 @@ public final class CraftServer implements Server { @@ -2804,5 +2808,39 @@ public final class CraftServer implements Server {
public boolean suggestPlayerNamesWhenNullTabCompletions() { public boolean suggestPlayerNamesWhenNullTabCompletions() {
return io.papermc.paper.configuration.GlobalConfiguration.get().commands.suggestPlayerNamesWhenNullTabCompletions; return io.papermc.paper.configuration.GlobalConfiguration.get().commands.suggestPlayerNamesWhenNullTabCompletions;
} }
@ -678,17 +680,14 @@ index 02308021712a2e947bd389e625b5d93e62f5024b..f7c258b6f0f4eb6094828da20e4a5af2
+ return new com.destroystokyo.paper.profile.CraftPlayerProfile((CraftPlayer) player); + return new com.destroystokyo.paper.profile.CraftPlayerProfile((CraftPlayer) player);
+ } + }
+ +
+ final com.mojang.authlib.GameProfile profile = new com.mojang.authlib.GameProfile( + final com.destroystokyo.paper.profile.CraftPlayerProfile profile = new com.destroystokyo.paper.profile.CraftPlayerProfile(uuid, name);
+ uuid != null ? uuid : net.minecraft.Util.NIL_UUID, + profile.getGameProfile().getProperties().putAll(((CraftPlayer) player).getHandle().getGameProfile().getProperties());
+ name != null ? name : "" + return profile;
+ );
+ profile.getProperties().putAll(((CraftPlayer) player).getHandle().getGameProfile().getProperties());
+ return new com.destroystokyo.paper.profile.CraftPlayerProfile(profile);
+ } + }
// Paper end // Paper end
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java diff --git a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
index ab18b1d480f7ecc0ad9a51471d8f45b0da74d8cf..d2c121cc610b6c635e2de5059b147f5ee35096bd 100644 index c49db689827b20ad211f06b9bad7062c8ef82c68..ce30a8853d5095ce5bf1ec902b41d27db9e35b4f 100644
--- a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java --- a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
+++ b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java +++ b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
@@ -28,7 +28,7 @@ import org.bukkit.profile.PlayerProfile; @@ -28,7 +28,7 @@ import org.bukkit.profile.PlayerProfile;
@ -700,7 +699,7 @@ index ab18b1d480f7ecc0ad9a51471d8f45b0da74d8cf..d2c121cc610b6c635e2de5059b147f5e
@Nonnull @Nonnull
public static GameProfile validateSkullProfile(@Nonnull GameProfile gameProfile) { public static GameProfile validateSkullProfile(@Nonnull GameProfile gameProfile) {
@@ -105,8 +105,10 @@ public final class CraftPlayerProfile implements PlayerProfile { @@ -107,8 +107,10 @@ public final class CraftPlayerProfile implements PlayerProfile {
} }
} }
@ -713,7 +712,7 @@ index ab18b1d480f7ecc0ad9a51471d8f45b0da74d8cf..d2c121cc610b6c635e2de5059b147f5e
} }
void rebuildDirtyProperties() { void rebuildDirtyProperties() {
@@ -249,6 +251,7 @@ public final class CraftPlayerProfile implements PlayerProfile { @@ -251,6 +253,7 @@ public final class CraftPlayerProfile implements PlayerProfile {
@Override @Override
public Map<String, Object> serialize() { public Map<String, Object> serialize() {
@ -721,7 +720,7 @@ index ab18b1d480f7ecc0ad9a51471d8f45b0da74d8cf..d2c121cc610b6c635e2de5059b147f5e
Map<String, Object> map = new LinkedHashMap<>(); Map<String, Object> map = new LinkedHashMap<>();
if (this.getUniqueId() != null) { if (this.getUniqueId() != null) {
map.put("uniqueId", this.getUniqueId().toString()); map.put("uniqueId", this.getUniqueId().toString());
@@ -264,10 +267,12 @@ public final class CraftPlayerProfile implements PlayerProfile { @@ -266,10 +269,12 @@ public final class CraftPlayerProfile implements PlayerProfile {
}); });
map.put("properties", propertiesData); map.put("properties", propertiesData);
} }
@ -734,7 +733,7 @@ index ab18b1d480f7ecc0ad9a51471d8f45b0da74d8cf..d2c121cc610b6c635e2de5059b147f5e
UUID uniqueId = ConfigSerializationUtil.getUuid(map, "uniqueId", true); UUID uniqueId = ConfigSerializationUtil.getUuid(map, "uniqueId", true);
String name = ConfigSerializationUtil.getString(map, "name", true); String name = ConfigSerializationUtil.getString(map, "name", true);
@@ -281,7 +286,7 @@ public final class CraftPlayerProfile implements PlayerProfile { @@ -283,7 +288,7 @@ public final class CraftPlayerProfile implements PlayerProfile {
profile.properties.put(property.name(), property); profile.properties.put(property.name(), property);
} }
} }

View File

@ -5,12 +5,12 @@ Subject: [PATCH] Expose the internal current tick
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 32765f19f6cd4973b4d2d8085637124f8192373c..11ef05f685b040f90988436bd07b1e747777dbb8 100644 index eb178edff9fa0d2be549e2fa62a8ddfd7fd73f83..383f38cd8436fa8efaff53d235b0ad9f757c5c0b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2882,5 +2882,10 @@ public final class CraftServer implements Server { @@ -2879,5 +2879,10 @@ public final class CraftServer implements Server {
profile.getProperties().putAll(((CraftPlayer) player).getHandle().getGameProfile().getProperties()); profile.getGameProfile().getProperties().putAll(((CraftPlayer) player).getHandle().getGameProfile().getProperties());
return new com.destroystokyo.paper.profile.CraftPlayerProfile(profile); return profile;
} }
+ +
+ @Override + @Override

View File

@ -6,10 +6,10 @@ Subject: [PATCH] Expose MinecraftServer#isRunning
This allows for plugins to detect if the server is actually turning off in onDisable rather than just plugins reloading. This allows for plugins to detect if the server is actually turning off in onDisable rather than just plugins reloading.
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 6e10244fe14d6271c0215c09a6df3f55a3ca6ade..8e082ec92c437e27d71e70a91a0bf65153de29a3 100644 index 69c10ac5f54141fe8afeef79df287ab694f2b033..2b096d8594b71261fe7166664574532fe7009a2a 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2897,5 +2897,10 @@ public final class CraftServer implements Server { @@ -2894,5 +2894,10 @@ public final class CraftServer implements Server {
public int getCurrentTick() { public int getCurrentTick() {
return net.minecraft.server.MinecraftServer.currentTick; return net.minecraft.server.MinecraftServer.currentTick;
} }

View File

@ -773,10 +773,10 @@ index 6667ecc4b7eded4e20a415cef1e1b1179e6710b8..16f9a98b8a939e5ca7e2dc04f87134a7
LOOK, LOOK,
JUMP, JUMP,
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 26bebc3ddd15e963e818011556f216f275bd7415..8e0e38bc85ca97f4c632299affc366ece7e63a52 100644 index cd6fb7eb121c527e798219177781c13097fd9ef6..c6a96664ef914d0da1e24b93da93bad1b4a17716 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -2903,5 +2903,11 @@ public final class CraftServer implements Server { @@ -2900,5 +2900,11 @@ public final class CraftServer implements Server {
public boolean isStopping() { public boolean isStopping() {
return net.minecraft.server.MinecraftServer.getServer().hasStopped(); return net.minecraft.server.MinecraftServer.getServer().hasStopped();
} }

View File

@ -92,7 +92,7 @@ index 0000000000000000000000000000000000000000..cf4374493c11057451a62a655514415c
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 1f6218e580a2a0138d128940a709147c20354b39..c4e63ba96a54fb9e1353510f77d848bed3656405 100644 index 6fbb452b583d5b5ab95a057a7e6ed17d2e6a2b15..2098ea8dcdf8e3a704db972192993cbc616d7dac 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -301,6 +301,7 @@ public final class CraftServer implements Server { @@ -301,6 +301,7 @@ public final class CraftServer implements Server {
@ -111,7 +111,7 @@ index 1f6218e580a2a0138d128940a709147c20354b39..c4e63ba96a54fb9e1353510f77d848be
} }
public boolean getCommandBlockOverride(String command) { public boolean getCommandBlockOverride(String command) {
@@ -2971,5 +2973,11 @@ public final class CraftServer implements Server { @@ -2968,5 +2970,11 @@ public final class CraftServer implements Server {
public com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() { public com.destroystokyo.paper.entity.ai.MobGoals getMobGoals() {
return mobGoals; return mobGoals;
} }

View File

@ -282,7 +282,7 @@ index 3ebfd564d4bbf00da5919e966f3d047285845640..887957ce1ddc2f32569405642f35df46
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftServer.java b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
index 9790cff70cf006c35dbfe95653a1bacdea33607d..0ed2d510918cc14ce3d7e5def2021e07f7ad378f 100644 index 151340a41adbdf9effe78aed8122abfaf54d9b7a..2f550747f605e27b9fe968c94ae37aa265624462 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java --- a/src/main/java/org/bukkit/craftbukkit/CraftServer.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftServer.java
@@ -304,6 +304,7 @@ public final class CraftServer implements Server { @@ -304,6 +304,7 @@ public final class CraftServer implements Server {
@ -301,7 +301,7 @@ index 9790cff70cf006c35dbfe95653a1bacdea33607d..0ed2d510918cc14ce3d7e5def2021e07
datapackManager = new io.papermc.paper.datapack.PaperDatapackManager(console.getPackRepository()); // Paper datapackManager = new io.papermc.paper.datapack.PaperDatapackManager(console.getPackRepository()); // Paper
} }
@@ -3095,5 +3097,9 @@ public final class CraftServer implements Server { @@ -3092,5 +3094,9 @@ public final class CraftServer implements Server {
return datapackManager; return datapackManager;
} }

View File

@ -256,7 +256,7 @@ index 7522a31d618e90d5109f3067e07748f9a07482a5..7dfad8abaf5db2ca5ea942a0ce92c331
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java diff --git a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
index d2c121cc610b6c635e2de5059b147f5ee35096bd..3e725dd3aca80a062917e3fd214c554b52dddde5 100644 index ce30a8853d5095ce5bf1ec902b41d27db9e35b4f..0121c90dd7f57be5f484f970f78747a92a734611 100644
--- a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java --- a/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
+++ b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java +++ b/src/main/java/org/bukkit/craftbukkit/profile/CraftPlayerProfile.java
@@ -28,7 +28,7 @@ import org.bukkit.profile.PlayerProfile; @@ -28,7 +28,7 @@ import org.bukkit.profile.PlayerProfile;
@ -268,7 +268,7 @@ index d2c121cc610b6c635e2de5059b147f5ee35096bd..3e725dd3aca80a062917e3fd214c554b
@Nonnull @Nonnull
public static GameProfile validateSkullProfile(@Nonnull GameProfile gameProfile) { public static GameProfile validateSkullProfile(@Nonnull GameProfile gameProfile) {
@@ -135,7 +135,7 @@ public final class CraftPlayerProfile implements PlayerProfile, com.destroystoky @@ -137,7 +137,7 @@ public final class CraftPlayerProfile implements PlayerProfile, com.destroystoky
} }
@Override @Override
@ -277,7 +277,7 @@ index d2c121cc610b6c635e2de5059b147f5ee35096bd..3e725dd3aca80a062917e3fd214c554b
return CompletableFuture.supplyAsync(this::getUpdatedProfile, Util.PROFILE_EXECUTOR); // Paper - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread return CompletableFuture.supplyAsync(this::getUpdatedProfile, Util.PROFILE_EXECUTOR); // Paper - don't submit BLOCKING PROFILE LOOKUPS to the world gen thread
} }
@@ -289,4 +289,71 @@ public final class CraftPlayerProfile implements PlayerProfile, com.destroystoky @@ -291,4 +291,71 @@ public final class CraftPlayerProfile implements PlayerProfile, com.destroystoky
// Paper - diff on change // Paper - diff on change
return profile; return profile;
} }