Adding flagPoints only setting

When this setting is true you can only score via flagreturn
Closes gh-283
This commit is contained in:
Tim Düsterhus 2011-09-10 18:00:51 +02:00
parent 8788c9c4b6
commit 0518fd0be4
5 changed files with 62 additions and 28 deletions

View File

@ -73,6 +73,7 @@ public class War extends JavaPlugin {
private boolean defaultBlockHeads = true;
private boolean defaultFriendlyFire = false;
private boolean defaultAutoAssignOnly = false;
private boolean defaultFlagPointsOnly = false;
private boolean defaultUnbreakableZoneBlocks = false;
private boolean defaultNoCreatures = false;
private FlagReturn defaultFlagReturn = FlagReturn.BOTH;
@ -424,7 +425,8 @@ public class War extends JavaPlugin {
+ " teamsize:" + zone.getTeamCap()
+ " maxscore:" + zone.getScoreCap()
+ " ff:" + String.valueOf(zone.getFriendlyFire())
+ " autoassign:" + String.valueOf(zone.getAutoAssignOnly())
+ " autoassign:" + String.valueOf(zone.isAutoAssignOnly())
+ " flagpoints:" + String.valueOf(zone.isFlagPointsOnly())
+ " blockheads:" + String.valueOf(zone.isBlockHeads())
+ " spawnstyle:" + zone.getSpawnStyle()
+ " flagreturn:" + zone.getFlagReturn()
@ -439,24 +441,25 @@ public class War extends JavaPlugin {
public String printConfig() {
return "War config -"
+ " pvpinzonesonly:" + String.valueOf(War.war.isPvpInZonesOnly())
+ " disablepvpmessage:" + String.valueOf(War.war.isDisablePvpMessage())
+ " buildinzonesonly:" + String.valueOf(War.war.isBuildInZonesOnly())
+ " pvpinzonesonly:" + String.valueOf(this.isPvpInZonesOnly())
+ " disablepvpmessage:" + String.valueOf(this.isDisablePvpMessage())
+ " buildinzonesonly:" + String.valueOf(this.isBuildInZonesOnly())
+ " - Warzone defaults -"
+ " lifepool:" + War.war.getDefaultLifepool()
+ " teamsize:" + War.war.getDefaultTeamCap()
+ " maxscore:" + War.war.getDefaultScoreCap()
+ " ff:" + String.valueOf(War.war.isDefaultFriendlyFire())
+ " autoassign:" + String.valueOf(War.war.isDefaultAutoAssignOnly())
+ " blockheads:" + String.valueOf(War.war.isDefaultBlockHeads())
+ " spawnstyle:" + War.war.getDefaultSpawnStyle()
+ " flagreturn:" + War.war.getDefaultFlagReturn()
+ " monumentheal:" + War.war.getDefaultMonumentHeal()
+ " unbreakable:" + String.valueOf(War.war.isDefaultUnbreakableZoneBlocks())
+ " nocreatures:" + String.valueOf(War.war.isDefaultNoCreatures())
+ " resetonempty:" + String.valueOf(War.war.isDefaultResetOnEmpty())
+ " resetonload:" + String.valueOf(War.war.isDefaultResetOnLoad())
+ " resetonunload:" + String.valueOf(War.war.isDefaultResetOnUnload());
+ " lifepool:" + this.getDefaultLifepool()
+ " teamsize:" + this.getDefaultTeamCap()
+ " maxscore:" + this.getDefaultScoreCap()
+ " ff:" + String.valueOf(this.isDefaultFriendlyFire())
+ " autoassign:" + String.valueOf(this.isDefaultAutoAssignOnly())
+ " flagpoints:" + String.valueOf(this.isDefaultFlagPointsOnly())
+ " blockheads:" + String.valueOf(this.isDefaultBlockHeads())
+ " spawnstyle:" + this.getDefaultSpawnStyle()
+ " flagreturn:" + this.getDefaultFlagReturn()
+ " monumentheal:" + this.getDefaultMonumentHeal()
+ " unbreakable:" + String.valueOf(this.isDefaultUnbreakableZoneBlocks())
+ " nocreatures:" + String.valueOf(this.isDefaultNoCreatures())
+ " resetonempty:" + String.valueOf(this.isDefaultResetOnEmpty())
+ " resetonload:" + String.valueOf(this.isDefaultResetOnLoad())
+ " resetonunload:" + String.valueOf(this.isDefaultResetOnUnload());
}
private void setZoneRallyPoint(String warzoneName, Player player) {
@ -888,4 +891,12 @@ public class War extends JavaPlugin {
public void setDisconnected(HashMap<String, InventoryStash> disconnected) {
this.disconnected = disconnected;
}
public void setDefaultFlagPointsOnly(boolean defaultFlagPointsOnly) {
this.defaultFlagPointsOnly = defaultFlagPointsOnly;
}
public boolean isDefaultFlagPointsOnly() {
return defaultFlagPointsOnly;
}
}

View File

@ -55,6 +55,7 @@ public class Warzone {
private List<ZoneWallGuard> zoneWallGuards = new ArrayList<ZoneWallGuard>();
private ZoneLobby lobby;
private boolean autoAssignOnly;
private boolean flagPointsOnly;
private boolean blockHeads;
private boolean unbreakableZoneBlocks;
private boolean disabled = false;
@ -167,6 +168,11 @@ public class Warzone {
return this.name;
}
@Override
public String toString() {
return this.getName();
}
public void setTeleport(Location location) {
this.teleport = location;
}
@ -381,6 +387,11 @@ public class Warzone {
return this.friendlyFire;
}
public void setFriendlyFire(boolean ffOn) {
this.friendlyFire = ffOn;
}
public void setLoadout(HashMap<Integer, ItemStack> newLoadout) {
this.loadout.clear();
for (Integer slot : newLoadout.keySet()) {
@ -414,10 +425,6 @@ public class Warzone {
return this.monumentHeal;
}
public void setFriendlyFire(boolean ffOn) {
this.friendlyFire = ffOn;
}
public boolean hasPlayerInventory(String playerName) {
return this.inventories.containsKey(playerName);
}
@ -679,10 +686,6 @@ public class Warzone {
playerGuards.clear();
}
public boolean getAutoAssignOnly() {
return this.isAutoAssignOnly();
}
public void setLobby(ZoneLobby lobby) {
this.lobby = lobby;
}
@ -754,7 +757,7 @@ public class Warzone {
for (Team t : teams) {
t.teamcast("The battle is over. Team " + playerTeam.getName() + " lost: " + player.getName() + " died and there were no lives left in their life pool.");
if (t.getPlayers().size() != 0) {
if (t.getPlayers().size() != 0 && !this.flagPointsOnly) {
if (!t.getName().equals(playerTeam.getName())) {
// all other teams get a point
t.addPoint();
@ -1075,4 +1078,12 @@ public class Warzone {
public boolean isResetOnEmpty() {
return this.resetOnEmpty;
}
public boolean isFlagPointsOnly() {
return flagPointsOnly;
}
public void setFlagPointsOnly(boolean flagPointsOnly) {
this.flagPointsOnly = flagPointsOnly;
}
}

View File

@ -362,7 +362,7 @@ public class ZoneLobby {
rightSide = BlockFace.SOUTH;
}
this.teamGateBlocks.clear();
if (this.warzone.getAutoAssignOnly()) {
if (this.warzone.isAutoAssignOnly()) {
this.autoAssignGate = new BlockInfo(lobbyMiddleWallBlock);
} else {
this.autoAssignGate = null;

View File

@ -98,6 +98,9 @@ public class WarMapper {
// defaultAutoAssignOnly
War.war.setDefaultAutoAssignOnly(warConfig.getBoolean("defaultAutoAssignOnly"));
// defaultFlagPointsOnly
War.war.setDefaultFlagPointsOnly(warConfig.getBoolean("defaultFlagPointsOnly"));
// defaultTeamCap
War.war.setDefaultTeamCap(warConfig.getInt("defaultTeamCap"));
@ -216,6 +219,9 @@ public class WarMapper {
// defaultAutoAssignOnly
warConfig.setBoolean("defaultAutoAssignOnly", War.war.isDefaultAutoAssignOnly());
// defaultFlagPointsOnly
warConfig.setBoolean("defaultFlagPointsOnly", War.war.isDefaultFlagPointsOnly());
// defaultTeamCap
warConfig.setInt("defaultTeamCap", War.war.getDefaultTeamCap());

View File

@ -150,6 +150,9 @@ public class WarzoneMapper {
// autoAssignOnly
warzone.setAutoAssignOnly(warzoneConfig.getBoolean("autoAssignOnly"));
// flagPointsOnly
warzone.setAutoAssignOnly(warzoneConfig.getBoolean("flagPointsOnly"));
// team cap
warzone.setTeamCap(warzoneConfig.getInt("teamCap"));
@ -359,6 +362,9 @@ public class WarzoneMapper {
// autoAssignOnly
warzoneConfig.setBoolean("autoAssignOnly", warzone.isAutoAssignOnly());
// flagPointsOnly
warzoneConfig.setBoolean("flagPointsOnly", warzone.isFlagPointsOnly());
// team cap
warzoneConfig.setInt("teamCap", warzone.getTeamCap());