mirror of
https://github.com/taoneill/war.git
synced 2025-02-02 12:41:22 +01:00
Closes gh-305. Added maxzones setting to prevent zonesmakers from making too many zones. Default is 12 - hopefully not many servers have that many warzones.
This commit is contained in:
parent
82c8397547
commit
95308c8bc9
@ -64,6 +64,7 @@ public class War extends JavaPlugin {
|
||||
private boolean disablePvpMessage = false;
|
||||
private boolean buildInZonesOnly = false;
|
||||
private boolean tntInZonesOnly = false;
|
||||
private int maxZones = 12;
|
||||
private final List<String> deadlyAdjectives = new ArrayList<String>();
|
||||
private final List<String> killerVerbs = new ArrayList<String>();
|
||||
|
||||
@ -505,6 +506,10 @@ public class War extends JavaPlugin {
|
||||
this.setTntInZonesOnly(onOff.equals("on") || onOff.equals("true"));
|
||||
returnMessage.append(" tntinzonesonly set to " + String.valueOf(war.isTntInZonesOnly()) + ".");
|
||||
}
|
||||
if (namedParams.containsKey("maxzones")) {
|
||||
this.setMaxZones(Integer.parseInt(namedParams.get("maxzones")));
|
||||
returnMessage.append(" maxzones set to " + war.getMaxZones() + ".");
|
||||
}
|
||||
|
||||
if (namedParams.containsKey("lifepool")) {
|
||||
this.setDefaultLifepool(Integer.parseInt(namedParams.get("lifepool")));
|
||||
@ -728,6 +733,7 @@ public class War extends JavaPlugin {
|
||||
+ " disablepvpmessage:" + global + String.valueOf(this.isDisablePvpMessage()) + normal
|
||||
+ " buildinzonesonly:" + global + String.valueOf(this.isBuildInZonesOnly()) + normal
|
||||
+ " tntinzonesonly:" + global + String.valueOf(this.isTntInZonesOnly()) + normal
|
||||
+ " maxzones:" + global + this.getMaxZones() + normal
|
||||
+ " - Warzone defaults -"
|
||||
+ " lifepool:" + color + this.getDefaultLifepool() + normal
|
||||
+ " teamsize:" + color + this.getDefaultTeamCap() + normal
|
||||
@ -1316,4 +1322,12 @@ public class War extends JavaPlugin {
|
||||
this.defaultSaturation = defaultSaturation;
|
||||
}
|
||||
|
||||
public void setMaxZones(int maxZones) {
|
||||
this.maxZones = maxZones;
|
||||
}
|
||||
|
||||
public int getMaxZones() {
|
||||
return maxZones;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -29,7 +29,11 @@ public class ZoneSetter {
|
||||
Block northwestBlock = this.player.getLocation().getWorld().getBlockAt(this.player.getLocation());
|
||||
StringBuilder msgString = new StringBuilder();
|
||||
try {
|
||||
if (warzone == null) {
|
||||
if (warzone == null && War.war.getWarzones().size() >= War.war.getMaxZones()) {
|
||||
// max warzones reached
|
||||
War.war.badMsg(player, "Too many warzones already! To change the maximum, use /warcfg maxzone:20.");
|
||||
return;
|
||||
} else if (warzone == null) {
|
||||
// create the warzone
|
||||
warzone = new Warzone(this.player.getLocation().getWorld(), this.zoneName);
|
||||
warzone.addAuthor(player.getName());
|
||||
@ -70,7 +74,11 @@ public class ZoneSetter {
|
||||
Block southeastBlock = this.player.getLocation().getWorld().getBlockAt(this.player.getLocation());
|
||||
StringBuilder msgString = new StringBuilder();
|
||||
try {
|
||||
if (warzone == null) {
|
||||
if (warzone == null && War.war.getWarzones().size() >= War.war.getMaxZones()) {
|
||||
// max warzones reached
|
||||
War.war.badMsg(player, "Too many warzones already! To change the maximum, use /warcfg maxzone:20.");
|
||||
return;
|
||||
} else if (warzone == null) {
|
||||
// create the warzone
|
||||
warzone = new Warzone(this.player.getLocation().getWorld(), this.zoneName);
|
||||
warzone.addAuthor(player.getName());
|
||||
@ -113,7 +121,11 @@ public class ZoneSetter {
|
||||
Warzone warzone = War.war.findWarzone(this.zoneName);
|
||||
StringBuilder msgString = new StringBuilder();
|
||||
try {
|
||||
if (warzone == null) {
|
||||
if (warzone == null && War.war.getWarzones().size() >= War.war.getMaxZones()) {
|
||||
// max warzones reached
|
||||
War.war.badMsg(player, "Too many warzones already! To change the maximum, use /warcfg maxzone:20.");
|
||||
return;
|
||||
} else if (warzone == null) {
|
||||
// create the warzone
|
||||
warzone = new Warzone(this.player.getLocation().getWorld(), this.zoneName);
|
||||
warzone.addAuthor(player.getName());
|
||||
@ -151,7 +163,11 @@ public class ZoneSetter {
|
||||
Warzone warzone = War.war.findWarzone(this.zoneName);
|
||||
StringBuilder msgString = new StringBuilder();
|
||||
try {
|
||||
if (warzone == null) {
|
||||
if (warzone == null && War.war.getWarzones().size() >= War.war.getMaxZones()) {
|
||||
// max warzones reached
|
||||
War.war.badMsg(player, "Too many warzones already! To change the maximum, use /warcfg maxzone:20.");
|
||||
return;
|
||||
} else if (warzone == null) {
|
||||
// create the warzone
|
||||
warzone = new Warzone(this.player.getLocation().getWorld(), this.zoneName);
|
||||
warzone.addAuthor(player.getName());
|
||||
|
@ -24,7 +24,6 @@ import com.tommytony.war.jobs.RestoreWarzonesJob;
|
||||
public class WarMapper {
|
||||
|
||||
public static void load() {
|
||||
// war.getLogger().info("Loading war config...");
|
||||
(War.war.getDataFolder()).mkdir();
|
||||
(new File(War.war.getDataFolder().getPath() + "/dat")).mkdir();
|
||||
PropertiesFile warConfig = new PropertiesFile(War.war.getDataFolder().getPath() + "/war.txt");
|
||||
@ -109,6 +108,11 @@ public class WarMapper {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// maxZones
|
||||
if (warConfig.keyExists("maxZones")) {
|
||||
War.war.setMaxZones(warConfig.getInt("maxZones"));
|
||||
}
|
||||
|
||||
// defaultLifePool
|
||||
if (warConfig.keyExists("defaultLifePool")) {
|
||||
@ -325,6 +329,9 @@ public class WarMapper {
|
||||
}
|
||||
warConfig.setString("defaultExtraLoadouts", defaultExtraLoadoutsStr);
|
||||
|
||||
// maxZones
|
||||
warConfig.setInt("maxZones", War.war.getMaxZones());
|
||||
|
||||
// defaultLifepool
|
||||
warConfig.setInt("defaultLifePool", War.war.getDefaultLifepool());
|
||||
|
||||
|
@ -15,7 +15,7 @@ permissions:
|
||||
war.build: true
|
||||
war.pvp: true
|
||||
war.zonemaker:
|
||||
description: Create and edit warzones, but you can't edit warzones that you are not the author of.
|
||||
description: Create and edit warzones, but you only edit a warzone if you are its author.
|
||||
default: false
|
||||
children:
|
||||
war.player: true
|
||||
@ -199,7 +199,7 @@ commands:
|
||||
Ex -
|
||||
/zonemaker
|
||||
/zonemaker <new-or-kicked-zone-maker-name>
|
||||
# War admin commands (must have the 'war.*' permission or be op)
|
||||
# War admin commands (must have the 'war.*' permission or be an op)
|
||||
# War hub
|
||||
setwarhub:
|
||||
description: War> Create or moves a wall of portals. One portal per warzone. Warzones get a portal back to the warhub.
|
||||
@ -226,7 +226,7 @@ commands:
|
||||
description: War> Change gobal settings and the default warzone configuration values.
|
||||
usage: Change gobal settings and the default warzone configuration values.
|
||||
Ex -
|
||||
/setwarconfig pvpinzonesonly:on buildinzonesonly:on disablepvpmessage:off tntinzonesonly:off => Global settings,
|
||||
/setwarconfig pvpinzonesonly:on buildinzonesonly:on disablepvpmessage:off tntinzonesonly:off maxzones:12 => Global settings,
|
||||
/setwarconfig lifepool:8 teamsize:5 maxscore:7 autoassign:on ff:on blockheads:on spawnstyle:<big/flat/small/invisible> unbreakable:on nocreatures:on disabled:on monumentheal:<0-20>
|
||||
flagreturn:<both/spawn/flag> flagpointsonly:false glasswalls:on pvpinzone:true instabreak:false nodrops:false nohunger:false saturation:<0-20> minplayers:1 minteams:1
|
||||
=> Warzone defaults,
|
||||
@ -239,7 +239,7 @@ commands:
|
||||
description: War> Alias for /setwarconfig
|
||||
usage: Change gobal settings and the default warzone configuration values.
|
||||
Ex -
|
||||
/warcfg pvpinzonesonly:on buildinzonesonly:on disablepvpmessage:off tntinzonesonly:off => Global settings,
|
||||
/warcfg pvpinzonesonly:on buildinzonesonly:on disablepvpmessage:off tntinzonesonly:off maxzones:12 => Global settings,
|
||||
/warcfg lifepool:8 teamsize:5 maxscore:7 autoassign:on ff:on blockheads:on spawnstyle:<big/flat/small/invisible> unbreakable:on nocreatures:on disabled:on monumentheal:<0-20>
|
||||
flagreturn:<both/spawn/flag> flagpointsonly:false glasswalls:on pvpinzone:true instabreak:false nodrops:false nohunger:false saturation:<0-20> minplayers:1 minteams:1
|
||||
=> Warzone defaults,
|
||||
|
@ -15,7 +15,7 @@ permissions:
|
||||
war.build: true
|
||||
war.pvp: true
|
||||
war.zonemaker:
|
||||
description: Create and edit warzones, but you can't edit warzones that you are not the author of.
|
||||
description: Create and edit warzones, but you only edit a warzone if you are its author.
|
||||
default: false
|
||||
children:
|
||||
war.player: true
|
||||
@ -199,7 +199,7 @@ commands:
|
||||
Ex -
|
||||
/zonemaker
|
||||
/zonemaker <new-or-kicked-zone-maker-name>
|
||||
# War admin commands (must have the 'war.*' permission or be op)
|
||||
# War admin commands (must have the 'war.*' permission or be an op)
|
||||
# War hub
|
||||
setwarhub:
|
||||
description: War> Create or moves a wall of portals. One portal per warzone. Warzones get a portal back to the warhub.
|
||||
@ -226,7 +226,7 @@ commands:
|
||||
description: War> Change gobal settings and the default warzone configuration values.
|
||||
usage: Change gobal settings and the default warzone configuration values.
|
||||
Ex -
|
||||
/setwarconfig pvpinzonesonly:on buildinzonesonly:on disablepvpmessage:off tntinzonesonly:off => Global settings,
|
||||
/setwarconfig pvpinzonesonly:on buildinzonesonly:on disablepvpmessage:off tntinzonesonly:off maxzones:12 => Global settings,
|
||||
/setwarconfig lifepool:8 teamsize:5 maxscore:7 autoassign:on ff:on blockheads:on spawnstyle:<big/flat/small/invisible> unbreakable:on nocreatures:on disabled:on monumentheal:<0-20>
|
||||
flagreturn:<both/spawn/flag> flagpointsonly:false glasswalls:on pvpinzone:true instabreak:false nodrops:false nohunger:false saturation:<0-20> minplayers:1 minteams:1
|
||||
=> Warzone defaults,
|
||||
@ -239,7 +239,7 @@ commands:
|
||||
description: War> Alias for /setwarconfig
|
||||
usage: Change gobal settings and the default warzone configuration values.
|
||||
Ex -
|
||||
/warcfg pvpinzonesonly:on buildinzonesonly:on disablepvpmessage:off tntinzonesonly:off => Global settings,
|
||||
/warcfg pvpinzonesonly:on buildinzonesonly:on disablepvpmessage:off tntinzonesonly:off maxzones:12 => Global settings,
|
||||
/warcfg lifepool:8 teamsize:5 maxscore:7 autoassign:on ff:on blockheads:on spawnstyle:<big/flat/small/invisible> unbreakable:on nocreatures:on disabled:on monumentheal:<0-20>
|
||||
flagreturn:<both/spawn/flag> flagpointsonly:false glasswalls:on pvpinzone:true instabreak:false nodrops:false nohunger:false saturation:<0-20> minplayers:1 minteams:1
|
||||
=> Warzone defaults,
|
||||
|
Loading…
Reference in New Issue
Block a user