Package net.wesjd.anvilgui
Interface AnvilGUI.ResponseAction
- All Superinterfaces:
BiConsumer<AnvilGUI,org.bukkit.entity.Player>
- Enclosing class:
AnvilGUI
- Functional Interface:
- This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.
@FunctionalInterface
public static interface AnvilGUI.ResponseAction
extends BiConsumer<AnvilGUI,org.bukkit.entity.Player>
An action to run in response to a player clicking the output slot in the GUI. This interface is public
and permits you, the developer, to add additional response features easily to your custom AnvilGUIs.
-
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic AnvilGUI.ResponseActionclose()Close the AnvilGUIstatic AnvilGUI.ResponseActionopenInventory(org.bukkit.inventory.Inventory otherInventory) Open another inventorystatic AnvilGUI.ResponseActionreplaceInputText(String text) Replace the input text box value with the provided text value.static AnvilGUI.ResponseActionRun the provided runnablestatic AnvilGUI.ResponseActionupdateJsonTitle(String json, boolean preserveRenameText) Updates the title of the AnvilGUI to the new one.static AnvilGUI.ResponseActionupdateTitle(String literalTitle, boolean preserveRenameText) Updates the title of the AnvilGUI to the new one.Methods inherited from interface java.util.function.BiConsumer
accept, andThen
-
Method Details
-
replaceInputText
Replace the input text box value with the provided text value. Before using this method, it must be verified by the caller that items are either inAnvilGUI.Slot.INPUT_LEFTorAnvilGUI.Slot.OUTPUTpresent.- Parameters:
text- The text to write in the input box- Returns:
- The
AnvilGUI.ResponseActionto achieve the text replacement - Throws:
IllegalArgumentException- when the text is nullIllegalStateException- when the slotsAnvilGUI.Slot.INPUT_LEFTandAnvilGUI.Slot.OUTPUTarenull
-
updateTitle
Updates the title of the AnvilGUI to the new one.- Parameters:
literalTitle- The title to use as literal textpreserveRenameText- Whether to preserve the entered rename text- Throws:
IllegalArgumentException- when literalTitle is null- See Also:
-
updateJsonTitle
Updates the title of the AnvilGUI to the new one.- Parameters:
json- The json used to parse into a rich chat componentpreserveRenameText- Whether to preserve the entered rename text- Throws:
IllegalArgumentException- when json is null- See Also:
-
openInventory
Open another inventory- Parameters:
otherInventory- The inventory to open- Returns:
- The
AnvilGUI.ResponseActionto achieve the inventory open - Throws:
IllegalArgumentException- when the otherInventory is null
-
close
Close the AnvilGUI- Returns:
- The
AnvilGUI.ResponseActionto achieve closing the AnvilGUI
-
run
Run the provided runnable- Parameters:
runnable- The runnable to run- Returns:
- The
AnvilGUI.ResponseActionto achieve running the runnable - Throws:
IllegalArgumentException- when the runnable is null
-