Package dev.kitteh.factions.upgrade
Class UpgradeSettings
java.lang.Object
dev.kitteh.factions.upgrade.UpgradeSettings
Settings for an upgrade.
-
Constructor Summary
ConstructorsConstructorDescriptionUpgradeSettings(Upgrade upgrade, Map<UpgradeVariable, LeveledValueProvider> variableSettings, int maxLevel, int startingLevel, LeveledValueProvider costSettings) -
Method Summary
Modifier and TypeMethodDescriptioncostAt(int level) Gets the cost of the upgrade at a given level.@Nullable StringfindFlaw()Tests this setting for issues like levels not aligning or missing variables.intmaxLevel()Gets the max level chosen in settings.intGets the starting level for factions to begin at.upgrade()Gets the associated upgrade.valueAt(UpgradeVariable variable, int level) Gets the value of a variable at a given level.
-
Constructor Details
-
UpgradeSettings
public UpgradeSettings(Upgrade upgrade, Map<UpgradeVariable, LeveledValueProvider> variableSettings, int maxLevel, int startingLevel, LeveledValueProvider costSettings)
-
-
Method Details
-
findFlaw
Tests this setting for issues like levels not aligning or missing variables. Called during construction, but this method allows for testing deserialized objects.- Returns:
- first flaw found or null if no flaws found
-
upgrade
Gets the associated upgrade.- Returns:
- upgrade
-
valueAt
Gets the value of a variable at a given level.- Parameters:
variable- variablelevel- level- Returns:
- value of variable at level
-
maxLevel
public int maxLevel()Gets the max level chosen in settings. Cannot exceedUpgrade.maxLevel().- Returns:
- max level
-
startingLevel
public int startingLevel()Gets the starting level for factions to begin at.- Returns:
- starting level
-
costAt
Gets the cost of the upgrade at a given level.- Parameters:
level- level- Returns:
- cost at level
-