Fixes bug where no entities are required for surrounding challenge

https://github.com/BentoBoxWorld/addon-challenges/issues/8
This commit is contained in:
tastybento 2018-08-27 14:01:16 -07:00
parent 44910200f5
commit aa805c7c24

View File

@ -194,7 +194,7 @@ public class TryToComplete {
}
private ChallengeResult searchForEntities(Map<EntityType, Integer> map, int searchRadius) {
Map<EntityType, Integer> entities = new EnumMap<>(map);
Map<EntityType, Integer> entities = map.isEmpty() ? new EnumMap<>(EntityType.class) : new EnumMap<>(map);
user.getPlayer().getNearbyEntities(searchRadius, searchRadius, searchRadius).forEach(entity -> {
// Look through all the nearby Entities, filtering by type
entities.computeIfPresent(entity.getType(), (reqEntity, amount) -> amount - 1);