Skip to content

Clean up Title packets and enforce action types (fixes #1802)#1803

Open
WouterGritter wants to merge 8 commits into
PaperMC:dev/3.0.0from
WouterGritter:title-actionbar-fix-and-enforcement
Open

Clean up Title packets and enforce action types (fixes #1802)#1803
WouterGritter wants to merge 8 commits into
PaperMC:dev/3.0.0from
WouterGritter:title-actionbar-fix-and-enforcement

Conversation

@WouterGritter

@WouterGritter WouterGritter commented May 22, 2026

Copy link
Copy Markdown
Contributor

Closes #1802, this PR builds on-top of the fix proposed and explained in that PR.

This PR drops the method visibility, enforces the action types (similar pattern to the already-existing enforcement in TitleClearPacket) and cleans up some whitespace formatting.

After the third commit, this PR now does away with the setAction() method completely, which was only used within this package. It does not make sense to set the action type at all here; they must be exactly one action for most modern packets, except for TitleClearPacket which supports two types (which is still enforced), and except for LegacyTitlePacket which can still hold any action type.

@WouterGritter

Copy link
Copy Markdown
Contributor Author

HeaderAndFooterPacket has a similar situation, where it's never expected to be decoded:

public HeaderAndFooterPacket() {
  throw new UnsupportedOperationException("Decode is not implemented");
}

@Override
public void decode(ByteBuf buf, ProtocolUtils.Direction direction, ProtocolVersion version) {
  throw new UnsupportedOperationException("Decode is not implemented");
}

I'll update this PR to match this convention.

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.

1 participant