Minecraft 1.21.6-pre1 support
This commit is contained in:
@@ -6,7 +6,7 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.md_5.bungee.api.dialog.action.DialogClickAction;
|
||||
import net.md_5.bungee.api.dialog.action.DialogAction;
|
||||
|
||||
/**
|
||||
* Represents a simple dialog with text and two actions at the bottom (default:
|
||||
@@ -26,11 +26,11 @@ public final class ConfirmationDialog implements Dialog
|
||||
/**
|
||||
* The "yes" click action / bottom (appears on the left).
|
||||
*/
|
||||
private DialogClickAction yes;
|
||||
private DialogAction yes;
|
||||
/**
|
||||
* The "no" click action / bottom (appears on the right).
|
||||
*/
|
||||
private DialogClickAction no;
|
||||
private DialogAction no;
|
||||
|
||||
public ConfirmationDialog(@NonNull DialogBase base)
|
||||
{
|
||||
|
@@ -8,6 +8,7 @@ import lombok.NonNull;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.dialog.body.DialogBody;
|
||||
import net.md_5.bungee.api.dialog.input.DialogInput;
|
||||
|
||||
/**
|
||||
* Represents the title and other options common to all dialogs.
|
||||
@@ -29,6 +30,10 @@ public final class DialogBase
|
||||
*/
|
||||
@SerializedName("external_title")
|
||||
private BaseComponent externalTitle;
|
||||
/**
|
||||
* The inputs to the dialog.
|
||||
*/
|
||||
private List<DialogInput> inputs;
|
||||
/**
|
||||
* The body elements which make up this dialog.
|
||||
*/
|
||||
@@ -38,9 +43,42 @@ public final class DialogBase
|
||||
*/
|
||||
@SerializedName("can_close_with_escape")
|
||||
private Boolean canCloseWithEscape;
|
||||
/**
|
||||
* Whether this dialog should pause the game in single-player mode (default:
|
||||
* true).
|
||||
*/
|
||||
private Boolean pause;
|
||||
/**
|
||||
* Action to take after the a click or submit action is performed on the
|
||||
* dialog (default: close).
|
||||
*/
|
||||
@SerializedName("after_action")
|
||||
private AfterAction afterAction;
|
||||
|
||||
public DialogBase(@NonNull BaseComponent title)
|
||||
{
|
||||
this( title, null, null, null );
|
||||
this( title, null, null, null, null, null, null );
|
||||
}
|
||||
|
||||
/**
|
||||
* Types of action which may be taken after the dialog.
|
||||
*/
|
||||
public enum AfterAction
|
||||
{
|
||||
/**
|
||||
* Close the dialog.
|
||||
*/
|
||||
@SerializedName("close")
|
||||
CLOSE,
|
||||
/**
|
||||
* Do nothing.
|
||||
*/
|
||||
@SerializedName("none")
|
||||
NONE,
|
||||
/**
|
||||
* Show a waiting for response screen.
|
||||
*/
|
||||
@SerializedName("wait_for_response")
|
||||
WAIT_FOR_RESPONSE;
|
||||
}
|
||||
}
|
||||
|
@@ -9,7 +9,7 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.dialog.action.DialogAction;
|
||||
|
||||
/**
|
||||
* Represents a dialog which contains buttons that link to other dialogs.
|
||||
@@ -29,10 +29,10 @@ public final class DialogListDialog implements Dialog
|
||||
*/
|
||||
private List<Dialog> dialogs;
|
||||
/**
|
||||
* The {@link ClickEvent} activated when the dialog is cancelled.
|
||||
* The {@link DialogAction} activated when the dialog is exited.
|
||||
*/
|
||||
@SerializedName("on_cancel")
|
||||
private ClickEvent onCancel;
|
||||
@SerializedName("exit_action")
|
||||
private DialogAction exitAction;
|
||||
/**
|
||||
* The number of columns for the dialog buttons (default: 2).
|
||||
*/
|
||||
@@ -48,11 +48,11 @@ public final class DialogListDialog implements Dialog
|
||||
this( base, Arrays.asList( dialogs ), null, null, null );
|
||||
}
|
||||
|
||||
public DialogListDialog(@NonNull DialogBase base, List<Dialog> dialogs, ClickEvent onCancel, Integer columns, Integer buttonWidth)
|
||||
public DialogListDialog(@NonNull DialogBase base, List<Dialog> dialogs, DialogAction exitAction, Integer columns, Integer buttonWidth)
|
||||
{
|
||||
this.base = base;
|
||||
this.dialogs = dialogs;
|
||||
this.onCancel = onCancel;
|
||||
this.exitAction = exitAction;
|
||||
columns( columns );
|
||||
buttonWidth( buttonWidth );
|
||||
}
|
||||
|
@@ -9,8 +9,7 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.dialog.action.DialogClickAction;
|
||||
import net.md_5.bungee.api.dialog.action.DialogAction;
|
||||
|
||||
/**
|
||||
* Represents a dialog with text a list of action buttons grouped into columns
|
||||
@@ -30,30 +29,30 @@ public final class MultiActionDialog implements Dialog
|
||||
* The action buttons in the dialog. At least one must be provided.
|
||||
*/
|
||||
@NonNull
|
||||
private List<DialogClickAction> actions;
|
||||
private List<DialogAction> actions;
|
||||
/**
|
||||
* The number of columns for the dialog buttons (default: 2).
|
||||
*/
|
||||
private Integer columns;
|
||||
/**
|
||||
* The {@link ClickEvent} activated when the dialog is cancelled.
|
||||
* The {@link DialogAction} activated when the dialog is exited.
|
||||
*/
|
||||
@SerializedName("on_cancel")
|
||||
private ClickEvent onCancel;
|
||||
@SerializedName("exit_action")
|
||||
private DialogAction exitAction;
|
||||
|
||||
public MultiActionDialog(@NonNull DialogBase base, @NonNull DialogClickAction... actions)
|
||||
public MultiActionDialog(@NonNull DialogBase base, @NonNull DialogAction... actions)
|
||||
{
|
||||
this( base, Arrays.asList( actions ), null, null );
|
||||
}
|
||||
|
||||
public MultiActionDialog(@NonNull DialogBase base, @NonNull List<DialogClickAction> actions, Integer columns, ClickEvent onCancel)
|
||||
public MultiActionDialog(@NonNull DialogBase base, @NonNull List<DialogAction> actions, Integer columns, DialogAction exitAction)
|
||||
{
|
||||
Preconditions.checkArgument( !actions.isEmpty(), "At least one action must be provided" );
|
||||
|
||||
this.base = base;
|
||||
this.actions = actions;
|
||||
columns( columns );
|
||||
this.onCancel = onCancel;
|
||||
this.exitAction = exitAction;
|
||||
}
|
||||
|
||||
public MultiActionDialog columns(Integer columns)
|
||||
|
@@ -1,71 +0,0 @@
|
||||
package net.md_5.bungee.api.dialog;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.md_5.bungee.api.dialog.action.DialogSubmitAction;
|
||||
import net.md_5.bungee.api.dialog.input.DialogInput;
|
||||
|
||||
/**
|
||||
* Represents a dialog which contains a variety of inputs and a multiple submit
|
||||
* buttons at the bottom.
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@Accessors(fluent = true)
|
||||
public final class MultiActionInputFormDialog implements Dialog
|
||||
{
|
||||
|
||||
@Accessors(fluent = false)
|
||||
@NonNull
|
||||
private DialogBase base;
|
||||
/**
|
||||
* The inputs to the dialog. At least one input must be provided.
|
||||
*/
|
||||
@NonNull
|
||||
private List<DialogInput> inputs;
|
||||
/**
|
||||
* The action/submit buttons for the dialog. At least one action must be
|
||||
* provided.
|
||||
*/
|
||||
@NonNull
|
||||
private List<DialogSubmitAction> actions;
|
||||
/**
|
||||
* The amount of columns (default: 2)
|
||||
*/
|
||||
private Integer columns;
|
||||
|
||||
public MultiActionInputFormDialog(@NonNull DialogBase base, @NonNull DialogInput input, @NonNull DialogSubmitAction action)
|
||||
{
|
||||
this( base, Arrays.asList( input ), Arrays.asList( action ), null );
|
||||
}
|
||||
|
||||
public MultiActionInputFormDialog(@NonNull DialogBase base, @NonNull DialogInput input, @NonNull DialogSubmitAction action, Integer columns)
|
||||
{
|
||||
this( base, Arrays.asList( input ), Arrays.asList( action ), columns );
|
||||
}
|
||||
|
||||
public MultiActionInputFormDialog(@NonNull DialogBase base, @NonNull List<DialogInput> inputs, @NonNull List<DialogSubmitAction> actions, Integer columns)
|
||||
{
|
||||
Preconditions.checkArgument( !inputs.isEmpty(), "At least one input must be provided" );
|
||||
Preconditions.checkArgument( !actions.isEmpty(), "At least one action must be provided" );
|
||||
|
||||
this.base = base;
|
||||
this.inputs = inputs;
|
||||
this.actions = actions;
|
||||
columns( columns );
|
||||
}
|
||||
|
||||
public MultiActionInputFormDialog columns(Integer columns)
|
||||
{
|
||||
Preconditions.checkArgument( columns == null || columns > 0, "At least one column is required" );
|
||||
this.columns = columns;
|
||||
return this;
|
||||
}
|
||||
}
|
@@ -6,7 +6,7 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.md_5.bungee.api.dialog.action.DialogClickAction;
|
||||
import net.md_5.bungee.api.dialog.action.DialogAction;
|
||||
|
||||
/**
|
||||
* Represents a simple dialog with text and one action at the bottom (default:
|
||||
@@ -26,7 +26,7 @@ public final class NoticeDialog implements Dialog
|
||||
/**
|
||||
* The "OK" action button for the dialog.
|
||||
*/
|
||||
private DialogClickAction action;
|
||||
private DialogAction action;
|
||||
|
||||
public NoticeDialog(DialogBase base)
|
||||
{
|
||||
|
@@ -7,7 +7,7 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.dialog.action.DialogAction;
|
||||
|
||||
/**
|
||||
* Represents a dialog which shows the links configured/sent from the server.
|
||||
@@ -19,15 +19,19 @@ import net.md_5.bungee.api.chat.ClickEvent;
|
||||
public final class ServerLinksDialog implements Dialog
|
||||
{
|
||||
|
||||
|
||||
@NonNull
|
||||
@Accessors(fluent = false)
|
||||
private DialogBase base;
|
||||
/**
|
||||
* The optional {@link ClickEvent} for this dialog.
|
||||
* The optional {@link DialogAction} for this dialog.
|
||||
*/
|
||||
@SerializedName("on_click")
|
||||
private ClickEvent onClick;
|
||||
@SerializedName("action")
|
||||
private DialogAction action;
|
||||
/**
|
||||
* The {@link DialogAction} activated when the dialog is exited.
|
||||
*/
|
||||
@SerializedName("exit_action")
|
||||
private DialogAction exitAction;
|
||||
/**
|
||||
* The number of columns for the dialog buttons (default: 2).
|
||||
*/
|
||||
@@ -43,10 +47,10 @@ public final class ServerLinksDialog implements Dialog
|
||||
this( base, null, null, null );
|
||||
}
|
||||
|
||||
public ServerLinksDialog(@NonNull DialogBase base, ClickEvent onClick, Integer columns, Integer buttonWidth)
|
||||
public ServerLinksDialog(@NonNull DialogBase base, DialogAction action, Integer columns, Integer buttonWidth)
|
||||
{
|
||||
this.base = base;
|
||||
this.onClick = onClick;
|
||||
this.action = action;
|
||||
columns( columns );
|
||||
buttonWidth( buttonWidth );
|
||||
}
|
||||
|
@@ -1,56 +0,0 @@
|
||||
package net.md_5.bungee.api.dialog;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.md_5.bungee.api.dialog.action.DialogSubmitAction;
|
||||
import net.md_5.bungee.api.dialog.input.DialogInput;
|
||||
|
||||
/**
|
||||
* Represents a dialog which contains a variety of inputs and a single submit
|
||||
* button at the bottom.
|
||||
*/
|
||||
@Data
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@Accessors(fluent = true)
|
||||
public final class SimpleInputFormDialog implements Dialog
|
||||
{
|
||||
|
||||
@NonNull
|
||||
@Accessors(fluent = false)
|
||||
private DialogBase base;
|
||||
/**
|
||||
* The inputs to the dialog. At least one input must be provided.
|
||||
*/
|
||||
@NonNull
|
||||
private List<DialogInput> inputs;
|
||||
/**
|
||||
* The action/submit buttons for the dialog.
|
||||
*/
|
||||
private DialogSubmitAction action;
|
||||
|
||||
public SimpleInputFormDialog(@NonNull DialogBase base, @NonNull DialogInput... inputs)
|
||||
{
|
||||
this( base, null, inputs );
|
||||
}
|
||||
|
||||
public SimpleInputFormDialog(@NonNull DialogBase base, DialogSubmitAction action, @NonNull DialogInput... inputs)
|
||||
{
|
||||
this( base, action, Arrays.asList( inputs ) );
|
||||
}
|
||||
|
||||
public SimpleInputFormDialog(@NonNull DialogBase base, DialogSubmitAction action, @NonNull List<DialogInput> inputs)
|
||||
{
|
||||
Preconditions.checkArgument( !inputs.isEmpty(), "At least one input must be provided" );
|
||||
|
||||
this.base = base;
|
||||
this.inputs = inputs;
|
||||
this.action = action;
|
||||
}
|
||||
}
|
@@ -11,7 +11,7 @@ import net.md_5.bungee.api.chat.BaseComponent;
|
||||
*/
|
||||
@Data
|
||||
@Accessors(fluent = true)
|
||||
public class DialogAction
|
||||
public abstract class DialogAction
|
||||
{
|
||||
|
||||
/**
|
||||
|
@@ -1,43 +0,0 @@
|
||||
package net.md_5.bungee.api.dialog.action;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
import lombok.ToString;
|
||||
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)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class DialogClickAction extends DialogAction
|
||||
{
|
||||
|
||||
/**
|
||||
* The optional action to take on click.
|
||||
*/
|
||||
@SerializedName("on_click")
|
||||
private ClickEvent onClick;
|
||||
|
||||
public DialogClickAction(@NonNull BaseComponent label)
|
||||
{
|
||||
this( null, label );
|
||||
}
|
||||
|
||||
public DialogClickAction(ClickEvent onClick, @NonNull BaseComponent label)
|
||||
{
|
||||
this( onClick, label, null, null );
|
||||
}
|
||||
|
||||
public DialogClickAction(ClickEvent onClick, @NonNull BaseComponent label, BaseComponent tooltip, Integer width)
|
||||
{
|
||||
super( label, tooltip, width );
|
||||
this.onClick = onClick;
|
||||
}
|
||||
}
|
@@ -1,47 +0,0 @@
|
||||
package net.md_5.bungee.api.dialog.action;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
import lombok.ToString;
|
||||
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)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class DialogSubmitAction extends DialogAction
|
||||
{
|
||||
|
||||
/**
|
||||
* The ID of the button, used to distinguish submissions initiated via
|
||||
* different buttons on the dialog.
|
||||
*/
|
||||
@NonNull
|
||||
private String id;
|
||||
/**
|
||||
* The submission action to take.
|
||||
*/
|
||||
@NonNull
|
||||
@SerializedName("on_submit")
|
||||
private DialogSubmission onSubmit;
|
||||
|
||||
public DialogSubmitAction(@NonNull String id, @NonNull DialogSubmission onSubmit, @NonNull BaseComponent label)
|
||||
{
|
||||
this( id, onSubmit, label, null, null );
|
||||
}
|
||||
|
||||
public DialogSubmitAction(@NonNull String id, @NonNull DialogSubmission onSubmit, @NonNull BaseComponent label, BaseComponent tooltip, Integer width)
|
||||
{
|
||||
super( label, tooltip, width );
|
||||
this.id = id;
|
||||
this.onSubmit = onSubmit;
|
||||
}
|
||||
}
|
@@ -0,0 +1,35 @@
|
||||
package net.md_5.bungee.api.dialog.action;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.dialog.dynamic.DynamicType;
|
||||
|
||||
/**
|
||||
* Represents a static dialog action.
|
||||
*/
|
||||
@Data
|
||||
@Accessors(fluent = true)
|
||||
@ToString(callSuper = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class DynamicAction extends DialogAction
|
||||
{
|
||||
|
||||
@NonNull
|
||||
private DynamicType action;
|
||||
|
||||
public DynamicAction(@NonNull BaseComponent label, BaseComponent tooltip, Integer width, @NonNull DynamicType action)
|
||||
{
|
||||
super( label, tooltip, width );
|
||||
this.action = action;
|
||||
}
|
||||
|
||||
public DynamicAction(@NonNull BaseComponent label, @NonNull DynamicType action)
|
||||
{
|
||||
super( label );
|
||||
this.action = action;
|
||||
}
|
||||
}
|
@@ -0,0 +1,44 @@
|
||||
package net.md_5.bungee.api.dialog.action;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Represents a static dialog action.
|
||||
*/
|
||||
@Data
|
||||
@Accessors(fluent = true)
|
||||
@ToString(callSuper = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class StaticAction extends DialogAction
|
||||
{
|
||||
|
||||
@NonNull
|
||||
private ChatClickEventWrapper action;
|
||||
|
||||
public StaticAction(@NonNull BaseComponent label, BaseComponent tooltip, Integer width, @NonNull ClickEvent action)
|
||||
{
|
||||
super( label, tooltip, width );
|
||||
this.action = new ChatClickEventWrapper( action );
|
||||
}
|
||||
|
||||
public StaticAction(@NonNull BaseComponent label, @NonNull ClickEvent action)
|
||||
{
|
||||
super( label );
|
||||
this.action = new ChatClickEventWrapper( action );
|
||||
}
|
||||
|
||||
@Data
|
||||
@ApiStatus.Internal
|
||||
public static final class ChatClickEventWrapper
|
||||
{
|
||||
|
||||
private final ClickEvent event;
|
||||
}
|
||||
}
|
@@ -1,5 +1,6 @@
|
||||
package net.md_5.bungee.api.dialog.submit;
|
||||
package net.md_5.bungee.api.dialog.dynamic;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
@@ -7,13 +8,13 @@ import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* Submits the form with the given ID and all values as a payload.
|
||||
* Submits the dialog with the given ID and values as a payload.
|
||||
*/
|
||||
@Data
|
||||
@Accessors(fluent = true)
|
||||
@ToString(callSuper = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CustomFormSubmission extends DialogSubmission
|
||||
public class Custom extends DynamicType
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -21,10 +22,14 @@ public class CustomFormSubmission extends DialogSubmission
|
||||
*/
|
||||
@NonNull
|
||||
private String id;
|
||||
/**
|
||||
* Fields to be added to the submission payload.
|
||||
*/
|
||||
private JsonElement additions;
|
||||
|
||||
public CustomFormSubmission(@NonNull String id)
|
||||
public Custom(@NonNull String id)
|
||||
{
|
||||
super( "minecraft:custom_form" );
|
||||
super( "dynamic/custom" );
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
package net.md_5.bungee.api.dialog.submit;
|
||||
package net.md_5.bungee.api.dialog.dynamic;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NonNull;
|
||||
@@ -10,7 +10,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
*/
|
||||
@Data
|
||||
@Accessors(fluent = true)
|
||||
public class DialogSubmission
|
||||
public class DynamicType
|
||||
{
|
||||
|
||||
/**
|
@@ -1,4 +1,4 @@
|
||||
package net.md_5.bungee.api.dialog.submit;
|
||||
package net.md_5.bungee.api.dialog.dynamic;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
@@ -7,14 +7,14 @@ import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* Executes a command on form submission. If the command requires a permission
|
||||
* Executes a command. If the command requires a permission
|
||||
* higher than 0, a confirmation dialog will be shown by the client.
|
||||
*/
|
||||
@Data
|
||||
@Accessors(fluent = true)
|
||||
@ToString(callSuper = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CommandTemplateSubmission extends DialogSubmission
|
||||
public class RunCommand extends DynamicType
|
||||
{
|
||||
|
||||
/**
|
||||
@@ -28,9 +28,9 @@ public class CommandTemplateSubmission extends DialogSubmission
|
||||
@NonNull
|
||||
private String template;
|
||||
|
||||
public CommandTemplateSubmission(@NonNull String template)
|
||||
public RunCommand(@NonNull String template)
|
||||
{
|
||||
super( "minecraft:command_template" );
|
||||
super( "dynamic/run_command" );
|
||||
this.template = template;
|
||||
}
|
||||
}
|
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* Represents the various dynamic actions of dialogs.
|
||||
*/
|
||||
package net.md_5.bungee.api.dialog.dynamic;
|
@@ -1,42 +0,0 @@
|
||||
package net.md_5.bungee.api.dialog.submit;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NonNull;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* Submits the form with the given ID and a single payload specified by the
|
||||
* template.
|
||||
*/
|
||||
@Data
|
||||
@Accessors(fluent = true)
|
||||
@ToString(callSuper = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CustomTemplateSubmission extends DialogSubmission
|
||||
{
|
||||
|
||||
/**
|
||||
* The namespaced key of the submission.
|
||||
*/
|
||||
@NonNull
|
||||
private String id;
|
||||
/**
|
||||
* The template to be applied, where variables of the form
|
||||
* <code>$(key)</code> will be replaced by their
|
||||
* {@link net.md_5.bungee.api.dialog.input.DialogInput#key} value.
|
||||
* <br>
|
||||
* The <code>action</code> key is special and will be replaced with the
|
||||
* {@link net.md_5.bungee.api.dialog.action.DialogSubmitAction#id}.
|
||||
*/
|
||||
@NonNull
|
||||
private String template;
|
||||
|
||||
public CustomTemplateSubmission(@NonNull String id, @NonNull String template)
|
||||
{
|
||||
super( "minecraft:custom_template" );
|
||||
this.id = id;
|
||||
this.template = template;
|
||||
}
|
||||
}
|
@@ -1,4 +0,0 @@
|
||||
/**
|
||||
* Represents the various submissions actions of form dialogs.
|
||||
*/
|
||||
package net.md_5.bungee.api.dialog.submit;
|
Reference in New Issue
Block a user