Configurable war zone max size

This war config option, MAXSIZE, can be used to change the limit on war zone size. Some reasons for using this could be to have a very long war zone or to limit the size from being abused by your zone makers. Thanks to @Delgado804 for the idea.
This commit is contained in:
cmastudios 2013-11-02 15:23:31 -05:00
parent ceeea15794
commit c6d2c6cbcc
3 changed files with 15 additions and 7 deletions

View File

@ -184,6 +184,7 @@ public class War extends JavaPlugin {
warConfig.put(WarConfig.PVPINZONESONLY, false);
warConfig.put(WarConfig.TNTINZONESONLY, false);
warConfig.put(WarConfig.RESETSPEED, 5000);
warConfig.put(WarConfig.MAXSIZE, 750);
warzoneDefaultConfig.put(WarzoneConfig.AUTOASSIGN, false);
warzoneDefaultConfig.put(WarzoneConfig.BLOCKHEADS, true);

View File

@ -9,7 +9,8 @@ public enum WarConfig {
MAXZONES (Integer.class),
PVPINZONESONLY (Boolean.class),
TNTINZONESONLY (Boolean.class),
RESETSPEED (Integer.class);
RESETSPEED (Integer.class),
MAXSIZE (Integer.class);
private final Class<?> configType;

View File

@ -237,18 +237,24 @@ public class ZoneVolume extends Volume {
}
}
private static final int MIN_SIZE = 10;
public boolean tooSmall() {
if (this.hasTwoCorners() && ((this.getMaxX() - this.getMinX() < 10) || (this.getMaxY() - this.getMinY() < 10) || (this.getMaxZ() - this.getMinZ() < 10))) {
return true;
if (!this.hasTwoCorners()) {
return false;
}
return false;
return this.getSizeX() < MIN_SIZE || this.getSizeY() < MIN_SIZE || this.getSizeZ() < MIN_SIZE;
}
private static final int MAX_SIZE_DEFAULT = 750;
public boolean tooBig() {
if (this.hasTwoCorners() && ((this.getMaxX() - this.getMinX() > 750) || (this.getMaxY() - this.getMinY() > 750) || (this.getMaxZ() - this.getMinZ() > 750))) {
return true;
if (!this.hasTwoCorners()) {
return false;
}
return false;
int MAX_SIZE = MAX_SIZE_DEFAULT;
if (War.war != null && War.war.getWarConfig() != null) {
MAX_SIZE = War.war.getWarConfig().getInt(WarConfig.MAXSIZE);
}
return this.getSizeX() > MAX_SIZE || this.getSizeY() > MAX_SIZE || this.getSizeZ() > MAX_SIZE;
}
public boolean zoneStructuresAreOutside() {