Search in sources :

Example 11 with ConquerFaction

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 };
}
Also used : ConquerFaction(me.andrew28.addons.conquer.api.ConquerFaction) ConquerFactionRelationWishEvent(me.andrew28.addons.conquer.api.events.ConquerFactionRelationWishEvent) ConquerFactionRelationEvent(me.andrew28.addons.conquer.api.events.ConquerFactionRelationEvent)

Example 12 with ConquerFaction

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()]);
}
Also used : ConquerFaction(me.andrew28.addons.conquer.api.ConquerFaction)

Example 13 with ConquerFaction

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) };
}
Also used : ConquerFaction(me.andrew28.addons.conquer.api.ConquerFaction)

Example 14 with ConquerFaction

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);
    }
}
Also used : Relation(me.andrew28.addons.conquer.api.Relation) EventFactionsRelation(net.redstoneore.legacyfactions.event.EventFactionsRelation) ConquerFaction(me.andrew28.addons.conquer.api.ConquerFaction) ConquerFactionRelationWishEvent(me.andrew28.addons.conquer.api.events.ConquerFactionRelationWishEvent) ConquerPlayer(me.andrew28.addons.conquer.api.ConquerPlayer) EventHandler(org.bukkit.event.EventHandler)

Example 15 with ConquerFaction

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);
    }
}
Also used : ConquerPowerLossEvent(me.andrew28.addons.conquer.api.events.ConquerPowerLossEvent) ConquerFaction(me.andrew28.addons.conquer.api.ConquerFaction) ConquerPlayer(me.andrew28.addons.conquer.api.ConquerPlayer) EventHandler(org.bukkit.event.EventHandler)

Aggregations

ConquerFaction (me.andrew28.addons.conquer.api.ConquerFaction)35 ConquerPlayer (me.andrew28.addons.conquer.api.ConquerPlayer)11 EventHandler (org.bukkit.event.EventHandler)7 Relation (me.andrew28.addons.conquer.api.Relation)6 ArrayList (java.util.ArrayList)5 ConquerFactionRelationEvent (me.andrew28.addons.conquer.api.events.ConquerFactionRelationEvent)5 ConquerFactionRelationWishEvent (me.andrew28.addons.conquer.api.events.ConquerFactionRelationWishEvent)5 ConquerClaim (me.andrew28.addons.conquer.api.ConquerClaim)4 Location (org.bukkit.Location)4 HashSet (java.util.HashSet)3 ConquerLandClaimEvent (me.andrew28.addons.conquer.api.events.ConquerLandClaimEvent)3 ConquerPowerLossEvent (me.andrew28.addons.conquer.api.events.ConquerPowerLossEvent)3 Event (org.bukkit.event.Event)3 Map (java.util.Map)2 FactionResolver (me.andrew28.addons.conquer.api.FactionResolver)2 ConquerFactionCreateEvent (me.andrew28.addons.conquer.api.events.ConquerFactionCreateEvent)2 ConquerFactionDisbandEvent (me.andrew28.addons.conquer.api.events.ConquerFactionDisbandEvent)2 ConquerFactionJoinEvent (me.andrew28.addons.conquer.api.events.ConquerFactionJoinEvent)2 ConquerFactionLeaveEvent (me.andrew28.addons.conquer.api.events.ConquerFactionLeaveEvent)2 ConquerUnclaimAllEvent (me.andrew28.addons.conquer.api.events.ConquerUnclaimAllEvent)2