Skip to content

Commit 541109f

Browse files
authored
Merge pull request #43 from SpigotMC/master
[pull] master from SpigotMC:master
2 parents 3704bf4 + f1f5be1 commit 541109f

18 files changed

+150
-20
lines changed

dialog/src/main/java/net/md_5/bungee/api/dialog/DialogListDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public final class DialogListDialog implements Dialog
3535
*/
3636
private int columns;
3737
/**
38-
* The width of the dialog buttons (default: 150).
38+
* The width of the dialog buttons (default: 150, minimum: 1, maximum: 1024).
3939
*/
4040
@SerializedName("button_width")
4141
private int buttonWidth;

dialog/src/main/java/net/md_5/bungee/api/dialog/ServerLinksDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public final class ServerLinksDialog implements Dialog
3131
*/
3232
private int columns;
3333
/**
34-
* The width of the dialog buttons (default: 150).
34+
* The width of the dialog buttons (default: 150, minimum: 1, maximum: 1024).
3535
*/
3636
@SerializedName("button_width")
3737
private int buttonWidth;

dialog/src/main/java/net/md_5/bungee/api/dialog/action/DialogAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public class DialogAction
2121
*/
2222
private BaseComponent tooltip;
2323
/**
24-
* The width of the button (default: 150).
24+
* The width of the button (default: 150, minimum: 1, maximum: 1024).
2525
*/
2626
private int width;
2727

dialog/src/main/java/net/md_5/bungee/api/dialog/body/PlainMessageBody.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public class PlainMessageBody extends DialogBody
2020
*/
2121
private BaseComponent contents;
2222
/**
23-
* The maximum width (default: 200).
23+
* The maximum width (default: 200, minimum: 1, maximum: 1024).
2424
*/
2525
private int width;
2626

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/**
2+
* Contains dialog extensions to the chat API.
3+
*/
4+
package net.md_5.bungee.api.dialog.chat;

dialog/src/main/java/net/md_5/bungee/api/dialog/input/BooleanInput.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,32 @@
77
import lombok.experimental.Accessors;
88
import net.md_5.bungee.api.chat.BaseComponent;
99

