Archiviert
13
0

Update to adventure 4.15 (#10045)

Dieser Commit ist enthalten in:
Jake Potrebic 2023-12-25 02:51:44 -08:00 committet von GitHub
Ursprung 49f9f6f2cd
Commit 4adca3d7a3
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: 4AEE18F83AFDEB23
51 geänderte Dateien mit 376 neuen und 246 gelöschten Zeilen

Datei anzeigen

@ -7,14 +7,14 @@ Co-authored-by: zml <zml@stellardrift.ca>
Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com> Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index cc8f297a71eb75b3388ff1cb21a297e268894aac..cbe75dc937409af36528e4eef6f257f323cd4d12 100644 index cc8f297a71eb75b3388ff1cb21a297e268894aac..4f5ac0c5fe6494d5fe5caa8ed5077a83cf43fa87 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -11,12 +11,28 @@ java { @@ -11,12 +11,28 @@ java {
val annotationsVersion = "24.0.1" val annotationsVersion = "24.0.1"
val bungeeCordChatVersion = "1.20-R0.1" val bungeeCordChatVersion = "1.20-R0.1"
+val adventureVersion = "4.14.0" +val adventureVersion = "4.15.0"
+val apiAndDocs: Configuration by configurations.creating { +val apiAndDocs: Configuration by configurations.creating {
+ attributes { + attributes {
+ attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION)) + attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.DOCUMENTATION))
@ -2138,7 +2138,7 @@ index 8532b8484d5a493c1c37ad7508597f624f1831c8..978431fd88cfb7d42fcdea8c904633df
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index a5046b416fa26d51974de0866d3af190ee197c3a..6b93a62ca4e25a4b3dfcf95e29a8cfac5ba5e564 100644 index a5046b416fa26d51974de0866d3af190ee197c3a..01fe25d7925d7c014524ae9c26b62fade5670e64 100644
--- a/src/main/java/org/bukkit/entity/Player.java --- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java
@@ -52,7 +52,41 @@ import org.jetbrains.annotations.Nullable; @@ -52,7 +52,41 @@ import org.jetbrains.annotations.Nullable;
@ -2481,15 +2481,25 @@ index a5046b416fa26d51974de0866d3af190ee197c3a..6b93a62ca4e25a4b3dfcf95e29a8cfac
*/ */
@Deprecated @Deprecated
public void setTexturePack(@NotNull String url); public void setTexturePack(@NotNull String url);
@@ -1377,6 +1588,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -1345,7 +1556,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @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.
+ * @deprecated in favour of {@link #sendResourcePacks(net.kyori.adventure.resource.ResourcePackRequest)}
*/
+ @Deprecated // Paper - adventure
public void setResourcePack(@NotNull String url);
/**
@@ -1377,6 +1590,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* pack correctly. * pack correctly.
* </ul> * </ul>
* *
+ * @deprecated in favour of {@link #setResourcePack(UUID, String, byte[], net.kyori.adventure.text.Component, boolean)} + * @deprecated in favour of {@link #sendResourcePacks(net.kyori.adventure.resource.ResourcePackRequest)}
* @param url The URL from which the client will download the resource * @param url The URL from which the client will download the resource
* pack. The string must contain only US-ASCII characters and should * pack. The string must contain only US-ASCII characters and should
* be encoded as per RFC 1738. * be encoded as per RFC 1738.
@@ -1389,6 +1601,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -1389,6 +1603,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @throws IllegalArgumentException Thrown if the hash is not 20 bytes * @throws IllegalArgumentException Thrown if the hash is not 20 bytes
* long. * long.
*/ */
@ -2497,15 +2507,22 @@ index a5046b416fa26d51974de0866d3af190ee197c3a..6b93a62ca4e25a4b3dfcf95e29a8cfac
public void setResourcePack(@NotNull String url, @Nullable byte[] hash); public void setResourcePack(@NotNull String url, @Nullable byte[] hash);
/** /**
@@ -1419,6 +1632,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -1413,12 +1628,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* {@link PlayerResourcePackStatusEvent} to figure out whether or not
* the player loaded the pack!
* <li>To remove a resource pack you can use
- * {@link #removeResourcePack(UUID)} or {@link #removeResourcePacks()}.
+ * {@link #removeResourcePacks(UUID, UUID...)} or {@link #clearResourcePacks()}.
* <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. * pack correctly.
* </ul> * </ul>
* *
+ * @deprecated in favour of {@link #setResourcePack(UUID, String, byte[], net.kyori.adventure.text.Component, boolean)} + * @deprecated in favour of {@link #sendResourcePacks(net.kyori.adventure.resource.ResourcePackRequest)}
* @param url The URL from which the client will download the resource * @param url The URL from which the client will download the resource
* pack. The string must contain only US-ASCII characters and should * pack. The string must contain only US-ASCII characters and should
* be encoded as per RFC 1738. * be encoded as per RFC 1738.
@@ -1432,8 +1646,54 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -1432,8 +1648,57 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @throws IllegalArgumentException Thrown if the hash is not 20 bytes * @throws IllegalArgumentException Thrown if the hash is not 20 bytes
* long. * long.
*/ */
@ -2534,6 +2551,8 @@ index a5046b416fa26d51974de0866d3af190ee197c3a..6b93a62ca4e25a4b3dfcf95e29a8cfac
+ * case this method will have no affect on them. Use the + * case this method will have no affect on them. Use the
+ * {@link PlayerResourcePackStatusEvent} to figure out whether or not + * {@link PlayerResourcePackStatusEvent} to figure out whether or not
+ * the player loaded the pack! + * the player loaded the pack!
+ * <li>To remove a resource pack you can use
+ * {@link #removeResourcePacks(UUID, UUID...)} or {@link #clearResourcePacks()}.
+ * <li>The request is sent with empty string as the hash when the hash is + * <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 + * not provided. This might result in newer versions not loading the
+ * pack correctly. + * pack correctly.
@ -2551,6 +2570,7 @@ index a5046b416fa26d51974de0866d3af190ee197c3a..6b93a62ca4e25a4b3dfcf95e29a8cfac
+ * length restriction is an implementation specific arbitrary value. + * length restriction is an implementation specific arbitrary value.
+ * @throws IllegalArgumentException Thrown if the hash is not 20 bytes + * @throws IllegalArgumentException Thrown if the hash is not 20 bytes
+ * long. + * long.
+ * @see #sendResourcePacks(net.kyori.adventure.resource.ResourcePackRequest)
+ */ + */
+ default void setResourcePack(final @NotNull String url, final byte @Nullable [] hash, final net.kyori.adventure.text.@Nullable Component prompt) { + default void setResourcePack(final @NotNull String url, final byte @Nullable [] hash, final net.kyori.adventure.text.@Nullable Component prompt) {
+ this.setResourcePack(url, hash, prompt, false); + this.setResourcePack(url, hash, prompt, false);
@ -2560,17 +2580,39 @@ index a5046b416fa26d51974de0866d3af190ee197c3a..6b93a62ca4e25a4b3dfcf95e29a8cfac
/** /**
* Request that the player's client download and switch resource packs. * Request that the player's client download and switch resource packs.
* <p> * <p>
@@ -1462,6 +1722,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -1456,7 +1721,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* {@link PlayerResourcePackStatusEvent} to figure out whether or not
* the player loaded the pack!
* <li>To remove a resource pack you can use
- * {@link #removeResourcePack(UUID)} or {@link #removeResourcePacks()}.
+ * {@link #removeResourcePacks(UUID, UUID...)} or {@link #clearResourcePacks()}.
* <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. * pack correctly.
* </ul> @@ -1475,7 +1740,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* * length restriction is an implementation specific arbitrary value.
+ * @deprecated in favour of {@link #setResourcePack(String, byte[], net.kyori.adventure.text.Component, boolean)}
* @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.
@@ -1521,8 +1782,56 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @throws IllegalArgumentException Thrown if the hash is not 20 bytes * @throws IllegalArgumentException Thrown if the hash is not 20 bytes
* long. * long.
+ * @deprecated in favour of {@link #sendResourcePacks(net.kyori.adventure.resource.ResourcePackRequest)}
*/
+ @Deprecated // Paper - adventure
public void setResourcePack(@NotNull String url, @Nullable byte[] hash, boolean force);
/**
@@ -1500,7 +1767,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* {@link PlayerResourcePackStatusEvent} to figure out whether or not
* the player loaded the pack!
* <li>To remove a resource pack you can use
- * {@link #removeResourcePack(UUID)} or {@link #removeResourcePacks()}.
+ * {@link #removeResourcePacks(UUID, UUID...)} or {@link #clearResourcePacks()}.
* <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.
@@ -1520,9 +1787,61 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* length restriction is an implementation specific arbitrary value.
* @throws IllegalArgumentException Thrown if the hash is not 20 bytes
* long.
+ * @deprecated in favour of {@link #sendResourcePacks(net.kyori.adventure.resource.ResourcePackRequest)}
*/ */
+ @Deprecated // Paper + @Deprecated // Paper
public void setResourcePack(@NotNull String url, @Nullable byte[] hash, @Nullable String prompt, boolean force); public void setResourcePack(@NotNull String url, @Nullable byte[] hash, @Nullable String prompt, boolean force);
@ -2588,8 +2630,8 @@ index a5046b416fa26d51974de0866d3af190ee197c3a..6b93a62ca4e25a4b3dfcf95e29a8cfac
+ * perform a file size check against the response content to determine if + * perform a file size check against the response content to determine if
+ * the resource pack has changed and needs to be downloaded again. When + * 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 + * 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 + * client will first display a confirmation GUI with a custom prompt
+ * proceeding with the download. + * to the player before proceeding with the download.
+ * <p> + * <p>
+ * Notes: + * Notes:
+ * <ul> + * <ul>
@ -2597,6 +2639,8 @@ index a5046b416fa26d51974de0866d3af190ee197c3a..6b93a62ca4e25a4b3dfcf95e29a8cfac
+ * case this method will have no affect on them. Use the + * case this method will have no affect on them. Use the
+ * {@link PlayerResourcePackStatusEvent} to figure out whether or not + * {@link PlayerResourcePackStatusEvent} to figure out whether or not
+ * the player loaded the pack! + * the player loaded the pack!
+ * <li>To remove a resource pack you can use
+ * {@link #removeResourcePacks(UUID, UUID...)} or {@link #clearResourcePacks()}.
+ * <li>The request is sent with empty string as the hash when the hash is + * <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 + * not provided. This might result in newer versions not loading the
+ * pack correctly. + * pack correctly.
@ -2616,6 +2660,7 @@ index a5046b416fa26d51974de0866d3af190ee197c3a..6b93a62ca4e25a4b3dfcf95e29a8cfac
+ * length restriction is an implementation specific arbitrary value. + * length restriction is an implementation specific arbitrary value.
+ * @throws IllegalArgumentException Thrown if the hash is not 20 bytes + * @throws IllegalArgumentException Thrown if the hash is not 20 bytes
+ * long. + * long.
+ * @see #sendResourcePacks(net.kyori.adventure.resource.ResourcePackRequest)
+ */ + */
+ default void setResourcePack(final @NotNull String url, final byte @Nullable [] hash, final net.kyori.adventure.text.@Nullable Component prompt, final boolean force) { + default void setResourcePack(final @NotNull String url, final byte @Nullable [] hash, final net.kyori.adventure.text.@Nullable Component prompt, final boolean force) {
+ this.setResourcePack(UUID.nameUUIDFromBytes(url.getBytes(java.nio.charset.StandardCharsets.UTF_8)), url, hash, prompt, force); + this.setResourcePack(UUID.nameUUIDFromBytes(url.getBytes(java.nio.charset.StandardCharsets.UTF_8)), url, hash, prompt, force);
@ -2625,11 +2670,20 @@ index a5046b416fa26d51974de0866d3af190ee197c3a..6b93a62ca4e25a4b3dfcf95e29a8cfac
/** /**
* Request that the player's client download and switch resource packs. * Request that the player's client download and switch resource packs.
* <p> * <p>
@@ -1566,9 +1875,57 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -1545,7 +1864,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* {@link PlayerResourcePackStatusEvent} to figure out whether or not
* the player loaded the pack!
* <li>To remove a resource pack you can use
- * {@link #removeResourcePack(UUID)} or {@link #removeResourcePacks()}.
+ * {@link #removeResourcePacks(UUID, UUID...)} or {@link #clearResourcePacks()}.
* <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.
@@ -1566,21 +1885,74 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* length restriction is an implementation specific arbitrary value. * length restriction is an implementation specific arbitrary value.
* @throws IllegalArgumentException Thrown if the hash is not 20 bytes * @throws IllegalArgumentException Thrown if the hash is not 20 bytes
* long. * long.
+ * @deprecated use {@link #setResourcePack(UUID, String, byte[], net.kyori.adventure.text.Component, boolean)} )} + * @deprecated in favour of {@link #sendResourcePacks(net.kyori.adventure.resource.ResourcePackRequest)}
*/ */
+ @Deprecated // Paper - adventure + @Deprecated // Paper - adventure
public void setResourcePack(@NotNull UUID id, @NotNull String url, @Nullable byte[] hash, @Nullable String prompt, boolean force); public void setResourcePack(@NotNull UUID id, @NotNull String url, @Nullable byte[] hash, @Nullable String prompt, boolean force);
@ -2656,6 +2710,8 @@ index a5046b416fa26d51974de0866d3af190ee197c3a..6b93a62ca4e25a4b3dfcf95e29a8cfac
+ * case this method will have no affect on them. Use the + * case this method will have no affect on them. Use the
+ * {@link PlayerResourcePackStatusEvent} to figure out whether or not + * {@link PlayerResourcePackStatusEvent} to figure out whether or not
+ * the player loaded the pack! + * the player loaded the pack!
+ * <li>To remove a resource pack you can use
+ * {@link #removeResourcePacks(UUID, UUID...)} or {@link #clearResourcePacks()}.
+ * <li>The request is sent with empty string as the hash when the hash is + * <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 + * not provided. This might result in newer versions not loading the
+ * pack correctly. + * pack correctly.
@ -2676,6 +2732,7 @@ index a5046b416fa26d51974de0866d3af190ee197c3a..6b93a62ca4e25a4b3dfcf95e29a8cfac
+ * length restriction is an implementation specific arbitrary value. + * length restriction is an implementation specific arbitrary value.
+ * @throws IllegalArgumentException Thrown if the hash is not 20 bytes + * @throws IllegalArgumentException Thrown if the hash is not 20 bytes
+ * long. + * long.
+ * @see #sendResourcePacks(net.kyori.adventure.resource.ResourcePackRequest)
+ */ + */
+ void setResourcePack(@NotNull UUID uuid, @NotNull String url, byte @Nullable [] hash, net.kyori.adventure.text.@Nullable Component prompt, boolean force); + void setResourcePack(@NotNull UUID uuid, @NotNull String url, byte @Nullable [] hash, net.kyori.adventure.text.@Nullable Component prompt, boolean force);
+ // Paper end + // Paper end
@ -2683,7 +2740,21 @@ index a5046b416fa26d51974de0866d3af190ee197c3a..6b93a62ca4e25a4b3dfcf95e29a8cfac
/** /**
* Request that the player's client remove a resource pack sent by the * Request that the player's client remove a resource pack sent by the
* server. * server.
@@ -1718,7 +2075,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM *
* @param id the id of the resource pack.
* @throws IllegalArgumentException If the ID is null.
+ * @see #removeResourcePacks(UUID, UUID...)
*/
public void removeResourcePack(@NotNull UUID id);
/**
* Request that the player's client remove all loaded resource pack sent by
* the server.
+ * @see #clearResourcePacks()
*/
public void removeResourcePacks();
@@ -1718,7 +2090,7 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* *
* @param title Title text * @param title Title text
* @param subtitle Subtitle text * @param subtitle Subtitle text
@ -2692,7 +2763,7 @@ index a5046b416fa26d51974de0866d3af190ee197c3a..6b93a62ca4e25a4b3dfcf95e29a8cfac
*/ */
@Deprecated @Deprecated
public void sendTitle(@Nullable String title, @Nullable String subtitle); public void sendTitle(@Nullable String title, @Nullable String subtitle);
@@ -1737,7 +2094,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -1737,7 +2109,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param fadeIn time in ticks for titles to fade in. Defaults to 10. * @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 stay time in ticks for titles to stay. Defaults to 70.
* @param fadeOut time in ticks for titles to fade out. Defaults to 20. * @param fadeOut time in ticks for titles to fade out. Defaults to 20.
@ -2702,7 +2773,7 @@ index a5046b416fa26d51974de0866d3af190ee197c3a..6b93a62ca4e25a4b3dfcf95e29a8cfac
public void sendTitle(@Nullable String title, @Nullable String subtitle, int fadeIn, int stay, int fadeOut); public void sendTitle(@Nullable String title, @Nullable String subtitle, int fadeIn, int stay, int fadeOut);
/** /**
@@ -1964,6 +2323,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -1964,6 +2338,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/ */
public int getClientViewDistance(); public int getClientViewDistance();
@ -2717,7 +2788,7 @@ index a5046b416fa26d51974de0866d3af190ee197c3a..6b93a62ca4e25a4b3dfcf95e29a8cfac
/** /**
* Gets the player's estimated ping in milliseconds. * Gets the player's estimated ping in milliseconds.
* *
@@ -1989,8 +2356,10 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -1989,8 +2371,10 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* they wish. * they wish.
* *
* @return the player's locale * @return the player's locale
@ -2728,7 +2799,7 @@ index a5046b416fa26d51974de0866d3af190ee197c3a..6b93a62ca4e25a4b3dfcf95e29a8cfac
public String getLocale(); public String getLocale();
/** /**
@@ -2042,6 +2411,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -2042,6 +2426,14 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/ */
public boolean isAllowingServerListings(); public boolean isAllowingServerListings();
@ -2743,7 +2814,7 @@ index a5046b416fa26d51974de0866d3af190ee197c3a..6b93a62ca4e25a4b3dfcf95e29a8cfac
// Spigot start // Spigot start
public class Spigot extends Entity.Spigot { public class Spigot extends Entity.Spigot {
@@ -2073,11 +2450,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -2073,11 +2465,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException("Not supported yet.");
} }
@ -2757,7 +2828,7 @@ index a5046b416fa26d51974de0866d3af190ee197c3a..6b93a62ca4e25a4b3dfcf95e29a8cfac
@Override @Override
public void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) { public void sendMessage(@NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException("Not supported yet.");
@@ -2088,7 +2467,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -2088,7 +2482,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* *
* @param position the screen position * @param position the screen position
* @param component the components to send * @param component the components to send
@ -2767,7 +2838,7 @@ index a5046b416fa26d51974de0866d3af190ee197c3a..6b93a62ca4e25a4b3dfcf95e29a8cfac
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @NotNull net.md_5.bungee.api.chat.BaseComponent component) { 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."); throw new UnsupportedOperationException("Not supported yet.");
} }
@@ -2098,7 +2479,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -2098,7 +2494,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* *
* @param position the screen position * @param position the screen position
* @param components the components to send * @param components the components to send
@ -2777,7 +2848,7 @@ index a5046b416fa26d51974de0866d3af190ee197c3a..6b93a62ca4e25a4b3dfcf95e29a8cfac
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @NotNull net.md_5.bungee.api.chat.BaseComponent... components) { 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."); throw new UnsupportedOperationException("Not supported yet.");
} }
@@ -2109,7 +2492,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -2109,7 +2507,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param position the screen position * @param position the screen position
* @param sender the sender of the message * @param sender the sender of the message
* @param component the components to send * @param component the components to send
@ -2787,7 +2858,7 @@ index a5046b416fa26d51974de0866d3af190ee197c3a..6b93a62ca4e25a4b3dfcf95e29a8cfac
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @Nullable java.util.UUID sender, @NotNull net.md_5.bungee.api.chat.BaseComponent component) { public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @Nullable java.util.UUID sender, @NotNull net.md_5.bungee.api.chat.BaseComponent component) {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException("Not supported yet.");
} }
@@ -2120,7 +2505,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -2120,7 +2520,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param position the screen position * @param position the screen position
* @param sender the sender of the message * @param sender the sender of the message
* @param components the components to send * @param components the components to send

Datei anzeigen

@ -3455,10 +3455,10 @@ index 516d7fc7812aac343782861d0d567f54aa578c2a..00000000000000000000000000000000
- // Spigot end - // Spigot end
-} -}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 6b93a62ca4e25a4b3dfcf95e29a8cfac5ba5e564..1a55f1b296d606179ee7ecbe4b482acc2d877fc1 100644 index 780928cd5d228901884a8aa6464870721dd64c96..5a4812cec9e13ca85f4bb18c95698f035fdc0fd9 100644
--- a/src/main/java/org/bukkit/entity/Player.java --- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2510,7 +2510,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -2525,7 +2525,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@Deprecated // Paper @Deprecated // Paper
public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @Nullable java.util.UUID sender, @NotNull net.md_5.bungee.api.chat.BaseComponent... components) { public void sendMessage(@NotNull net.md_5.bungee.api.ChatMessageType position, @Nullable java.util.UUID sender, @NotNull net.md_5.bungee.api.chat.BaseComponent... components) {
throw new UnsupportedOperationException("Not supported yet."); throw new UnsupportedOperationException("Not supported yet.");

Datei anzeigen

@ -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 diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 1a55f1b296d606179ee7ecbe4b482acc2d877fc1..8f6c133ff7ce78de8f0ac17eb45aced699548431 100644 index 5a4812cec9e13ca85f4bb18c95698f035fdc0fd9..6cf37df9c12510846b40d37d71577de061d058de 100644
--- a/src/main/java/org/bukkit/entity/Player.java --- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2362,6 +2362,22 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -2377,6 +2377,22 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@Deprecated // Paper @Deprecated // Paper
public String getLocale(); public String getLocale();

Datei anzeigen

@ -75,10 +75,10 @@ index 30dc2f85b60877930cab68230d3259ce92c08618..2867faf0acbbbb2e99c5b503f0c6bc83
public class Spigot { public class Spigot {
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 8f6c133ff7ce78de8f0ac17eb45aced699548431..934a347fc7be511cc125e1c2c175bcb2bf91c41a 100644 index 6cf37df9c12510846b40d37d71577de061d058de..6ed90056c16f8f3c0b844d378147397be94c3b58 100644
--- a/src/main/java/org/bukkit/entity/Player.java --- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2376,6 +2376,78 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -2391,6 +2391,78 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param affects Whether the player can affect mob spawning * @param affects Whether the player can affect mob spawning
*/ */
public void setAffectsSpawning(boolean affects); public void setAffectsSpawning(boolean affects);

Datei anzeigen

@ -5,20 +5,10 @@ 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 diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index fd557f0ee33748362ee97e24822509a6020a2c33..2995dd0ec8f6e49f850865bbc9fc7e0f0e66f121 100644 index f9a39faf656af1cd5e16513bab21afa6ab972556..1ec40d90b697af5759c5cd0bc8c2c3e76f8491eb 100644
--- a/src/main/java/org/bukkit/entity/Player.java --- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1717,7 +1717,9 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -2100,6 +2100,180 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @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.
+ * @deprecated use {@link #setResourcePack(String, String)}
*/
+ @Deprecated // Paper
public void setResourcePack(@NotNull String url);
/**
@@ -2087,6 +2089,165 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
void setResourcePack(@NotNull UUID uuid, @NotNull String url, byte @Nullable [] hash, net.kyori.adventure.text.@Nullable Component prompt, boolean force); void setResourcePack(@NotNull UUID uuid, @NotNull String url, byte @Nullable [] hash, net.kyori.adventure.text.@Nullable Component prompt, boolean force);
// Paper end // Paper end
@ -39,6 +29,8 @@ index fd557f0ee33748362ee97e24822509a6020a2c33..2995dd0ec8f6e49f850865bbc9fc7e0f
+ * <ul> + * <ul>
+ * <li>Players can disable server resources on their client, in which + * <li>Players can disable server resources on their client, in which
+ * case this method will have no affect on them. + * case this method will have no affect on them.
+ * <li>To remove a resource pack you can use
+ * {@link #removeResourcePacks(UUID, UUID...)} or {@link #clearResourcePacks()}.
+ * </ul> + * </ul>
+ * + *
+ * @param url The URL from which the client will download the resource + * @param url The URL from which the client will download the resource
@ -70,6 +62,8 @@ index fd557f0ee33748362ee97e24822509a6020a2c33..2995dd0ec8f6e49f850865bbc9fc7e0f
+ * <ul> + * <ul>
+ * <li>Players can disable server resources on their client, in which + * <li>Players can disable server resources on their client, in which
+ * case this method will have no affect on them. + * case this method will have no affect on them.
+ * <li>To remove a resource pack you can use
+ * {@link #removeResourcePacks(UUID, UUID...)} or {@link #clearResourcePacks()}.
+ * </ul> + * </ul>
+ * + *
+ * @param url The URL from which the client will download the resource + * @param url The URL from which the client will download the resource
@ -102,6 +96,8 @@ index fd557f0ee33748362ee97e24822509a6020a2c33..2995dd0ec8f6e49f850865bbc9fc7e0f
+ * <ul> + * <ul>
+ * <li>Players can disable server resources on their client, in which + * <li>Players can disable server resources on their client, in which
+ * case this method will have no affect on them. + * case this method will have no affect on them.
+ * <li>To remove a resource pack you can use
+ * {@link #removeResourcePacks(UUID, UUID...)} or {@link #clearResourcePacks()}.
+ * </ul> + * </ul>
+ * + *
+ * @param url The URL from which the client will download the resource + * @param url The URL from which the client will download the resource
@ -135,6 +131,8 @@ index fd557f0ee33748362ee97e24822509a6020a2c33..2995dd0ec8f6e49f850865bbc9fc7e0f
+ * <ul> + * <ul>
+ * <li>Players can disable server resources on their client, in which + * <li>Players can disable server resources on their client, in which
+ * case this method will have no affect on them. + * case this method will have no affect on them.
+ * <li>To remove a resource pack you can use
+ * {@link #removeResourcePacks(UUID, UUID...)} or {@link #clearResourcePacks()}.
+ * </ul> + * </ul>
+ * + *
+ * @param uuid Unique resource pack ID. + * @param uuid Unique resource pack ID.
@ -149,7 +147,14 @@ index fd557f0ee33748362ee97e24822509a6020a2c33..2995dd0ec8f6e49f850865bbc9fc7e0f
+ * @throws IllegalArgumentException Thrown if the URL is too long. The + * @throws IllegalArgumentException Thrown if the URL is too long. The
+ * length restriction is an implementation specific arbitrary value. + * length restriction is an implementation specific arbitrary value.
+ */ + */
+ void setResourcePack(@NotNull UUID uuid, @NotNull String url, @NotNull String hash, net.kyori.adventure.text.@Nullable Component resourcePackPrompt, boolean required); + default void setResourcePack(final @NotNull UUID uuid, final @NotNull String url, final @NotNull String hash, final net.kyori.adventure.text.@Nullable Component resourcePackPrompt, final boolean required) {
+ this.sendResourcePacks(net.kyori.adventure.resource.ResourcePackRequest.resourcePackRequest()
+ .required(required)
+ .replace(true)
+ .prompt(resourcePackPrompt)
+ .packs(net.kyori.adventure.resource.ResourcePackInfo.resourcePackInfo(uuid, java.net.URI.create(url), hash))
+ );
+ }
+ +
+ /** + /**
+ * Gets the most recent resource pack status from the player. + * Gets the most recent resource pack status from the player.

Datei anzeigen

@ -386,7 +386,7 @@ index ae9eaaa8e38e1d9dfc459926c7fc51ddb89de84a..b2ec535bb1b0ce0c114ddd7638b90218
@Override @Override
public int getConversionTime(); public int getConversionTime();
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 938780fb04751ceba4b871cd386f7ece5d6def37..d8e0fe5ed16e99192e8bd0431219c4bb5649b436 100644 index 732acee61a0a0c894df1b040dfd1d8a05141b5c4..4fd0ec2d6e520f60d20832325a8d171125ed9eef 100644
--- a/src/main/java/org/bukkit/entity/Player.java --- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java
@@ -432,15 +432,15 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -432,15 +432,15 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM

Datei anzeigen

@ -14,13 +14,13 @@ it without having to shade it in the plugin and going through
several layers of logging abstraction. several layers of logging abstraction.
diff --git a/build.gradle.kts b/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts
index c8e4f4613cd2af0c650a079ec5ed520254ce5816..9d817bf3f26ffd484945a00a6538970eca22ee20 100644 index 863833e05e2363b2e4ba4937f96ecbeac03a1ede..bf01892c248b988531d21d9fb0f74d0adf2205ac 100644
--- a/build.gradle.kts --- a/build.gradle.kts
+++ b/build.gradle.kts +++ b/build.gradle.kts
@@ -12,6 +12,8 @@ java { @@ -12,6 +12,8 @@ java {
val annotationsVersion = "24.0.1" val annotationsVersion = "24.0.1"
val bungeeCordChatVersion = "1.20-R0.1" val bungeeCordChatVersion = "1.20-R0.1"
val adventureVersion = "4.14.0" val adventureVersion = "4.15.0"
+val slf4jVersion = "2.0.9" +val slf4jVersion = "2.0.9"
+val log4jVersion = "2.17.1" +val log4jVersion = "2.17.1"
val apiAndDocs: Configuration by configurations.creating { val apiAndDocs: Configuration by configurations.creating {

Datei anzeigen

@ -93,10 +93,10 @@ index 4016129ead172c5f5b550482f523921d39df046f..4d500904b28375f8517aa05075667da2
/** /**
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 267d7ac323e5bde343ea4b4caa6ec2fc837e1a6d..03f86dbb176428380465a9163b9c0789454a49c3 100644 index 4433ec84c717f9f922384836b45d636be76b3463..3e6f25bc92cd4711b9875f169b7d5071c1dbac12 100644
--- a/src/main/java/org/bukkit/entity/Player.java --- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2876,6 +2876,26 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -2904,6 +2904,26 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
} }
// Paper end // Paper end

Datei anzeigen

@ -36,10 +36,10 @@ index abdca9fe5acc90f167219eb769ece66c35682bb1..b3aa3dc6aa5afbc36cc86741b4cba56f
/** /**
* Make the entity drop the item in their hand. * 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 diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 03f86dbb176428380465a9163b9c0789454a49c3..c74be483d11c7b2ab6d462af55495af8ccc7d0da 100644 index 3e6f25bc92cd4711b9875f169b7d5071c1dbac12..c8fa6733c6c8c08f653069d4630e35df4e29bd04 100644
--- a/src/main/java/org/bukkit/entity/Player.java --- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java
@@ -2837,10 +2837,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -2865,10 +2865,12 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
/** /**
* Open a Sign for editing by the Player. * Open a Sign for editing by the Player.
* *

Datei anzeigen

@ -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 diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 529e423889607b6128c7851c87480eb94125c1e8..bfed5759b4f4613e5143da41f5e82a37ab4f10a8 100644 index e8497492713a97ef05dff838bdc2a8880111a0e1..f17fadd635f7f0bc1b55cca4947377942e50aceb 100644
--- a/src/main/java/org/bukkit/entity/Player.java --- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3054,6 +3054,28 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -3082,6 +3082,28 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
void setPlayerProfile(com.destroystokyo.paper.profile.@NotNull PlayerProfile profile); void setPlayerProfile(com.destroystokyo.paper.profile.@NotNull PlayerProfile profile);
// Paper end - Player Profile API // Paper end - Player Profile API

Datei anzeigen

@ -229,10 +229,10 @@ index 0000000000000000000000000000000000000000..cf67dc7d465223710adbf2b798109f52
+ } + }
+} +}
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 5e7fec90713e580801c1e98bccf4adc5e16b9c71..25b86021224e53f5ff10ca21f19cce85e4073c4c 100644 index 604172b2362028a98599e463c18251ca12fabb49..dd9527b973239e20e62289ea8b4931623be6f7be 100644
--- a/src/main/java/org/bukkit/entity/Player.java --- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3073,6 +3073,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -3101,6 +3101,13 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
void resetCooldown(); void resetCooldown();
// Paper end - attack cooldown API // Paper end - attack cooldown API

Datei anzeigen

@ -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 diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 25b86021224e53f5ff10ca21f19cce85e4073c4c..76b9a7735b7f9860f051eaf205f711f594dbe966 100644 index dd9527b973239e20e62289ea8b4931623be6f7be..5311c533883e75bb8bf6017f6404dc3d02f1ea7a 100644
--- a/src/main/java/org/bukkit/entity/Player.java --- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3186,6 +3186,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -3214,6 +3214,16 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
// Paper end // Paper end
} }

Datei anzeigen

@ -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 diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 76b9a7735b7f9860f051eaf205f711f594dbe966..e78cc9a7908c857272d931726dc6b217e98ce14d 100644 index 5311c533883e75bb8bf6017f6404dc3d02f1ea7a..7bd0cf4ce7d79a69bbb47129d6a3917a54dd9a5a 100644
--- a/src/main/java/org/bukkit/entity/Player.java --- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3080,6 +3080,25 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -3108,6 +3108,25 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
<T> @NotNull T getClientOption(com.destroystokyo.paper.@NotNull ClientOption<T> option); <T> @NotNull T getClientOption(com.destroystokyo.paper.@NotNull ClientOption<T> option);
// Paper end - client option API // Paper end - client option API

Datei anzeigen

@ -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 diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index e78cc9a7908c857272d931726dc6b217e98ce14d..f9f33c83adcfe04fcc0937e3279ac1b77eb6774d 100644 index 7bd0cf4ce7d79a69bbb47129d6a3917a54dd9a5a..a1bf0abc5a22f75e2cf3a981fc917915ae7ef00f 100644
--- a/src/main/java/org/bukkit/entity/Player.java --- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3099,6 +3099,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -3127,6 +3127,19 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
} }
// Paper end - elytra boost API // Paper end - elytra boost API

Datei anzeigen

@ -158,10 +158,10 @@ index 953bb49b7079647450d3453356d1c8a91be94c01..2ea66188468cf32bcaedc5167d4b9b0c
* Teleports this entity to the given location. If this entity is riding a * Teleports this entity to the given location. If this entity is riding a
* vehicle, it will be dismounted prior to teleportation. * vehicle, it will be dismounted prior to teleportation.
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 2ee4844870e00b3971d92f49f7b5607435053f7f..d7da0e2abd953805a076a4b5c48678ca27ed7759 100644 index d0eeb2c6b0f3f56d8c3c9608991091750a3bd607..aeaed639ba3a0b91501d1da837adfc6bf5517ffa 100644
--- a/src/main/java/org/bukkit/entity/Player.java --- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3259,6 +3259,45 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -3287,6 +3287,45 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
String getClientBrandName(); String getClientBrandName();
// Paper end // Paper end

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Custom Chat Completion Suggestions API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index d7da0e2abd953805a076a4b5c48678ca27ed7759..db22831f7f444e5cee27c2cd8f5e17fecbfb5c65 100644 index aeaed639ba3a0b91501d1da837adfc6bf5517ffa..450ec166b8faf08de52b30844315a5ed29006784 100644
--- a/src/main/java/org/bukkit/entity/Player.java --- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3143,6 +3143,31 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -3171,6 +3171,31 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
void sendOpLevel(byte level); void sendOpLevel(byte level);
// Paper end - sendOpLevel API // Paper end - sendOpLevel API

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Elder Guardian appearance API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index db22831f7f444e5cee27c2cd8f5e17fecbfb5c65..374e7f82033ef964a5e4c8b10099e330e716d56d 100644 index 450ec166b8faf08de52b30844315a5ed29006784..e00dabaf992580230e89292a2c2fea88c4de87fd 100644
--- a/src/main/java/org/bukkit/entity/Player.java --- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3323,6 +3323,24 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -3351,6 +3351,24 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
void lookAt(@NotNull org.bukkit.entity.Entity entity, @NotNull io.papermc.paper.entity.LookAnchor playerAnchor, @NotNull io.papermc.paper.entity.LookAnchor entityAnchor); void lookAt(@NotNull org.bukkit.entity.Entity entity, @NotNull io.papermc.paper.entity.LookAnchor playerAnchor, @NotNull io.papermc.paper.entity.LookAnchor entityAnchor);
// Paper end - Teleport API // Paper end - Teleport API

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Add Player Warden Warning API
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 374e7f82033ef964a5e4c8b10099e330e716d56d..f008f3c9137e4c0662b53efab476c83a49494d22 100644 index e00dabaf992580230e89292a2c2fea88c4de87fd..0a3a29b5489684a4062663362694025cc3224adf 100644
--- a/src/main/java/org/bukkit/entity/Player.java --- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3339,6 +3339,59 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -3367,6 +3367,59 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
* @param silent whether sound should be silenced * @param silent whether sound should be silenced
*/ */
void showElderGuardian(boolean silent); void showElderGuardian(boolean silent);

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Add player idle duration API
Implements API for getting and resetting a player's idle duration. Implements API for getting and resetting a player's idle duration.
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index d74c12d8b2c9b813f13591bd552c67c857657d08..ec937534f049ba25fb359c3e022ebe52ead6abef 100644 index 118ecb48f014539f18105a20bdebe2e03ee8e6f8..9f8d0242c00008432012319a95453a25c5ef761e 100644
--- a/src/main/java/org/bukkit/entity/Player.java --- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java +++ b/src/main/java/org/bukkit/entity/Player.java
@@ -3480,6 +3480,29 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM @@ -3508,6 +3508,29 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
void increaseWardenWarningLevel(); void increaseWardenWarningLevel();
// Paper end // Paper end

Datei anzeigen

@ -14,10 +14,10 @@ Co-authored-by: Jake Potrebic <jake.m.potrebic@gmail.com>
diff --git a/src/main/java/io/papermc/paper/adventure/AdventureCodecs.java b/src/main/java/io/papermc/paper/adventure/AdventureCodecs.java diff --git a/src/main/java/io/papermc/paper/adventure/AdventureCodecs.java b/src/main/java/io/papermc/paper/adventure/AdventureCodecs.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..89d24905a91b3844ff95fe1d9252464a896906a7 index 0000000000000000000000000000000000000000..215ccf169d4e8522da5495768d33cf3e5cd92690
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/adventure/AdventureCodecs.java +++ b/src/main/java/io/papermc/paper/adventure/AdventureCodecs.java
@@ -0,0 +1,393 @@ @@ -0,0 +1,418 @@
+package io.papermc.paper.adventure; +package io.papermc.paper.adventure;
+ +
+import com.mojang.brigadier.exceptions.CommandSyntaxException; +import com.mojang.brigadier.exceptions.CommandSyntaxException;
@ -39,6 +39,7 @@ index 0000000000000000000000000000000000000000..89d24905a91b3844ff95fe1d9252464a
+import net.kyori.adventure.nbt.api.BinaryTagHolder; +import net.kyori.adventure.nbt.api.BinaryTagHolder;
+import net.kyori.adventure.text.BlockNBTComponent; +import net.kyori.adventure.text.BlockNBTComponent;
+import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.ComponentLike;
+import net.kyori.adventure.text.EntityNBTComponent; +import net.kyori.adventure.text.EntityNBTComponent;
+import net.kyori.adventure.text.KeybindComponent; +import net.kyori.adventure.text.KeybindComponent;
+import net.kyori.adventure.text.NBTComponent; +import net.kyori.adventure.text.NBTComponent;
@ -48,6 +49,7 @@ index 0000000000000000000000000000000000000000..89d24905a91b3844ff95fe1d9252464a
+import net.kyori.adventure.text.StorageNBTComponent; +import net.kyori.adventure.text.StorageNBTComponent;
+import net.kyori.adventure.text.TextComponent; +import net.kyori.adventure.text.TextComponent;
+import net.kyori.adventure.text.TranslatableComponent; +import net.kyori.adventure.text.TranslatableComponent;
+import net.kyori.adventure.text.TranslationArgument;
+import net.kyori.adventure.text.event.ClickEvent; +import net.kyori.adventure.text.event.ClickEvent;
+import net.kyori.adventure.text.event.HoverEvent; +import net.kyori.adventure.text.event.HoverEvent;
+import net.kyori.adventure.text.format.NamedTextColor; +import net.kyori.adventure.text.format.NamedTextColor;
@ -76,6 +78,9 @@ index 0000000000000000000000000000000000000000..89d24905a91b3844ff95fe1d9252464a
+import static com.mojang.serialization.codecs.RecordCodecBuilder.mapCodec; +import static com.mojang.serialization.codecs.RecordCodecBuilder.mapCodec;
+import static java.util.function.Function.identity; +import static java.util.function.Function.identity;
+import static net.kyori.adventure.text.Component.text; +import static net.kyori.adventure.text.Component.text;
+import static net.kyori.adventure.text.TranslationArgument.bool;
+import static net.kyori.adventure.text.TranslationArgument.component;
+import static net.kyori.adventure.text.TranslationArgument.numeric;
+import static net.minecraft.util.ExtraCodecs.recursive; +import static net.minecraft.util.ExtraCodecs.recursive;
+import static net.minecraft.util.ExtraCodecs.strictOptionalField; +import static net.minecraft.util.ExtraCodecs.strictOptionalField;
+ +
@ -246,16 +251,36 @@ index 0000000000000000000000000000000000000000..89d24905a91b3844ff95fe1d9252464a
+ return instance.group(Codec.STRING.fieldOf("text").forGetter(TextComponent::content)).apply(instance, Component::text); + return instance.group(Codec.STRING.fieldOf("text").forGetter(TextComponent::content)).apply(instance, Component::text);
+ }); + });
+ static final Codec<Object> PRIMITIVE_ARG_CODEC = ExtraCodecs.validate(ExtraCodecs.JAVA, TranslatableContents::filterAllowedArguments); + static final Codec<Object> PRIMITIVE_ARG_CODEC = ExtraCodecs.validate(ExtraCodecs.JAVA, TranslatableContents::filterAllowedArguments);
+ static final Codec<Component> ARG_CODEC = Codec.either(PRIMITIVE_ARG_CODEC, COMPONENT_CODEC).xmap((primitiveOrComponent) -> { + static final Codec<TranslationArgument> ARG_CODEC = Codec.either(PRIMITIVE_ARG_CODEC, COMPONENT_CODEC).flatXmap((primitiveOrComponent) -> {
+ // just toString all primitives (not 100% correct to vanilla spec) + return primitiveOrComponent.map(o -> {
+ // vanilla allows primitive translatable args, but adventure doesn't (in 4.14) + final TranslationArgument arg;
+ return primitiveOrComponent.map(o -> text(String.valueOf(o)), identity()); + if (o instanceof String s) {
+ }, Either::right); + arg = component(text(s));
+ } else if (o instanceof Boolean bool) {
+ arg = bool(bool);
+ } else if (o instanceof Number num) {
+ arg = numeric(num);
+ } else {
+ return DataResult.error(() -> o + " is not a valid translation argument primitive");
+ }
+ return DataResult.success(arg);
+ }, component -> DataResult.success(component(component)));
+ }, translationArgument -> {
+ if (translationArgument.value() instanceof Number || translationArgument.value() instanceof Boolean) {
+ return DataResult.success(Either.left(translationArgument.value()));
+ }
+ final Component component = translationArgument.asComponent();
+ final @Nullable String collapsed = tryCollapseToString(component);
+ if (collapsed != null) {
+ return DataResult.success(Either.left(collapsed)); // attempt to collapse all text components to strings
+ }
+ return DataResult.success(Either.right(component));
+ });
+ static final MapCodec<TranslatableComponent> TRANSLATABLE_COMPONENT_MAP_CODEC = mapCodec((instance) -> { + static final MapCodec<TranslatableComponent> TRANSLATABLE_COMPONENT_MAP_CODEC = mapCodec((instance) -> {
+ return instance.group( + return instance.group(
+ Codec.STRING.fieldOf("translate").forGetter(TranslatableComponent::key), + Codec.STRING.fieldOf("translate").forGetter(TranslatableComponent::key),
+ Codec.STRING.optionalFieldOf("fallback").forGetter(nullableGetter(TranslatableComponent::fallback)), + Codec.STRING.optionalFieldOf("fallback").forGetter(nullableGetter(TranslatableComponent::fallback)),
+ strictOptionalField(ARG_CODEC.listOf(), "with").forGetter(c -> c.args().isEmpty() ? Optional.empty() : Optional.of(c.args())) + strictOptionalField(ARG_CODEC.listOf(), "with").forGetter(c -> c.arguments().isEmpty() ? Optional.empty() : Optional.of(c.arguments()))
+ ).apply(instance, (key, fallback, components) -> { + ).apply(instance, (key, fallback, components) -> {
+ return Component.translatable(key, components.orElse(Collections.emptyList())).fallback(fallback.orElse(null)); + return Component.translatable(key, components.orElse(Collections.emptyList())).fallback(fallback.orElse(null));
+ }); + });
@ -497,10 +522,10 @@ index 0000000000000000000000000000000000000000..4b01e1249276a26aa82eb2d70f4b1223
+} +}
diff --git a/src/main/java/io/papermc/paper/adventure/BossBarImplementationImpl.java b/src/main/java/io/papermc/paper/adventure/BossBarImplementationImpl.java diff --git a/src/main/java/io/papermc/paper/adventure/BossBarImplementationImpl.java b/src/main/java/io/papermc/paper/adventure/BossBarImplementationImpl.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..465d634dae2e94a488c03376c3ec59a242c8e59b index 0000000000000000000000000000000000000000..23bd6d2d8fed5a3491e856f8b875456dd29f8aaf
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/adventure/BossBarImplementationImpl.java +++ b/src/main/java/io/papermc/paper/adventure/BossBarImplementationImpl.java
@@ -0,0 +1,84 @@ @@ -0,0 +1,85 @@
+package io.papermc.paper.adventure; +package io.papermc.paper.adventure;
+ +
+import com.google.common.collect.Collections2; +import com.google.common.collect.Collections2;
@ -518,6 +543,7 @@ index 0000000000000000000000000000000000000000..465d634dae2e94a488c03376c3ec59a2
+import org.checkerframework.checker.nullness.qual.NonNull; +import org.checkerframework.checker.nullness.qual.NonNull;
+import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.NotNull;
+ +
+@SuppressWarnings("UnstableApiUsage")
+public final class BossBarImplementationImpl implements BossBar.Listener, BossBarImplementation { +public final class BossBarImplementationImpl implements BossBar.Listener, BossBarImplementation {
+ private final BossBar bar; + private final BossBar bar;
+ private ServerBossEvent vanilla; + private ServerBossEvent vanilla;
@ -1221,10 +1247,10 @@ index 0000000000000000000000000000000000000000..2fd6c3e65354071af71c7d8ebb97b559
+} +}
diff --git a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java diff --git a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..c10c0ffa29332d73328f088935a0b914260d4c50 index 0000000000000000000000000000000000000000..2e757cd9b01ac7eba1e4723a6e21dcea9d062483
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java +++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
@@ -0,0 +1,397 @@ @@ -0,0 +1,401 @@
+package io.papermc.paper.adventure; +package io.papermc.paper.adventure;
+ +
+import com.mojang.brigadier.exceptions.CommandSyntaxException; +import com.mojang.brigadier.exceptions.CommandSyntaxException;
@ -1239,6 +1265,7 @@ index 0000000000000000000000000000000000000000..c10c0ffa29332d73328f088935a0b914
+import java.util.function.BiConsumer; +import java.util.function.BiConsumer;
+import java.util.regex.Matcher; +import java.util.regex.Matcher;
+import java.util.regex.Pattern; +import java.util.regex.Pattern;
+import java.util.stream.StreamSupport;
+import net.kyori.adventure.bossbar.BossBar; +import net.kyori.adventure.bossbar.BossBar;
+import net.kyori.adventure.inventory.Book; +import net.kyori.adventure.inventory.Book;
+import net.kyori.adventure.key.Key; +import net.kyori.adventure.key.Key;
@ -1246,6 +1273,7 @@ index 0000000000000000000000000000000000000000..c10c0ffa29332d73328f088935a0b914
+import net.kyori.adventure.sound.Sound; +import net.kyori.adventure.sound.Sound;
+import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.TranslatableComponent; +import net.kyori.adventure.text.TranslatableComponent;
+import net.kyori.adventure.text.TranslationArgument;
+import net.kyori.adventure.text.flattener.ComponentFlattener; +import net.kyori.adventure.text.flattener.ComponentFlattener;
+import net.kyori.adventure.text.format.TextColor; +import net.kyori.adventure.text.format.TextColor;
+import net.kyori.adventure.text.serializer.ComponentSerializer; +import net.kyori.adventure.text.serializer.ComponentSerializer;
@ -1298,7 +1326,7 @@ index 0000000000000000000000000000000000000000..c10c0ffa29332d73328f088935a0b914
+ final @NotNull String translated = Language.getInstance().getOrDefault(translatable.key(), fallback != null ? fallback : translatable.key()); + final @NotNull String translated = Language.getInstance().getOrDefault(translatable.key(), fallback != null ? fallback : translatable.key());
+ +
+ final Matcher matcher = LOCALIZATION_PATTERN.matcher(translated); + final Matcher matcher = LOCALIZATION_PATTERN.matcher(translated);
+ final List<Component> args = translatable.args(); + final List<TranslationArgument> args = translatable.arguments();
+ int argPosition = 0; + int argPosition = 0;
+ int lastIdx = 0; + int lastIdx = 0;
+ while (matcher.find()) { + while (matcher.find()) {
@ -1314,7 +1342,7 @@ index 0000000000000000000000000000000000000000..c10c0ffa29332d73328f088935a0b914
+ try { + try {
+ final int idx = Integer.parseInt(argIdx) - 1; + final int idx = Integer.parseInt(argIdx) - 1;
+ if (idx < args.size()) { + if (idx < args.size()) {
+ consumer.accept(args.get(idx)); + consumer.accept(args.get(idx).asComponent());
+ } + }
+ } catch (final NumberFormatException ex) { + } catch (final NumberFormatException ex) {
+ // ignore, drop the format placeholder + // ignore, drop the format placeholder
@ -1322,7 +1350,7 @@ index 0000000000000000000000000000000000000000..c10c0ffa29332d73328f088935a0b914
+ } else { + } else {
+ final int idx = argPosition++; + final int idx = argPosition++;
+ if (idx < args.size()) { + if (idx < args.size()) {
+ consumer.accept(args.get(idx)); + consumer.accept(args.get(idx).asComponent());
+ } + }
+ } + }
+ } + }
@ -1375,7 +1403,7 @@ index 0000000000000000000000000000000000000000..c10c0ffa29332d73328f088935a0b914
+ return component == null ? Component.empty() : WRAPPER_AWARE_SERIALIZER.deserialize(component); + return component == null ? Component.empty() : WRAPPER_AWARE_SERIALIZER.deserialize(component);
+ } + }
+ +
+ public static ArrayList<Component> asAdventure(final List<net.minecraft.network.chat.Component> vanillas) { + public static ArrayList<Component> asAdventure(final List<? extends net.minecraft.network.chat.Component> vanillas) {
+ final ArrayList<Component> adventures = new ArrayList<>(vanillas.size()); + final ArrayList<Component> adventures = new ArrayList<>(vanillas.size());
+ for (final net.minecraft.network.chat.Component vanilla : vanillas) { + for (final net.minecraft.network.chat.Component vanilla : vanillas) {
+ adventures.add(asAdventure(vanilla)); + adventures.add(asAdventure(vanilla));
@ -1405,7 +1433,7 @@ index 0000000000000000000000000000000000000000..c10c0ffa29332d73328f088935a0b914
+ return WRAPPER_AWARE_SERIALIZER.serialize(component); + return WRAPPER_AWARE_SERIALIZER.serialize(component);
+ } + }
+ +
+ public static List<net.minecraft.network.chat.Component> asVanilla(final List<Component> adventures) { + public static List<net.minecraft.network.chat.Component> asVanilla(final List<? extends Component> adventures) {
+ final List<net.minecraft.network.chat.Component> vanillas = new ArrayList<>(adventures.size()); + final List<net.minecraft.network.chat.Component> vanillas = new ArrayList<>(adventures.size());
+ for (final Component adventure : adventures) { + for (final Component adventure : adventures) {
+ vanillas.add(asVanilla(adventure)); + vanillas.add(asVanilla(adventure));
@ -1417,6 +1445,11 @@ index 0000000000000000000000000000000000000000..c10c0ffa29332d73328f088935a0b914
+ return GsonComponentSerializer.gson().serialize(translated(component, locale)); + return GsonComponentSerializer.gson().serialize(translated(component, locale));
+ } + }
+ +
+ public static boolean hasAnyTranslations() {
+ return StreamSupport.stream(GlobalTranslator.translator().sources().spliterator(), false)
+ .anyMatch(t -> t.hasAnyTranslations().toBooleanOrElse(true));
+ }
+
+ private static final Map<Locale, com.mojang.serialization.Codec<Component>> LOCALIZED_CODECS = new ConcurrentHashMap<>(); + private static final Map<Locale, com.mojang.serialization.Codec<Component>> LOCALIZED_CODECS = new ConcurrentHashMap<>();
+ +
+ public static com.mojang.serialization.Codec<Component> localizedCodec(final @Nullable Locale l) { + public static com.mojang.serialization.Codec<Component> localizedCodec(final @Nullable Locale l) {
@ -1434,6 +1467,7 @@ index 0000000000000000000000000000000000000000..c10c0ffa29332d73328f088935a0b914
+ } + }
+ +
+ private static Component translated(final Component component, final Locale locale) { + private static Component translated(final Component component, final Locale locale) {
+ //noinspection ConstantValue
+ return GlobalTranslator.render( + return GlobalTranslator.render(
+ component, + component,
+ // play it safe + // play it safe
@ -1452,7 +1486,7 @@ index 0000000000000000000000000000000000000000..c10c0ffa29332d73328f088935a0b914
+ } + }
+ try { + try {
+ return asAdventure(ComponentUtils.updateForEntity(css, asVanilla(component), scoreboardSubject == null ? null : ((CraftEntity) scoreboardSubject).getHandle(), 0)); + return asAdventure(ComponentUtils.updateForEntity(css, asVanilla(component), scoreboardSubject == null ? null : ((CraftEntity) scoreboardSubject).getHandle(), 0));
+ } catch (CommandSyntaxException e) { + } catch (final CommandSyntaxException e) {
+ throw new IOException(e); + throw new IOException(e);
+ } finally { + } finally {
+ if (css != null && previous != null) { + if (css != null && previous != null) {
@ -1534,10 +1568,6 @@ index 0000000000000000000000000000000000000000..c10c0ffa29332d73328f088935a0b914
+ } + }
+ +
+ private static String validateField(final String content, final int length, final String name) { + private static String validateField(final String content, final int length, final String name) {
+ if (content == null) {
+ return content;
+ }
+
+ final int actual = content.length(); + final int actual = content.length();
+ if (actual > length) { + if (actual > length) {
+ throw new IllegalArgumentException("Field '" + name + "' has a maximum length of " + length + " but was passed '" + content + "', which was " + actual + " characters long."); + throw new IllegalArgumentException("Field '" + name + "' has a maximum length of " + length + " but was passed '" + content + "', which was " + actual + " characters long.");
@ -1792,10 +1822,10 @@ index 0000000000000000000000000000000000000000..23432eea862c6df716d7726a32da3a06
+} +}
diff --git a/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java b/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java diff --git a/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java b/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..c3631efda9c7fa531a8a9f18fbee7b5f8655382b index 0000000000000000000000000000000000000000..8323f135d6bf2e1f12525e05094ffa3f2420e7e1
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java +++ b/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java
@@ -0,0 +1,19 @@ @@ -0,0 +1,20 @@
+package io.papermc.paper.adventure.providers; +package io.papermc.paper.adventure.providers;
+ +
+import io.papermc.paper.adventure.PaperAdventure; +import io.papermc.paper.adventure.PaperAdventure;
@ -1805,6 +1835,7 @@ index 0000000000000000000000000000000000000000..c3631efda9c7fa531a8a9f18fbee7b5f
+import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.NotNull;
+import org.slf4j.LoggerFactory; +import org.slf4j.LoggerFactory;
+ +
+@SuppressWarnings("UnstableApiUsage")
+public class ComponentLoggerProviderImpl implements ComponentLoggerProvider { +public class ComponentLoggerProviderImpl implements ComponentLoggerProvider {
+ @Override + @Override
+ public @NotNull ComponentLogger logger(@NotNull LoggerHelper helper, @NotNull String name) { + public @NotNull ComponentLogger logger(@NotNull LoggerHelper helper, @NotNull String name) {
@ -1921,26 +1952,26 @@ index 0000000000000000000000000000000000000000..25fd6992c869c841b1b1b3240f4d5249
+} +}
diff --git a/src/main/java/io/papermc/paper/adventure/providers/NBTLegacyHoverEventSerializer.java b/src/main/java/io/papermc/paper/adventure/providers/NBTLegacyHoverEventSerializer.java diff --git a/src/main/java/io/papermc/paper/adventure/providers/NBTLegacyHoverEventSerializer.java b/src/main/java/io/papermc/paper/adventure/providers/NBTLegacyHoverEventSerializer.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..b3514a3e415f3444a235f1a45f0c53741264e516 index 0000000000000000000000000000000000000000..202b964e7e67717904cd3f00b6af6ad7f2a5c90e
--- /dev/null --- /dev/null
+++ b/src/main/java/io/papermc/paper/adventure/providers/NBTLegacyHoverEventSerializer.java +++ b/src/main/java/io/papermc/paper/adventure/providers/NBTLegacyHoverEventSerializer.java
@@ -0,0 +1,89 @@ @@ -0,0 +1,91 @@
+package io.papermc.paper.adventure.providers; +package io.papermc.paper.adventure.providers;
+ +
+import com.mojang.brigadier.exceptions.CommandSyntaxException; +import com.mojang.brigadier.exceptions.CommandSyntaxException;
+import java.io.IOException;
+import java.util.UUID;
+import net.kyori.adventure.key.Key; +import net.kyori.adventure.key.Key;
+import net.kyori.adventure.nbt.api.BinaryTagHolder; +import net.kyori.adventure.nbt.api.BinaryTagHolder;
+import net.kyori.adventure.text.Component; +import net.kyori.adventure.text.Component;
+import net.kyori.adventure.text.event.HoverEvent; +import net.kyori.adventure.text.event.HoverEvent;
+import net.kyori.adventure.text.serializer.gson.LegacyHoverEventSerializer; +import net.kyori.adventure.text.serializer.json.LegacyHoverEventSerializer;
+import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; +import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
+import net.kyori.adventure.util.Codec; +import net.kyori.adventure.util.Codec;
+import net.minecraft.nbt.CompoundTag; +import net.minecraft.nbt.CompoundTag;
+import net.minecraft.nbt.Tag; +import net.minecraft.nbt.Tag;
+import net.minecraft.nbt.TagParser; +import net.minecraft.nbt.TagParser;
+ +import org.intellij.lang.annotations.Subst;
+import java.io.IOException;
+import java.util.UUID;
+ +
+final class NBTLegacyHoverEventSerializer implements LegacyHoverEventSerializer { +final class NBTLegacyHoverEventSerializer implements LegacyHoverEventSerializer {
+ public static final NBTLegacyHoverEventSerializer INSTANCE = new NBTLegacyHoverEventSerializer(); + public static final NBTLegacyHoverEventSerializer INSTANCE = new NBTLegacyHoverEventSerializer();
@ -1963,8 +1994,9 @@ index 0000000000000000000000000000000000000000..b3514a3e415f3444a235f1a45f0c5374
+ try { + try {
+ final CompoundTag contents = SNBT_CODEC.decode(raw); + final CompoundTag contents = SNBT_CODEC.decode(raw);
+ final CompoundTag tag = contents.getCompound(ITEM_TAG); + final CompoundTag tag = contents.getCompound(ITEM_TAG);
+ return HoverEvent.ShowItem.of( + @Subst("key") final String keyString = contents.getString(ITEM_TYPE);
+ Key.key(contents.getString(ITEM_TYPE)), + return HoverEvent.ShowItem.showItem(
+ Key.key(keyString),
+ contents.contains(ITEM_COUNT) ? contents.getByte(ITEM_COUNT) : 1, + contents.contains(ITEM_COUNT) ? contents.getByte(ITEM_COUNT) : 1,
+ tag.isEmpty() ? null : BinaryTagHolder.encode(tag, SNBT_CODEC) + tag.isEmpty() ? null : BinaryTagHolder.encode(tag, SNBT_CODEC)
+ ); + );
@ -1978,8 +2010,9 @@ index 0000000000000000000000000000000000000000..b3514a3e415f3444a235f1a45f0c5374
+ final String raw = PlainTextComponentSerializer.plainText().serialize(input); + final String raw = PlainTextComponentSerializer.plainText().serialize(input);
+ try { + try {
+ final CompoundTag contents = SNBT_CODEC.decode(raw); + final CompoundTag contents = SNBT_CODEC.decode(raw);
+ return HoverEvent.ShowEntity.of( + @Subst("key") final String keyString = contents.getString(ENTITY_TYPE);
+ Key.key(contents.getString(ENTITY_TYPE)), + return HoverEvent.ShowEntity.showEntity(
+ Key.key(keyString),
+ UUID.fromString(contents.getString(ENTITY_ID)), + UUID.fromString(contents.getString(ENTITY_ID)),
+ componentCodec.decode(contents.getString(ENTITY_NAME)) + componentCodec.decode(contents.getString(ENTITY_NAME))
+ ); + );
@ -2004,7 +2037,7 @@ index 0000000000000000000000000000000000000000..b3514a3e415f3444a235f1a45f0c5374
+ } + }
+ +
+ @Override + @Override
+ public Component serializeShowEntity(final HoverEvent.ShowEntity input, final Codec.Encoder<Component, String, ? extends RuntimeException> componentCodec) throws IOException { + public Component serializeShowEntity(final HoverEvent.ShowEntity input, final Codec.Encoder<Component, String, ? extends RuntimeException> componentCodec) {
+ final CompoundTag tag = new CompoundTag(); + final CompoundTag tag = new CompoundTag();
+ tag.putString(ENTITY_ID, input.id().toString()); + tag.putString(ENTITY_ID, input.id().toString());
+ tag.putString(ENTITY_TYPE, input.type().asString()); + tag.putString(ENTITY_TYPE, input.type().asString());
@ -2246,7 +2279,7 @@ index 887b9fd625aa23c4ec828a175d63695f915232d3..8152420b9c3eb1bf13c012dd43505d99
+ // Paper end + // Paper end
} }
diff --git a/src/main/java/net/minecraft/network/chat/ComponentSerialization.java b/src/main/java/net/minecraft/network/chat/ComponentSerialization.java diff --git a/src/main/java/net/minecraft/network/chat/ComponentSerialization.java b/src/main/java/net/minecraft/network/chat/ComponentSerialization.java
index 49138ccda0f378b13c7f425be765876eb4026b06..ca662b668177532a73e7e309bb8b0fb3c4e310f1 100644 index 49138ccda0f378b13c7f425be765876eb4026b06..dc572d5be6ee3af74be2ffb4c02351c8be235159 100644
--- a/src/main/java/net/minecraft/network/chat/ComponentSerialization.java --- a/src/main/java/net/minecraft/network/chat/ComponentSerialization.java
+++ b/src/main/java/net/minecraft/network/chat/ComponentSerialization.java +++ b/src/main/java/net/minecraft/network/chat/ComponentSerialization.java
@@ -55,12 +55,58 @@ public class ComponentSerialization { @@ -55,12 +55,58 @@ public class ComponentSerialization {
@ -2290,7 +2323,7 @@ index 49138ccda0f378b13c7f425be765876eb4026b06..ca662b668177532a73e7e309bb8b0fb3
+ final net.kyori.adventure.text.Component adventureComponent; + final net.kyori.adventure.text.Component adventureComponent;
+ if (input instanceof io.papermc.paper.adventure.AdventureComponent adv) { + if (input instanceof io.papermc.paper.adventure.AdventureComponent adv) {
+ adventureComponent = adv.adventure$component(); + adventureComponent = adv.adventure$component();
+ } else if (locale != null && input.getContents() instanceof TranslatableContents) { + } else if (locale != null && input.getContents() instanceof TranslatableContents && io.papermc.paper.adventure.PaperAdventure.hasAnyTranslations()) {
+ adventureComponent = io.papermc.paper.adventure.PaperAdventure.asAdventure(input); + adventureComponent = io.papermc.paper.adventure.PaperAdventure.asAdventure(input);
+ } else { + } else {
+ return origCodec.encode(input, ops, prefix); + return origCodec.encode(input, ops, prefix);
@ -2756,10 +2789,10 @@ index c8e016135ad80a892b48a6a338c24cfd757a5f10..b403b7d585f474e2b6029404d19e756a
this.chatVisibility = clientOptions.chatVisibility(); this.chatVisibility = clientOptions.chatVisibility();
this.canChatColor = clientOptions.chatColors(); this.canChatColor = clientOptions.chatColors();
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 132a79251d5eb46ded6e1a96cc1c8e9c48f3f5fd..56f6f65ceb1271e9273b1ee6658773eb3445beed 100644 index 132a79251d5eb46ded6e1a96cc1c8e9c48f3f5fd..c8041492b7b2a1ff67b95d9944cfccd476b3ee1d 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -47,7 +47,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -47,12 +47,13 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
public static final int LATENCY_CHECK_INTERVAL = 15000; public static final int LATENCY_CHECK_INTERVAL = 15000;
private static final Component TIMEOUT_DISCONNECTION_MESSAGE = Component.translatable("disconnect.timeout"); private static final Component TIMEOUT_DISCONNECTION_MESSAGE = Component.translatable("disconnect.timeout");
protected final MinecraftServer server; protected final MinecraftServer server;
@ -2768,7 +2801,32 @@ index 132a79251d5eb46ded6e1a96cc1c8e9c48f3f5fd..56f6f65ceb1271e9273b1ee6658773eb
private long keepAliveTime; private long keepAliveTime;
private boolean keepAlivePending; private boolean keepAlivePending;
private long keepAliveChallenge; private long keepAliveChallenge;
@@ -217,12 +217,18 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack private int latency;
private volatile boolean suspendFlushingOnServerThread = false;
+ public final java.util.Map<java.util.UUID, net.kyori.adventure.resource.ResourcePackCallback> packCallbacks = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - adventure resource pack callbacks
public ServerCommonPacketListenerImpl(MinecraftServer minecraftserver, Connection networkmanager, CommonListenerCookie commonlistenercookie, ServerPlayer player) { // CraftBukkit
this.server = minecraftserver;
@@ -156,6 +157,18 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
ServerCommonPacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack {} rejection", this.playerProfile().getName(), packet.id());
this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect"));
}
+ // Paper start - adventure pack callbacks
+ // call the callbacks before the previously-existing event so the event has final say
+ final net.kyori.adventure.resource.ResourcePackCallback callback;
+ if (packet.action().isTerminal()) {
+ callback = this.packCallbacks.remove(packet.id());
+ } else {
+ callback = this.packCallbacks.get(packet.id());
+ }
+ if (callback != null) {
+ callback.packEventReceived(packet.id(), net.kyori.adventure.resource.ResourcePackStatus.valueOf(packet.action().name()), this.getCraftPlayer());
+ }
+ // Paper end
this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(this.getCraftPlayer(), packet.id(), PlayerResourcePackStatusEvent.Status.values()[packet.action().ordinal()])); // CraftBukkit
}
@@ -217,12 +230,18 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
// CraftBukkit start // CraftBukkit start
@Deprecated @Deprecated
@ -2790,7 +2848,7 @@ index 132a79251d5eb46ded6e1a96cc1c8e9c48f3f5fd..56f6f65ceb1271e9273b1ee6658773eb
// CraftBukkit start - fire PlayerKickEvent // CraftBukkit start - fire PlayerKickEvent
if (this.processedDisconnect) { if (this.processedDisconnect) {
return; return;
@@ -231,7 +237,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -231,7 +250,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
Waitable waitable = new Waitable() { Waitable waitable = new Waitable() {
@Override @Override
protected Object evaluate() { protected Object evaluate() {
@ -2799,7 +2857,7 @@ index 132a79251d5eb46ded6e1a96cc1c8e9c48f3f5fd..56f6f65ceb1271e9273b1ee6658773eb
return null; return null;
} }
}; };
@@ -248,9 +254,9 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -248,9 +267,9 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
return; return;
} }
@ -2811,7 +2869,7 @@ index 132a79251d5eb46ded6e1a96cc1c8e9c48f3f5fd..56f6f65ceb1271e9273b1ee6658773eb
if (this.cserver.getServer().isRunning()) { if (this.cserver.getServer().isRunning()) {
this.cserver.getPluginManager().callEvent(event); this.cserver.getPluginManager().callEvent(event);
@@ -262,7 +268,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -262,7 +281,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
} }
this.player.kickLeaveMessage = event.getLeaveMessage(); // CraftBukkit - SPIGOT-3034: Forward leave message to PlayerQuitEvent this.player.kickLeaveMessage = event.getLeaveMessage(); // CraftBukkit - SPIGOT-3034: Forward leave message to PlayerQuitEvent
// Send the possibly modified leave message // Send the possibly modified leave message
@ -3198,7 +3256,7 @@ index 4c62df5a3781ec9df4a5c5f1b528649e6e8a62d1..affd1b8c7589ba59330dc0b6fc803cce
} }
diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java diff --git a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
index fe31cd2698077c7d75fbd411a59947268100823c..4642113daf986c16d1390c53fbbb50e1e3067738 100644 index 9026e380736d7298dd68d6aeb817c59f5daf552e..6003731da7be596baf1954df2e13ae54e111cd91 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java --- a/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java +++ b/src/main/java/net/minecraft/world/level/block/entity/SignBlockEntity.java
@@ -209,22 +209,22 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C @@ -209,22 +209,22 @@ public class SignBlockEntity extends BlockEntity implements CommandSource { // C
@ -4027,7 +4085,7 @@ index 61759e8179d0f6342abf0c0294e5a024928db8d9..92e21126a9347f1ee2279ab09bb6abf2
public boolean isOp() { public boolean isOp() {
return true; return true;
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 429bbe15f8b04a57108f311a9cc198ed5c5a45c5..098e85980670723cffd751f6d5b67bb66e209e9a 100644 index 429bbe15f8b04a57108f311a9cc198ed5c5a45c5..c683afd09f03188638983bbdbe271a7e407a3efe 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -300,14 +300,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -300,14 +300,39 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -4211,7 +4269,7 @@ index 429bbe15f8b04a57108f311a9cc198ed5c5a45c5..098e85980670723cffd751f6d5b67bb6
} }
@Override @Override
@@ -1728,6 +1794,23 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1728,6 +1794,59 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
} }
@ -4230,12 +4288,48 @@ index 429bbe15f8b04a57108f311a9cc198ed5c5a45c5..098e85980670723cffd751f6d5b67bb6
+ this.getHandle().connection.send(new ClientboundResourcePackPopPacket(Optional.empty())); + this.getHandle().connection.send(new ClientboundResourcePackPopPacket(Optional.empty()));
+ this.getHandle().connection.send(new ClientboundResourcePackPushPacket(uuid, url, hash, force, io.papermc.paper.adventure.PaperAdventure.asVanilla(prompt))); + this.getHandle().connection.send(new ClientboundResourcePackPushPacket(uuid, url, hash, force, io.papermc.paper.adventure.PaperAdventure.asVanilla(prompt)));
+ } + }
+
+ @SuppressWarnings({"unchecked", "rawtypes"})
+ void sendBundle(final List<? extends net.minecraft.network.protocol.Packet<? extends net.minecraft.network.protocol.common.ClientCommonPacketListener>> packet) {
+ this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundBundlePacket((List) packet));
+ }
+
+ @Override
+ public void sendResourcePacks(final net.kyori.adventure.resource.ResourcePackRequest request) {
+ if (this.getHandle().connection == null) return;
+ final List<ClientboundResourcePackPushPacket> packs = new java.util.ArrayList<>(request.packs().size());
+ if (request.replace()) {
+ this.clearResourcePacks();
+ }
+ final Component prompt = io.papermc.paper.adventure.PaperAdventure.asVanilla(request.prompt());
+ for (final java.util.Iterator<net.kyori.adventure.resource.ResourcePackInfo> iter = request.packs().iterator(); iter.hasNext();) {
+ final net.kyori.adventure.resource.ResourcePackInfo pack = iter.next();
+ packs.add(new ClientboundResourcePackPushPacket(pack.id(), pack.uri().toASCIIString(), pack.hash(), request.required(), iter.hasNext() ? null : prompt));
+ if (request.callback() != net.kyori.adventure.resource.ResourcePackCallback.noOp()) {
+ this.getHandle().connection.packCallbacks.put(pack.id(), request.callback()); // just override if there is a previously existing callback
+ }
+ }
+ this.sendBundle(packs);
+ super.sendResourcePacks(request);
+ }
+
+ @Override
+ public void removeResourcePacks(final UUID id, final UUID ... others) {
+ if (this.getHandle().connection == null) return;
+ this.sendBundle(net.kyori.adventure.util.MonkeyBars.nonEmptyArrayToList(pack -> new ClientboundResourcePackPopPacket(Optional.of(pack)), id, others));
+ }
+
+ @Override
+ public void clearResourcePacks() {
+ if (this.getHandle().connection == null) return;
+ this.getHandle().connection.send(new ClientboundResourcePackPopPacket(Optional.empty()));
+ }
+ // Paper end - adventure + // Paper end - adventure
+ +
@Override @Override
public void removeResourcePack(UUID id) { public void removeResourcePack(UUID id) {
Preconditions.checkArgument(id != null, "Resource pack id cannot be null"); Preconditions.checkArgument(id != null, "Resource pack id cannot be null");
@@ -2136,6 +2219,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2136,6 +2255,12 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return (this.getHandle().requestedViewDistance() == 0) ? Bukkit.getViewDistance() : this.getHandle().requestedViewDistance(); return (this.getHandle().requestedViewDistance() == 0) ? Bukkit.getViewDistance() : this.getHandle().requestedViewDistance();
} }
@ -4248,7 +4342,7 @@ index 429bbe15f8b04a57108f311a9cc198ed5c5a45c5..098e85980670723cffd751f6d5b67bb6
@Override @Override
public int getPing() { public int getPing() {
return this.getHandle().connection.latency(); return this.getHandle().connection.latency();
@@ -2186,6 +2275,252 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2186,6 +2311,252 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this.getHandle().allowsListing(); return this.getHandle().allowsListing();
} }
@ -5468,10 +5562,10 @@ index 0000000000000000000000000000000000000000..3aedd0bbc97edacc1ebf71264b310e55
+} +}
diff --git a/src/test/java/io/papermc/paper/adventure/AdventureCodecsTest.java b/src/test/java/io/papermc/paper/adventure/AdventureCodecsTest.java diff --git a/src/test/java/io/papermc/paper/adventure/AdventureCodecsTest.java b/src/test/java/io/papermc/paper/adventure/AdventureCodecsTest.java
new file mode 100644 new file mode 100644
index 0000000000000000000000000000000000000000..af4b7704ab4690138e3188a45d41b890369f6237 index 0000000000000000000000000000000000000000..b97078552a86885bf77a2832d292f4062116c743
--- /dev/null --- /dev/null
+++ b/src/test/java/io/papermc/paper/adventure/AdventureCodecsTest.java +++ b/src/test/java/io/papermc/paper/adventure/AdventureCodecsTest.java
@@ -0,0 +1,366 @@ @@ -0,0 +1,369 @@
+package io.papermc.paper.adventure; +package io.papermc.paper.adventure;
+ +
+import com.mojang.datafixers.util.Pair; +import com.mojang.datafixers.util.Pair;
@ -5526,6 +5620,8 @@ index 0000000000000000000000000000000000000000..af4b7704ab4690138e3188a45d41b890
+import static net.kyori.adventure.text.Component.storageNBT; +import static net.kyori.adventure.text.Component.storageNBT;
+import static net.kyori.adventure.text.Component.text; +import static net.kyori.adventure.text.Component.text;
+import static net.kyori.adventure.text.Component.translatable; +import static net.kyori.adventure.text.Component.translatable;
+import static net.kyori.adventure.text.TranslationArgument.bool;
+import static net.kyori.adventure.text.TranslationArgument.numeric;
+import static net.kyori.adventure.text.event.ClickEvent.openUrl; +import static net.kyori.adventure.text.event.ClickEvent.openUrl;
+import static net.kyori.adventure.text.event.ClickEvent.suggestCommand; +import static net.kyori.adventure.text.event.ClickEvent.suggestCommand;
+import static net.kyori.adventure.text.event.HoverEvent.showEntity; +import static net.kyori.adventure.text.event.HoverEvent.showEntity;
@ -5773,6 +5869,7 @@ index 0000000000000000000000000000000000000000..af4b7704ab4690138e3188a45d41b890
+ .key("thisIsA") + .key("thisIsA")
+ .fallback("This is a test.") + .fallback("This is a test.")
+ .build(), + .build(),
+ translatable(key, numeric(5), text("HEY")), // boolean doesn't work in vanilla, can't test here
+ translatable( + translatable(
+ key, + key,
+ text().content(name) + text().content(name)

Datei anzeigen

@ -1817,10 +1817,10 @@ index b0ffa23faf62629043dfd613315eaf9c5fcc2cfe..00000000000000000000000000000000
- } - }
-} -}
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 098e85980670723cffd751f6d5b67bb66e209e9a..2f05361e8c086e07de2ff18bc5136fb9e8d62399 100644 index c683afd09f03188638983bbdbe271a7e407a3efe..ea7eb5019b5332469f8c1b51ccfe97de206bcb0c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2596,6 +2596,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2632,6 +2632,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
CraftPlayer.this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundSystemChatPacket(components, position == net.md_5.bungee.api.ChatMessageType.ACTION_BAR)); CraftPlayer.this.getHandle().connection.send(new net.minecraft.network.protocol.game.ClientboundSystemChatPacket(components, position == net.md_5.bungee.api.ChatMessageType.ACTION_BAR));
} }

Datei anzeigen

@ -137,10 +137,10 @@ index 2ec2b1d9d987c7f31c685aec3d3c87f42758c94b..36d793b492d9776ee36f8285b5bab09e
for(Player player : this.players()) { for(Player player : this.players()) {
if (EntitySelector.NO_SPECTATORS.test(player) && EntitySelector.LIVING_ENTITY_STILL_ALIVE.test(player)) { if (EntitySelector.NO_SPECTATORS.test(player) && EntitySelector.LIVING_ENTITY_STILL_ALIVE.test(player)) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 2dbc49b944ce318ec5081e3ec421efa1ff24c615..879bbc36e8390945276414a18a4fe4a9903e3999 100644 index f06ae63a1fb102647d16adc44adf25dc9ff8d03a..c6c4a50bc9d8dbba4c8e5980417e93e190f25d42 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2277,6 +2277,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2313,6 +2313,17 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this.getHandle().language; return this.getHandle().language;
} }

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Only refresh abilities if needed
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 879bbc36e8390945276414a18a4fe4a9903e3999..e80d2d6568a4fa2b877add86e2a2b974d9d87c03 100644 index c6c4a50bc9d8dbba4c8e5980417e93e190f25d42..9f1ab39b333ef51ed41a80d5d513a7c1d30d92f9 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1948,12 +1948,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1984,12 +1984,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override @Override
public void setFlying(boolean value) { public void setFlying(boolean value) {

Datei anzeigen

@ -39,10 +39,10 @@ index bf89ea0f7506434848cb9c1cbfb3fe6dd2eb3212..686b42a9b4475fe3d530a9b950c1cc8f
// CraftBukkit end // CraftBukkit end
this.language = clientOptions.language(); this.language = clientOptions.language();
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index e80d2d6568a4fa2b877add86e2a2b974d9d87c03..fc6557ad318209a3f1f617cec162740a1d26b051 100644 index 9f1ab39b333ef51ed41a80d5d513a7c1d30d92f9..e22a75c78faeec35f8fbe310e8c28da5e8a8ec10 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2275,7 +2275,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2311,7 +2311,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override @Override
public String getLocale() { public String getLocale() {

Datei anzeigen

@ -5,24 +5,24 @@ Subject: [PATCH] Complete resource pack API
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 56f6f65ceb1271e9273b1ee6658773eb3445beed..771db61f81d7a3cd763efb5febf6008fd2ba1232 100644 index c8041492b7b2a1ff67b95d9944cfccd476b3ee1d..66497960995dc30abe60d26200979a78513ff2c6 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -156,7 +156,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -169,7 +169,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
ServerCommonPacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack {} rejection", this.playerProfile().getName(), packet.id()); callback.packEventReceived(packet.id(), net.kyori.adventure.resource.ResourcePackStatus.valueOf(packet.action().name()), this.getCraftPlayer());
this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect"));
} }
// Paper end
- this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(this.getCraftPlayer(), packet.id(), PlayerResourcePackStatusEvent.Status.values()[packet.action().ordinal()])); // CraftBukkit - this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(this.getCraftPlayer(), packet.id(), PlayerResourcePackStatusEvent.Status.values()[packet.action().ordinal()])); // CraftBukkit
+ // Paper start + // Paper start - store last pack status
+ PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action().ordinal()]; + PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action().ordinal()];
+ player.getBukkitEntity().resourcePackStatus = packStatus; + player.getBukkitEntity().resourcePackStatus = packStatus;
+ this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(this.getCraftPlayer(), packet.id(), packStatus)); // CraftBukkit + this.cserver.getPluginManager().callEvent(new PlayerResourcePackStatusEvent(this.getCraftPlayer(), packet.id(), packStatus)); // CraftBukkit
+ // Paper end + // Paper end - store last pack status
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 73b6740cf50d878b98438f58c2291c0d13f412b7..5107128b0868d46b1672df8c8f98018de87c9eff 100644 index 533aad9a2ed3e9f49307696146b34e0a1bf61cf4..5fef370f164e78a336cfe598aee15e277dd6b946 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -189,6 +189,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -189,6 +189,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -33,24 +33,12 @@ index 73b6740cf50d878b98438f58c2291c0d13f412b7..5107128b0868d46b1672df8c8f98018d
public CraftPlayer(CraftServer server, ServerPlayer entity) { public CraftPlayer(CraftServer server, ServerPlayer entity) {
super(server, entity); super(server, entity);
@@ -1961,6 +1962,25 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1997,6 +1998,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
// Paper end - adventure // Paper end - adventure
+ // Paper start - more resource pack API + // Paper start - more resource pack API
+ @Override + @Override
+ public void setResourcePack(@NotNull UUID uuid, @NotNull String url, @NotNull String hash, net.kyori.adventure.text.Component resourcePackPrompt, boolean required) {
+ Preconditions.checkArgument(uuid != null, "Resource pack UUID cannot be null");
+ Preconditions.checkArgument(url != null, "Resource pack URL cannot be null");
+ Preconditions.checkArgument(hash != null, "Hash cannot be null");
+ final net.minecraft.network.chat.Component promptComponent = resourcePackPrompt != null ?
+ io.papermc.paper.adventure.PaperAdventure.asVanilla(resourcePackPrompt) :
+ null;
+ this.getHandle().connection.send(new ClientboundResourcePackPopPacket(Optional.empty()));
+ this.getHandle().connection.send(new ClientboundResourcePackPushPacket(uuid, url, hash, required, promptComponent));
+ }
+
+ @Override
+ public org.bukkit.event.player.PlayerResourcePackStatusEvent.Status getResourcePackStatus() { + public org.bukkit.event.player.PlayerResourcePackStatusEvent.Status getResourcePackStatus() {
+ return this.resourcePackStatus; + return this.resourcePackStatus;
+ } + }

Datei anzeigen

@ -44,10 +44,10 @@ index b76ac10fe0d4b860a4b30fae365cf38400afb456..1e2d3040bb3e8b1901fbc933caa5ad3b
protected void internalSetAbsorptionAmount(float absorptionAmount) { protected void internalSetAbsorptionAmount(float absorptionAmount) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 5107128b0868d46b1672df8c8f98018de87c9eff..3fe9b9a28829f6796a23fe337df3a677d2e8d19b 100644 index 5fef370f164e78a336cfe598aee15e277dd6b946..de0102ef932e062eb3d7aba3a0805b6e261e673c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2209,6 +2209,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2233,6 +2233,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
public void setRealHealth(double health) { public void setRealHealth(double health) {

Datei anzeigen

@ -19,10 +19,10 @@ index d986c09392182335112040d4b6feae6a1a740d84..75d2213aadcbd1d0a49fd4c8cef2d4d5
@Override @Override
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index a26db4bd859ef52dadf03f1b62155bcc54b7a740..54cc23d07f4c0e9a87cbf63c8e866b2e07a0dbbc 100644 index 57a865c606a234556bf57486bbaa69ef54ce1370..1135da391523c464447198ce5e3743b8bd9d66e8 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -145,7 +145,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -146,7 +146,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
} }
public final boolean isDisconnected() { public final boolean isDisconnected() {

Datei anzeigen

@ -206,10 +206,10 @@ index 0000000000000000000000000000000000000000..8f07539a82f449ad217e316a7513a170
+ +
+} +}
diff --git a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java diff --git a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
index c10c0ffa29332d73328f088935a0b914260d4c50..99871023c54e387c6ef72a4307d945047aee87fe 100644 index 6f429f69ac3ac11d9fa1f7c348e6aae8ac99a5e9..7e859d638181a0db412e4d724c35cbe624661b96 100644
--- a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java --- a/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
+++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java +++ b/src/main/java/io/papermc/paper/adventure/PaperAdventure.java
@@ -22,6 +22,7 @@ import net.kyori.adventure.text.TranslatableComponent; @@ -24,6 +24,7 @@ import net.kyori.adventure.text.TranslationArgument;
import net.kyori.adventure.text.flattener.ComponentFlattener; import net.kyori.adventure.text.flattener.ComponentFlattener;
import net.kyori.adventure.text.format.TextColor; import net.kyori.adventure.text.format.TextColor;
import net.kyori.adventure.text.serializer.ComponentSerializer; import net.kyori.adventure.text.serializer.ComponentSerializer;
@ -217,7 +217,7 @@ index c10c0ffa29332d73328f088935a0b914260d4c50..99871023c54e387c6ef72a4307d94504
import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer; import net.kyori.adventure.text.serializer.gson.GsonComponentSerializer;
import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer; import net.kyori.adventure.text.serializer.plain.PlainComponentSerializer;
import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer; import net.kyori.adventure.text.serializer.plain.PlainTextComponentSerializer;
@@ -109,6 +110,7 @@ public final class PaperAdventure { @@ -111,6 +112,7 @@ public final class PaperAdventure {
public static final AttributeKey<Locale> LOCALE_ATTRIBUTE = AttributeKey.valueOf("adventure:locale"); // init after FLATTENER because classloading triggered here might create a logger public static final AttributeKey<Locale> LOCALE_ATTRIBUTE = AttributeKey.valueOf("adventure:locale"); // init after FLATTENER because classloading triggered here might create a logger
@Deprecated @Deprecated
public static final PlainComponentSerializer PLAIN = PlainComponentSerializer.builder().flattener(FLATTENER).build(); public static final PlainComponentSerializer PLAIN = PlainComponentSerializer.builder().flattener(FLATTENER).build();
@ -226,7 +226,7 @@ index c10c0ffa29332d73328f088935a0b914260d4c50..99871023c54e387c6ef72a4307d94504
@Override @Override
public @NotNull CompoundTag decode(final @NotNull String encoded) throws IOException { public @NotNull CompoundTag decode(final @NotNull String encoded) throws IOException {
diff --git a/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java b/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java diff --git a/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java b/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java
index c3631efda9c7fa531a8a9f18fbee7b5f8655382b..769f6489632302627fa1730cc08e77f51eb54eb4 100644 index 8323f135d6bf2e1f12525e05094ffa3f2420e7e1..a143ea1e58464a3122fbd8ccafe417bdb3c31c78 100644
--- a/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java --- a/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java
+++ b/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java +++ b/src/main/java/io/papermc/paper/adventure/providers/ComponentLoggerProviderImpl.java
@@ -1,9 +1,11 @@ @@ -1,9 +1,11 @@
@ -241,7 +241,7 @@ index c3631efda9c7fa531a8a9f18fbee7b5f8655382b..769f6489632302627fa1730cc08e77f5
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@@ -14,6 +16,6 @@ public class ComponentLoggerProviderImpl implements ComponentLoggerProvider { @@ -15,6 +17,6 @@ public class ComponentLoggerProviderImpl implements ComponentLoggerProvider {
} }
private String serialize(final Component message) { private String serialize(final Component message) {

Datei anzeigen

@ -15,10 +15,10 @@ also adding some additional logging in order to help work out what is causing
random disconnections for clients. random disconnections for clients.
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 54cc23d07f4c0e9a87cbf63c8e866b2e07a0dbbc..cc167de8d8fc86793971e2ad1ad45bfa51f1cca0 100644 index 1135da391523c464447198ce5e3743b8bd9d66e8..910b9a2918ec58ecb9fff77cca36abb48c7db7dd 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -83,14 +83,18 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -84,14 +84,18 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@Override @Override
public void handleKeepAlive(ServerboundKeepAlivePacket packet) { public void handleKeepAlive(ServerboundKeepAlivePacket packet) {

Datei anzeigen

@ -17,10 +17,10 @@ from networking or during connections flood of chunk packets on slower clients,
at the cost of dead connections being kept open for longer. at the cost of dead connections being kept open for longer.
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index cc167de8d8fc86793971e2ad1ad45bfa51f1cca0..1bd0ed91f5f64c4cf89f6819bea7ecd3a72f1d5d 100644 index 910b9a2918ec58ecb9fff77cca36abb48c7db7dd..cf81671a32874d89588a829e6ad6696e41e1cfa4 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -48,11 +48,12 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -48,12 +48,13 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
private static final Component TIMEOUT_DISCONNECTION_MESSAGE = Component.translatable("disconnect.timeout"); private static final Component TIMEOUT_DISCONNECTION_MESSAGE = Component.translatable("disconnect.timeout");
protected final MinecraftServer server; protected final MinecraftServer server;
public final Connection connection; // Paper public final Connection connection; // Paper
@ -30,11 +30,12 @@ index cc167de8d8fc86793971e2ad1ad45bfa51f1cca0..1bd0ed91f5f64c4cf89f6819bea7ecd3
private long keepAliveChallenge; private long keepAliveChallenge;
private int latency; private int latency;
private volatile boolean suspendFlushingOnServerThread = false; private volatile boolean suspendFlushingOnServerThread = false;
public final java.util.Map<java.util.UUID, net.kyori.adventure.resource.ResourcePackCallback> packCallbacks = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - adventure resource pack callbacks
+ private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit + private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
public ServerCommonPacketListenerImpl(MinecraftServer minecraftserver, Connection networkmanager, CommonListenerCookie commonlistenercookie, ServerPlayer player) { // CraftBukkit public ServerCommonPacketListenerImpl(MinecraftServer minecraftserver, Connection networkmanager, CommonListenerCookie commonlistenercookie, ServerPlayer player) { // CraftBukkit
this.server = minecraftserver; this.server = minecraftserver;
@@ -170,18 +171,25 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -183,18 +184,25 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
protected void keepConnectionAlive() { protected void keepConnectionAlive() {
this.server.getProfiler().push("keepAlive"); this.server.getProfiler().push("keepAlive");

Datei anzeigen

@ -9,7 +9,7 @@ e.g. servers which allow and support the usage of mod packs.
provide an optional flag to disable this check, at your own risk. provide an optional flag to disable this check, at your own risk.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 44b98fc01ce1879f08987c6544b77b442e7bfad6..cb6cad55f02feaacfb1a194b63fa75c3b7e267be 100644 index be7fce2bc261739232bc07468eeb0240f644e760..44334bafacd95304a5b657ea5be7acee3e64c7df 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -190,6 +190,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -190,6 +190,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -20,7 +20,7 @@ index 44b98fc01ce1879f08987c6544b77b442e7bfad6..cb6cad55f02feaacfb1a194b63fa75c3
public CraftPlayer(CraftServer server, ServerPlayer entity) { public CraftPlayer(CraftServer server, ServerPlayer entity) {
super(server, entity); super(server, entity);
@@ -2138,7 +2139,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2162,7 +2163,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
public void addChannel(String channel) { public void addChannel(String channel) {

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Expose attack cooldown methods for Player
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index d034c84a95f24233a8dd54b25c1ef670311c346a..80ae7a85cf4dbad3aa6a17c4095b9db193a0aec9 100644 index 14c489157fee05c5ec8752bf7c0acdd9a277d9ea..a2624085360ca3d315378f3a0f9220a5eb43217a 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2850,6 +2850,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2874,6 +2874,21 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
return this.adventure$pointers; return this.adventure$pointers;
} }

Datei anzeigen

@ -392,10 +392,10 @@ index 948ba97e318506dad96e59121297b5bf8340d2e6..810bead2f19de70786027b190137f743
this.gameEvent(GameEvent.ENTITY_DIE); this.gameEvent(GameEvent.ENTITY_DIE);
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 80ae7a85cf4dbad3aa6a17c4095b9db193a0aec9..d03b9c8a0253b217666a745db18271336fcaab56 100644 index a2624085360ca3d315378f3a0f9220a5eb43217a..66330f499cb178b24691cdc8c6601d14242328e3 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2387,7 +2387,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2411,7 +2411,14 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@Override @Override
public void sendHealthUpdate() { public void sendHealthUpdate() {
FoodData foodData = this.getHandle().getFoodData(); FoodData foodData = this.getHandle().getFoodData();

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Fix CB call to changed postToMainThread method
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 40e25de6534f997b603e9b407e7ab3331b667585..698fc66f8c232644f2d747c81f8ac2e39204fd7f 100644 index cf81671a32874d89588a829e6ad6696e41e1cfa4..77b9a4899f708f41a4e4049e3c946be100f13c6c 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -297,7 +297,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -310,7 +310,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
Objects.requireNonNull(this.connection); Objects.requireNonNull(this.connection);
// CraftBukkit - Don't wait // CraftBukkit - Don't wait

Datei anzeigen

@ -17,18 +17,18 @@ index 25c5f23b859961c792b2ec08404171eea1aedba7..478abaffd1a80949b96f1c1774c98134
// Paper start - replace player chunk loader // Paper start - replace player chunk loader
private final java.util.concurrent.atomic.AtomicReference<io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances> viewDistances = new java.util.concurrent.atomic.AtomicReference<>(new io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances(-1, -1, -1)); private final java.util.concurrent.atomic.AtomicReference<io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances> viewDistances = new java.util.concurrent.atomic.AtomicReference<>(new io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances(-1, -1, -1));
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 698fc66f8c232644f2d747c81f8ac2e39204fd7f..8cb7e9d67fc4713dc327ad0459518f062dc9264e 100644 index 44aa178968c87fa72023a2c0f33c1a8123f3db72..f489b207cd3b62a33723f2e9ed0f46020d7f4fd1 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -54,6 +54,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -55,6 +55,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
private int latency;
private volatile boolean suspendFlushingOnServerThread = false; private volatile boolean suspendFlushingOnServerThread = false;
public final java.util.Map<java.util.UUID, net.kyori.adventure.resource.ResourcePackCallback> packCallbacks = new java.util.concurrent.ConcurrentHashMap<>(); // Paper - adventure resource pack callbacks
private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit private static final long KEEPALIVE_LIMIT = Long.getLong("paper.playerconnection.keepalive", 30) * 1000; // Paper - provide property to set keepalive limit
+ protected static final ResourceLocation MINECRAFT_BRAND = new ResourceLocation("brand"); // Paper - Brand support + protected static final ResourceLocation MINECRAFT_BRAND = new ResourceLocation("brand"); // Paper - Brand support
public ServerCommonPacketListenerImpl(MinecraftServer minecraftserver, Connection networkmanager, CommonListenerCookie commonlistenercookie, ServerPlayer player) { // CraftBukkit public ServerCommonPacketListenerImpl(MinecraftServer minecraftserver, Connection networkmanager, CommonListenerCookie commonlistenercookie, ServerPlayer player) { // CraftBukkit
this.server = minecraftserver; this.server = minecraftserver;
@@ -109,6 +110,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -110,6 +111,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@Override @Override
public void handleCustomPayload(ServerboundCustomPayloadPacket packet) { public void handleCustomPayload(ServerboundCustomPayloadPacket packet) {
@ -40,7 +40,7 @@ index 698fc66f8c232644f2d747c81f8ac2e39204fd7f..8cb7e9d67fc4713dc327ad0459518f06
if (!(packet.payload() instanceof ServerboundCustomPayloadPacket.UnknownPayload)) { if (!(packet.payload() instanceof ServerboundCustomPayloadPacket.UnknownPayload)) {
return; return;
} }
@@ -140,6 +146,15 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -141,6 +147,15 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
try { try {
byte[] data = new byte[payload.readableBytes()]; byte[] data = new byte[payload.readableBytes()];
payload.readBytes(data); payload.readBytes(data);
@ -57,10 +57,10 @@ index 698fc66f8c232644f2d747c81f8ac2e39204fd7f..8cb7e9d67fc4713dc327ad0459518f06
} catch (Exception ex) { } catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 5fdd1bc97b3e04b59a76cfbf190cc9cb504837cf..d90e61917142624ec831fcf775a69b66200a1625 100644 index 5e7145653fef2f91d5f40f24ea0bcdea428dc80a..ef42716a18b64af36105baae49742b3699cc12a9 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -3009,6 +3009,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -3033,6 +3033,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
// Paper end // Paper end
}; };

Datei anzeigen

@ -37,10 +37,10 @@ index 478abaffd1a80949b96f1c1774c98134be92e5ac..063742400f3065ace62b64b42d952517
// Paper start - replace player chunk loader // Paper start - replace player chunk loader
private final java.util.concurrent.atomic.AtomicReference<io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances> viewDistances = new java.util.concurrent.atomic.AtomicReference<>(new io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances(-1, -1, -1)); private final java.util.concurrent.atomic.AtomicReference<io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances> viewDistances = new java.util.concurrent.atomic.AtomicReference<>(new io.papermc.paper.chunk.system.RegionizedPlayerChunkLoader.ViewDistances(-1, -1, -1));
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 8cb7e9d67fc4713dc327ad0459518f062dc9264e..4a2ff42950a9c15a3dbbf9ca7e3c43cad4c77404 100644 index e58e8fe05a6e826ef8bf6f04924e2aadba738d97..c07b0fcc62e8ce05ddfe9c6c9c9dd57d85e6683b 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -302,6 +302,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -315,6 +315,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
final Component ichatbasecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()); // Paper - Adventure final Component ichatbasecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()); // Paper - Adventure
// CraftBukkit end // CraftBukkit end

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Fix Player spawnParticle x/y/z precision loss
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index d90e61917142624ec831fcf775a69b66200a1625..cd8b40db82a42f55c8253dc91df3caa415aabed1 100644 index ef42716a18b64af36105baae49742b3699cc12a9..e1e6b672b90a8d6b725ec06041f15f2d23fbdaa5 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2572,7 +2572,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2596,7 +2596,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
if (data != null) { if (data != null) {
Preconditions.checkArgument(particle.getDataType().isInstance(data), "data (%s) should be %s", data.getClass(), particle.getDataType()); Preconditions.checkArgument(particle.getDataType().isInstance(data), "data (%s) should be %s", data.getClass(), particle.getDataType());
} }

Datei anzeigen

@ -100,10 +100,10 @@ index b9560b4ae5c0867396006119c5dadd7f3b47f78b..f3e32da770f379d46c65a0ba5a100b5f
return Component.translatable("commands.kick.success", serverPlayer.getDisplayName(), reason); return Component.translatable("commands.kick.success", serverPlayer.getDisplayName(), reason);
}, true); }, true);
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 4a2ff42950a9c15a3dbbf9ca7e3c43cad4c77404..312b7a446453cf0859538cb10e6e98a8188d9094 100644 index 0616a8e89931680602da2dbc640906708aebd5ca..70458ff8c9bf6f3263868b0f5570840fe3d89ed2 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -94,7 +94,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -95,7 +95,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
} else if (!this.isSingleplayerOwner()) { } else if (!this.isSingleplayerOwner()) {
// Paper start - This needs to be handled on the main thread for plugins // Paper start - This needs to be handled on the main thread for plugins
server.submit(() -> { server.submit(() -> {
@ -112,7 +112,7 @@ index 4a2ff42950a9c15a3dbbf9ca7e3c43cad4c77404..312b7a446453cf0859538cb10e6e98a8
}); });
// Paper endg // Paper endg
} }
@@ -130,7 +130,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -131,7 +131,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
} }
} catch (Exception ex) { } catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex); ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t register custom payload", ex);
@ -121,7 +121,7 @@ index 4a2ff42950a9c15a3dbbf9ca7e3c43cad4c77404..312b7a446453cf0859538cb10e6e98a8
} }
} else if (identifier.equals(ServerCommonPacketListenerImpl.CUSTOM_UNREGISTER)) { } else if (identifier.equals(ServerCommonPacketListenerImpl.CUSTOM_UNREGISTER)) {
try { try {
@@ -140,7 +140,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -141,7 +141,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
} }
} catch (Exception ex) { } catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex); ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t unregister custom payload", ex);
@ -130,7 +130,7 @@ index 4a2ff42950a9c15a3dbbf9ca7e3c43cad4c77404..312b7a446453cf0859538cb10e6e98a8
} }
} else { } else {
try { try {
@@ -158,7 +158,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -159,7 +159,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), identifier.toString(), data); this.cserver.getMessenger().dispatchIncomingMessage(this.player.getBukkitEntity(), identifier.toString(), data);
} catch (Exception ex) { } catch (Exception ex) {
ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex); ServerGamePacketListenerImpl.LOGGER.error("Couldn\'t dispatch custom payload", ex);
@ -139,16 +139,16 @@ index 4a2ff42950a9c15a3dbbf9ca7e3c43cad4c77404..312b7a446453cf0859538cb10e6e98a8
} }
} }
@@ -174,7 +174,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -175,7 +175,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
PacketUtils.ensureRunningOnSameThread(packet, this, (BlockableEventLoop) this.server); PacketUtils.ensureRunningOnSameThread(packet, this, (BlockableEventLoop) this.server);
if (packet.action() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) { if (packet.action() == ServerboundResourcePackPacket.Action.DECLINED && this.server.isResourcePackRequired()) {
ServerCommonPacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack {} rejection", this.playerProfile().getName(), packet.id()); ServerCommonPacketListenerImpl.LOGGER.info("Disconnecting {} due to resource pack {} rejection", this.playerProfile().getName(), packet.id());
- this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect")); - this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect"));
+ this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect"), org.bukkit.event.player.PlayerKickEvent.Cause.RESOURCE_PACK_REJECTION); // Paper - kick event cause + this.disconnect(Component.translatable("multiplayer.requiredTexturePrompt.disconnect"), org.bukkit.event.player.PlayerKickEvent.Cause.RESOURCE_PACK_REJECTION); // Paper - kick event cause
} }
// Paper start // Paper start - adventure pack callbacks
PlayerResourcePackStatusEvent.Status packStatus = PlayerResourcePackStatusEvent.Status.values()[packet.action().ordinal()]; // call the callbacks before the previously-existing event so the event has final say
@@ -194,7 +194,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -207,7 +207,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
if (this.keepAlivePending) { if (this.keepAlivePending) {
if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected if (!this.processedDisconnect && elapsedTime >= KEEPALIVE_LIMIT) { // check keepalive limit, don't fire if already disconnected
ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info ServerGamePacketListenerImpl.LOGGER.warn("{} was kicked due to keepalive timeout!", this.player.getScoreboardName()); // more info
@ -157,7 +157,7 @@ index 4a2ff42950a9c15a3dbbf9ca7e3c43cad4c77404..312b7a446453cf0859538cb10e6e98a8
} }
} else { } else {
if (elapsedTime >= 15000L) { // 15 seconds if (elapsedTime >= 15000L) { // 15 seconds
@@ -247,18 +247,28 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -260,18 +260,28 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
} }
// CraftBukkit start // CraftBukkit start
@ -190,7 +190,7 @@ index 4a2ff42950a9c15a3dbbf9ca7e3c43cad4c77404..312b7a446453cf0859538cb10e6e98a8
// Paper end // Paper end
// CraftBukkit start - fire PlayerKickEvent // CraftBukkit start - fire PlayerKickEvent
if (this.processedDisconnect) { if (this.processedDisconnect) {
@@ -268,7 +278,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -281,7 +291,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
Waitable waitable = new Waitable() { Waitable waitable = new Waitable() {
@Override @Override
protected Object evaluate() { protected Object evaluate() {
@ -199,7 +199,7 @@ index 4a2ff42950a9c15a3dbbf9ca7e3c43cad4c77404..312b7a446453cf0859538cb10e6e98a8
return null; return null;
} }
}; };
@@ -287,7 +297,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -300,7 +310,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure net.kyori.adventure.text.Component leaveMessage = net.kyori.adventure.text.Component.translatable("multiplayer.player.left", net.kyori.adventure.text.format.NamedTextColor.YELLOW, io.papermc.paper.configuration.GlobalConfiguration.get().messages.useDisplayNameInQuitMessage ? this.player.getBukkitEntity().displayName() : net.kyori.adventure.text.Component.text(this.player.getScoreboardName())); // Paper - Adventure
@ -491,7 +491,7 @@ index 6724d0a1af13e97bc1d3bd94fd43fef742a0deab..20ba0a0c9eae28658888a77dd2170f62
} }
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index ef707c71f3ba78a54c7bcaf74d4bc3a4b844dc9c..2f12019edc3dd578d66f70d0510c16270fa9193d 100644 index 6910cb1d02b07ec17f8ece922d40803c4eb659c4..bcd68b2e88f06e693d31a81b4eb79eeb381f7119 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -591,7 +591,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -591,7 +591,7 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

Datei anzeigen

@ -17,10 +17,10 @@ index 814754a73a8d653adc159b313fa201565db59590..ebbf5f835d619c90eae4240dbd2eb665
public boolean isRealPlayer; // Paper public boolean isRealPlayer; // Paper
public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper public final com.destroystokyo.paper.util.misc.PooledLinkedHashSets.PooledObjectLinkedOpenHashSet<ServerPlayer> cachedSingleHashSet; // Paper
diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java diff --git a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
index 312b7a446453cf0859538cb10e6e98a8188d9094..4a712f5fc4f0b4a4434ae808c989113bee8d8634 100644 index 13e2129dd02706ad5eb3124efd2d8393201e1231..eee07d4c06380bfc797e83b36f880234170b03b7 100644
--- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java --- a/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java +++ b/src/main/java/net/minecraft/server/network/ServerCommonPacketListenerImpl.java
@@ -76,6 +76,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -77,6 +77,11 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
@Override @Override
public void onDisconnect(Component reason) { public void onDisconnect(Component reason) {
@ -32,7 +32,7 @@ index 312b7a446453cf0859538cb10e6e98a8188d9094..4a712f5fc4f0b4a4434ae808c989113b
if (this.isSingleplayerOwner()) { if (this.isSingleplayerOwner()) {
ServerCommonPacketListenerImpl.LOGGER.info("Stopping singleplayer server as player logged out"); ServerCommonPacketListenerImpl.LOGGER.info("Stopping singleplayer server as player logged out");
this.server.halt(false); this.server.halt(false);
@@ -307,7 +312,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -320,7 +325,6 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
// Do not kick the player // Do not kick the player
return; return;
} }
@ -40,7 +40,7 @@ index 312b7a446453cf0859538cb10e6e98a8188d9094..4a712f5fc4f0b4a4434ae808c989113b
// Send the possibly modified leave message // Send the possibly modified leave message
final Component ichatbasecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()); // Paper - Adventure final Component ichatbasecomponent = io.papermc.paper.adventure.PaperAdventure.asVanilla(event.reason()); // Paper - Adventure
// CraftBukkit end // CraftBukkit end
@@ -316,7 +320,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack @@ -329,7 +333,7 @@ public abstract class ServerCommonPacketListenerImpl implements ServerCommonPack
this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), PacketSendListener.thenRun(() -> { this.connection.send(new ClientboundDisconnectPacket(ichatbasecomponent), PacketSendListener.thenRun(() -> {
this.connection.disconnect(ichatbasecomponent); this.connection.disconnect(ichatbasecomponent);
})); }));

Datei anzeigen

@ -5,10 +5,10 @@ Subject: [PATCH] Elder Guardian appearance API
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index adab5ee4eb2b3ff84ed00ec770fcce1939ba9b9a..936ecf12fb3fc9c4d62cfc4dfed0bd02af46ac41 100644 index f75b05ae8b91e3099d7c306e66cf8e8d4e239697..50280facadd97d1af7a3b7eeb81cd37a6b1d962c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -3162,6 +3162,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -3186,6 +3186,13 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
// Paper end // Paper end

Datei anzeigen

@ -10,10 +10,10 @@ public net.minecraft.world.entity.monster.warden.WardenSpawnTracker cooldownTick
public net.minecraft.world.entity.monster.warden.WardenSpawnTracker increaseWarningLevel()V public net.minecraft.world.entity.monster.warden.WardenSpawnTracker increaseWarningLevel()V
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 936ecf12fb3fc9c4d62cfc4dfed0bd02af46ac41..7caf184a658b1307e342471ab000c2a8b5352e0e 100644 index 50280facadd97d1af7a3b7eeb81cd37a6b1d962c..0317c853ac87f84fa4aaf0f9422ebcc1efa05e19 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -3167,6 +3167,41 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -3191,6 +3191,41 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
public void showElderGuardian(boolean silent) { public void showElderGuardian(boolean silent) {
if (getHandle().connection != null) getHandle().connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.GUARDIAN_ELDER_EFFECT, silent ? 0F : 1F)); if (getHandle().connection != null) getHandle().connection.send(new ClientboundGameEventPacket(ClientboundGameEventPacket.GUARDIAN_ELDER_EFFECT, silent ? 0F : 1F));
} }

