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);
}
}
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 };
}
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())));
}
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);
}
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);
}
Aggregations