[ci-skip] Fix annotations stuff

This commit is contained in:
William Blake Galbreath
2021-08-23 13:29:51 -05:00
parent 8e42878d35
commit b03eac1f35
2 changed files with 44 additions and 45 deletions

View File

@@ -5,14 +5,53 @@ Subject: [PATCH] Add force and prompt parameters to resource pack api
diff --git a/src/main/java/org/bukkit/entity/Player.java b/src/main/java/org/bukkit/entity/Player.java
index 8748199736a288f602e4cf5fb5ac4a08278f38b9..743883f3d95b94a58ed7826dd74b3f37be9aecb9 100644
index 8748199736a288f602e4cf5fb5ac4a08278f38b9..82112d408a8ce139d041bad6c9af9a5eb28777d0 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -1490,6 +1490,89 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
@@ -1490,6 +1490,88 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM
*/
public void setResourcePack(@NotNull String url, @NotNull byte[] hash);
+ // Purpur start
+ /**
+ * Request that the player's client download and switch resource packs.
+ * <p>
+ * The player's client will download the new resource pack asynchronously
+ * in the background, and will automatically switch to it once the
+ * download is complete. If the client has downloaded and cached a
+ * resource pack with the same hash in the past it will not download but
+ * directly apply the cached pack. When this request is sent for the very
+ * first time from a given server, the client will first display a
+ * confirmation GUI to the player before proceeding with the download.
+ * <p>
+ * Notes:
+ * <ul>
+ * <li>Players can disable server resources on their client, in which
+ * case this method will have no affect on them. Use the
+ * {@link PlayerResourcePackStatusEvent} to figure out whether or not
+ * the player loaded the pack!
+ * <li>There is no concept of resetting resource packs back to default
+ * within Minecraft, so players will have to relog to do so or you
+ * have to send an empty pack.
+ * </ul>
+ *
+ * @param url The URL from which the client will download the resource
+ * pack. The string must contain only US-ASCII characters and should
+ * be encoded as per RFC 1738.
+ * @param hash The sha1 hash sum of the resource pack file which is used
+ * to apply a cached version of the pack directly without downloading
+ * if it is available. Hast to be 20 bytes long!
+ * @param force If true, players will get kicked from the server if the
+ * resource pack is denied.
+ * @param prompt The server message added to the resource pack prompt.
+ * @throws IllegalArgumentException Thrown if the URL is null.
+ * @throws IllegalArgumentException Thrown if the URL is too long. The
+ * length restriction is an implementation specific arbitrary value.
+ * @throws IllegalArgumentException Thrown if the hash is null.
+ * @throws IllegalArgumentException Thrown if the hash is not 20 bytes
+ * long.
+ */
+ void setResourcePack(@NotNull String url, @NotNull byte[] hash, boolean force, @Nullable String prompt);
+
+ /**
+ * Request that the player's client download and switch resource packs.
@@ -52,47 +91,7 @@ index 8748199736a288f602e4cf5fb5ac4a08278f38b9..743883f3d95b94a58ed7826dd74b3f37
+ * @throws IllegalArgumentException Thrown if the hash is not 20 bytes
+ * long.
+ */
+ void setResourcePack(@NotNull String url, @NotNull byte[] hash, boolean force, String prompt);
+
+ /**
+ * Request that the player's client download and switch resource packs.
+ * <p>
+ * The player's client will download the new resource pack asynchronously
+ * in the background, and will automatically switch to it once the
+ * download is complete. If the client has downloaded and cached a
+ * resource pack with the same hash in the past it will not download but
+ * directly apply the cached pack. When this request is sent for the very
+ * first time from a given server, the client will first display a
+ * confirmation GUI to the player before proceeding with the download.
+ * <p>
+ * Notes:
+ * <ul>
+ * <li>Players can disable server resources on their client, in which
+ * case this method will have no affect on them. Use the
+ * {@link PlayerResourcePackStatusEvent} to figure out whether or not
+ * the player loaded the pack!
+ * <li>There is no concept of resetting resource packs back to default
+ * within Minecraft, so players will have to relog to do so or you
+ * have to send an empty pack.
+ * </ul>
+ *
+ * @param url The URL from which the client will download the resource
+ * pack. The string must contain only US-ASCII characters and should
+ * be encoded as per RFC 1738.
+ * @param hash The sha1 hash sum of the resource pack file which is used
+ * to apply a cached version of the pack directly without downloading
+ * if it is available. Hast to be 20 bytes long!
+ * @param force If true, players will get kicked from the server if the
+ * resource pack is denied.
+ * @param prompt The server message added to the resource pack prompt.
+ * @throws IllegalArgumentException Thrown if the URL is null.
+ * @throws IllegalArgumentException Thrown if the URL is too long. The
+ * length restriction is an implementation specific arbitrary value.
+ * @throws IllegalArgumentException Thrown if the hash is null.
+ * @throws IllegalArgumentException Thrown if the hash is not 20 bytes
+ * long.
+ */
+ void setResourcePack(String url, byte[] hash, boolean force, net.kyori.adventure.text.Component prompt);
+ void setResourcePack(@NotNull String url, @NotNull byte[] hash, boolean force, @Nullable net.kyori.adventure.text.Component prompt);
+ // Purpur end
+
/**

View File

@@ -5,7 +5,7 @@ Subject: [PATCH] Add force and prompt parameters to resource pack api
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index 98751b195e5bea9ef89e1432fba54d6823036818..c0e14be91996628be0e69ae0ec5dd0b785b9e11f 100644
index 0c1d64731c3c9581b0cf9b720057ef07be4f764e..588214ed4ed06541d0c561c9f1da63c8fbf78f6c 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -25,6 +25,8 @@ import java.util.WeakHashMap;
@@ -27,7 +27,7 @@ index 98751b195e5bea9ef89e1432fba54d6823036818..c0e14be91996628be0e69ae0ec5dd0b7
+
+ @Override
+ public void setResourcePack(String url, byte[] hash, boolean force, String prompt) {
+ this.setResourcePack(url, hash, force, io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(prompt));
+ this.setResourcePack(url, hash, force, prompt == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(prompt));
+ }
+
+ @Override