Search in sources :

Example 1 with ConquerFactionRelationEvent

use of me.andrew28.addons.conquer.api.events.ConquerFactionRelationEvent 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 2 with ConquerFactionRelationEvent

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

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

the class FOEventForwarder method onRelationChange.

@EventHandler
public void onRelationChange(FactionRelationEvent event) {
    callEvent(new ConquerFactionRelationWishEvent(null, FOFaction.get(plugin, event.getFaction()), FOFaction.get(plugin, event.getTargetFaction()), plugin.translateRelation(event.getOldRelation()), plugin.translateRelation(event.getRelation())));
    callEvent(new ConquerFactionRelationEvent(FOFaction.get(plugin, event.getFaction()), FOFaction.get(plugin, event.getTargetFaction()), plugin.translateRelation(event.getOldRelation()), plugin.translateRelation(event.getRelation())));
}
Also used : ConquerFactionRelationWishEvent(me.andrew28.addons.conquer.api.events.ConquerFactionRelationWishEvent) ConquerFactionRelationEvent(me.andrew28.addons.conquer.api.events.ConquerFactionRelationEvent) EventHandler(org.bukkit.event.EventHandler)

Example 4 with ConquerFactionRelationEvent

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

the class FUEventForwarder method onRelationChange.

@EventHandler
public void onRelationChange(FactionRelationEvent event) {
    ConquerFactionRelationEvent forwardEvent = new ConquerFactionRelationEvent(FUFaction.get(plugin, event.getFaction()), FUFaction.get(plugin, event.getTargetFaction()), plugin.translate(event.getOldRelation()), plugin.translate(event.getRelation()));
    callEvent(forwardEvent);
}
Also used : ConquerFactionRelationEvent(me.andrew28.addons.conquer.api.events.ConquerFactionRelationEvent) EventHandler(org.bukkit.event.EventHandler)

Example 5 with ConquerFactionRelationEvent

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

the class SFEventForwarder method onRelationChange.

@EventHandler
public void onRelationChange(FactionRelationEvent event) {
    ConquerFactionRelationEvent forwardEvent = new ConquerFactionRelationEvent(SFFaction.get(plugin, event.getFaction()), SFFaction.get(plugin, event.getTargetFaction()), plugin.translate(event.getOldRelation()), plugin.translate(event.getRelation()));
    callEvent(forwardEvent);
}
Also used : ConquerFactionRelationEvent(me.andrew28.addons.conquer.api.events.ConquerFactionRelationEvent) EventHandler(org.bukkit.event.EventHandler)

Aggregations

ConquerFactionRelationEvent (me.andrew28.addons.conquer.api.events.ConquerFactionRelationEvent)6 EventHandler (org.bukkit.event.EventHandler)5 ConquerFaction (me.andrew28.addons.conquer.api.ConquerFaction)3 ConquerFactionRelationWishEvent (me.andrew28.addons.conquer.api.events.ConquerFactionRelationWishEvent)3 Relation (me.andrew28.addons.conquer.api.Relation)2 ConquerPlayer (me.andrew28.addons.conquer.api.ConquerPlayer)1 EventFactionsRelation (net.redstoneore.legacyfactions.event.EventFactionsRelation)1