Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions common/src/main/java/org/pokesplash/hunt/config/Config.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down Expand Up @@ -28,6 +29,7 @@ public class Config extends Versioned {
private Properties matchProperties; // What properties should be checked to complete the hunt.
private ArrayList<CustomPrice> customPrices; // List of custom prices.
private ArrayList<String> blacklist; // List if Pokemon that shouldn't be added to Hunt.
private ArrayList<String> labelBlacklist; //List if Pokemon label that shouldn't be added to Hunt.

public Config() {
super(Hunt.CONFIG_VERSION);
Expand All @@ -47,6 +49,7 @@ public Config() {
customPrices = new ArrayList<>();
customPrices.add(new CustomPrice());
blacklist = new ArrayList<>();
labelBlacklist = new ArrayList<>();
}

/**
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -154,6 +158,10 @@ public ArrayList<String> getBlacklist() {
return blacklist;
}

public ArrayList<String> getLabelBlacklist() {
return this.labelBlacklist;
}

public RarityConfig getRarity() {
return rarity;
}
Expand All @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}

Expand Down