-
-
Notifications
You must be signed in to change notification settings - Fork 208
feat(paper): add dialog documentation about tags and nbt payloads #702
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: main
Are you sure you want to change the base?
Conversation
built with Refined Cloudflare Pages Action⚡ Cloudflare Pages Deployment
|
zlataovce
left a comment
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.
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 |
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.
| 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`. |
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.
| #### 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. |
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.
consistency
| #### Reading payloads with adventure-nbt. | |
| #### Reading payloads with `adventure-nbt` |
| 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) | ||
| ), |
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.
would probably dedent this
| 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 |
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.
| ### 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: |
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.
| Dialog when registered in the registry can be tagged with these special tags: | |
| Dialogs can be tagged with these special tags when registered: |
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-nbtlibrary.Dialog Tag Registration Enhancements:
PAUSE_SCREEN_ADDITIONSandQUICK_ACTIONSto 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:
PlayerCustomClickEvent.adventure-nbtlibrary, including exception handling and dependency notes.BinaryTagHoldertoCompoundBinaryTagand handling potential nulls and IO exceptions.