Add support for potion effect upgrades in Upgrade Waves.

It doesn't seem like there was any real reason to leave out potion effects as upgrades in Upgrade Waves previously, so they were likely just forgotten in the Things API overhaul.

Closes #565
This commit is contained in:
Andreas Troelsen committed 2019-08-07 23:43:11 +02:00
1 parent 127d273fd6
commit e3a4b3b2a0
2 files changed
+21

No files matched your search

@@ -542,6 +542,26 @@ public class WaveParser
throw new ConfigError("Failed to parse armor upgrades for class " + className + " in wave " + name + " of arena " + arena.configName() + ": " + e.getInput());
}
// Effects
List<String> effects = classSection.getStringList("effects");
if (effects == null || effects.isEmpty()) {
String value = classSection.getString("effects", null);
if (value == null || value.isEmpty()) {
effects = Collections.emptyList();
} else {
effects = Arrays.asList(value.split(","));
}
}
try {
// Prepend "effect:" for the potion effect thing parser
effects.stream()
.map(String::trim)
.map(s -> thingman.parse("effect", s))
.forEach(list::add);
} catch (InvalidThingInputString e) {
throw new ConfigError("Failed to parse potion effects for class " + className + " in wave " + name + " of arena " + arena.configName() + ": " + e.getInput());
}
try {
// Prepend "perm:" for the permission thing parser
classSection.getStringList("permissions").stream()