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
- Direct Known Subclasses:
InventoryConfirm
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.- 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
-