Class AnvilGUI
java.lang.Object
de.marcely.bedwars.tools.gui.type.AnvilGUI
- All Implemented Interfaces:
GUI
Represents a GUI that allows the player to rename an item
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addCloseListener
(Consumer<Player> callback) Adds a close listener to the gui.boolean
addListener
(WriteListener listener) Adds a listener to this GUIboolean
Returns if this type allows its items to get moved around and to be droppedvoid
clear()
Resets its contentvoid
closeAll()
Closes this GUI for any playerReturns the default/initial message that will be shown inside the text fieldReturns all listeners that were added to this GUIReturns the player for whom the GUI is currently opengetTitle()
Returns the set titleboolean
Get whether the given player has the inventory currently openvoid
Event method that's getting called whenever a player closes the inventoryvoid
Opens the GUI for the playerboolean
removeCloseListener
(Consumer<Player> callback) Removes a close listener from the gui.boolean
removeListener
(WriteListener listener) Removes an already added listener from this GUIvoid
Set the title of the GUI.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface de.marcely.bedwars.tools.gui.GUI
getCloseListeners, ignoresCancelEvent
-
Constructor Details
-
AnvilGUI
public AnvilGUI()Creates a new instance with an empty message -
AnvilGUI
Creates a new instance with a default message- Parameters:
defaultMessage
- The initial text inside the editor
-
-
Method Details
-
open
Description copied from interface:GUI
Opens the GUI for the player -
closeAll
public void closeAll()Description copied from interface:GUI
Closes this GUI for any player -
setTitle
Set the title of the GUI.Only supported for 1.14 or higher
-
getTitle
Description copied from interface:GUI
Returns the set title -
areItemsMoveable
public boolean areItemsMoveable()Description copied from interface:GUI
Returns if this type allows its items to get moved around and to be dropped- Specified by:
areItemsMoveable
in interfaceGUI
- Returns:
- If the items are moveable/dragable
-
getPlayers
Description copied from interface:GUI
Returns the player for whom the GUI is currently open- Specified by:
getPlayers
in interfaceGUI
- Returns:
- The players for who the GUI has been opened
-
hasOpen
Description copied from interface:GUI
Get whether the given player has the inventory currently open -
addCloseListener
Description copied from interface:GUI
Adds a close listener to the gui. This listener will be called when a player closes the gui- Specified by:
addCloseListener
in interfaceGUI
- Parameters:
callback
- the listener that is being added- Returns:
- if the listener was added successfully
-
removeCloseListener
Description copied from interface:GUI
Removes a close listener from the gui.- Specified by:
removeCloseListener
in interfaceGUI
- Parameters:
callback
- the listener that is being removed- Returns:
- if the listener was removed successfully
-
clear
public void clear()Description copied from interface:GUI
Resets its content -
onClose
Description copied from interface:GUI
Event method that's getting called whenever a player closes the inventory -
getDefaultMessage
Returns the default/initial message that will be shown inside the text field- Returns:
- The text the player has to rename
-
getListeners
Returns all listeners that were added to this GUI- Returns:
- All listeners listeners whenever someone writes something in this GUI
-
addListener
Adds a listener to this GUI- Parameters:
listener
- The listener that shall be added- Returns:
false
if it was already added
-
removeListener
Removes an already added listener from this GUI- Parameters:
listener
- The listener that shall be removed- Returns:
true
if it has been removed
-