Interface UpgradeState
public interface UpgradeState
Holds all the information regarding team upgrades.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Clears the trap queue.@Nullable UpgradeLevel
clearUpgrade
(Upgrade upgrade) Removes existing upgrades for the specified upgrade.boolean
doUpgrade
(UpgradeLevel level, Player player) Runs an upgrade for a team.The upgrade levels that currently effect the team.getArena()
Returns the arena belonging to this state.int
getCurrentLevel
(Upgrade upgrade) Returns the level this team has upgraded this upgrade to.@Nullable UpgradeLevel
getCurrentUpgradeLevel
(Upgrade upgrade) Returns the UpgradeLevel the teams has reached on this upgrade.@Nullable UpgradeLevel
getNextUpgradeLevel
(Upgrade upgrade) Returns the next upgrade level players can buy of the specified type.The traps currently queued for this team.getTeam()
The team that belongs to this state.boolean
isMaxLevel
(Upgrade upgrade) Checks if an upgrade is maxed out.boolean
queueTrap
(QueuedTrap trap, boolean force) Adds a trap to the queue.boolean
removeTrap
(QueuedTrap trap, Player player) Removes a queued trap.@Nullable UpgradeLevel
setCurrentUpgradeLevel
(@Nullable UpgradeLevel level) Set the new level for the upgrade.void
triggerTrap
(Player player, Team baseTeam, boolean force) Triggers a trap at a certain base.
-
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
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
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
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
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
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
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
Runs an upgrade for a team.Also calls PlayerTriggerUpgradeEvent, which may cancel this.
- Parameters:
level
- The UpgradeLevel we will attempt to applyplayer
- The player who ran the upgrade- Returns:
- Whether the upgrade was successfully
-
queueTrap
Adds a trap to the queue.- Parameters:
trap
- The trap we are adding to the queueforce
- 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
Removes a queued trap.This will remove it from the queue and call
PlayerRemoveTrapEvent
.- Parameters:
trap
- The trap we are removingplayer
- The player who is removing the trap- Returns:
- Weather we were successful in removing the trap
-
clearTrapQueue
void clearTrapQueue()Clears the trap queue. -
triggerTrap
Triggers a trap at a certain base.- Parameters:
player
- The player who triggered the trapbaseTeam
- The team that will have a trap triggerforce
- If we should bypass the trigger cool down
-