Class SpectatorItemUseNextRoundEvent
java.lang.Object
org.bukkit.event.Event
org.bukkit.event.player.PlayerEvent
de.marcely.bedwars.api.event.player.SpectatorItemUseNextRoundEvent
Gets called whenever a spectator uses the
SpectatorItemHandlerType.NEXT_ROUND item.
This event is used to determine the arena the spectator shall attempt to join.
Event is not called if SpectatorItemUseEvent is cancelled.
-
Nested Class Summary
Nested classes/interfaces inherited from class Event
Event.Result -
Field Summary
Fields inherited from class PlayerEvent
player -
Constructor Summary
ConstructorsConstructorDescriptionSpectatorItemUseNextRoundEvent(Spectator spectator, Collection<RemoteArena> considerations) -
Method Summary
Modifier and TypeMethodDescription@Nullable RemoteArenaGets the next arena the spectator shall attempt to join.Get the arenas that are considered as the "next arena".static HandlerListReturns the spectator who's trying to join.voidsetConsiderations(Collection<RemoteArena> considerations) Set the new arenas to consider for.Methods inherited from class PlayerEvent
getPlayerMethods inherited from class Event
getEventName, isAsynchronous
-
Constructor Details
-
SpectatorItemUseNextRoundEvent
-
-
Method Details
-
getSpectator
Returns the spectator who's trying to join.- Returns:
- The involved spectator
-
getConsiderations
Get the arenas that are considered as the "next arena".By default, it only includes arenas that are in
ArenaStatus.LOBBYstatus, aren't full, and have an equalRemoteArena.getCustomModeName().Further, if it doesn't result into no considerations, all arenas of an unequal mode (
RemoteArena.getPlayersPerTeam()) get filtered out.- Returns:
- The current considerations as a mutable collection
-
setConsiderations
Set the new arenas to consider for.- Parameters:
considerations- The new viable options for the "next arena"- See Also:
-
getBestOption
Gets the next arena the spectator shall attempt to join.Returns the arena with the greatest amount of players from
getConsiderations(). Result might change if the considerations are modified within this event.Returns
nullifgetConsiderations()is empty.- Returns:
- The next "best" arena.
nullif there are no viable arenas
-
getHandlers
- Specified by:
getHandlersin classEvent
-
getHandlerList
-