Minecraft 25w20a protocol support
This commit is contained in:
28
dialog/LICENSE
Normal file
28
dialog/LICENSE
Normal file
@@ -0,0 +1,28 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2025, SpigotMC Pty. Ltd.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
35
dialog/README.md
Normal file
35
dialog/README.md
Normal file
@@ -0,0 +1,35 @@
|
||||
BungeeCord-Dialog
|
||||
=================
|
||||
|
||||
Highly experimental API, subject to breakage. All contributions welcome, including major refactors/design changes.
|
||||
|
||||
Sample Plugin
|
||||
-------------
|
||||
|
||||
```java
|
||||
private class TestCommand extends Command
|
||||
{
|
||||
|
||||
public TestCommand()
|
||||
{
|
||||
super( "btest" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String[] args)
|
||||
{
|
||||
ProxiedPlayer player = (ProxiedPlayer) sender;
|
||||
|
||||
Dialog notice = new NoticeDialog( new DialogBase( new ComponentBuilder( "Hello" ).color( ChatColor.RED ).build() ) );
|
||||
player.showDialog( notice );
|
||||
|
||||
notice = new SimpleInputFormDialog(
|
||||
new DialogBase( new ComponentBuilder( "Hello" ).color( ChatColor.RED ).build() ),
|
||||
new DialogSubmitAction( "submit", new CustomFormSubmission( "customform" ), new ComponentBuilder( "Submit Button" ).build() ),
|
||||
new TextInput( "first", new ComponentBuilder( "First" ).build() ),
|
||||
new TextInput( "second", new ComponentBuilder( "Second" ).build() )
|
||||
);
|
||||
player.sendMessage( new ComponentBuilder( "click me" ).event( new ShowDialogClickEvent( notice ) ).build() );
|
||||
}
|
||||
}
|
||||
```
|
31
dialog/nb-configuration.xml
Normal file
31
dialog/nb-configuration.xml
Normal file
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project-shared-configuration>
|
||||
<!--
|
||||
This file contains additional configuration written by modules in the NetBeans IDE.
|
||||
The configuration is intended to be shared among all the users of project and
|
||||
therefore it is assumed to be part of version control checkout.
|
||||
Without this configuration present, some functionality in the IDE may be limited or fail altogether.
|
||||
-->
|
||||
<properties xmlns="http://www.netbeans.org/ns/maven-properties-data/1">
|
||||
<!--
|
||||
Properties that influence various parts of the IDE, especially code formatting and the like.
|
||||
You can copy and paste the single properties, into the pom.xml file and the IDE will pick them up.
|
||||
That way multiple projects can share the same settings (useful for formatting rules for example).
|
||||
Any value defined here will override the pom.xml file value but is only applicable to the current project.
|
||||
-->
|
||||
<org-netbeans-modules-editor-indent.CodeStyle.usedProfile>project</org-netbeans-modules-editor-indent.CodeStyle.usedProfile>
|
||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.classDeclBracePlacement>
|
||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.otherBracePlacement>
|
||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement>NEW_LINE</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.methodDeclBracePlacement>
|
||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinMethodCallParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinMethodCallParens>
|
||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSwitchParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSwitchParens>
|
||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinCatchParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinCatchParens>
|
||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinTryParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinTryParens>
|
||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSynchronizedParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinSynchronizedParens>
|
||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinArrayInitBrackets>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinArrayInitBrackets>
|
||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinParens>
|
||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinWhileParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinWhileParens>
|
||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinIfParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinIfParens>
|
||||
<org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinForParens>true</org-netbeans-modules-editor-indent.text.x-java.CodeStyle.project.spaceWithinForParens>
|
||||
</properties>
|
||||
</project-shared-configuration>
|
36
dialog/pom.xml
Normal file
36
dialog/pom.xml
Normal file
@@ -0,0 +1,36 @@
|
||||
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-parent</artifactId>
|
||||
<version>1.21-R0.3-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-dialog</artifactId>
|
||||
<version>1.21-R0.3-SNAPSHOT</version>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
<name>BungeeCord-Dialog</name>
|
||||
<description>Minecraft dialog API intended for use with BungeeCord</description>
|
||||
<licenses>
|
||||
<license>
|
||||
<name>BSD-3-Clause</name>
|
||||
<url>https://github.com/SpigotMC/BungeeCord/blob/master/dialog/LICENSE</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>net.md-5</groupId>
|
||||
<artifactId>bungeecord-chat</artifactId>
|
||||
<version>${project.version}</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@@ -0,0 +1,27 @@
|
||||
package net.md_5.bungee.api.dialog;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.md_5.bungee.api.dialog.action.DialogClickAction;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@AllArgsConstructor
|
||||
@Accessors(fluent = true)
|
||||
public class ConfirmationDialog implements Dialog
|
||||
{
|
||||
|
||||
@Accessors(fluent = false)
|
||||
private DialogBase base;
|
||||
private DialogClickAction yes;
|
||||
private DialogClickAction no;
|
||||
|
||||
public ConfirmationDialog(DialogBase base)
|
||||
{
|
||||
this( base, null, null );
|
||||
}
|
||||
}
|
@@ -0,0 +1,9 @@
|
||||
package net.md_5.bungee.api.dialog;
|
||||
|
||||
public interface Dialog
|
||||
{
|
||||
|
||||
DialogBase getBase();
|
||||
|
||||
void setBase(DialogBase base);
|
||||
}
|
@@ -0,0 +1,21 @@
|
||||
package net.md_5.bungee.api.dialog;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@RequiredArgsConstructor
|
||||
@Accessors(fluent = true)
|
||||
public class DialogBase
|
||||
{
|
||||
|
||||
private final BaseComponent title;
|
||||
private BaseComponent externalTitle;
|
||||
private List<?> body;
|
||||
private boolean canCloseWithEscape;
|
||||
}
|
@@ -0,0 +1,41 @@
|
||||
package net.md_5.bungee.api.dialog;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@Accessors(fluent = true)
|
||||
public class DialogListDialog implements Dialog
|
||||
{
|
||||
|
||||
@Accessors(fluent = false)
|
||||
private DialogBase base;
|
||||
private List<Dialog> dialogs;
|
||||
@SerializedName("on_cancel")
|
||||
private ClickEvent onCancel;
|
||||
private int columns;
|
||||
@SerializedName("button_width")
|
||||
private int buttonWidth;
|
||||
|
||||
public DialogListDialog(DialogBase base, Dialog... dialogs)
|
||||
{
|
||||
this( base, Arrays.asList( dialogs ), null, 2, 150 );
|
||||
}
|
||||
|
||||
public DialogListDialog(DialogBase base, List<Dialog> dialogs, ClickEvent onCancel, int columns, int buttonWidth)
|
||||
{
|
||||
this.base = base;
|
||||
this.dialogs = dialogs;
|
||||
this.onCancel = onCancel;
|
||||
this.columns = columns;
|
||||
this.buttonWidth = buttonWidth;
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
package net.md_5.bungee.api.dialog;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.dialog.action.DialogClickAction;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@Accessors(fluent = true)
|
||||
public class MultiActionDialog implements Dialog
|
||||
{
|
||||
|
||||
@Accessors(fluent = false)
|
||||
private DialogBase base;
|
||||
private List<DialogClickAction> actions;
|
||||
private int columns;
|
||||
@SerializedName("on_cancel")
|
||||
private ClickEvent onCancel;
|
||||
|
||||
public MultiActionDialog(DialogBase base, DialogClickAction... actions)
|
||||
{
|
||||
this( base, Arrays.asList( actions ), 2, null );
|
||||
}
|
||||
|
||||
public MultiActionDialog(DialogBase base, List<DialogClickAction> actions, int columns, ClickEvent onCancel)
|
||||
{
|
||||
Preconditions.checkArgument( actions != null && !actions.isEmpty(), "At least one action must be provided" );
|
||||
|
||||
this.base = base;
|
||||
this.actions = actions;
|
||||
this.columns = columns;
|
||||
this.onCancel = onCancel;
|
||||
}
|
||||
}
|
@@ -0,0 +1,29 @@
|
||||
package net.md_5.bungee.api.dialog;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.md_5.bungee.api.dialog.action.DialogClickAction;
|
||||
import net.md_5.bungee.api.dialog.input.DialogInput;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@AllArgsConstructor
|
||||
@Accessors(fluent = true)
|
||||
public class MultiActionInputFormDialog implements Dialog
|
||||
{
|
||||
|
||||
@Accessors(fluent = false)
|
||||
private DialogBase base;
|
||||
private List<DialogInput> inputs;
|
||||
private List<DialogClickAction> actions;
|
||||
|
||||
public MultiActionInputFormDialog(DialogBase base)
|
||||
{
|
||||
this( base, null, null );
|
||||
}
|
||||
}
|
@@ -0,0 +1,26 @@
|
||||
package net.md_5.bungee.api.dialog;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.md_5.bungee.api.dialog.action.DialogClickAction;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@AllArgsConstructor
|
||||
@Accessors(fluent = true)
|
||||
public class NoticeDialog implements Dialog
|
||||
{
|
||||
|
||||
@Accessors(fluent = false)
|
||||
private DialogBase base;
|
||||
private DialogClickAction action;
|
||||
|
||||
public NoticeDialog(DialogBase base)
|
||||
{
|
||||
this( base, null );
|
||||
}
|
||||
}
|
@@ -0,0 +1,31 @@
|
||||
package net.md_5.bungee.api.dialog;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@AllArgsConstructor
|
||||
@Accessors(fluent = true)
|
||||
public class ServerLinksDialog implements Dialog
|
||||
{
|
||||
|
||||
@Accessors(fluent = false)
|
||||
private DialogBase base;
|
||||
@SerializedName("on_click")
|
||||
private ClickEvent onClick;
|
||||
private int columns;
|
||||
@SerializedName("button_width")
|
||||
private int buttonWidth;
|
||||
|
||||
public ServerLinksDialog(DialogBase base)
|
||||
{
|
||||
this( base, null, 2, 150 );
|
||||
}
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
package net.md_5.bungee.api.dialog;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
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;
|
||||
|
||||
@Data
|
||||
@ToString
|
||||
@EqualsAndHashCode
|
||||
@Accessors(fluent = true)
|
||||
public class SimpleInputFormDialog implements Dialog
|
||||
{
|
||||
|
||||
@Accessors(fluent = false)
|
||||
private DialogBase base;
|
||||
private List<DialogInput> inputs;
|
||||
private DialogSubmitAction action;
|
||||
|
||||
public SimpleInputFormDialog(DialogBase base, DialogInput... inputs)
|
||||
{
|
||||
this( base, null, inputs );
|
||||
}
|
||||
|
||||
public SimpleInputFormDialog(DialogBase base, DialogSubmitAction action, DialogInput... inputs)
|
||||
{
|
||||
this( base, action, Arrays.asList( inputs ) );
|
||||
}
|
||||
|
||||
public SimpleInputFormDialog(DialogBase base, DialogSubmitAction action, List<DialogInput> inputs)
|
||||
{
|
||||
this.base = base;
|
||||
this.inputs = inputs;
|
||||
this.action = action;
|
||||
}
|
||||
}
|
@@ -0,0 +1,20 @@
|
||||
package net.md_5.bungee.api.dialog.action;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class DialogAction
|
||||
{
|
||||
|
||||
private BaseComponent label;
|
||||
private BaseComponent tooltip;
|
||||
private int width;
|
||||
|
||||
public DialogAction(BaseComponent label)
|
||||
{
|
||||
this( label, null, 150 );
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package net.md_5.bungee.api.dialog.action;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
|
||||
@Data
|
||||
@Accessors(fluent = true)
|
||||
@ToString(callSuper = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class DialogClickAction extends DialogAction
|
||||
{
|
||||
|
||||
@SerializedName("on_click")
|
||||
private ClickEvent onClick;
|
||||
|
||||
public DialogClickAction(BaseComponent label)
|
||||
{
|
||||
this( null, label );
|
||||
}
|
||||
|
||||
public DialogClickAction(ClickEvent onClick, BaseComponent label)
|
||||
{
|
||||
this( onClick, label, null, 150 );
|
||||
}
|
||||
|
||||
public DialogClickAction(ClickEvent onClick, BaseComponent label, BaseComponent tooltip, int width)
|
||||
{
|
||||
super( label, tooltip, width );
|
||||
this.onClick = onClick;
|
||||
}
|
||||
}
|
@@ -0,0 +1,33 @@
|
||||
package net.md_5.bungee.api.dialog.action;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
import net.md_5.bungee.api.dialog.submit.DialogSubmission;
|
||||
|
||||
@Data
|
||||
@Accessors(fluent = true)
|
||||
@ToString(callSuper = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class DialogSubmitAction extends DialogAction
|
||||
{
|
||||
|
||||
private String id;
|
||||
@SerializedName("on_submit")
|
||||
private DialogSubmission onSubmit;
|
||||
|
||||
public DialogSubmitAction(String id, DialogSubmission onSubmit, BaseComponent label)
|
||||
{
|
||||
this( id, onSubmit, label, null, 150 );
|
||||
}
|
||||
|
||||
public DialogSubmitAction(String id, DialogSubmission onSubmit, BaseComponent label, BaseComponent tooltip, int width)
|
||||
{
|
||||
super( label, tooltip, width );
|
||||
this.id = id;
|
||||
this.onSubmit = onSubmit;
|
||||
}
|
||||
}
|
@@ -0,0 +1,10 @@
|
||||
package net.md_5.bungee.api.dialog.body;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class DialogBody
|
||||
{
|
||||
|
||||
private final String type;
|
||||
}
|
@@ -0,0 +1,28 @@
|
||||
package net.md_5.bungee.api.dialog.body;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class PlainMessageBody extends DialogBody
|
||||
{
|
||||
|
||||
private BaseComponent contents;
|
||||
private int width;
|
||||
|
||||
public PlainMessageBody(BaseComponent contents)
|
||||
{
|
||||
this( contents, 200 );
|
||||
}
|
||||
|
||||
public PlainMessageBody(BaseComponent contents, int width)
|
||||
{
|
||||
super( "minecraft:plain_message" );
|
||||
this.contents = contents;
|
||||
this.width = width;
|
||||
}
|
||||
}
|
@@ -0,0 +1,42 @@
|
||||
package net.md_5.bungee.api.dialog.chat;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import net.md_5.bungee.api.chat.ClickEvent;
|
||||
import net.md_5.bungee.api.dialog.Dialog;
|
||||
|
||||
/**
|
||||
* Click event which displays either a pre-existing dialog by key or a custom
|
||||
* dialog.
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class ShowDialogClickEvent extends ClickEvent
|
||||
{
|
||||
|
||||
/**
|
||||
* Key for a pre-existing dialog to show.
|
||||
*/
|
||||
private String reference;
|
||||
/**
|
||||
* Dialog to show.
|
||||
*/
|
||||
private Dialog dialog;
|
||||
|
||||
public ShowDialogClickEvent(String reference)
|
||||
{
|
||||
this( reference, null );
|
||||
}
|
||||
|
||||
public ShowDialogClickEvent(Dialog dialog)
|
||||
{
|
||||
this( null, dialog );
|
||||
}
|
||||
|
||||
private ShowDialogClickEvent(String reference, Dialog dialog)
|
||||
{
|
||||
super( Action.SHOW_DIALOG, null );
|
||||
this.reference = reference;
|
||||
this.dialog = dialog;
|
||||
}
|
||||
}
|
@@ -0,0 +1,37 @@
|
||||
package net.md_5.bungee.api.dialog.input;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
|
||||
@Data
|
||||
@Accessors(fluent = true)
|
||||
@ToString(callSuper = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class BooleanInput extends DialogInput
|
||||
{
|
||||
|
||||
private BaseComponent label;
|
||||
private boolean initial;
|
||||
@SerializedName("on_true")
|
||||
private String onTrue;
|
||||
@SerializedName("on_false")
|
||||
private String onFalse;
|
||||
|
||||
public BooleanInput(String key, BaseComponent label)
|
||||
{
|
||||
this( key, label, false, "true", "false" );
|
||||
}
|
||||
|
||||
public BooleanInput(String key, BaseComponent label, boolean initial, String onTrue, String onFalse)
|
||||
{
|
||||
super( "minecraft:boolean", key );
|
||||
this.label = label;
|
||||
this.initial = initial;
|
||||
this.onTrue = onTrue;
|
||||
this.onFalse = onFalse;
|
||||
}
|
||||
}
|
@@ -0,0 +1,13 @@
|
||||
package net.md_5.bungee.api.dialog.input;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(fluent = true)
|
||||
public class DialogInput
|
||||
{
|
||||
|
||||
private final String type;
|
||||
private final String key;
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
package net.md_5.bungee.api.dialog.input;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@Accessors(fluent = true)
|
||||
public class InputOption
|
||||
{
|
||||
|
||||
private String id;
|
||||
private BaseComponent display;
|
||||
private boolean initial;
|
||||
|
||||
public InputOption(String id)
|
||||
{
|
||||
this( id, null, false );
|
||||
}
|
||||
}
|
@@ -0,0 +1,40 @@
|
||||
package net.md_5.bungee.api.dialog.input;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
|
||||
@Data
|
||||
@Accessors(fluent = true)
|
||||
@ToString(callSuper = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class NumberRangeInput extends DialogInput
|
||||
{
|
||||
|
||||
private int width;
|
||||
private BaseComponent label;
|
||||
private String labelFormat;
|
||||
private int start;
|
||||
private int end;
|
||||
private int steps;
|
||||
private int initial;
|
||||
|
||||
public NumberRangeInput(String key, BaseComponent label, int start, int end, int steps)
|
||||
{
|
||||
this( key, 200, label, "options.generic_value", start, end, steps, start );
|
||||
}
|
||||
|
||||
public NumberRangeInput(String key, int width, BaseComponent label, String labelFormat, int start, int end, int steps, int initial)
|
||||
{
|
||||
super( "minecraft:number_range", key );
|
||||
this.width = width;
|
||||
this.label = label;
|
||||
this.labelFormat = labelFormat;
|
||||
this.start = start;
|
||||
this.end = end;
|
||||
this.steps = steps;
|
||||
this.initial = initial;
|
||||
}
|
||||
}
|
@@ -0,0 +1,38 @@
|
||||
package net.md_5.bungee.api.dialog.input;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
|
||||
@Data
|
||||
@Accessors(fluent = true)
|
||||
@ToString(callSuper = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class SingleOptionInput extends DialogInput
|
||||
{
|
||||
|
||||
private int width;
|
||||
private BaseComponent label;
|
||||
@SerializedName("label_visible")
|
||||
private boolean labelVisible;
|
||||
private List<InputOption> options;
|
||||
|
||||
public SingleOptionInput(String key, BaseComponent label, InputOption... options)
|
||||
{
|
||||
this( key, 200, label, true, Arrays.asList( options ) );
|
||||
}
|
||||
|
||||
public SingleOptionInput(String key, int width, BaseComponent label, boolean labelVisible, List<InputOption> options)
|
||||
{
|
||||
super( "minecraft:single_option", key );
|
||||
this.width = width;
|
||||
this.label = label;
|
||||
this.labelVisible = labelVisible;
|
||||
this.options = options;
|
||||
}
|
||||
}
|
@@ -0,0 +1,36 @@
|
||||
package net.md_5.bungee.api.dialog.input;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
import net.md_5.bungee.api.chat.BaseComponent;
|
||||
|
||||
@Data
|
||||
@Accessors(fluent = true)
|
||||
@ToString(callSuper = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class TextInput extends DialogInput
|
||||
{
|
||||
|
||||
private int width;
|
||||
private BaseComponent label;
|
||||
@SerializedName("label_visible")
|
||||
private boolean labelVisible;
|
||||
private String initial;
|
||||
|
||||
public TextInput(String key, BaseComponent label)
|
||||
{
|
||||
this( key, 200, label, true, "" );
|
||||
}
|
||||
|
||||
public TextInput(String key, int width, BaseComponent label, boolean labelVisible, String initial)
|
||||
{
|
||||
super( "minecraft:text", key );
|
||||
this.width = width;
|
||||
this.label = label;
|
||||
this.labelVisible = labelVisible;
|
||||
this.initial = initial;
|
||||
}
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
package net.md_5.bungee.api.dialog.submit;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(fluent = true)
|
||||
@ToString(callSuper = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CommandTemplateSubmission extends DialogSubmission
|
||||
{
|
||||
|
||||
private String template;
|
||||
|
||||
public CommandTemplateSubmission(String template)
|
||||
{
|
||||
super( "minecraft:command_template" );
|
||||
this.template = template;
|
||||
}
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
package net.md_5.bungee.api.dialog.submit;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(fluent = true)
|
||||
@ToString(callSuper = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CustomFormSubmission extends DialogSubmission
|
||||
{
|
||||
|
||||
private String id;
|
||||
|
||||
public CustomFormSubmission(String id)
|
||||
{
|
||||
super( "minecraft:custom_form" );
|
||||
this.id = id;
|
||||
}
|
||||
}
|
@@ -0,0 +1,24 @@
|
||||
package net.md_5.bungee.api.dialog.submit;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.ToString;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(fluent = true)
|
||||
@ToString(callSuper = true)
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class CustomTemplateSubmission extends DialogSubmission
|
||||
{
|
||||
|
||||
private String id;
|
||||
private String template;
|
||||
|
||||
public CustomTemplateSubmission(String id, String template)
|
||||
{
|
||||
super( "minecraft:custom_template" );
|
||||
this.id = id;
|
||||
this.template = template;
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
package net.md_5.bungee.api.dialog.submit;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
@Data
|
||||
@Accessors(fluent = true)
|
||||
public class DialogSubmission
|
||||
{
|
||||
|
||||
private final String type;
|
||||
}
|
Reference in New Issue
Block a user