Skip to content

Add PlayerConfigurationResourcePackEvent to apply resource packs during configuration#992

Merged
R00tB33rMan merged 2 commits into
libdeflatefrom
config-resource-pack-event
Jul 3, 2026
Merged

Add PlayerConfigurationResourcePackEvent to apply resource packs during configuration#992
R00tB33rMan merged 2 commits into
libdeflatefrom
config-resource-pack-event

Conversation

@WouterGritter

Copy link
Copy Markdown
Collaborator

Introduces PlayerConfigurationResourcePackEvent, allowing plugins to apply resource packs while a player is still in the configuration state, before they enter play.

When it fires

The event is fired on every (re)configuration of a player:

  • On initial post-login configuration (event.isFirstJoin() == true) - e.g. for network-wide packs.
  • On every server-switch reconfiguration (event.isFirstJoin() == false) - e.g. for per-server packs.

If a plugin sets a pack via event.setResourcePack(...), the player is held in configuration until every pack reaches a terminal status:

  • Required packs hold indefinitely until the client acknowledges (in practice the backend will time-out the player after 15 seconds, we catch this and gracefully disconnect the player with velocity.error.resource-pack-configuration-timeout).
  • Optional packs hold for up to a timeout, then advance to play as if declined.

While holding, the proxy sends keepalives to the client itself (backends don't send keepalives after finishing configuration on their end).

Example

private ResourcePackInfo resourcePack;

@Subscribe
public void onProxyInitialize(ProxyInitializeEvent event) {
  byte[] hash = HexFormat.of().parseHex("8de90b010c37565361d47ea4a8b7c04ec5f6cf42");
  resourcePack = proxy.createResourcePackBuilder("http://example.com/resourcepack.zip")
      .setHash(hash)
      .setId(UUID.nameUUIDFromBytes(hash))
      .setShouldForce(true)
      .build();
}

@Subscribe
public void onConfigureResourcePack(PlayerConfigurationResourcePackEvent event) {
  if (event.isFirstJoin()) {
    event.setResourcePack(resourcePack);
  }
}

@WouterGritter WouterGritter requested a review from R00tB33rMan July 2, 2026 10:53

@R00tB33rMan R00tB33rMan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I’ll test this later but LGTM from my POV

@R00tB33rMan R00tB33rMan merged commit 6f98762 into libdeflate Jul 3, 2026
1 check passed
@R00tB33rMan R00tB33rMan deleted the config-resource-pack-event branch July 3, 2026 17:24
WouterGritter added a commit that referenced this pull request Jul 8, 2026
…so slow clients no longer time it out

Builds upon #992
WouterGritter added a commit that referenced this pull request Jul 9, 2026
#1002)

* Advance the backend to PLAY during configuration resource-pack holds so slow clients no longer time it out

Builds upon #992

* Default `RESOURCE_PACK_HOLD_CAP_SECONDS` to 60 seconds and read it from a system property (`velocity-ctd.resource-pack-hold-cap-seconds`)

* Add `velocity-ctd.split-phase-delay-seconds` system property and advance the client to PLAY immediately (no hold in CONFIG) when 0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants