use of me.andrew28.addons.conquer.api.FactionResolver in project Conquer by xXAndrew28Xx.
the class ExprFactionAtLocClaim method get.
@Override
protected ConquerFaction[] get(Event e) {
Set<ConquerFaction> factions = new HashSet<>();
FactionResolver factionResolver = Conquer.getInstance().getFactions().getFactionResolver();
Object[] claimObjects = this.targets.getArray(e);
if (claimObjects == null) {
return null;
}
for (Object claimObject : claimObjects) {
if (claimObject instanceof ConquerClaim) {
factions.add(factionResolver.getByClaim((ConquerClaim) claimObject));
} else if (claimObject instanceof Location) {
factions.add(factionResolver.getAtLocation((Location) claimObject));
}
}
return factions.toArray(new ConquerFaction[factions.size()]);
}
use of me.andrew28.addons.conquer.api.FactionResolver in project Conquer by xXAndrew28Xx.
the class ExprFactionWithName method get.
@Override
protected ConquerFaction[] get(Event e) {
FactionResolver resolver = Conquer.getInstance().getFactions().getFactionResolver();
List<ConquerFaction> factions = new ArrayList<>();
String[] names = this.names.getArray(e);
if (names == null) {
return null;
}
for (String name : names) {
if (name == null) {
continue;
}
ConquerFaction faction = resolver.getByName(name);
if (faction != null) {
factions.add(faction);
}
}
return factions.toArray(new ConquerFaction[factions.size()]);
}
Aggregations