Support adding/removing multiple resource packs#2712
Support adding/removing multiple resource packs#2712mergu wants to merge 2 commits intoDenizenScript:devfrom
Conversation
| UUID packUUID; | ||
| try { | ||
| packUUID = UUID.fromString(id); | ||
| } catch (IllegalArgumentException e) { |
|
fixed format |
| Debug.echoDebug(scriptEntry, "Player is offline, can't send resource pack to them. Skipping."); | ||
| continue; | ||
| } | ||
| player.getPlayerEntity().addResourcePack(packUUID, url, hashData, prompt, forced); |
There was a problem hiding this comment.
Using Spigot API here vs Paper API for setting means that set allows advanced text stuff in the prompt and add doesn't - might be better to use Paper API here as well for consistency?
There was a problem hiding this comment.
There isn't a paper api version of this that I saw, other than the Audience stuff. Can you link me what you're referencing?
There was a problem hiding this comment.
Don't think Paper has a direct alternative to the Spigot method? but you can just use adventure, untested but should be something like this:
ResourcePackRequest.Builder builder = ResourcePackRequest.resourcePackRequest();
builder.packs(ResourcePackInfo.resourcePackInfo(UUID.fromString("123"), URI.create("https://www.pack.com/pack.zip"), "hash-13th0aing"));
builder.prompt(Component.text("Use pack pls").color(NamedTextColor.AQUA));
builder.replace(false);
builder.required(true);
player.sendResourcePacks(builder);| try { | ||
| packUUID = UUID.fromString(id); | ||
| } | ||
| catch (IllegalArgumentException e) { | ||
| packUUID = UUID.nameUUIDFromBytes(id.getBytes(StandardCharsets.UTF_8)); | ||
| } |
There was a problem hiding this comment.
I'd probably put this in a util method on ResourcePackCommand, just because it's repeated a couple times
|
Marking this as a draft for now, feel free to mark as ready for review once comments are addressed. |
|
Closing to de-clutter PR list, when this can be finished let us know and we'll reopen. |
I'm a bit rusty here so apologies if anything is flat out wrong.
This was all tested on 1.21.4, multiple rps can be added and removals work:

I wasn't sure how to format the command with removals.. my guess is url/hash would become optional args and the meta would need to explain the differences. I just opted for some mecs