use of me.andrew28.addons.conquer.api.ConquerFaction 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()]);
}
use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.
the class ExprMembersOfFaction method get.
@Override
protected ConquerPlayer[] get(Event e) {
Set<ConquerPlayer> players = new HashSet<>();
ConquerFaction[] factions = this.factions.getArray(e);
for (ConquerFaction faction : factions) {
if (faction == null) {
continue;
}
players.addAll(Arrays.asList(faction.getMembers()));
}
return players.toArray(new ConquerPlayer[players.size()]);
}
use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.
the class ExprMotdOfFaction method change.
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode) {
if (delta == null || delta.length == 0 || delta[0] == null) {
return;
}
ConquerFaction faction = getExpr().getSingle(e);
faction.setMotd((String) delta[0]);
}
use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.
the class ExprNameOfFaction method change.
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode) {
if (delta == null || delta.length == 0 || delta[0] == null) {
return;
}
ConquerFaction faction = getExpr().getSingle(e);
if (faction == null) {
return;
}
faction.setName((String) delta[0]);
}
use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.
the class ExprWarpNamesOfFaction method change.
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode) {
ConquerFaction faction = this.faction.getSingle(e);
if (faction == null) {
return;
}
if (mode == Changer.ChangeMode.REMOVE) {
if (delta == null || delta.length == 0 || delta[0] == null) {
return;
}
String name = (String) delta[0];
faction.getWarps().remove(name);
} else {
faction.getWarps().clear();
}
}
Aggregations