Class BaseConfirmationPage
java.lang.Object
mc.obliviate.inventory.Gui
com.ultikits.ultitools.abstracts.gui.BaseInventoryPage
com.ultikits.ultitools.abstracts.gui.BaseConfirmationPage
- All Implemented Interfaces:
org.bukkit.inventory.InventoryHolder
Base class for confirmation dialogs with OK and Cancel buttons.
带有确定和取消按钮的确认对话框基类。
- Since:
- 6.2.0
- Version:
- 2.0.0
- Author:
- wisdomme
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder for creating confirmation dialogs. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intDefault column for the cancel buttonprotected static final intDefault column for the OK buttonFields inherited from class com.ultikits.ultitools.abstracts.gui.BaseInventoryPage
DEFAULT_BOTTOM_ROWFields inherited from class mc.obliviate.inventory.Gui
player -
Constructor Summary
ConstructorsConstructorDescriptionBaseConfirmationPage(@NotNull org.bukkit.entity.Player player, @NotNull String id, String title, int rows) BaseConfirmationPage(@NotNull org.bukkit.entity.Player player, @NotNull String id, String title, org.bukkit.event.inventory.InventoryType inventoryType) BaseConfirmationPage(@NotNull org.bukkit.entity.Player player, @NotNull String id, net.kyori.adventure.text.Component title, int rows) BaseConfirmationPage(@NotNull org.bukkit.entity.Player player, @NotNull String id, net.kyori.adventure.text.Component title, org.bukkit.event.inventory.InventoryType inventoryType) -
Method Summary
Modifier and TypeMethodDescriptionstatic BaseConfirmationPage.Builderbuilder(@NotNull org.bukkit.entity.Player player) Creates a new builder for confirmation dialogs.protected mc.obliviate.inventory.IconCreates the Cancel button.protected mc.obliviate.inventory.IconCreates the OK button.protected StringGets the Cancel button display name.protected StringGets the OK button display name.protected voidonCancel(org.bukkit.event.inventory.InventoryClickEvent event) Called when the Cancel button is clicked.protected abstract voidonConfirm(org.bukkit.event.inventory.InventoryClickEvent event) Called when the OK button is clicked.protected voidSets up the OK and Cancel buttons.protected final voidsetupContent(org.bukkit.event.inventory.InventoryOpenEvent event) Sets up the GUI content.protected voidsetupDialogContent(org.bukkit.event.inventory.InventoryOpenEvent event) Sets up the dialog content.Methods inherited from class com.ultikits.ultitools.abstracts.gui.BaseInventoryPage
addToBottomRow, afterSetup, createActionButton, createBackgroundIcon, fillArea, fillBorder, getBottomCenterSlot, getContentSlots, getSlotFromEnd, onClose, onClose, onOpen, refresh, setShowBottomToolbar, setupBottomToolbarMethods inherited from class mc.obliviate.inventory.Gui
addItem, addItem, addItem, addItem, addItem, addItem, addItem, addItem, createInventory, createInventory, fillColumn, fillGui, fillGui, fillGui, fillGui, fillRow, getId, getInventory, getItems, getLastSlot, getPlugin, getSize, getTaskList, getTitle, isClosed, onClick, onDrag, open, runTaskLater, sendSizeUpdate, sendTitleUpdate, setClosed, setInventory, setSize, setTitle, stopAllTasks, stopTask, updateTask
-
Field Details
-
CANCEL_BUTTON_COLUMN
protected static final int CANCEL_BUTTON_COLUMNDefault column for the cancel button- See Also:
-
OK_BUTTON_COLUMN
protected static final int OK_BUTTON_COLUMNDefault column for the OK button- See Also:
-
-
Constructor Details
-
BaseConfirmationPage
-
BaseConfirmationPage
-
BaseConfirmationPage
public BaseConfirmationPage(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull String id, net.kyori.adventure.text.Component title, int rows) -
BaseConfirmationPage
public BaseConfirmationPage(@NotNull @NotNull org.bukkit.entity.Player player, @NotNull @NotNull String id, net.kyori.adventure.text.Component title, org.bukkit.event.inventory.InventoryType inventoryType)
-
-
Method Details
-
setupContent
protected final void setupContent(org.bukkit.event.inventory.InventoryOpenEvent event) Description copied from class:BaseInventoryPageSets up the GUI content. Override this method to add custom content.设置 GUI 内容。重写此方法以添加自定义内容。
- Specified by:
setupContentin classBaseInventoryPage- Parameters:
event- the inventory open event
-
setupDialogContent
protected void setupDialogContent(org.bukkit.event.inventory.InventoryOpenEvent event) Sets up the dialog content. Override to add custom content.设置对话框内容。重写以添加自定义内容。
- Parameters:
event- the inventory open event
-
setupConfirmationButtons
protected void setupConfirmationButtons()Sets up the OK and Cancel buttons.设置确定和取消按钮。
-
createOkButton
protected mc.obliviate.inventory.Icon createOkButton()Creates the OK button. Override to customize.创建确定按钮。 重写以自定义。
- Returns:
- the OK button icon
-
createCancelButton
protected mc.obliviate.inventory.Icon createCancelButton()Creates the Cancel button. Override to customize.创建取消按钮。 重写以自定义。
- Returns:
- the Cancel button icon
-
getOkButtonName
Gets the OK button display name. Override to customize.获取确定按钮的显示名称。 重写以自定义。
- Returns:
- the OK button name
-
getCancelButtonName
Gets the Cancel button display name. Override to customize.获取取消按钮的显示名称。 重写以自定义。
- Returns:
- the Cancel button name
-
onConfirm
protected abstract void onConfirm(org.bukkit.event.inventory.InventoryClickEvent event) Called when the OK button is clicked.当点击确定按钮时调用。
- Parameters:
event- the click event
-
onCancel
protected void onCancel(org.bukkit.event.inventory.InventoryClickEvent event) Called when the Cancel button is clicked. Default implementation does nothing.当点击取消按钮时调用。 默认实现不做任何事情。
- Parameters:
event- the click event
-
builder
public static BaseConfirmationPage.Builder builder(@NotNull @NotNull org.bukkit.entity.Player player) Creates a new builder for confirmation dialogs.创建确认对话框的新构建器。
- Parameters:
player- the player to show the dialog to- Returns:
- a new builder
-