Class AnvilGUI

java.lang.Object
de.marcely.bedwars.tools.gui.type.AnvilGUI
All Implemented Interfaces:
GUI

public class AnvilGUI extends Object implements GUI
  • Constructor Details

    • AnvilGUI

      public AnvilGUI()
    • AnvilGUI

      public AnvilGUI(String defaultMessage)
      Parameters:
      defaultMessage - The initial text inside the editor
  • Method Details

    • open

      public void open(Player player)
      Description copied from interface: GUI
      Opens the GUI for the player
      Specified by:
      open in interface GUI
      Parameters:
      player - The player who shall see the inventory
    • closeAll

      public void closeAll()
      Description copied from interface: GUI
      Closes this GUI for any player
      Specified by:
      closeAll in interface GUI
    • setTitle

      public void setTitle(String title)
      Set the title of the GUI.

      Only supported for 1.14 or higher

      Specified by:
      setTitle in interface GUI
      Parameters:
      title - The new title
    • getTitle

      public String getTitle()
      Description copied from interface: GUI
      Returns the set title
      Specified by:
      getTitle in interface GUI
      Returns:
      The 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 interface GUI
      Returns:
      If the items are moveable/dragable
    • getPlayers

      public Collection<Player> getPlayers()
      Description copied from interface: GUI
      Returns the player for whom the GUI is currently open
      Specified by:
      getPlayers in interface GUI
      Returns:
      The players for who the GUI has been opened
    • hasOpen

      public boolean hasOpen(Player player)
      Description copied from interface: GUI
      Get whether the given player has the inventory currently open
      Specified by:
      hasOpen in interface GUI
      Parameters:
      player - The player who might have the GUI open
      Returns:
      true if he's seeing it right now
    • addCloseListener

      public boolean addCloseListener(Consumer<Player> callback)
      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 interface GUI
      Parameters:
      callback - the listener that is being added
      Returns:
      if the listener was added successfully
    • removeCloseListener

      public boolean removeCloseListener(Consumer<Player> callback)
      Description copied from interface: GUI
      Removes a close listener from the gui.
      Specified by:
      removeCloseListener in interface GUI
      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
      Specified by:
      clear in interface GUI
    • onClose

      public void onClose(Player player)
      Description copied from interface: GUI
      Event method that's getting called whenever a player closes the inventory
      Specified by:
      onClose in interface GUI
      Parameters:
      player - The player who closed the GUI
    • getDefaultMessage

      public String getDefaultMessage()
      Returns the default/initial message that will be shown inside the text field
      Returns:
      The text the player has to rename
    • getListeners

      public Set<WriteListener> getListeners()
      Returns all listeners that were added to this GUI
      Returns:
      All listeners listeners whenever someone writes something in this GUI
    • addListener

      public boolean addListener(WriteListener listener)
      Adds a listener to this GUI
      Parameters:
      listener - The listener that shall be added
      Returns:
      false if it was already added
    • removeListener

      public boolean removeListener(WriteListener listener)
      Removes an already added listener from this GUI
      Parameters:
      listener - The listener that shall be removed
      Returns:
      true if it has been removed