Search in sources :

Example 1 with ConquerPlayer

use of me.andrew28.addons.conquer.api.ConquerPlayer 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)

Example 2 with ConquerPlayer

use of me.andrew28.addons.conquer.api.ConquerPlayer 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 3 with ConquerPlayer

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

the class MSEventForwarder method onRelationChange.

@EventHandler
public void onRelationChange(EventFactionsRelationChange event) {
    ConquerPlayer player = MSPlayer.get(plugin, event.getMPlayer());
    ConquerFaction faction = MSFaction.get(plugin, event.getFaction());
    ConquerFaction otherFaction = MSFaction.get(plugin, event.getOtherFaction());
    Relation oldRelation = plugin.translateRelation(event.getFaction().getRelationTo(event.getOtherFaction()));
    Relation newRelation = plugin.translateRelation(event.getNewRelation());
    ConquerFactionRelationWishEvent forwardWishEvent = new ConquerFactionRelationWishEvent(player, faction, otherFaction, oldRelation, newRelation);
    callEvent(forwardWishEvent);
    if (forwardWishEvent.isCancelled()) {
        event.setCancelled(true);
        return;
    }
    ConquerFactionRelationEvent forwardEvent = new ConquerFactionRelationEvent(faction, otherFaction, oldRelation, newRelation);
    callEvent(forwardEvent);
    if (forwardEvent.isCancelled()) {
        event.setCancelled(true);
    }
}
Also used : Relation(me.andrew28.addons.conquer.api.Relation) ConquerFaction(me.andrew28.addons.conquer.api.ConquerFaction) ConquerFactionRelationWishEvent(me.andrew28.addons.conquer.api.events.ConquerFactionRelationWishEvent) ConquerFactionRelationEvent(me.andrew28.addons.conquer.api.events.ConquerFactionRelationEvent) ConquerPlayer(me.andrew28.addons.conquer.api.ConquerPlayer) EventHandler(org.bukkit.event.EventHandler)

Example 4 with ConquerPlayer

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

the class ExprAutoClaimState method change.

@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode) {
    ConquerPlayer[] players = getExpr().getArray(e);
    boolean state = false;
    if (mode == Changer.ChangeMode.SET) {
        if (delta == null || delta.length == 0 || delta[0] == null) {
            return;
        }
        state = (boolean) delta[0];
    }
    for (ConquerPlayer player : players) {
        if (player == null) {
            continue;
        }
        player.setAutoClaiming(state);
    }
}
Also used : ConquerPlayer(me.andrew28.addons.conquer.api.ConquerPlayer)

Example 5 with ConquerPlayer

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

the class ExprInvitedPlayers 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(faction.getInvited());
    }
    return players.toArray(new ConquerPlayer[players.size()]);
}
Also used : ConquerFaction(me.andrew28.addons.conquer.api.ConquerFaction) ConquerPlayer(me.andrew28.addons.conquer.api.ConquerPlayer) HashSet(java.util.HashSet)

Aggregations

ConquerPlayer (me.andrew28.addons.conquer.api.ConquerPlayer)16 ConquerFaction (me.andrew28.addons.conquer.api.ConquerFaction)11 EventHandler (org.bukkit.event.EventHandler)7 ConquerFactionRelationWishEvent (me.andrew28.addons.conquer.api.events.ConquerFactionRelationWishEvent)4 ConquerPowerLossEvent (me.andrew28.addons.conquer.api.events.ConquerPowerLossEvent)4 Relation (me.andrew28.addons.conquer.api.Relation)3 ConquerFactionRelationEvent (me.andrew28.addons.conquer.api.events.ConquerFactionRelationEvent)3 ConquerLandClaimEvent (me.andrew28.addons.conquer.api.events.ConquerLandClaimEvent)3 HashSet (java.util.HashSet)2 Map (java.util.Map)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 Cancellable (org.bukkit.event.Cancellable)2 Event (org.bukkit.event.Event)2 Date (ch.njol.skript.util.Date)1 EventFactionsChunkChangeType (com.massivecraft.factions.event.EventFactionsChunkChangeType)1 EventFactionsChunksChange (com.massivecraft.factions.event.EventFactionsChunksChange)1