use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.
the class ExprRelationFactionSenderTarget method get.
@Override
protected ConquerFaction[] get(Event e) {
ConquerFaction faction;
if (e instanceof ConquerFactionRelationEvent) {
ConquerFactionRelationEvent event = (ConquerFactionRelationEvent) e;
faction = sender ? event.getSender() : event.getTarget();
} else if (e instanceof ConquerFactionRelationWishEvent) {
ConquerFactionRelationWishEvent event = (ConquerFactionRelationWishEvent) e;
faction = sender ? event.getSender() : event.getTarget();
} else {
return null;
}
return new ConquerFaction[] { faction };
}
use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.
the class ExprWarpNamesOfFaction method get.
@Override
protected String[] get(Event e) {
ConquerFaction faction = this.faction.getSingle(e);
if (faction == null || faction.getWarps() == null) {
return null;
}
Set<String> warps = faction.getWarps().keySet();
return warps.toArray(new String[warps.size()]);
}
use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.
the class ExprWarpPassword method get.
@Override
protected String[] get(Event e) {
String name = this.name.getSingle(e);
ConquerFaction faction = this.faction.getSingle(e);
if (name == null || faction == null) {
return null;
}
return new String[] { faction.getWarpPassword(name) };
}
use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.
the class LFEventForwarder method onRelationWish.
@EventHandler
public void onRelationWish(EventFactionsRelationChange event) {
ConquerPlayer caller = LFPlayer.get(plugin, event.getfPlayer());
Relation oldRelation = plugin.translate(event.getCurrentRelation());
Relation newRelation = plugin.translate(event.getTargetRelation());
ConquerFaction faction = LFFaction.get(plugin, event.getFaction());
ConquerFaction targetFaction = LFFaction.get(plugin, event.getTargetFaction());
ConquerFactionRelationWishEvent forwardEvent = new ConquerFactionRelationWishEvent(caller, faction, targetFaction, oldRelation, newRelation);
callEvent(forwardEvent);
if (forwardEvent.isCancelled()) {
event.setCancelled(true);
}
}
use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.
the class LFEventForwarder method onPowerLoss.
@EventHandler
public void onPowerLoss(EventFactionsPowerLoss event) {
ConquerPlayer player = LFPlayer.get(plugin, event.getfPlayer());
ConquerFaction faction = LFFaction.get(plugin, event.getFaction());
ConquerPowerLossEvent forwardEvent = new ConquerPowerLossEvent(faction, player);
callEvent(forwardEvent);
if (forwardEvent.isCancelled()) {
event.setCancelled(true);
}
}
Aggregations