mirror of
https://github.com/FancyInnovations/FancyPlugins.git
synced 2025-12-06 07:43:36 +00:00
fancydialogs: Allow inputs to be null
This commit is contained in:
@@ -5,6 +5,10 @@ order: 1
|
||||
|
||||
# FancyDialogs v0.x.x
|
||||
|
||||
## v0.0.9 [!badge variant="info" text="2025-06-29"]
|
||||
|
||||
- Allow inputs to be null
|
||||
|
||||
## v0.0.9 [!badge variant="info" text="2025-06-28"]
|
||||
|
||||
- Added `open_random_dialog` action to open a random dialog from a list
|
||||
|
||||
@@ -1 +1 @@
|
||||
0.0.9
|
||||
0.0.10
|
||||
@@ -2,6 +2,7 @@ package com.fancyinnovations.fancydialogs.api.data;
|
||||
|
||||
import com.fancyinnovations.fancydialogs.api.data.inputs.DialogInputs;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -10,7 +11,7 @@ public record DialogData(
|
||||
@NotNull String title,
|
||||
boolean canCloseWithEscape,
|
||||
@NotNull List<DialogBodyData> body,
|
||||
@NotNull DialogInputs inputs,
|
||||
@Nullable DialogInputs inputs,
|
||||
@NotNull List<DialogButton> buttons
|
||||
) {
|
||||
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.fancyinnovations.fancydialogs.api.data.inputs;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public record DialogInputs(
|
||||
List<DialogTextField> textFields,
|
||||
List<DialogSelect> selects
|
||||
@Nullable List<DialogTextField> textFields,
|
||||
@Nullable List<DialogSelect> selects
|
||||
) {
|
||||
|
||||
public static final DialogInputs EMPTY = new DialogInputs(List.of(), List.of());
|
||||
|
||||
@@ -47,6 +47,7 @@ public class DialogImpl extends Dialog {
|
||||
}
|
||||
|
||||
List<FS_DialogInput> inputs = new ArrayList<>();
|
||||
if (data.inputs() != null) {
|
||||
for (DialogInput input : data.inputs().all()) {
|
||||
FS_DialogInputControl control = null;
|
||||
if (input instanceof DialogTextField textField) {
|
||||
@@ -80,6 +81,7 @@ public class DialogImpl extends Dialog {
|
||||
FS_DialogInput fsDialogInput = new FS_DialogInput(input.getKey(), control);
|
||||
inputs.add(fsDialogInput);
|
||||
}
|
||||
}
|
||||
|
||||
List<FS_DialogActionButton> actions = new ArrayList<>();
|
||||
for (DialogButton button : data.buttons()) {
|
||||
|
||||
Reference in New Issue
Block a user