mirror of
https://github.com/taoneill/war.git
synced 2025-02-23 06:41:20 +01:00
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:
parent
ceeea15794
commit
c6d2c6cbcc
@ -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);
|
||||
|
@ -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;
|
||||
|
||||
|
@ -237,19 +237,25 @@ 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 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;
|
||||
}
|
||||
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() {
|
||||
// check team spawns & flags
|
||||
|
Loading…
Reference in New Issue
Block a user