Skip to content

Conversation

@ajh123
Copy link

@ajh123 ajh123 commented Dec 25, 2025

This pull request adds new documentation explaining how to use dialog tags for pause screen and quick actions integration, and introduces a new section on using NBT payloads with dialogs in the API. The changes provide detailed code examples and best practices for both registering dialogs with special tags and handling custom NBT data using the adventure-nbt library.

Dialog Tag Registration Enhancements:

  • Added documentation on tagging dialogs with PAUSE_SCREEN_ADDITIONS and QUICK_ACTIONS to integrate custom dialogs into the game's pause screen and quick actions menu, including a full code example for registering these tags in a plugin bootstrapper.

NBT Payload Support for Dialogs:

  • Introduced a new section describing how to attach and read NBT payloads to dialog actions, covering both sending custom NBT data with dialog buttons and handling it with PlayerCustomClickEvent.
  • Provided guidance and code samples for creating NBT payloads using the adventure-nbt library, including exception handling and dependency notes.
  • Added instructions for reading NBT payloads from events, including converting from BinaryTagHolder to CompoundBinaryTag and handling potential nulls and IO exceptions.
  • Note: The adventure NBT sections should be replaced once adventure NBT gets actual documentation Document adventure-nbt #661

@github-actions
Copy link

github-actions bot commented Dec 25, 2025

built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
papermc-docs ✅ Ready (View Log) Visit Preview 62202e6

Copy link
Member

@zlataovce zlataovce left a comment

Choose a reason for hiding this comment

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

looks good apart from a couple of nitpicks


#### Creating payloads with `adventure-nbt`.

The `BinaryTagHolder.binaryTagHolder` factory method requires an SNBT formatted string. We can either construct this string manually, or use
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
The `BinaryTagHolder.binaryTagHolder` factory method requires an SNBT formatted string. We can either construct this string manually, or use
The `BinaryTagHolder.binaryTagHolder` factory method requires an SNBT-formatted string. We can either construct this string manually, or use

This NBT data will be sent to the client when the dialog is shown, and when the player clicks the button, a
[`PlayerCustomClickEvent`](jd:paper:io.papermc.paper.event.player.PlayerCustomClickEvent) will be fired containing the same NBT data among other information.

#### Creating payloads with `adventure-nbt`.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
#### Creating payloads with `adventure-nbt`.
#### Creating payloads with `adventure-nbt`


To read the NBT payload, we can use the [`PlayerCustomClickEvent#getTag()`](jd:paper:io.papermc.paper.event.player.PlayerCustomClickEvent#getTag()) method.

#### Reading payloads with adventure-nbt.
Copy link
Member

Choose a reason for hiding this comment

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

consistency

Suggested change
#### Reading payloads with adventure-nbt.
#### Reading payloads with `adventure-nbt`

Comment on lines +481 to +486
ActionButton.create(
Component.text("Confirm", TextColor.color(0xAEFFC1)),
Component.text("Click to confirm your input."),
100,
DialogAction.customClick(Key.key("papermc:user_input/confirm"), null)
),
Copy link
Member

Choose a reason for hiding this comment

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

would probably dedent this

Suggested change
ActionButton.create(
Component.text("Confirm", TextColor.color(0xAEFFC1)),
Component.text("Click to confirm your input."),
100,
DialogAction.customClick(Key.key("papermc:user_input/confirm"), null)
),
ActionButton.create(
Component.text("Confirm", TextColor.color(0xAEFFC1)),
Component.text("Click to confirm your input."),
100,
DialogAction.customClick(Key.key("papermc:user_input/confirm"), null)
)

}
```

### Registering Pause Screen Additions and Quick Actions tags
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
### Registering Pause Screen Additions and Quick Actions tags
### Pause Screen Additions and Quick Actions

```

### Registering Pause Screen Additions and Quick Actions tags
Dialog when registered in the registry can be tagged with these special tags:
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
Dialog when registered in the registry can be tagged with these special tags:
Dialogs can be tagged with these special tags when registered:

@zlataovce zlataovce added dev guide This issue or PR aims to introduce developer API documentation status: accepted This issue has been accepted project: Paper labels Dec 25, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dev guide This issue or PR aims to introduce developer API documentation project: Paper status: accepted This issue has been accepted

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants