use of me.andrew28.addons.conquer.api.ClaimType 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.ClaimType in project Conquer by xXAndrew28Xx.
the class ExprTypeOfClaim method change.
@Override
public void change(Event e, Object[] delta, Changer.ChangeMode mode) {
ConquerClaim[] claims = getExpr().getArray(e);
if (claims == null) {
return;
}
ClaimType type = ClaimType.WILDERNESS;
if (mode == Changer.ChangeMode.SET) {
if (delta == null || delta.length == 0) {
return;
}
type = (ClaimType) delta[0];
if (type == null) {
type = ClaimType.WILDERNESS;
}
}
for (ConquerClaim claim : claims) {
if (claim == null) {
continue;
}
claim.setTo(type);
}
}
use of me.andrew28.addons.conquer.api.ClaimType in project Conquer by xXAndrew28Xx.
the class CondClaimType method check.
@Override
public boolean check(Event e) {
ClaimType type = this.type.getSingle(e);
if (type == null) {
type = ClaimType.WILDERNESS;
}
ClaimType finalType = type;
return claims.check(e, claim -> claim.getType().equals(finalType), isNegated());
}
Aggregations