-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
Dialog registry API #12671
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
Dialog registry API #12671
Conversation
dfc6f7b to
b594f38
Compare
|
Last updated for: ade079827c0165ac5b943f4fecc0f6c7370b4c6c. Download the Paperclip jar for this pull request: paper-12671.zip Maven PublicationThe artifacts published by this PR:
Repository DeclarationIn order to use the artifacts published by the PR, add the following repository to your buildscript: repositories {
maven("https://maven-prs.papermc.io/Paper/pr12671") {
name = "Maven for PR #12671" // https://github.com/PaperMC/Paper/pull/12671
mavenContent {
includeModule("io.papermc.paper", "dev-bundle")
includeModule("io.papermc.paper", "paper-api")
}
}
} |
|
Something we need to decide is how to handle the "custom all" dialog action. This is the action that sends a full CompoundTag of all the input values back to the server using the new packet. Right now, there's no way to listen for these. Do we just add an event for both config/game phase that includes the player its from, the id of the payload, and the BinaryTagHolder payload? Or do we do smth like adventure click callback provider? |
I personally would prefer to at least have an event if that allows listening to arbitrary dialogs too but a way to directly react on some form of callback directly from the code that creates the dialog in a plugin would be nice too but I feel the event would be more important. Ideally the data would be in a format that can be easily read e.g. a |
cda6130 to
c2767fb
Compare
Width and height rangeThere really should be These numbers are from the minecraft wiki. Default valuesOne other thing I'd like to see is default values being used. So you don't have to specify width/height and use the default. |
|
Ok, I pushed a super duper rough concept of the The other is a raw response wrapper with methods to just get any bool, float, or string in the top level of the response payload (if the response payload exists and is a compound tag). And of course you can get a BinaryTagHolder and parse it into NBT using whatever library you want. |
paper-api/src/main/java/io/papermc/paper/event/player/PlayerCustomClickEvent.java
Show resolved
Hide resolved
|
Ok, I added another approach. You can manually specify a callback that runs. Create it with |
9bdcbdb to
9ac3613
Compare
why even add a key, feels like this should just create a key internally |
|
Yeah, I think you're right. Will remove. |
|
I did not see a way to make a DialogAction close the dialog? Am I missing something or is that just not a thing? I'd be needed if you don't auto close it. I know adventure will add a Audience#closeDialog but I'd feel like there should be a predefined DialogAction#close that removed the boiler plate of having do to a customClick |
|
You don't have to specify any action. In say, a confirmation dialog, the dialog will follow the DialogAfterAction on any button click. |
kennytv
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.
Open to feedback/no changes at all on all of these, but this is what caught my eye
paper-api/src/main/java/io/papermc/paper/registry/data/dialog/DialogBase.java
Show resolved
Hide resolved
...api/src/main/java/io/papermc/paper/registry/data/dialog/specialty/ConfirmationSpecialty.java
Outdated
Show resolved
Hide resolved
paper-api/src/main/java/io/papermc/paper/registry/data/dialog/DialogRegistryEntry.java
Outdated
Show resolved
Hide resolved
paper-api/src/main/java/io/papermc/paper/registry/data/dialog/DialogRegistryEntry.java
Outdated
Show resolved
Hide resolved
paper-api/src/main/java/io/papermc/paper/registry/data/dialog/DialogRegistryEntry.java
Outdated
Show resolved
Hide resolved
paper-api/src/main/java/io/papermc/paper/registry/data/dialog/input/DialogInput.java
Outdated
Show resolved
Hide resolved
d4cfb0b to
11a1e0f
Compare
26ab9a3 to
a9f74cb
Compare
11a1e0f to
7ecd167
Compare
7ecd167 to
00cf3e2
Compare
Emilxyz
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.
Did some testing with this and generally everything works as expected, just some nitpicks.
I pushed my test-plugin for anyone curious on what exactly I tried.
paper-api/src/main/java/io/papermc/paper/registry/data/dialog/type/DialogListTypeImpl.java
Show resolved
Hide resolved
paper-api/src/main/java/io/papermc/paper/registry/data/dialog/type/ServerLinksTypeImpl.java
Outdated
Show resolved
Hide resolved
00cf3e2 to
2cce855
Compare
2cce855 to
4541a90
Compare
This comment was marked as spam.
This comment was marked as spam.
…2ee0d6ce4e6bd Signed-off-by: David Mayr <davidliebtkekse@gmail.com>
Adds 2 temporary methods to show/clear dialogs from a Player. Will be replaced by adventure methods.
Player#tempShowDialogandPlayer#tempClearDialog.