Search in sources :

Example 31 with ConquerFaction

use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.

the class ExprWarpOfFaction method get.

@Override
protected Location[] get(Event e) {
    String name = this.name.getSingle(e);
    ConquerFaction faction = this.faction.getSingle(e);
    if (name == null || faction == null || faction.getWarps() == null) {
        return null;
    }
    return new Location[] { faction.getWarps().get(name) };
}
Also used : ConquerFaction(me.andrew28.addons.conquer.api.ConquerFaction) Location(org.bukkit.Location)

Example 32 with ConquerFaction

use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.

the class ExprWarpOfFaction method change.

@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode) {
    String name = this.name.getSingle(e);
    ConquerFaction faction = this.faction.getSingle(e);
    if (name == null || faction == null || faction.getWarps() == null) {
        return;
    }
    switch(mode) {
        case SET:
            if (delta == null || delta.length == 0 || delta[0] == null) {
                return;
            }
            faction.getWarps().put(name, (Location) delta[0]);
            break;
        case REMOVE:
        case REMOVE_ALL:
        case DELETE:
            faction.getWarps().remove(name);
            break;
    }
}
Also used : ConquerFaction(me.andrew28.addons.conquer.api.ConquerFaction)

Example 33 with ConquerFaction

use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.

the class ExprWarpPassword method change.

@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode) {
    String name = this.name.getSingle(e);
    ConquerFaction faction = this.faction.getSingle(e);
    if (name == null || faction == null) {
        return;
    }
    switch(mode) {
        case SET:
            if (delta == null || delta.length == 0 || delta[0] == null) {
                return;
            }
            faction.setWarpPassword(name, (String) delta[0]);
            break;
        case REMOVE_ALL:
        case RESET:
        case DELETE:
            faction.setWarpPassword(name, null);
            break;
    }
}
Also used : ConquerFaction(me.andrew28.addons.conquer.api.ConquerFaction)

Example 34 with ConquerFaction

use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.

the class LFEventForwarder method onLandChange.

@EventHandler
public void onLandChange(EventFactionsLandChange event) {
    boolean claiming = event.getCause() == EventFactionsLandChange.LandChangeCause.Claim;
    ConquerPlayer player = LFPlayer.get(plugin, event.getFPlayer());
    Iterator<Map.Entry<FLocation, Faction>> iterator = event.getTransactions().entrySet().iterator();
    while (iterator.hasNext()) {
        Map.Entry<FLocation, Faction> entry = iterator.next();
        ConquerClaim<Chunk> claim = LFClaim.get(plugin, entry.getKey());
        ConquerFaction faction = LFFaction.get(plugin, entry.getValue());
        ConquerLandClaimEvent forwardEvent = new ConquerLandClaimEvent(claim, claiming, faction, player);
        callEvent(forwardEvent);
        if (forwardEvent.isCancelled()) {
            iterator.remove();
        }
    }
}
Also used : ConquerFaction(me.andrew28.addons.conquer.api.ConquerFaction) FLocation(net.redstoneore.legacyfactions.FLocation) ConquerLandClaimEvent(me.andrew28.addons.conquer.api.events.ConquerLandClaimEvent) ConquerPlayer(me.andrew28.addons.conquer.api.ConquerPlayer) Chunk(org.bukkit.Chunk) Map(java.util.Map) ConquerFaction(me.andrew28.addons.conquer.api.ConquerFaction) Faction(net.redstoneore.legacyfactions.entity.Faction) EventHandler(org.bukkit.event.EventHandler)

Example 35 with ConquerFaction

use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.

the class LFEventForwarder method onRelationChange.

@EventHandler
public void onRelationChange(EventFactionsRelation event) {
    Relation oldRelation = plugin.translate(event.getOldRelation());
    Relation newRelation = plugin.translate(event.getRelation());
    ConquerFaction faction = LFFaction.get(plugin, event.getFaction());
    ConquerFaction targetFaction = LFFaction.get(plugin, event.getTargetFaction());
    ConquerFactionRelationEvent forwardEvent = new ConquerFactionRelationEvent(faction, targetFaction, oldRelation, newRelation);
    callEvent(forwardEvent);
}
Also used : Relation(me.andrew28.addons.conquer.api.Relation) EventFactionsRelation(net.redstoneore.legacyfactions.event.EventFactionsRelation) ConquerFaction(me.andrew28.addons.conquer.api.ConquerFaction) ConquerFactionRelationEvent(me.andrew28.addons.conquer.api.events.ConquerFactionRelationEvent) 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