diff --git a/common/src/main/java/org/pokesplash/hunt/config/Config.java b/common/src/main/java/org/pokesplash/hunt/config/Config.java index abb3939..65c370a 100644 --- a/common/src/main/java/org/pokesplash/hunt/config/Config.java +++ b/common/src/main/java/org/pokesplash/hunt/config/Config.java @@ -1,5 +1,6 @@ package org.pokesplash.hunt.config; +import com.cobblemon.mod.common.pokemon.Pokemon; import com.google.gson.Gson; import org.pokesplash.hunt.Hunt; import org.pokesplash.hunt.enumeration.Economy; @@ -28,6 +29,7 @@ public class Config extends Versioned { private Properties matchProperties; // What properties should be checked to complete the hunt. private ArrayList customPrices; // List of custom prices. private ArrayList blacklist; // List if Pokemon that shouldn't be added to Hunt. + private ArrayList labelBlacklist; //List if Pokemon label that shouldn't be added to Hunt. public Config() { super(Hunt.CONFIG_VERSION); @@ -47,6 +49,7 @@ public Config() { customPrices = new ArrayList<>(); customPrices.add(new CustomPrice()); blacklist = new ArrayList<>(); + labelBlacklist = new ArrayList<>(); } /** @@ -79,6 +82,7 @@ public void init() { rarity = cfg.getRarity(); rewards = cfg.getRewards(); economy = cfg.getEconomy(); + labelBlacklist = cfg.getLabelBlacklist(); if (!versioned.getVersion().equals(Hunt.CONFIG_VERSION)) { ConfigOld cfgOld = gson.fromJson(el, ConfigOld.class); @@ -154,6 +158,10 @@ public ArrayList getBlacklist() { return blacklist; } + public ArrayList getLabelBlacklist() { + return this.labelBlacklist; + } + public RarityConfig getRarity() { return rarity; } @@ -169,6 +177,13 @@ public boolean blacklistContains(String pokemon) { return false; } + public boolean labelBlacklistContains(Pokemon pokemon) { + for (String label : labelBlacklist) { + if (pokemon.hasLabels(label)) return true; + } + return false; + } + public boolean isUseImpactorDefaultCurrency() { return useImpactorDefaultCurrency; } diff --git a/common/src/main/java/org/pokesplash/hunt/hunts/CurrentHunts.java b/common/src/main/java/org/pokesplash/hunt/hunts/CurrentHunts.java index be48c05..47dee2e 100644 --- a/common/src/main/java/org/pokesplash/hunt/hunts/CurrentHunts.java +++ b/common/src/main/java/org/pokesplash/hunt/hunts/CurrentHunts.java @@ -60,10 +60,10 @@ public SingleHunt addHunt() { // If the maximum hunt amount is reached, don't add another. if (hunts.size() < Hunt.config.getHuntAmount()) { SingleHunt hunt = new SingleHunt(owner); - // If a species matches, add hunt again. if (species.containsValue(hunt.getPokemon().getSpecies()) || - Hunt.config.blacklistContains(hunt.getPokemon().getSpecies().getName())) { + Hunt.config.blacklistContains(hunt.getPokemon().getSpecies().getName()) || + Hunt.config.labelBlacklistContains(hunt.getPokemon())) { return addHunt(); }