use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.
the class ExprFactionCheckpoint method change.
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode) {
if (delta == null || delta.length == 0 || delta[0] == null) {
return;
}
Location location = (Location) delta[0];
ConquerFaction[] factions = getExpr().getArray(e);
if (factions == null) {
return;
}
for (ConquerFaction faction : factions) {
if (faction == null) {
continue;
}
faction.setCheckpoint(location);
}
}
use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.
the class ExprFactionOfPlayer method change.
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode) {
ConquerPlayer[] players = getExpr().getArray(e);
if (players == null) {
return;
}
ConquerFaction faction = null;
if (mode == Changer.ChangeMode.SET) {
if (delta == null || delta.length == 0) {
return;
}
faction = (ConquerFaction) delta[0];
}
for (ConquerPlayer player : players) {
if (player == null) {
continue;
}
player.setFaction(faction);
}
}
use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.
the class ExprFactionRelations method change.
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode) {
ConquerFaction[] factions = this.factions.getArray(e);
ConquerFaction[] otherFactions = this.otherFactions.getArray(e);
if (factions == null || otherFactions == null) {
return;
}
Relation relation = Relation.NEUTRAL;
if (mode == Changer.ChangeMode.SET) {
if (delta == null || delta.length == 0 || delta[0] == null) {
return;
}
relation = (Relation) delta[0];
}
for (ConquerFaction faction : factions) {
if (faction == null) {
continue;
}
for (ConquerFaction otherFaction : otherFactions) {
if (otherFaction == null) {
continue;
}
faction.setRelationBetween(otherFaction, relation);
}
}
}
use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.
the class ExprFactionRelations method get.
@Override
protected Relation[] get(Event e) {
ConquerFaction[] factions = this.factions.getArray(e);
ConquerFaction[] otherFactions = this.otherFactions.getArray(e);
if (factions == null || otherFactions == null) {
return null;
}
List<Relation> relations = new ArrayList<>();
for (ConquerFaction faction : factions) {
if (faction == null) {
continue;
}
for (ConquerFaction otherFaction : otherFactions) {
if (otherFaction == null) {
continue;
}
relations.add(faction.getRelationTo(otherFaction));
}
}
return relations.toArray(new Relation[relations.size()]);
}
use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.
the class ExprFactionRules method get.
@Override
protected String[] get(Event e) {
List<String> rules = new ArrayList<>();
ConquerFaction[] factions = this.factions.getArray(e);
for (ConquerFaction faction : factions) {
if (faction == null) {
continue;
}
List<String> factionRules = faction.getRules();
if (factionRules != null) {
rules.addAll(factionRules);
}
}
return rules.toArray(new String[rules.size()]);
}
Aggregations