Files
Purpur/patches/api/0043-Add-force-and-prompt-parameters-to-resource-pack-api.patch
William Blake Galbreath 69c7c31f9a Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
26c37d99d5 create random seeds for features using SecureRandom
589bf2f1bf Upgrade gson to 2.8.8 (Closes #6370)
0a6103597b Get entity default attributes (#6449)
40057019e0 Correctly inflate villager activation bounding box (#6798)
e5f9241d15 Left handed API (#6775)
40ee63496c Add advancement display API (#6175)
9d570042ed Add ItemFactory#getMonsterEgg API (#6772)
55ca459515 rename method to getSpawnEgg
bb397ba74c Add critical damage API (#6275)
f47aeafe00 Add Horse Animation API (#5599)
7a0886180f AT & Mapping fixes (#6809)
5553432644 docs: Update gradle instructions for Java 16 (#6811) [ci skip]
a1f49e4c60 Fix command suggestion leak (#6592)
9472d38f3c Fix method name for Critical damage (#6813)
2021-10-21 10:58:20 -05:00

100 lines
5.2 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Tue, 17 Aug 2021 17:39:14 -0500
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 566c8f8b505c3bfc23044a836083a00b92cacedd..033cf450dcfb02e57d0875d0117086e6fe615c32 100644
--- a/src/main/java/org/bukkit/entity/Player.java
+++ b/src/main/java/org/bukkit/entity/Player.java
@@ -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.
+ * <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 net.kyori.adventure.text.Component prompt);
+ // Purpur end
+
/**
* Gets the Scoreboard displayed to this player
*