use of me.andrew28.addons.conquer.api.events.ConquerFactionRelationWishEvent 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);
}
}
use of me.andrew28.addons.conquer.api.events.ConquerFactionRelationWishEvent 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.events.ConquerFactionRelationWishEvent 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())));
}
use of me.andrew28.addons.conquer.api.events.ConquerFactionRelationWishEvent 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.events.ConquerFactionRelationWishEvent in project Conquer by xXAndrew28Xx.
the class SFEventForwarder method onRelationWish.
@EventHandler
public void onRelationWish(FactionRelationWishEvent event) {
ConquerFactionRelationWishEvent forwardEvent = new ConquerFactionRelationWishEvent(SFPlayer.get(plugin, event.getfPlayer()), SFFaction.get(plugin, event.getFaction()), SFFaction.get(plugin, event.getTargetFaction()), plugin.translate(event.getCurrentRelation()), plugin.translate(event.getTargetRelation()));
callEvent(forwardEvent);
if (forwardEvent.isCancelled()) {
event.setCancelled(true);
}
}
Aggregations