use of tc.oc.pgm.filters.TeamFilter in project PGM by PGMDev.
the class SpawnParser method parseAttributes.
public SpawnAttributes parseAttributes(Element el, SpawnAttributes parent) throws InvalidXMLException {
PointProviderAttributes providerAttributes = pointParser.parseAttributes(el, parent.providerAttributes);
Kit kit = factory.getKits().parseKitProperty(el, "kit", parent.kit);
boolean sequential = XMLUtils.parseBoolean(el.getAttribute("sequential"), parent.sequential);
boolean spread = XMLUtils.parseBoolean(el.getAttribute("spread"), parent.spread);
boolean exclusive = XMLUtils.parseBoolean(el.getAttribute("exclusive"), parent.exclusive);
boolean persistent = XMLUtils.parseBoolean(el.getAttribute("persistent"), parent.persistent);
boolean newFilters = false;
List<Filter> filters = new ArrayList<>();
if (parent.filter != StaticFilter.ABSTAIN) {
filters.add(parent.filter);
}
Node nodeTeam = Node.fromAttr(el, "team");
if (nodeTeam != null) {
if (!this.factory.hasModule(TeamModule.class)) {
throw new InvalidXMLException("no teams defined", nodeTeam);
}
filters.add(new TeamFilter(Teams.getTeamRef(nodeTeam, this.factory)));
newFilters = true;
}
Filter filter = this.factory.getFilters().parseFilterProperty(el, "filter");
if (filter != null) {
filters.add(filter);
newFilters = true;
}
if (providerAttributes == parent.providerAttributes && kit == parent.kit && sequential == parent.sequential && spread == parent.spread && exclusive == parent.exclusive && persistent == parent.persistent && !newFilters) {
return parent;
} else {
return new SpawnAttributes(AllFilter.of(filters), providerAttributes, kit, sequential, spread, exclusive, persistent);
}
}
use of tc.oc.pgm.filters.TeamFilter in project PGM by PGMDev.
the class RegionFilterApplicationParser method parseLane.
public void parseLane(Element el) throws InvalidXMLException {
final Filter filter = new DenyFilter(new TeamFilter(Teams.getTeamRef(new Node(XMLUtils.getRequiredAttribute(el, "team")), factory)));
final Region region = parseRegion(el);
final Component message = translatable("match.laneExit");
prepend(el, new RegionFilterApplication(RFAScope.PLAYER_ENTER, region, filter, message, false));
prepend(el, new RegionFilterApplication(RFAScope.BLOCK_PLACE, new NegativeRegion(region), filter, message, false));
}
Aggregations