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 2019-08-07 23:43:11 +02:00
parent 127d273fd6
commit e3a4b3b2a0
2 changed files with 21 additions and 0 deletions

View File

@ -15,6 +15,7 @@ These changes will (most likely) be included in the next version.
- MobArena now has basic tab completion support for most of the commands that take arguments.
- The `pet-items` node in `global-settings` now supports any living entity as a pet - even zombies! Pets will aggro hostile mobs that damage their owner, but only tameable pets (wolves, cats, etc.) will properly follow their owners around. This should also allow 1.14 servers to replace `ocelot` with `cat` in their `pet-items` node to get cat pets working again.
- Pets now have custom names that denote who their owner is, e.g. "garbagemule's pet".
- Potion effects can now be used as upgrades in Upgrade Waves. Check the wiki for details.
- Tridents and crossbows are now considered weapons with regards to the `unbreakable-weapons` flag. All class items that have durability now have their unbreakable flag set to true unless the `unbreakable-weapons` and/or `unbreakable-armor` flags are set to `false`.
- Leaderboards now work again on servers running Minecraft 1.14+.
- Class chests (non-linked) now work again on servers running Minecraft 1.14+.

View File

@ -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()