10+
/**
11+
* Represents a checkbox input control.
12+
*/
1013
@Data
1114
@Accessors(fluent = true)
1215
@ToString(callSuper = true)
1316
@EqualsAndHashCode(callSuper = true)
1417
public class BooleanInput extends DialogInput
1518
{
1619

20+
/**
21+
* The input label.
22+
*/
1723
private BaseComponent label;
24+
/**
25+
* The initial value (default: false/unchecked).
26+
*/
1827
private boolean initial;
28+
/**
29+
* The string value to be submitted when true/checked (default: "true").
30+
*/
1931
@SerializedName("on_true")
2032
private String onTrue;
33+
/**
34+
* The string value to be submitted when false/unchecked (default: "false").
35+
*/
2136
@SerializedName("on_false")
2237
private String onFalse;
2338

dialog/src/main/java/net/md_5/bungee/api/dialog/input/DialogInput.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,25 @@
22

33
import lombok.Data;
44
import lombok.experimental.Accessors;
5+
import org.jetbrains.annotations.ApiStatus;
56

7+
/**
8+
* Represents a type of input which may be displayed/submitted with a form
9+
* dialog.
10+
*/
611
@Data
712
@Accessors(fluent = true)
813
public class DialogInput
914
{
1015

16+
/**
17+
* The internal input type.
18+
*/
19+
@ApiStatus.Internal
1120
private final String type;
21+
/**
22+
* The key corresponding to this input and associated with the value
23+
* submitted.
24+
*/
1225
private final String key;
1326
}

dialog/src/main/java/net/md_5/bungee/api/dialog/input/InputOption.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,29 @@
55
import lombok.experimental.Accessors;
66
import net.md_5.bungee.api.chat.BaseComponent;
77

8+
/**
9+
* Represents an option choice which may form part of a
10+
* {@link SingleOptionInput}.
11+
*/
812
@Data
913
@AllArgsConstructor
1014
@Accessors(fluent = true)
1115
public class InputOption
1216
{
1317

18+
/**
19+
* The string value associated with this option, to be submitted when
20+
* selected.
21+
*/
1422
private String id;
23+
/**
24+
* The text to display for this option.
25+
*/
1526
private BaseComponent display;
27+
/**
28+
* Whether this option is the one initially selected. Only one option may
29+
* have this value as true (default: first option).
30+
*/
1631
private boolean initial;
1732

1833
public InputOption(String id)

dialog/src/main/java/net/md_5/bungee/api/dialog/input/NumberRangeInput.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
import lombok.experimental.Accessors;
77
import net.md_5.bungee.api.chat.BaseComponent;
88

9+
/**
10+
* Represents a number slider input.
11+
*/
912
@Data
1013
@Accessors(fluent = true)
1114
@ToString(callSuper = true)
@@ -14,28 +17,33 @@ public class NumberRangeInput extends DialogInput
1417
{
1518

1619
/**
17-
* The width of the input (default 200)
20+
* The width of the input (default: 200, minimum: 1, maximum: 1024).
1821
*/
1922
private int width;
2023
/**
21-
* The label of the slider
24+
* The label of the slider.
2225
*/
2326
private BaseComponent label;
27+
/**
28+
* A translate key used to display the label value (default:
29+
* options.generic_value).
30+
*/
2431
private String labelFormat;
2532
/**
26-
* The start position of the slider (leftmost position)
33+
* The start position of the slider (leftmost position).
2734
*/
2835
private float start;
2936
/**
30-
* The end position of the slider (rightmost position)
37+
* The end position of the slider (rightmost position).
3138
*/
3239
private float end;
3340
/**
34-
* The steps in which the input will be increased or decreased, or null if no specific steps
41+
* The steps in which the input will be increased or decreased, or null if
42+
* no specific steps.
3543
*/
3644
private Float step;
3745
/**
38-
* The initial value of number input, or null to fall back to the middle
46+
* The initial value of number input, or null to fall back to the middle.
3947
*/
4048
private Float initial;
4149

dialog/src/main/java/net/md_5/bungee/api/dialog/input/SingleOptionInput.java

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package net.md_5.bungee.api.dialog.input;
22

3+
import com.google.common.base.Preconditions;
34
import com.google.gson.annotations.SerializedName;
45
import java.util.Arrays;
56
import java.util.List;
@@ -9,17 +10,32 @@
910
import lombok.experimental.Accessors;
1011
import net.md_5.bungee.api.chat.BaseComponent;
1112

13+
/**
14+
* Represents a single option (dropdown) input.
15+
*/
1216
@Data
1317
@Accessors(fluent = true)
1418
@ToString(callSuper = true)
1519
@EqualsAndHashCode(callSuper = true)
1620
public class SingleOptionInput extends DialogInput
1721
{
1822

23+
/**
24+
* The width of the input (default: 200, minimum: 1, maximum: 1024).
25+
*/
1926
private int width;
27+
/**
28+
* The input label.
29+
*/
2030
private BaseComponent label;
31+
/**
32+
* Whether the label is visible (default: true).
33+
*/
2134
@SerializedName("label_visible")
2235
private boolean labelVisible;
36+
/**
37+
* The non-empty list of options to be selected from.
38+
*/
2339
private List<InputOption> options;
2440

2541
public SingleOptionInput(String key, BaseComponent label, InputOption... options)
@@ -30,6 +46,8 @@ public SingleOptionInput(String key, BaseComponent label, InputOption... options
3046
public SingleOptionInput(String key, int width, BaseComponent label, boolean labelVisible, List<InputOption> options)
3147
{
3248
super( "minecraft:single_option", key );
49+
Preconditions.checkArgument( options != null && !options.isEmpty(), "At least one option must be provided" );
50+
3351
this.width = width;
3452
this.label = label;
3553
this.labelVisible = labelVisible;

0 commit comments

Comments
 (0)