Interface UpgradeState


public interface UpgradeState
Holds all the information regarding team upgrades.
  • Method Details

    • getArena

      Arena getArena()
      Returns the arena belonging to this state.
      Returns:
      The arena attached to this state
    • getTeam

      Team getTeam()
      The team that belongs to this state.
      Returns:
      The team attached to this state
    • getCurrentLevel

      int getCurrentLevel(Upgrade upgrade)
      Returns the level this team has upgraded this upgrade to.

      Starts at 0 if no level has been bought yet.

      Parameters:
      upgrade - The upgrade we are checking
      Returns:
      The level (how much) this upgrade has been upgraded to
    • getCurrentUpgradeLevel

      @Nullable @Nullable UpgradeLevel getCurrentUpgradeLevel(Upgrade upgrade)
      Returns the UpgradeLevel the teams has reached on this upgrade.
      Parameters:
      upgrade - The upgrade we are checking
      Returns:
      The UpgradeLevel this upgrade is at, or null if it has not been upgraded
    • setCurrentUpgradeLevel

      @Nullable @Nullable UpgradeLevel setCurrentUpgradeLevel(@Nullable @Nullable UpgradeLevel level)
      Set the new level for the upgrade.
      Parameters:
      level - The new level we are setting
      Returns:
      The previous upgrade level for the upgrade of the level, or null if it was not set
    • clearUpgrade

      @Nullable @Nullable UpgradeLevel clearUpgrade(Upgrade upgrade)
      Removes existing upgrades for the specified upgrade.
      Parameters:
      upgrade - The upgrade we are resetting
      Returns:
      The previous upgrade level for the upgrade of the level, or null if it was not set
    • getNextUpgradeLevel

      @Nullable @Nullable UpgradeLevel getNextUpgradeLevel(Upgrade upgrade)
      Returns the next upgrade level players can buy of the specified type.
      Parameters:
      upgrade - The upgrade we are checking
      Returns:
      The next upgrade level players can buy. null if max was reached
    • isMaxLevel

      boolean isMaxLevel(Upgrade upgrade)
      Checks if an upgrade is maxed out.
      Parameters:
      upgrade - The upgrade we are checking
      Returns:
      If the upgrade is maxed out
    • getActiveUpgrades

      Collection<UpgradeLevel> getActiveUpgrades()
      The upgrade levels that currently effect the team.

      This is a read only collection and any specific order isn't granted.

      Returns:
      All upgrades effecting the team
    • getQueuedTraps

      Queue<QueuedTrap> getQueuedTraps()
      The traps currently queued for this team.

      This is a read-only list in the right order, with first being the first trap to be triggered.

      Returns:
      The queued traps
    • doUpgrade

      boolean doUpgrade(UpgradeLevel level, Player player)
      Runs an upgrade for a team.

      Also calls PlayerTriggerUpgradeEvent, which may cancel this.

      Parameters:
      level - The UpgradeLevel we will attempt to apply
      player - The player who ran the upgrade
      Returns:
      Whether the upgrade was successfully
    • queueTrap

      boolean queueTrap(QueuedTrap trap, boolean force)
      Adds a trap to the queue.
      Parameters:
      trap - The trap we are adding to the queue
      force - If the trap should be forced into the queue (it might be full)
      Returns:
      Weather or not we were successful in adding it to the queue
    • removeTrap

      boolean removeTrap(QueuedTrap trap, Player player)
      Removes a queued trap.

      This will remove it from the queue and call PlayerRemoveTrapEvent.

      Parameters:
      trap - The trap we are removing
      player - The player who is removing the trap
      Returns:
      Weather we were successful in removing the trap
    • clearTrapQueue

      void clearTrapQueue()
      Clears the trap queue.
    • triggerTrap

      void triggerTrap(Player player, Team baseTeam, boolean force)
      Triggers a trap at a certain base.
      Parameters:
      player - The player who triggered the trap
      baseTeam - The team that will have a trap trigger
      force - If we should bypass the trigger cool down