use of me.andrew28.addons.conquer.api.ConquerFaction 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.ConquerFaction in project Conquer by xXAndrew28Xx.
the class CondWarpPassValid method check.
@Override
public boolean check(Event e) {
String password = this.password.getSingle(e);
ConquerFaction faction = this.faction.getSingle(e);
return password != null && faction != null && names.check(e, warp -> faction.isWarpPassword(warp, password), isNegated());
}
use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.
the class EffChangeClaimOwnership method execute.
@Override
protected void execute(Event e) {
Object[] claimObjects = this.claims.getArray(e);
if (claimObjects == null) {
return;
}
List<ConquerClaim> claims = new ArrayList<>();
for (Object claimObject : claimObjects) {
if (claimObject instanceof ConquerClaim) {
claims.add((ConquerClaim) claimObject);
} else if (claimObject instanceof Location) {
claims.add(Conquer.getInstance().getFactions().getClaim((Location) claimObject));
}
}
if (claiming) {
if (forFactions) {
ConquerFaction faction = (ConquerFaction) this.type.getSingle(e);
if (faction == null) {
return;
}
claims.forEach(faction::claim);
} else {
ClaimType type = (ClaimType) this.type.getSingle(e);
if (type == null) {
return;
}
claims.forEach(claim -> claim.setTo(type));
}
} else {
claims.forEach(claim -> claim.setTo(ClaimType.WILDERNESS));
}
}
use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.
the class ExprCreationDateOfFaction method change.
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode) {
if (delta == null || delta.length == 0 || delta[0] == null) {
return;
}
ConquerFaction faction = getExpr().getSingle(e);
faction.setCreationDate(new java.util.Date(((Date) delta[0]).getTimestamp()));
}
use of me.andrew28.addons.conquer.api.ConquerFaction in project Conquer by xXAndrew28Xx.
the class ExprDescriptionOfFaction method change.
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode) {
if (delta == null || delta.length == 0 || delta[0] == null) {
return;
}
ConquerFaction faction = getExpr().getSingle(e);
if (faction == null) {
return;
}
faction.setDescription((String) delta[0]);
}
Aggregations