Class SpectatorItemHandler
java.lang.Object
de.marcely.bedwars.api.game.spectator.SpectatorItemHandler
Handles the execution of a
SpectatorItem
.
Make sure to register it with GameAPI.registerSpectatorItemHandler(SpectatorItemHandler)
.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionfinal String
getId()
Returns the id of this handler.final Plugin
Returns the plugin that constructed this handler.getType()
Returns the type of this handler.abstract void
handleUse
(Spectator spectator, SpectatorItem item) Handles the execution of the item.final boolean
Returns whether or not this handler is registered.abstract boolean
isVisible
(Spectator spectator, SpectatorItem item) Whether or not the item shall be shown and usable at the given circumstances.
-
Constructor Details
-
SpectatorItemHandler
- 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
Handles the execution of the item.- Parameters:
spectator
- The spectator who used the itemitem
- The item that has been used
-
isVisible
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 toitem
- The item to which this handler was added to- Returns:
true
if it shall be visible in this session
-
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
Returns the plugin that constructed this handler.- Returns:
- The plugin behind this handler
-
getType
Returns the type of this handler. Custom ones should returnSpectatorItemHandlerType.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, orGameAPI.unregisterSpectatorItemHandler(SpectatorItemHandler)
to unregister it.- Returns:
true
if it's registered
-