Skip to content

Commit

Permalink
Fix: Don't wrongly warn about config duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
spnda committed Nov 13, 2024
1 parent 88d35df commit 37fc1d9
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,14 @@ private <T extends Enum<?>> void loadBlockListFromConfig(
@NotNull String key, @NotNull final ArrayList<T> list, @NotNull final T[] enumValues, Function<T, Boolean> validateCallback) {
List<?> configList = config.getList(key);
if (configList == null) return;
ArrayList<String> stringList = configList
final var stringList = configList
.stream()
.filter(String.class::isInstance)
.map(String.class::cast)
.distinct() // Remove duplicates
.collect(Collectors.toCollection(ArrayList::new));
Set<T> newEnumValues = this.loadEnumValuesByName(enumValues, stringList);

final var newEnumValues = this.loadEnumValuesByName(enumValues, stringList);
newEnumValues.removeIf((value) -> {
if (!validateCallback.apply(value)) {
BlockProt.getInstance().getLogger().warning("Caught invalid value passed to " + key + ": " + value.toString());
Expand Down

0 comments on commit 37fc1d9

Please sign in to comment.