Skip to content

Commit

Permalink
make whitelist work like a whitelist
Browse files Browse the repository at this point in the history
  • Loading branch information
xGinko committed Jul 30, 2024
1 parent 0ff37cb commit 0a3cd80
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import java.time.Duration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
import java.util.HashSet;
import java.util.List;
Expand Down Expand Up @@ -66,10 +67,8 @@ protected VillagerChunkLimit() {
}).collect(Collectors.toList());
this.use_whitelist = config.getBoolean(configPath + ".whitelist.enable", false,
"Enable if you only want to manage villager counts for certain profession types.");
this.profession_whitelist = config.getList(configPath + ".whitelist.professions", defaults.stream()
.filter(prof -> !prof.equalsIgnoreCase("NONE") && !prof.equalsIgnoreCase("NITWIT"))
.collect(Collectors.toList()),
"Only professions in this list will count for the cap.")
this.profession_whitelist = config.getList(configPath + ".whitelist.professions", Arrays.asList("NONE", "NITWIT"),
"Professions in this list will not be touched by the chunk limit.")
.stream()
.map(configuredProfession -> {
try {
Expand Down Expand Up @@ -182,7 +181,7 @@ private void manageVillagerCount(@NotNull Chunk chunk) {
Villager villager = (Villager) entity;

// Ignore villager if profession is not in the whitelist
if (use_whitelist && !profession_whitelist.contains(villager.getProfession())) continue;
if (use_whitelist && profession_whitelist.contains(villager.getProfession())) continue;

if (wrapperCache.get(villager).isOptimized()) {
optimized_villagers.add(villager);
Expand Down

0 comments on commit 0a3cd80

Please sign in to comment.