Class InventoryConfirm
java.lang.Object
mc.obliviate.inventory.Gui
com.ultikits.ultitools.abstracts.gui.BaseInventoryPage
com.ultikits.ultitools.abstracts.gui.BaseConfirmationPage
com.ultikits.ultitools.widgets.impl.InventoryConfirm
- All Implemented Interfaces:
Confirm,org.bukkit.inventory.InventoryHolder
A GUI inventory-based confirmation dialog implementation.
This widget displays a 3-row inventory GUI with OK and Cancel buttons.
Extends BaseConfirmationPage to inherit the standard OK/Cancel button layout.
Example Usage:
Confirm.gui(player, "Confirm Purchase", "Buy Diamond Sword for 100 coins?",
() -> completePurchase(),
() -> cancelPurchase()
).show();
- Since:
- 6.0.0
- Author:
- wisdomme
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class com.ultikits.ultitools.abstracts.gui.BaseConfirmationPage
BaseConfirmationPage.Builder -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate StringCustom cancel button text, null uses BaseConfirmationPage defaultprivate StringCustom confirm button text, null uses BaseConfirmationPage defaultprivate static final StringThe unique GUI identifierprivate static final intThe number of rows in the GUI (3 rows = 27 slots)private final RunnableCallback executed when player clicks Cancel buttonprivate final RunnableCallback executed when player clicks OK buttonFields inherited from class com.ultikits.ultitools.abstracts.gui.BaseConfirmationPage
CANCEL_BUTTON_COLUMN, OK_BUTTON_COLUMNFields inherited from class com.ultikits.ultitools.abstracts.gui.BaseInventoryPage
DEFAULT_BOTTOM_ROWFields inherited from class mc.obliviate.inventory.Gui
player -
Constructor Summary
ConstructorsConstructorDescriptionInventoryConfirm(org.bukkit.entity.Player player, String title, String description, Runnable onConfirm, Runnable onCancel) Creates an inventory confirmation dialog with default button text.InventoryConfirm(org.bukkit.entity.Player player, String title, String description, String confirmText, String cancelText, Runnable onConfirm, Runnable onCancel) Creates an inventory confirmation dialog with custom button text. -
Method Summary
Modifier and TypeMethodDescriptionprotected StringGets the Cancel button display name.Get the cancel text.Get the confirm text.protected StringGets the OK button display name.protected voidonCancel(org.bukkit.event.inventory.InventoryClickEvent clickEvent) Called when the Cancel button is clicked.protected voidonConfirm(org.bukkit.event.inventory.InventoryClickEvent clickEvent) Called when the OK button is clicked.voidshow()Show the confirm dialog.Methods inherited from class com.ultikits.ultitools.abstracts.gui.BaseConfirmationPage
builder, createCancelButton, createOkButton, setupConfirmationButtons, setupContent, setupDialogContentMethods 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
-
confirmText
Custom confirm button text, null uses BaseConfirmationPage default -
cancelText
Custom cancel button text, null uses BaseConfirmationPage default -
onConfirmCallback
Callback executed when player clicks OK button -
onCancelCallback
Callback executed when player clicks Cancel button -
GUI_ID
The unique GUI identifier- See Also:
-
GUI_ROWS
private static final int GUI_ROWSThe number of rows in the GUI (3 rows = 27 slots)- See Also:
-
-
Constructor Details
-
InventoryConfirm
public InventoryConfirm(org.bukkit.entity.Player player, String title, String description, Runnable onConfirm, Runnable onCancel) Creates an inventory confirmation dialog with default button text.- Parameters:
player- the target playertitle- the dialog titledescription- the dialog description (appended to title)onConfirm- callback for confirm actiononCancel- callback for cancel action
-
InventoryConfirm
public InventoryConfirm(org.bukkit.entity.Player player, String title, String description, String confirmText, String cancelText, Runnable onConfirm, Runnable onCancel) Creates an inventory confirmation dialog with custom button text.- Parameters:
player- the target playertitle- the dialog titledescription- the dialog description (appended to title)confirmText- custom confirm button textcancelText- custom cancel button textonConfirm- callback for confirm actiononCancel- callback for cancel action
-
-
Method Details
-
getOkButtonName
Description copied from class:BaseConfirmationPageGets the OK button display name. Override to customize.- Overrides:
getOkButtonNamein classBaseConfirmationPage- Returns:
- the OK button name
-
getCancelButtonName
Description copied from class:BaseConfirmationPageGets the Cancel button display name. Override to customize.- Overrides:
getCancelButtonNamein classBaseConfirmationPage- Returns:
- the Cancel button name
-
getConfirmText
Description copied from interface:ConfirmGet the confirm text.- Specified by:
getConfirmTextin interfaceConfirm
-
getCancelText
Description copied from interface:ConfirmGet the cancel text.- Specified by:
getCancelTextin interfaceConfirm
-
show
public void show()Description copied from interface:ConfirmShow the confirm dialog. -
onConfirm
protected void onConfirm(org.bukkit.event.inventory.InventoryClickEvent clickEvent) Description copied from class:BaseConfirmationPageCalled when the OK button is clicked.- Specified by:
onConfirmin classBaseConfirmationPage- Parameters:
clickEvent- the click event
-
onCancel
protected void onCancel(org.bukkit.event.inventory.InventoryClickEvent clickEvent) Description copied from class:BaseConfirmationPageCalled when the Cancel button is clicked. Default implementation does nothing.- Overrides:
onCancelin classBaseConfirmationPage- Parameters:
clickEvent- the click event
-