mirror of
https://github.com/FancyInnovations/FancyPlugins.git
synced 2025-12-06 07:43:36 +00:00
fancydialogs: Add notice dialog to api
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
package com.fancyinnovations.fancydialogs.api;
|
||||
|
||||
import com.fancyinnovations.fancydialogs.api.data.DialogBodyData;
|
||||
import com.fancyinnovations.fancydialogs.api.data.DialogData;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public class NoticeDialog {
|
||||
|
||||
private final String title;
|
||||
private final String text;
|
||||
|
||||
private final DialogData dialogData;
|
||||
|
||||
public NoticeDialog(String title, String text) {
|
||||
this.title = title;
|
||||
this.text = text;
|
||||
|
||||
this.dialogData = new DialogData(
|
||||
"notice_dialog_" + UUID.randomUUID(),
|
||||
this.title,
|
||||
this.title,
|
||||
true,
|
||||
List.of(
|
||||
new DialogBodyData(this.text)
|
||||
),
|
||||
List.of()
|
||||
);
|
||||
}
|
||||
|
||||
public NoticeDialog(String text) {
|
||||
this("Notice", text);
|
||||
}
|
||||
|
||||
public static void show(Player player, String text) {
|
||||
new NoticeDialog(text).show(player);
|
||||
}
|
||||
|
||||
public void show(Player player) {
|
||||
FancyDialogs.get()
|
||||
.createDialog(dialogData)
|
||||
.open(player);
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public String getText() {
|
||||
return text;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user