Class LobbyItemHandler
java.lang.Object
de.marcely.bedwars.api.game.lobby.LobbyItemHandler
Handles the execution of a
LobbyItem.
Make sure to register it with GameAPI.registerLobbyItemHandler(LobbyItemHandler).
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionfinal StringgetId()Returns the id of this handler.final PluginReturns the plugin that constructed this handler.getType()Returns the type of this handler.abstract voidHandles the execution of the item.final booleanReturns whether or not this handler is registered.abstract booleanWhether the item shall be shown and usable at the given circumstances.
-
Constructor Details
-
LobbyItemHandler
- 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
Handles the execution of the item.- Parameters:
player- The player who used the arenaarena- The arena in which the item was executed initem- The item that has been used
-
isVisible
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 itarena- The arena in which it might get useditem- The item to which this handler was added to- Returns:
trueif 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
LobbyItemto 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 returnLobbyItemHandlerType.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, orGameAPI.unregisterLobbyItemHandler(LobbyItemHandler)to unregister it.- Returns:
trueif it's registered
-