mirror of
https://github.com/garbagemule/MobArena.git
synced 2025-02-16 20:41:56 +01:00
Guard against nothing
in ThingGroupPicker.
This commit filters the result list of a ThingGroupPicker by a non-null predicate to avoid null values in the resulting ThingGroup instance. Since null values represent `nothing`, and we don't usually announce it when players earn a `nothing` reward, it makes sense that they wouldn't bubble up and somehow "manifest" in groups of things either. Fixes #691
This commit is contained in:
parent
286071871f
commit
823be96b4e
@ -20,6 +20,9 @@ These changes will (most likely) be included in the next version.
|
||||
- MobArena now targets the Minecraft 1.17 version of the Spigot API (but still works on 1.13-1.16). This should make it easier to tackle feature requests and bug reports related to modern Minecraft.
|
||||
- The regex pattern for the player list command is now less greedy, so it will only match on `/ma players`, `/ma playerlist`, and `/ma player-list`. The previous pattern matched on anything that starts with `player`, which rendered the `/ma player-stats` command in MobArenaStats impossible to invoke.
|
||||
|
||||
### Fixed
|
||||
- Reward groups with `nothing` in them no longer cause errors when earned/granted.
|
||||
|
||||
## [0.106] - 2021-05-09
|
||||
### Added
|
||||
- It is now possible to write custom formulas for wave growth in Default Wave, swarm amounts in Swarm Waves, and boss health in Boss Waves, allowing for much more control and fine-tuning. The formulas support various session-related variables as well as various mathematical operators and functions. Formulas can be predefined as macros in the new `formulas.yml` file. Check the wiki for details.
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.garbagemule.MobArena.things;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public class ThingGroupPicker implements ThingPicker {
|
||||
@ -15,6 +16,7 @@ public class ThingGroupPicker implements ThingPicker {
|
||||
public Thing pick() {
|
||||
List<Thing> things = pickers.stream()
|
||||
.map(ThingPicker::pick)
|
||||
.filter(Objects::nonNull)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
return new ThingGroup(things);
|
||||
|
Loading…
Reference in New Issue
Block a user