Interface LobbyItem


public interface LobbyItem
Represents an actual item that will be added into the hotbar to players during the lobby phase
  • Method Details

    • getName

      default String getName()
      Returns getConfigName(), but formats it into the default configured language.
      Returns:
      The name in the default language
    • getName

      String getName(@Nullable @Nullable CommandSender sender)
      Returns getConfigName(), but formats it and translates it to the given sender.
      Parameters:
      sender - The person from which it should look up the language. Null if it should take the default language
      Returns:
      The name in the language of the sender
    • getConfigName

      String getConfigName()
      Returns the name of the item exactly the same as it has been configured.
      Returns:
      The raw name
    • setConfigName

      void setConfigName(String name)
      Set the unformatted name of the config.
      Parameters:
      name - The new raw name
    • getSlot

      int getSlot()
      Returns the slot to which this item will be added to.
      Returns:
      The slot in the hotbar at which this item is located at.
    • getItem

      ItemStack getItem()
      Returns the item that will be set into the hotbar.
      Returns:
      The item/icon
    • setItem

      void setItem(ItemStack is)
      Set the item that will be set into the hotbar.
      Parameters:
      is - The new item/icon
    • getHandler

      @Nullable @Nullable LobbyItemHandler getHandler()
      Returns the handler that handles the execution of an item.

      May be null even when getHandlerId() returns a non-null value. This means that no handler has been registered under the given id.

      Returns:
      The handler of this item, null if none under the set id is registered
    • getHandlerId

      @Nullable @Nullable String getHandlerId()
      Returns the id of the current set handler for this item. It's possible that null is being returned, this means that none has been defined yet.
      Returns:
      The set handler id, may be null
    • setHandler

      void setHandler(@Nullable @Nullable LobbyItemHandler handler)
      Set the handler for this item. Make sure it's registered, otherwise no change is being applied.

      Passing null causes the item to do nothing when used.

      Parameters:
      handler - The new handler, may be null
    • setHandlerId

      void setHandlerId(@Nullable @Nullable String id)
      Set the handler id of this item. It'll automatically update setHandler(LobbyItemHandler) if the given id is registered. If the handler under the given id isn't registered then the id will still be anyways.
      Parameters:
      id - The id of the handler, may be null
    • getCommands

      List<String> getCommands()
      Returns all commands that will be executed whenever a player uses the item.
      Returns:
      The commands that will be executed on use
      See Also:
    • isCommandsAsConsole

      boolean isCommandsAsConsole()
      Returns whether the commands (getCommands()) will be executed as console or as the player who used the item.
      Returns:
      true if the commands will be executed as console, false if as the player
    • setCommandsAsConsole

      void setCommandsAsConsole(boolean value)
      Set whether the commands (getCommands()) will be executed as console or as the player who used the item.
      Parameters:
      value - true if the commands will be executed as console, false if as the player
    • addCommand

      void addCommand(String cmd)
      Adds a command that will be executed whenever a player uses the item.
      Parameters:
      cmd - The command that will be executed on use
    • removeCommand

      boolean removeCommand(String cmd)
      Removes a command from the getCommands() List. That command won't be executed any further if the operation was successful (returns true).
      Parameters:
      cmd - The command that shall be removed
      Returns:
      false if it wouldn't have been executed anyways