Fix default boss health value.
This commit is contained in:
@@ -249,23 +249,24 @@ public class WaveParser
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Grab the boss health
|
// Grab the boss health
|
||||||
String hlth = config.getString("health");
|
String healthString = config.getString("health");
|
||||||
BossHealth health = BossHealth.fromString(hlth);
|
if (healthString == null) {
|
||||||
if (health != null) {
|
String warning = "No health value found for boss '%s' in arena '%s'. Defaulting to medium.";
|
||||||
result.setHealth(health);
|
Messenger.warning(String.format(warning, name, arena.configName()));
|
||||||
|
result.setHealth(BossHealth.MEDIUM);
|
||||||
} else {
|
} else {
|
||||||
try {
|
BossHealth health = BossHealth.fromString(healthString);
|
||||||
int flatHealth;
|
if (health != null) {
|
||||||
if (hlth != null) {
|
result.setHealth(health);
|
||||||
flatHealth = Integer.parseInt(hlth);
|
} else {
|
||||||
|
int flatHealth = config.getInt("health", 0);
|
||||||
|
if (flatHealth <= 0) {
|
||||||
|
String warning = "Unable to parse health of boss '%s' in arena '%s'. Defaulting to medium. Value was '%s'";
|
||||||
|
Messenger.warning(String.format(warning, name, arena.configName(), healthString));
|
||||||
|
result.setHealth(BossHealth.MEDIUM);
|
||||||
} else {
|
} else {
|
||||||
flatHealth = config.getInt("health");
|
result.setFlatHealth(flatHealth);
|
||||||
}
|
}
|
||||||
result.setFlatHealth(flatHealth);
|
|
||||||
} catch (Exception e) {
|
|
||||||
String warning = "Unable to parse health of boss '%s' in arena '%s'. Defaulting to medium. Value was '%s'";
|
|
||||||
Messenger.warning(String.format(warning, name, arena.configName(), hlth));
|
|
||||||
result.setHealth(BossHealth.MEDIUM);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user