Class SpectatorItemHandler

java.lang.Object
de.marcely.bedwars.api.game.spectator.SpectatorItemHandler

public abstract class SpectatorItemHandler extends Object
Handles the execution of a SpectatorItem.

Make sure to register it with GameAPI.registerSpectatorItemHandler(SpectatorItemHandler).

  • Constructor Details

    • SpectatorItemHandler

      public SpectatorItemHandler(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 contructs this handler
  • Method Details

    • handleUse

      public abstract void handleUse(Spectator spectator, SpectatorItem item)
      Handles the execution of the item.
      Parameters:
      spectator - The spectator who used the item
      item - The item that has been used
    • isVisible

      public abstract boolean isVisible(Spectator spectator, SpectatorItem item)
      Whether or not the item shall be shown and usable at the given circumstances.
      Parameters:
      spectator - The spectator to whom the item shall be added to
      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 SpectatorItem 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 SpectatorItemHandlerType getType()
      Returns the type of this handler. Custom ones should return SpectatorItemHandlerType.PLUGIN.
      Returns:
      The type of this handler
    • isRegistered

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

      Use GameAPI.registerSpectatorItemHandler(SpectatorItemHandler) to register it, or GameAPI.unregisterSpectatorItemHandler(SpectatorItemHandler) to unregister it.

      Returns:
      true if it's registered