20 package net.sf.gridarta.model.validation.checks;
22 import java.util.ArrayList;
23 import java.util.Arrays;
24 import java.util.Collection;
25 import java.util.HashSet;
26 import java.util.List;
37 import org.jetbrains.annotations.NotNull;
44 public class BlockedMobOrSpawnPointChecker<G
extends GameObject<G, A, R>, A extends
MapArchObject<A>, R extends
Archetype<G, A, R>> extends
AbstractValidator<G, A, R> implements
SquareValidator<G, A, R> {
50 private final List<G>
blockers =
new ArrayList<>();
62 private final Collection<Integer>
typeNumbers =
new HashSet<>();
70 super(validatorPreferences);
71 this.typeNumbers.addAll(Arrays.asList(typeNumbers));
76 for (
final G gameObject : mapSquare) {
77 if (typeNumbers.contains(gameObject.getTypeNo())) {
78 mobsOrSpawnPoints.add(gameObject);
80 blockers.add(gameObject);
83 if (!blockers.isEmpty() && !mobsOrSpawnPoints.isEmpty()) {
87 mobsOrSpawnPoints.clear();
This is the base class for validators.
This package contains the framework for validating maps.
BlockedMobOrSpawnPointChecker(@NotNull final ValidatorPreferences validatorPreferences, @NotNull final Integer... typeNumbers)
Create a new instance.
String NO_PASS
The name of the "no_pass" attribute.
Validation error that's used when the BlockedMobOrSpawnPointChecker detected a possible error on the ...
Base package of all Gridarta classes.
Reflects a game object (object on a map).
Configuration parameters for Validators.
GameObjects are the objects based on Archetypes found on maps.
A SquareValidator to assert that mobs or spawn points aren't on blocked squares.
final List< G > mobsOrSpawnPoints
List with blocked objects.
final Collection< Integer > typeNumbers
The object types to check.
final ValidatorPreferences validatorPreferences
The ValidatorPreferences to use.
An interface for classes that collect errors.
void validateSquare(@NotNull final MapSquare< G, A, R > mapSquare, @NotNull final ErrorCollector< G, A, R > errorCollector)
Validate a map square.
final List< G > blockers
List with blocking objects.
Interface for MapArchObjects.
Interface for Square Validators.