Skip to content

Commit

Permalink
use EMPTY ActionApplier on RequirementSet
Browse files Browse the repository at this point in the history
  • Loading branch information
HSGamer committed Feb 24, 2024
1 parent 885a122 commit c5a6042
Showing 1 changed file with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,12 @@ public RequirementSet(Menu menu, String name, Map<String, Object> section) {
}).collect(Collectors.toList());

Map<String, Object> keys = new CaseInsensitiveStringMap<>(section);
this.successActionApplier = new ActionApplier(menu, MapUtils.getIfFoundOrDefault(keys, Collections.emptyList(), "success-command", "success-action"));
this.failActionApplier = new ActionApplier(menu, MapUtils.getIfFoundOrDefault(keys, Collections.emptyList(), "fail-command", "fail-action"));
this.successActionApplier = Optional.ofNullable(MapUtils.getIfFound(keys, "success-command", "success-action"))
.map(o -> new ActionApplier(menu, o))
.orElse(ActionApplier.EMPTY);
this.failActionApplier = Optional.ofNullable(MapUtils.getIfFound(keys, "fail-command", "fail-action"))
.map(o -> new ActionApplier(menu, o))
.orElse(ActionApplier.EMPTY);
}

/**
Expand Down

0 comments on commit c5a6042

Please # to comment.