Adventure changes for Java 17 and Component support for resourcepack prompt

This commit is contained in:
Riley Park 2021-12-21 23:07:17 -08:00
parent 8a21c1742b
commit 26fbb02aae
No known key found for this signature in database
GPG key ID: 31C1CAA12DB10BAB
26 changed files with 328 additions and 202 deletions

View file

@ -7,7 +7,7 @@ Co-authored-by: zml <zml@stellardrift.ca>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/build.gradle.kts b/build.gradle.kts
index 3777d12874ede329410a6bf1c0533deb44924d73..0e8e827b5a05ac9423386eaea4188d132cc7f954 100644
index 55ee0c6330e4dbba22b4044346d1e1dd39c745ce..80fdd05dd593455ca89b66636ed30f1d9facf4ed 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -8,6 +8,19 @@ java {
@ -379,7 +379,7 @@ index 0000000000000000000000000000000000000000..eb179aae1e1d2ce842442e49fe275827
+}
diff --git a/src/main/java/io/papermc/paper/text/PaperComponents.java b/src/main/java/io/papermc/paper/text/PaperComponents.java
new file mode 100644
index 0000000000000000000000000000000000000000..77db592d05b754f879f8d1790642e9d9bbd30a4e
index 0000000000000000000000000000000000000000..be72827aafc9a689883f936b4db97bdf01d3bb35
--- /dev/null
+++ b/src/main/java/io/papermc/paper/text/PaperComponents.java
@@ -0,0 +1,88 @@
@ -390,9 +390,9 @@ index 0000000000000000000000000000000000000000..77db592d05b754f879f8d1790642e9d9
+import net.kyori.adventure.text.format.NamedTextColor;
+import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
+import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer;
+import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer;
+import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
+import org.bukkit.Bukkit;
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.jetbrains.annotations.NotNull;
+
+/**
+ * Paper API-specific methods for working with {@link Component}s and related.
@ -407,7 +407,7 @@ index 0000000000000000000000000000000000000000..77db592d05b754f879f8d1790642e9d9
+ *
+ * @return a component flattener
+ */
+ public static @NonNull ComponentFlattener flattener() {
+ public static @NotNull ComponentFlattener flattener() {
+ return Bukkit.getUnsafe().componentFlattener();
+ }
+
@ -420,7 +420,7 @@ index 0000000000000000000000000000000000000000..77db592d05b754f879f8d1790642e9d9
+ *
+ * @return a serializer to plain text
+ */
+ public static @NonNull PlainComponentSerializer plainSerializer() {
+ public static @NotNull PlainTextComponentSerializer plainSerializer() {
+ return Bukkit.getUnsafe().plainComponentSerializer();
+ }
+
@ -434,7 +434,7 @@ index 0000000000000000000000000000000000000000..77db592d05b754f879f8d1790642e9d9
+ *
+ * @return a json component serializer
+ */
+ public static @NonNull GsonComponentSerializer gsonSerializer() {
+ public static @NotNull GsonComponentSerializer gsonSerializer() {
+ return Bukkit.getUnsafe().gsonComponentSerializer();
+ }
+
@ -449,7 +449,7 @@ index 0000000000000000000000000000000000000000..77db592d05b754f879f8d1790642e9d9
+ *
+ * @return a json component serializer
+ */
+ public static @NonNull GsonComponentSerializer colorDownsamplingGsonSerializer() {
+ public static @NotNull GsonComponentSerializer colorDownsamplingGsonSerializer() {
+ return Bukkit.getUnsafe().colorDownsamplingGsonComponentSerializer();
+ }
+
@ -467,7 +467,7 @@ index 0000000000000000000000000000000000000000..77db592d05b754f879f8d1790642e9d9
+ *
+ * @return a section serializer
+ */
+ public static @NonNull LegacyComponentSerializer legacySectionSerializer() {
+ public static @NotNull LegacyComponentSerializer legacySectionSerializer() {
+ return Bukkit.getUnsafe().legacyComponentSerializer();
+ }
+}
@ -1086,7 +1086,7 @@ index ac5e263d737973af077e3406a84a84baca4370db..2d91924b7f5ef16a91d40cdc1bfc3d68
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/UnsafeValues.java b/src/main/java/org/bukkit/UnsafeValues.java
index 945b8b030d1b2a13afc0c4efad76997eb7bf00ba..207c656c0a11a3a630bc70491efcf433b2681e18 100644
index 945b8b030d1b2a13afc0c4efad76997eb7bf00ba..3b10d6387606a6efbed059ce54d565bdc756e13e 100644
--- a/src/main/java/org/bukkit/UnsafeValues.java
+++ b/src/main/java/org/bukkit/UnsafeValues.java
@@ -17,6 +17,13 @@ import org.bukkit.plugin.PluginDescriptionFile;
@ -1095,7 +1095,7 @@ index 945b8b030d1b2a13afc0c4efad76997eb7bf00ba..207c656c0a11a3a630bc70491efcf433
public interface UnsafeValues {
+ // Paper start
+ net.kyori.adventure.text.flattener.ComponentFlattener componentFlattener();
+ net.kyori.adventure.text.serializer.plain.PlainComponentSerializer plainComponentSerializer();
+ net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer plainComponentSerializer();
+ net.kyori.adventure.text.serializer.gson.GsonComponentSerializer gsonComponentSerializer();
+ net.kyori.adventure.text.serializer.gson.GsonComponentSerializer colorDownsamplingGsonComponentSerializer();
+ net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer legacyComponentSerializer();
@ -1579,7 +1579,7 @@ index 25a6f9313a1953def7470e411b53016f2ca14bef..10cb6088c4618f228c757f4e592b44ed
+ // Paper end
}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856bc561d70 100644
index c36e4ceb1094aa9469f976e0952e2725358ff761..e3cc40a54b48e8a90ccc93c272c1a2dca1da9595 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -35,7 +35,28 @@ import org.jetbrains.annotations.Nullable;
@ -1752,7 +1752,7 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
/**
* Says a message (or runs a command).
*
@@ -473,6 +554,26 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -473,6 +554,90 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public void sendEquipmentChange(@NotNull LivingEntity entity, @NotNull EquipmentSlot slot, @NotNull ItemStack item);
@ -1776,18 +1776,23 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
+ this.sendSignChange(loc, lines, DyeColor.BLACK);
+ }
+
/**
* Send a sign change. This fakes a sign change packet for a user at
* a certain location. This will not actually change the world in any way.
@@ -485,9 +586,75 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*
* @param loc the location of the sign
* @param lines the new text on the sign or null to clear it
+ /**
+ * Send a sign change. This fakes a sign change packet for a user at
+ * a certain location. This will not actually change the world in any way.
+ * This method will use a sign at the location's block or a faked sign
+ * sent via
+ * {@link #sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)}.
+ * <p>
+ * If the client does not have a sign at the given location it will
+ * display an error message to the user.
+ *
+ * @param loc the location of the sign
+ * @param lines the new text on the sign or null to clear it
+ * @param dyeColor the color of the sign
* @throws IllegalArgumentException if location is null
+ * @throws IllegalArgumentException if location is null
+ * @throws IllegalArgumentException if dyeColor is null
* @throws IllegalArgumentException if lines is non-null and has a length less than 4
*/
+ * @throws IllegalArgumentException if lines is non-null and has a length less than 4
+ */
+ default void sendSignChange(@NotNull Location loc, @Nullable java.util.List<net.kyori.adventure.text.Component> lines, @NotNull DyeColor dyeColor) throws IllegalArgumentException {
+ this.sendSignChange(loc, lines, dyeColor, false);
+ }
@ -1835,22 +1840,15 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
+ throws IllegalArgumentException;
+ // Paper end
+
+ /**
+ * Send a sign change. This fakes a sign change packet for a user at
+ * a certain location. This will not actually change the world in any way.
+ * This method will use a sign at the location's block or a faked sign
+ * sent via
+ * {@link #sendBlockChange(org.bukkit.Location, org.bukkit.Material, byte)}.
+ * <p>
+ * If the client does not have a sign at the given location it will
+ * display an error message to the user.
+ *
+ * @param loc the location of the sign
+ * @param lines the new text on the sign or null to clear it
+ * @throws IllegalArgumentException if location is null
+ * @throws IllegalArgumentException if lines is non-null and has a length less than 4
/**
* Send a sign change. This fakes a sign change packet for a user at
* a certain location. This will not actually change the world in any way.
@@ -487,7 +652,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param lines the new text on the sign or null to clear it
* @throws IllegalArgumentException if location is null
* @throws IllegalArgumentException if lines is non-null and has a length less than 4
+ * @deprecated in favour of {@link #sendSignChange(org.bukkit.Location, java.util.List)}
+ */
*/
+ @Deprecated // Paper
public void sendSignChange(@NotNull Location loc, @Nullable String[] lines) throws IllegalArgumentException;
@ -1875,7 +1873,117 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
public void sendSignChange(@NotNull Location loc, @Nullable String[] lines, @NotNull DyeColor dyeColor, boolean hasGlowingText) throws IllegalArgumentException;
/**
@@ -1192,7 +1363,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1008,6 +1179,54 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public void setResourcePack(@NotNull String url, @Nullable byte[] hash, @Nullable String prompt);
+ // Paper start
+ /**
+ * Request that the player's client download and switch resource packs.
+ * <p>
+ * The player's client will download the new resource pack asynchronously
+ * in the background, and will automatically switch to it once the
+ * download is complete. If the client has downloaded and cached a
+ * resource pack with the same hash in the past it will not download but
+ * directly apply the cached pack. If the hash is null and the client has
+ * downloaded and cached the same resource pack in the past, it will
+ * perform a file size check against the response content to determine if
+ * the resource pack has changed and needs to be downloaded again. When
+ * this request is sent for the very first time from a given server, the
+ * client will first display a confirmation GUI to the player before
+ * proceeding with the download.
+ * <p>
+ * Notes:
+ * <ul>
+ * <li>Players can disable server resources on their client, in which
+ * case this method will have no affect on them. Use the
+ * {@link PlayerResourcePackStatusEvent} to figure out whether or not
+ * the player loaded the pack!
+ * <li>There is no concept of resetting resource packs back to default
+ * within Minecraft, so players will have to relog to do so or you
+ * have to send an empty pack.
+ * <li>The request is sent with empty string as the hash when the hash is
+ * not provided. This might result in newer versions not loading the
+ * pack correctly.
+ * </ul>
+ *
+ * @param url The URL from which the client will download the resource
+ * pack. The string must contain only US-ASCII characters and should
+ * be encoded as per RFC 1738.
+ * @param hash The sha1 hash sum of the resource pack file which is used
+ * to apply a cached version of the pack directly without downloading
+ * if it is available. Hast to be 20 bytes long!
+ * @param prompt The optional custom prompt message to be shown to client.
+ * @throws IllegalArgumentException Thrown if the URL is null.
+ * @throws IllegalArgumentException Thrown if the URL is too long. The
+ * length restriction is an implementation specific arbitrary value.
+ * @throws IllegalArgumentException Thrown if the hash is not 20 bytes
+ * long.
+ */
+ default void setResourcePack(@NotNull String url, byte @Nullable [] hash, net.kyori.adventure.text.@Nullable Component prompt) {
+ this.setResourcePack(url, hash, prompt, false);
+ }
+ // Paper end
+
/**
* Request that the player's client download and switch resource packs.
* <p>
@@ -1099,6 +1318,54 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public void setResourcePack(@NotNull String url, @Nullable byte[] hash, @Nullable String prompt, boolean force);
+ // Paper end
+ /**
+ * Request that the player's client download and switch resource packs.
+ * <p>
+ * The player's client will download the new resource pack asynchronously
+ * in the background, and will automatically switch to it once the
+ * download is complete. If the client has downloaded and cached a
+ * resource pack with the same hash in the past it will not download but
+ * directly apply the cached pack. If the hash is null and the client has
+ * downloaded and cached the same resource pack in the past, it will
+ * perform a file size check against the response content to determine if
+ * the resource pack has changed and needs to be downloaded again. When
+ * this request is sent for the very first time from a given server, the
+ * client will first display a confirmation GUI to the player before
+ * proceeding with the download.
+ * <p>
+ * Notes:
+ * <ul>
+ * <li>Players can disable server resources on their client, in which
+ * case this method will have no affect on them. Use the
+ * {@link PlayerResourcePackStatusEvent} to figure out whether or not
+ * the player loaded the pack!
+ * <li>There is no concept of resetting resource packs back to default
+ * within Minecraft, so players will have to relog to do so or you
+ * have to send an empty pack.
+ * <li>The request is sent with empty string as the hash when the hash is
+ * not provided. This might result in newer versions not loading the
+ * pack correctly.
+ * </ul>
+ *
+ * @param url The URL from which the client will download the resource
+ * pack. The string must contain only US-ASCII characters and should
+ * be encoded as per RFC 1738.
+ * @param hash The sha1 hash sum of the resource pack file which is used
+ * to apply a cached version of the pack directly without downloading
+ * if it is available. Hast to be 20 bytes long!
+ * @param prompt The optional custom prompt message to be shown to client.
+ * @param force If true, the client will be disconnected from the server
+ * when it declines to use the resource pack.
+ * @throws IllegalArgumentException Thrown if the URL is null.
+ * @throws IllegalArgumentException Thrown if the URL is too long. The
+ * length restriction is an implementation specific arbitrary value.
+ * @throws IllegalArgumentException Thrown if the hash is not 20 bytes
+ * long.
+ */
+ public void setResourcePack(@NotNull String url, byte @Nullable [] hash, net.kyori.adventure.text.@Nullable Component prompt, boolean force);
+ // Paper end
+
/**
* Gets the Scoreboard displayed to this player
*
@@ -1192,7 +1459,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*
* @param title Title text
* @param subtitle Subtitle text
@ -1884,7 +1992,7 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
*/
@Deprecated
public void sendTitle(@Nullable String title, @Nullable String subtitle);
@@ -1211,7 +1382,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1211,7 +1478,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param fadeIn time in ticks for titles to fade in. Defaults to 10.
* @param stay time in ticks for titles to stay. Defaults to 70.
* @param fadeOut time in ticks for titles to fade out. Defaults to 20.
@ -1894,7 +2002,7 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
public void sendTitle(@Nullable String title, @Nullable String subtitle, int fadeIn, int stay, int fadeOut);
/**
@@ -1438,6 +1611,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1438,6 +1707,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public int getClientViewDistance();
@ -1909,7 +2017,7 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
/**
* Gets the player's estimated ping in milliseconds.
*
@@ -1463,8 +1644,10 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1463,8 +1740,10 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* they wish.
*
* @return the player's locale
@ -1920,7 +2028,7 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
public String getLocale();
/**
@@ -1506,6 +1689,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1506,6 +1785,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public boolean isAllowingServerListings();
@ -1935,7 +2043,7 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
// Spigot start
public class Spigot extends Entity.Spigot {
@@ -1560,11 +1751,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1560,11 +1847,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
throw new UnsupportedOperationException("Not supported yet.");
}
@ -1949,7 +2057,7 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
@Override
public void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
throw new UnsupportedOperationException("Not supported yet.");
@@ -1575,7 +1768,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1575,7 +1864,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*
* @param position the screen position
* @param component the components to send
@ -1959,7 +2067,7 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @NotNull net.md_5.bungee.api.chat.BaseComponent component) {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -1585,7 +1780,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1585,7 +1876,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*
* @param position the screen position
* @param components the components to send
@ -1969,7 +2077,7 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -1596,7 +1793,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1596,7 +1889,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param position the screen position
* @param sender the sender of the message
* @param component the components to send
@ -1979,7 +2087,7 @@ index c36e4ceb1094aa9469f976e0952e2725358ff761..32850ac21d59f962de10125e1b528856
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @Nullable UUID sender, @NotNull net.md_5.bungee.api.chat.BaseComponent component) {
throw new UnsupportedOperationException("Not supported yet.");
}
@@ -1607,7 +1806,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1607,7 +1902,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param position the screen position
* @param sender the sender of the message
* @param components the components to send
@ -4106,7 +4214,7 @@ index 0db7fe1b9fe5621ceed3f4f046691e359f5949dd..d5b39fb4fc16a342b5661e08df150685
/**
diff --git a/src/test/java/org/bukkit/AnnotationTest.java b/src/test/java/org/bukkit/AnnotationTest.java
index c6a8a37a933cfc5a5885602a8a70fdda8fb6aa10..61441e56da69ee8cb92a2b1239f5406425a8344d 100644
index c6a8a37a933cfc5a5885602a8a70fdda8fb6aa10..7f57b95727d0336f1f1548055574e0c129fe9643 100644
--- a/src/test/java/org/bukkit/AnnotationTest.java
+++ b/src/test/java/org/bukkit/AnnotationTest.java
@@ -26,6 +26,12 @@ import org.objectweb.asm.tree.ParameterNode;
@ -4122,3 +4230,12 @@ index c6a8a37a933cfc5a5885602a8a70fdda8fb6aa10..61441e56da69ee8cb92a2b1239f54064
"Lorg/jetbrains/annotations/Nullable;",
"Lorg/jetbrains/annotations/NotNull;",
"Lorg/jetbrains/annotations/Contract;",
@@ -105,7 +111,7 @@ public class AnnotationTest {
if (method.invisibleTypeAnnotations != null) {
for (final org.objectweb.asm.tree.TypeAnnotationNode invisibleTypeAnnotation : method.invisibleTypeAnnotations) {
final org.objectweb.asm.TypeReference ref = new org.objectweb.asm.TypeReference(invisibleTypeAnnotation.typeRef);
- if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && java.util.Arrays.binarySearch(ACCEPTED_ANNOTATIONS, invisibleTypeAnnotation.desc) >= 0) {
+ if (ref.getSort() == org.objectweb.asm.TypeReference.METHOD_FORMAL_PARAMETER && ref.getTypeParameterIndex() == i && org.apache.commons.lang.ArrayUtils.contains(ACCEPTED_ANNOTATIONS, invisibleTypeAnnotation.desc)) {
continue dancing;
}
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Player affects spawning API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 32850ac21d59f962de10125e1b528856bc561d70..b3b53db0a74df795866677285fab4c943db42100 100644
index e3cc40a54b48e8a90ccc93c272c1a2dca1da9595..a6f6dea965eee2de2183f189580d1b7141a9308f 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1650,6 +1650,22 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1746,6 +1746,22 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@Deprecated // Paper
public String getLocale();

View file

@ -65,10 +65,10 @@ index c58b1885662c6a234ffee75995051c9750c1a512..7b1fb280a86ab44756fc233b085f878d
public class Spigot {
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index b3b53db0a74df795866677285fab4c943db42100..152f848d2f93a52999f093bd83b4732af9aab8d8 100644
index a6f6dea965eee2de2183f189580d1b7141a9308f..bf60cc1beed41f6dc30b0df0bae9b937ddfa5553 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1664,6 +1664,62 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1760,6 +1760,62 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param affects Whether the player can affect mob spawning
*/
public void setAffectsSpawning(boolean affects);

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Complete resource pack API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 70e97db83071935dfe6cbf2a60660672d0205a96..8fa4606e187b4677d2302b4fec5c02adf652b3e5 100644
index cd2c4ff23cdbcc3e4e9ae94477a372d25ad31e39..422f322b9623dcb33472744ddfd91d7dba817471 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1251,7 +1251,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@ -18,7 +18,7 @@ index 70e97db83071935dfe6cbf2a60660672d0205a96..8fa4606e187b4677d2302b4fec5c02ad
public void setResourcePack(@NotNull String url);
/**
@@ -1929,6 +1931,124 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2025,6 +2027,124 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
default net.kyori.adventure.text.event.HoverEvent<net.kyori.adventure.text.event.HoverEvent.ShowEntity> asHoverEvent(final @NotNull java.util.function.UnaryOperator<net.kyori.adventure.text.event.HoverEvent.ShowEntity> op) {
return net.kyori.adventure.text.event.HoverEvent.showEntity(op.apply(net.kyori.adventure.text.event.HoverEvent.ShowEntity.of(this.getType().getKey(), this.getUniqueId(), this.displayName())));
}

View file

@ -5,7 +5,7 @@ Subject: [PATCH] Add String based Action Bar API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 8fa4606e187b4677d2302b4fec5c02adf652b3e5..d98029f01bc81c5bf33545fee54bdbce17960b50 100644
index 422f322b9623dcb33472744ddfd91d7dba817471..9d9dd1f73b4c3ff143fbba87d8b5630017affd08 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3,6 +3,7 @@ package org.bukkit.entity;
@ -68,7 +68,7 @@ index 8fa4606e187b4677d2302b4fec5c02adf652b3e5..d98029f01bc81c5bf33545fee54bdbce
public default void sendMessage(net.md_5.bungee.api.ChatMessageType position, net.md_5.bungee.api.chat.BaseComponent... components) {
spigot().sendMessage(position, components);
}
@@ -2120,6 +2156,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2216,6 +2252,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
/**
* Sends the component to the specified screen position of this player
*
@ -76,7 +76,7 @@ index 8fa4606e187b4677d2302b4fec5c02adf652b3e5..d98029f01bc81c5bf33545fee54bdbce
* @param position the screen position
* @param component the components to send
* @deprecated use {@code sendMessage} methods that accept {@link net.kyori.adventure.text.Component}
@@ -2132,6 +2169,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2228,6 +2265,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
/**
* Sends an array of components as a single message to the specified screen position of this player
*

View file

@ -6,7 +6,7 @@ Subject: [PATCH] Player.setPlayerProfile API
This can be useful for changing name or skins after a player has logged in.
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 4485542bcf3014364c2920026a07da6194d6ba29..1c3b5b1950b8b2cb660e160e455384780f2d4e75 100644
index 7e390f5d7438f292ddd849f47964282a1ad889d1..ac94189b7bc76e1de0ae7d46fe581af57594ef64 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -4,6 +4,7 @@ import java.net.InetSocketAddress;
@ -17,7 +17,7 @@ index 4485542bcf3014364c2920026a07da6194d6ba29..1c3b5b1950b8b2cb660e160e45538478
import org.bukkit.DyeColor;
import org.bukkit.Effect;
import org.bukkit.GameMode;
@@ -2106,6 +2107,20 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2202,6 +2203,20 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* was {@link org.bukkit.event.player.PlayerResourcePackStatusEvent.Status#SUCCESSFULLY_LOADED}
*/
boolean hasResourcePack();

View file

@ -24,10 +24,10 @@ index 396092fd249928ca01133eeeeb61f0ad90b2e332..5cc025b69c4f405be8f7098d0dcef40f
/**
* Make the entity drop the item in their hand.
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 1c3b5b1950b8b2cb660e160e455384780f2d4e75..7587483e96a842391e3711c165825682b58286cd 100644
index ac94189b7bc76e1de0ae7d46fe581af57594ef64..dbfd062792b0cc1d8fbfc8a30b0143467e7aaef7 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1962,7 +1962,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2058,7 +2058,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
/**
* Open a Sign for editing by the Player.
*

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Expose attack cooldown methods for Player
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 55054303659544ac9ef0d69838e5f8fadb2d43c5..ecebe470f4b3579a5af39a4dfa541a7e470de181 100644
index 62b41c809cec18b75ee83371f0ca97ccde141e30..fc44e75c52354d95fa7422e1d08ac4cba455be74 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2281,6 +2281,26 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2377,6 +2377,26 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param profile The new profile to use
*/
void setPlayerProfile(@NotNull PlayerProfile profile);

View file

@ -193,7 +193,7 @@ index 0000000000000000000000000000000000000000..f7f171c4ee0b8339b2f8fbe82442d65f
+ }
+}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index ecebe470f4b3579a5af39a4dfa541a7e470de181..b349b2c2a7c70e57b4c28c8b540d01a2c0e62959 100644
index fc44e75c52354d95fa7422e1d08ac4cba455be74..2404864227694e357350a8080b4f609b28ef0a47 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2,6 +2,7 @@ package org.bukkit.entity;
@ -204,7 +204,7 @@ index ecebe470f4b3579a5af39a4dfa541a7e470de181..b349b2c2a7c70e57b4c28c8b540d01a2
import com.destroystokyo.paper.Title; // Paper
import net.kyori.adventure.text.Component;
import com.destroystokyo.paper.profile.PlayerProfile; // Paper
@@ -2301,6 +2302,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2397,6 +2398,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* Reset the cooldown counter to 0, effectively starting the cooldown period.
*/
void resetCooldown();

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Brand support
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index b349b2c2a7c70e57b4c28c8b540d01a2c0e62959..f6137979701026f2acbd04d111afa79332bf08bf 100644
index 2404864227694e357350a8080b4f609b28ef0a47..c04572b87fc59b9cf92558653d06c449e2210233 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2436,6 +2436,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2532,6 +2532,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
// Paper end
}

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Player elytra boost API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index f6137979701026f2acbd04d111afa79332bf08bf..4847db0673ea2a6587703a30f9f3b4e3c278514b 100644
index c04572b87fc59b9cf92558653d06c449e2210233..116c75fa16fa544723c9a430ede3a46c3599d7e8 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2308,6 +2308,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2404,6 +2404,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
@NotNull
<T> T getClientOption(@NotNull ClientOption<T> option);

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add sendOpLevel API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 4847db0673ea2a6587703a30f9f3b4e3c278514b..f31519b5208ed1426bb59499c62e82e49a192488 100644
index 116c75fa16fa544723c9a430ede3a46c3599d7e8..3b24457a1d25515132613b7e4fdaa7901d00ab78 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2321,6 +2321,17 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -2417,6 +2417,17 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
@Nullable
Firework boostElytra(@NotNull ItemStack firework);

View file

@ -5,10 +5,10 @@ Subject: [PATCH] Add player health update API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 7f476ff106a641ef475899a9c6cfafdaa18fc63c..1b4b54741719252892a3a51491d49cd5423de499 100644
index ecd1a8c13137adc880067f9e911e8b1a08c5cd14..5e4a9ce5f899624255e806152c59f60664bcf701 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1725,6 +1725,31 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1821,6 +1821,31 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public double getHealthScale();