Class LobbyItemHandler

java.lang.Object
de.marcely.bedwars.api.game.lobby.LobbyItemHandler

public abstract class LobbyItemHandler extends Object
Handles the execution of a LobbyItem.

Make sure to register it with GameAPI.registerLobbyItemHandler(LobbyItemHandler).

  • Constructor Details

    • LobbyItemHandler

      public LobbyItemHandler(String id, Plugin plugin)
      Parameters:
      id - The id of this handler, should be unique to others. Default ones start with bedwars:
      plugin - The plugin that constructs this handler
  • Method Details

    • handleUse

      public abstract void handleUse(Player player, Arena arena, LobbyItem item)
      Handles the execution of the item.
      Parameters:
      player - The player who used the arena
      arena - The arena in which the item was executed in
      item - The item that has been used
    • isVisible

      public abstract boolean isVisible(Player player, Arena arena, LobbyItem item)
      Whether the item shall be shown and usable at the given circumstances.

      Important: This method is getting called very frequently (every second when the timer is running). Make sure to write efficient code.

      Parameters:
      player - The player who might use it
      arena - The arena in which it might get used
      item - The item to which this handler was added to
      Returns:
      true if it shall be visible in this session
    • getId

      public final String getId()
      Returns the id of this handler. This one should be unique to others.

      It's being used by LobbyItem to allow users to configure which exact handler they want to use for their item.

      Returns:
      The id of this handler
    • getPlugin

      public final Plugin getPlugin()
      Returns the plugin that constructed this handler.
      Returns:
      The plugin behind this handler
    • getType

      public LobbyItemHandlerType getType()
      Returns the type of this handler. Custom ones should return LobbyItemHandlerType.PLUGIN.
      Returns:
      The type of this handler
    • isRegistered

      public final boolean isRegistered()
      Returns whether or not this handler is registered.

      Use GameAPI.registerLobbyItemHandler(LobbyItemHandler) to register it, or GameAPI.unregisterLobbyItemHandler(LobbyItemHandler) to unregister it.

      Returns:
      true if it's registered