Datei anzeigen

@ -26,10 +26,10 @@ index 28fa46f29639a6b643b475912133d601028facb2..7f3466340891b4409d1399ebeb2ca865
} else { } else {
if (fallDistance >= 2.0F) { if (fallDistance >= 2.0F) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index cf0d420747f4004e80553c783e29226cdb848c5a..de261416f6746f32388f373030f09b867edd2b9a 100644 index e5a34f1bbea22eaefee84252ac32a25a7b0b9712..7b8e637d524d4ae17cbb07d013d9e3645c531384 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2444,6 +2444,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2468,6 +2468,19 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
this.getHandle().onUpdateAbilities(); this.getHandle().onUpdateAbilities();
} }

Datei anzeigen

@ -6,10 +6,10 @@ Subject: [PATCH] Add player idle duration API
Implements API for getting and resetting a player's idle duration. Implements API for getting and resetting a player's idle duration.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 26ef78ea23a9b3abdf3e43aa5e90eec15bf1d78b..5ff67321df91bcf66b198ff346630e4d912ae341 100644 index 991b00637665b1a07ee93ff728aaed2ed77e917d..48849cb39ac647b77652005335d1261b47e727f4 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -3284,6 +3284,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -3308,6 +3308,18 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
} }
// Paper end // Paper end

