Document packages net.md_5.bungee.api.dialog.action and net.md_5.bungee.api.dialog.body.

This commit is contained in:
md_5 2025-05-20 21:49:44 +10:00
parent 75456b2c0a
commit 4d37c2488e
No known key found for this signature in database
GPG Key ID: E8E901AC7C617C11
8 changed files with 57 additions and 1 deletions

View File

@ -4,13 +4,25 @@ import lombok.AllArgsConstructor;
import lombok.Data;
import net.md_5.bungee.api.chat.BaseComponent;
/**
* Represents a dialog action which will usually appear as a button.
*/
@Data
@AllArgsConstructor
public class DialogAction
{
/**
* The text label of the button, mandatory.
*/
private BaseComponent label;
/**
* The hover tooltip of the button.
*/
private BaseComponent tooltip;
/**
* The width of the button (default: 150).
*/
private int width;
public DialogAction(BaseComponent label)

View File

@ -8,6 +8,9 @@ import lombok.experimental.Accessors;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.chat.ClickEvent;
/**
* Represents a button which may be clicked.
*/
@Data
@Accessors(fluent = true)
@ToString(callSuper = true)
@ -15,6 +18,9 @@ import net.md_5.bungee.api.chat.ClickEvent;
public class DialogClickAction extends DialogAction
{
/**
* The optional action to take on click.
*/
@SerializedName("on_click")
private ClickEvent onClick;

View File

@ -8,6 +8,10 @@ import lombok.experimental.Accessors;
import net.md_5.bungee.api.chat.BaseComponent;
import net.md_5.bungee.api.dialog.submit.DialogSubmission;
/**
* Represents a dialog button associated with the submission of a form dialog
* containing inputs.
*/
@Data
@Accessors(fluent = true)
@ToString(callSuper = true)
@ -15,7 +19,14 @@ import net.md_5.bungee.api.dialog.submit.DialogSubmission;
public class DialogSubmitAction extends DialogAction
{
/**
* The ID of the button, used to distinguish submissions initiated via
* different buttons on the dialog.
*/
private String id;
/**
* The submission action to take.
*/
@SerializedName("on_submit")
private DialogSubmission onSubmit;

View File

@ -0,0 +1,4 @@
/**
* Contains the different actions/buttons for a {@link net.md_5.bungee.api.dialog.Dialog}.
*/
package net.md_5.bungee.api.dialog.action;

View File

@ -1,10 +1,18 @@
package net.md_5.bungee.api.dialog.body;
import lombok.Data;
import org.jetbrains.annotations.ApiStatus;
/**
* Represents the body content of a {@link net.md_5.bungee.api.dialog.Dialog}.
*/
@Data
public abstract class DialogBody
{
/**
* The internal body type.
*/
@ApiStatus.Internal
private final String type;
}

View File

@ -5,13 +5,23 @@ import lombok.EqualsAndHashCode;
import lombok.ToString;
import net.md_5.bungee.api.chat.BaseComponent;
/**
* Represents a dialog body which consists of text constrained to a certain
* width.
*/
@Data
@ToString(callSuper = true)
@EqualsAndHashCode(callSuper = true)
public class PlainMessageBody extends DialogBody
{
/**
* The text body.
*/
private BaseComponent contents;
/**
* The maximum width (default: 200).
*/
private int width;
public PlainMessageBody(BaseComponent contents)

View File

@ -0,0 +1,5 @@
/**
* Contains the different {@link net.md_5.bungee.api.dialog.Dialog} body content
* types.
*/
package net.md_5.bungee.api.dialog.body;

View File

@ -1,4 +1,4 @@
/**
* Contains the core classes for the display of a {@link Dialog}.
* Contains the core classes for the display of a {@link net.md_5.bungee.api.dialog.Dialog}.
*/
package net.md_5.bungee.api.dialog;