mirror of
https://github.com/FancyInnovations/FancyPlugins.git
synced 2025-12-06 07:43:36 +00:00
fancydialogs: Add dialog class
This commit is contained in:
@@ -13,6 +13,8 @@ dependencies {
|
||||
compileOnly("de.oliver.FancyAnalytics:logger:0.0.6")
|
||||
|
||||
implementation("org.lushplugins:ChatColorHandler:5.1.3")
|
||||
|
||||
implementation("org.jetbrains:annotations:24.0.0")
|
||||
}
|
||||
|
||||
tasks {
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.fancyinnovations.fancydialogs.api;
|
||||
|
||||
import org.bukkit.entity.Player;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public abstract class Dialog {
|
||||
|
||||
private final @NotNull String id;
|
||||
private @NotNull String title;
|
||||
private @Nullable String externalTitle;
|
||||
private boolean canCloseWithEscape;
|
||||
|
||||
/**
|
||||
* @param externalTitle if null, the title will be used
|
||||
* @param canCloseWithEscape default is true
|
||||
*/
|
||||
public Dialog(@NotNull String id, @NotNull String title, @Nullable String externalTitle, @Nullable Boolean canCloseWithEscape) {
|
||||
this.id = id;
|
||||
this.title = title;
|
||||
this.externalTitle = externalTitle == null ? title : externalTitle;
|
||||
this.canCloseWithEscape = canCloseWithEscape == null || canCloseWithEscape;
|
||||
}
|
||||
|
||||
abstract public void show(Player player);
|
||||
|
||||
abstract public void close(Player player);
|
||||
|
||||
public @NotNull String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public @NotNull String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(@NotNull String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public @Nullable String getExternalTitle() {
|
||||
return externalTitle;
|
||||
}
|
||||
|
||||
public void setExternalTitle(@Nullable String externalTitle) {
|
||||
this.externalTitle = externalTitle;
|
||||
}
|
||||
|
||||
public boolean canCloseWithEscape() {
|
||||
return canCloseWithEscape;
|
||||
}
|
||||
|
||||
public void setCanCloseWithEscape(boolean canCloseWithEscape) {
|
||||
this.canCloseWithEscape = canCloseWithEscape;
|
||||
}
|
||||
}
|
||||
@@ -55,6 +55,8 @@ dependencies {
|
||||
implementation("de.oliver.FancyAnalytics:logger:0.0.6")
|
||||
|
||||
compileOnly("org.lushplugins:ChatColorHandler:5.1.3")
|
||||
|
||||
implementation("org.jetbrains:annotations:24.0.0")
|
||||
}
|
||||
|
||||
paper {
|
||||
|
||||
Reference in New Issue
Block a user