mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
45 lines
2.2 KiB
Diff
45 lines
2.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: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 c1404be359c9f21bb7ae94b9cf69b6a01ba75392..544d2fee9835d6c7313ed1a1d085e4d73be63dd1 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
|
@@ -27,6 +27,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;
|
|
@@ -1729,11 +1731,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) {
|