Add allowedEvents support for adventure configs

This commit is contained in:
Jetz
2025-11-06 08:29:55 -05:00
parent 0bb67ec8d0
commit 50a98238d1
2 changed files with 7 additions and 2 deletions

View File

@@ -197,7 +197,11 @@ public class AdventureEventData implements Serializable {
ConfigData configData = Config.instance().getConfigData();
Predicate<CardEdition> filter = CardEdition.Predicates.CAN_MAKE_BOOSTER.and(selectSetPool());
if(configData.restrictedEvents != null) {
if(configData.allowedEvents != null) {
Set<String> allowedEvents = Set.of(configData.allowedEvents);
filter = filter.and(q -> allowedEvents.contains(q.getCode()));
}
else if(configData.restrictedEvents != null) {
//Temporary restriction until rewards are more diverse - don't want to award restricted cards so these editions need different rewards added.
//Also includes sets that use conspiracy or commander drafts.
Set<String> restrictedEvents = Set.of(configData.restrictedEvents);
@@ -206,7 +210,7 @@ public class AdventureEventData implements Serializable {
if (configData.allowedEditions != null) {
Set<String> allowed = Set.of(configData.allowedEditions);
filter = filter.and(q -> allowed.contains(q.getCode()));
} else {
} else if(configData.restrictedEditions != null) {
List<String> restrictedList = Arrays.asList(configData.restrictedEditions);
Set<String> restricted = new HashSet<>(restrictedList); //Would use Set.of but that throws an error if there's any duplicates, and users edit these lists all the time.
filter = filter.and(q -> !restricted.contains(q.getCode()));

View File

@@ -24,5 +24,6 @@ public class ConfigData {
public String[] restrictedEditions;
public String[] allowedEditions;
public String[] restrictedEvents;
public String[] allowedEvents;
public String[] allowedJumpstart;
}