Datei anzeigen

@ -10,7 +10,7 @@ packs before sending the new pack. Other API exists
for adding a new pack to the existing packs on a client. for adding a new pack to the existing packs on a client.
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index d5b5bb52a0d678bfe69be54b2cd25c95c39daf8d..3be5e4df190bff0087c8450b16e4e37b07169040 100644 index 35db598b8dac6de7729a0fdb3602a19c0492f166..c45bcd5102111d4ddc438a85652ecc259c8d3cb5 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -2347,8 +2347,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -2347,8 +2347,10 @@ public class CraftPlayer extends CraftHumanEntity implements Player {

Datei anzeigen

@ -1,32 +0,0 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jason Penilla <11360596+jpenilla@users.noreply.github.com>
Date: Wed, 6 Dec 2023 21:21:46 -0700
Subject: [PATCH] Temp adventure update
diff --git a/build.gradle.kts b/build.gradle.kts
index 58da26ad2f128ba0b66f86820f60853f4be352f0..b12b5a1e82a5ebf47135a3863a390a45a9d8d8ec 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -12,7 +12,21 @@ configurations.named(log4jPlugins.compileClasspathConfigurationName) {
}
val alsoShade: Configuration by configurations.creating
+val extraRuntime: Configuration by configurations.creating
+configurations.runtimeClasspath {
+ extendsFrom(extraRuntime)
+}
+repositories {
+ maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") {
+ mavenContent {
+ snapshotsOnly()
+ includeGroup("net.kyori")
+ }
+ }
+}
+
dependencies {
+ extraRuntime(platform("net.kyori:adventure-bom:4.15.0-SNAPSHOT"))
implementation(project(":paper-api"))
implementation(project(":paper-mojangapi"))
// Paper start