// make sure the player has the right amount of points for the specified objectives
boolean enoughPoints = minScores.isEmpty() && maxScores.isEmpty(); // default to whether there are any objectives set
if (board != null) {
// first make sure the player has the minimum requirements
for (Map.Entry<String, Integer> e : minScores.entrySet()) {
Objective obj = board.getObjective(e.getKey());
if (obj == null) {
continue;
}
int score = obj.getScore(p.getName()); // player's score for specified objective
int minScore = e.getValue(); // specified minimum score
enoughPoints = score >= minScore;
if (!enoughPoints) {
// not enough? break.
break;
}
}
// next make sure the player isn't over the maximums
for (Map.Entry<String, Integer> e : maxScores.entrySet()) {
Objective obj = board.getObjective(e.getKey());
if (obj == null) {
continue;
}
int score = obj.getScore(p.getName()); // player's score for specified objective
int maxScore = e.getValue(); // specified maximum score
enoughPoints = score <= maxScore;
if (!enoughPoints) {
// too many points? break.
break;