Package de.marcely.bedwars.api.arena
Interface ArenaVotingHandler
public interface ArenaVotingHandler
Represents the handler for the voting system of an arena.
This is only available to arenas with the regeneration type RegenerationType.VOTING
.
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionGet the pool of arenas that are currently actively being voted for.getArena()
Get the arena this handler is for.@Nullable Arena
Get the choice of a player.Get the pool of theoretical arenas that may be voted for.@Nullable Collection
<Player> Get all the players who are voting for an arena.boolean
Set the choice of a player.boolean
unsetChoice
(Player player) Unset the choice of a player.void
Manually execute the re-calculation of the entries within the active pool.
-
Method Details
-
getArena
Arena getArena()Get the arena this handler is for.- Returns:
- The arena backing this handler
-
getActivePool
Collection<Arena> getActivePool()Get the pool of arenas that are currently actively being voted for.- Returns:
- The active pool
-
getTotalPool
Collection<Arena> getTotalPool()Get the pool of theoretical arenas that may be voted for.This method does not check for the state of the arenas etc. Meaning it is possible that an arena is in the total pool but not in the active pool.
Main purpose of this method is to be displayed as a showcase within the configuration page of the Setup GUI.- Returns:
- The total arenas that may theoretically be voted for
-
getVoters
Get all the players who are voting for an arena.- Parameters:
arena
- The arena from the active pool- Returns:
- The players who are voting for the arena. May be
null
if it is not a part of the active pool
-
getChoice
Get the choice of a player.- Parameters:
player
- The player who is voting- Returns:
- The arena the player is voting for or
null
if the player hasn't voted yet
-
setChoice
Set the choice of a player.May fail if an API cancels the
PlayerArenaVoteEvent
.- Parameters:
player
- The player who is votingarena
- The arena the player shall vote for ornull
to unset the vote- Returns:
true
if the vote was successfully changed- Throws:
IllegalArgumentException
- If the player isn't a part of the arenaIllegalArgumentException
- If the arena is not in the active pool
-
unsetChoice
Unset the choice of a player.May fail if an API cancels the
PlayerArenaVoteEvent
.- Parameters:
player
- The player who is voting- Returns:
true
if the vote was successfully changed
-
updateActivePool
void updateActivePool()Manually execute the re-calculation of the entries within the active pool.This method is already called automatically when needed. The event
ArenaVotingPoolUpdateEvent
is called with this method as well.
-