diff --git a/paper-api/src/main/java/org/bukkit/Bukkit.java b/paper-api/src/main/java/org/bukkit/Bukkit.java index 34cdaaf929..f576daefaa 100644 --- a/paper-api/src/main/java/org/bukkit/Bukkit.java +++ b/paper-api/src/main/java/org/bukkit/Bukkit.java @@ -44,6 +44,7 @@ import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.loot.LootTable; import org.bukkit.map.MapView; import org.bukkit.packs.DataPackManager; +import org.bukkit.packs.ResourcePack; import org.bukkit.permissions.Permissible; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.ServicesManager; @@ -280,6 +281,16 @@ public final class Bukkit { return server.getDataPackManager(); } + /** + * Gets the resource pack configured to be sent to clients by the server. + * + * @return the resource pack + */ + @Nullable + public static ResourcePack getServerResourcePack() { + return server.getServerResourcePack(); + } + /** * Get the ServerTick Manager. * diff --git a/paper-api/src/main/java/org/bukkit/Server.java b/paper-api/src/main/java/org/bukkit/Server.java index 30e1fbaee7..76e75d7fe2 100644 --- a/paper-api/src/main/java/org/bukkit/Server.java +++ b/paper-api/src/main/java/org/bukkit/Server.java @@ -44,6 +44,7 @@ import org.bukkit.inventory.meta.ItemMeta; import org.bukkit.loot.LootTable; import org.bukkit.map.MapView; import org.bukkit.packs.DataPackManager; +import org.bukkit.packs.ResourcePack; import org.bukkit.permissions.Permissible; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.ServicesManager; @@ -247,6 +248,14 @@ public interface Server extends PluginMessageRecipient { @NotNull public ServerTickManager getServerTickManager(); + /** + * Gets the resource pack configured to be sent to clients by the server. + * + * @return the resource pack + */ + @Nullable + public ResourcePack getServerResourcePack(); + /** * Gets the server resource pack uri, or empty string if not specified. * diff --git a/paper-api/src/main/java/org/bukkit/entity/Player.java b/paper-api/src/main/java/org/bukkit/entity/Player.java index be7965161b..fe643c1b3b 100644 --- a/paper-api/src/main/java/org/bukkit/entity/Player.java +++ b/paper-api/src/main/java/org/bukkit/entity/Player.java @@ -1610,6 +1610,52 @@ public interface Player extends HumanEntity, Conversable, OfflinePlayer, PluginM */ public void setResourcePack(@NotNull UUID id, @NotNull String url, @Nullable byte[] hash, @Nullable String prompt, boolean force); + /** + * Request that the player's client download and include another resource pack. + *
+ * The player's client will download the new resource pack asynchronously + * in the background, and will automatically add to it once the + * download is complete. If the client has downloaded and cached a + * resource pack with the same hash in the past it will not download but + * directly apply the cached pack. If the hash is null and the client has + * downloaded and cached the same resource pack in the past, it will + * perform a file size check against the response content to determine if + * the resource pack has changed and needs to be downloaded again. When + * this request is sent for the very first time from a given server, the + * client will first display a confirmation GUI to the player before + * proceeding with the download. + *
+ * Notes: + *