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 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

      @Nullable @Nullable Collection<Player> getVoters(Arena arena)
      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

      @Nullable @Nullable Arena getChoice(Player player)
      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

      boolean setChoice(Player player, @Nullable @Nullable Arena arena)
      Set the choice of a player.

      May fail if an API cancels the PlayerArenaVoteEvent.

      Parameters:
      player - The player who is voting
      arena - The arena the player shall vote for or null to unset the vote
      Returns:
      true if the vote was successfully changed
      Throws:
      IllegalArgumentException - If the player isn't a part of the arena
      IllegalArgumentException - If the arena is not in the active pool
    • unsetChoice

      boolean unsetChoice(Player player)
      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.