From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <blake.galbreath@gmail.com>
Date: Tue, 17 Aug 2021 17:39:21 -0500
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 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;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import javax.annotation.Nullable;
+
+import io.papermc.paper.adventure.PaperAdventure;
 import net.minecraft.Util;
 import net.minecraft.advancements.AdvancementProgress;
 import net.minecraft.core.BlockPos;
@@ -1750,11 +1752,23 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
 
     @Override
     public void setResourcePack(String url, byte[] hash) {
+        // Purpur start
+        this.setResourcePack(url, hash, false, (net.kyori.adventure.text.Component) null);
+    }
+
+    @Override
+    public void setResourcePack(String url, byte[] hash, boolean force, String prompt) {
+        this.setResourcePack(url, hash, force, prompt == null ? null : io.papermc.paper.adventure.PaperAdventure.LEGACY_SECTION_UXRC.deserialize(prompt));
+    }
+
+    @Override
+    public void setResourcePack(String url, byte[] hash, boolean force, net.kyori.adventure.text.Component prompt) {
+        // Purpur end
         Validate.notNull(url, "Resource pack URL cannot be null");
         Validate.notNull(hash, "Resource pack hash cannot be null");
         Validate.isTrue(hash.length == 20, "Resource pack hash should be 20 bytes long but was " + hash.length);
 
-        this.getHandle().sendTexturePack(url, BaseEncoding.base16().lowerCase().encode(hash), false, null);
+        this.getHandle().sendTexturePack(url, BaseEncoding.base16().lowerCase().encode(hash), force, prompt == null ? null : io.papermc.paper.adventure.PaperAdventure.asVanilla(prompt)); // Purpur
     }
 
     public void addChannel(String channel) {
