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