-
-
Notifications
You must be signed in to change notification settings - Fork 108
Support adding/removing multiple resource packs #2712
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: dev
Are you sure you want to change the base?
Conversation
UUID packUUID; | ||
try { | ||
packUUID = UUID.fromString(id); | ||
} catch (IllegalArgumentException e) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd probably put this in a util method on ResourcePackCommand
, just because it's repeated a couple times
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