Package de.marcely.bedwars.tools.gui
Interface GUI
- All Known Subinterfaces:
ClickableGUI
- All Known Implementing Classes:
AnvilGUI
,ChestGUI
,VillagerGUI
public interface GUI
Interface that includes anything that any kind of GUI have in common
-
Method Summary
Modifier and TypeMethodDescriptionboolean
addCloseListener
(Consumer<Player> callback) Adds a close listener to the gui.boolean
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 playerGets all the close listeners attached to the GUIReturns the player for whom the GUI is currently opengetTitle()
Returns the set titleboolean
Get whether the given player has the inventory currently opendefault boolean
Ignore it.default void
Deprecated.Poor API implementation.void
Opens the GUI for the playerboolean
removeCloseListener
(Consumer<Player> callback) Removes a close listener from the gui.void
Set the title of the GUI.
-
Method Details
-
open
Opens the GUI for the player- Parameters:
player
- The player who shall see the inventory
-
closeAll
void closeAll()Closes this GUI for any player -
setTitle
Set the title of the GUI. Keep in mind that not every type supports this- Parameters:
title
- The new title
-
getTitle
String getTitle()Returns the set title- Returns:
- The title
-
areItemsMoveable
boolean areItemsMoveable()Returns if this type allows its items to get moved around and to be dropped- Returns:
- If the items are moveable/dragable
-
ignoresCancelEvent
default boolean ignoresCancelEvent()Ignore it. Only for internal use- Returns:
- Something you probably don't need
-
getPlayers
Collection<Player> getPlayers()Returns the player for whom the GUI is currently open- Returns:
- The players for who the GUI has been opened
-
hasOpen
Get whether the given player has the inventory currently open- Parameters:
player
- The player who might have the GUI open- Returns:
true
if he's seeing it right now
-
addCloseListener
Adds a close listener to the gui. This listener will be called when a player closes the gui- Parameters:
callback
- the listener that is being added- Returns:
- if the listener was added successfully
-
removeCloseListener
Removes a close listener from the gui.- Parameters:
callback
- the listener that is being removed- Returns:
- if the listener was removed successfully
-
getCloseListeners
Collection<Consumer<Player>> getCloseListeners()Gets all the close listeners attached to the GUI- Returns:
- a collection of all the attached listeners
-
clear
void clear()Resets its content -
onClose
Deprecated.Poor API implementation. Not using #super(player) with AnvilGUI and VillagerGUI can cause memory leaks. UseaddCloseListener(Consumer)
insteadEvent method that's getting called whenever a player closes the inventory- Parameters:
player
- The player who closed the GUI
-