Merge pull request #286 from taoneill/flagPointsOnly

New flagpointsonly setting for true CTF.
This commit is contained in:
taoneill 2011-09-12 20:22:05 -07:00
commit 3277491c64
5 changed files with 71 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;
@ -260,6 +261,10 @@ public class War extends JavaPlugin {
String onOff = namedParams.get("autoassign");
warzone.setAutoAssignOnly(onOff.equals("on") || onOff.equals("true"));
}
if (namedParams.containsKey("flagpointsonly")) {
String onOff = namedParams.get("flagpointsonly");
warzone.setFlagPointsOnly(onOff.equals("on") || onOff.equals("true"));
}
if (namedParams.containsKey("blockheads")) {
String onOff = namedParams.get("blockheads");
warzone.setBlockHeads(onOff.equals("on") || onOff.equals("true"));
@ -348,6 +353,10 @@ public class War extends JavaPlugin {
String onOff = namedParams.get("autoassign");
this.setDefaultAutoAssignOnly(onOff.equals("on") || onOff.equals("true"));
}
if (namedParams.containsKey("flagpointsonly")) {
String onOff = namedParams.get("flagpointsonly");
this.setDefaultFlagPointsOnly(onOff.equals("on") || onOff.equals("true"));
}
if (namedParams.containsKey("pvpinzonesonly")) {
String onOff = namedParams.get("pvpinzonesonly");
this.setPvpInZonesOnly(onOff.equals("on") || onOff.equals("true"));
@ -424,7 +433,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())
+ " flagpointsonly:" + String.valueOf(zone.isFlagPointsOnly())
+ " blockheads:" + String.valueOf(zone.isBlockHeads())
+ " spawnstyle:" + zone.getSpawnStyle()
+ " flagreturn:" + zone.getFlagReturn()
@ -439,24 +449,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())
+ " flagpointsonly:" + 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 +899,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;
@ -74,6 +75,7 @@ public class Warzone {
this.setLifePool(War.war.getDefaultLifepool());
this.setLoadout(War.war.getDefaultLoadout());
this.setAutoAssignOnly(War.war.isDefaultAutoAssignOnly());
this.setFlagPointsOnly(War.war.isDefaultFlagPointsOnly());
this.teamCap = War.war.getDefaultTeamCap();
this.scoreCap = War.war.getDefaultScoreCap();
this.monumentHeal = War.war.getDefaultMonumentHeal();
@ -167,6 +169,11 @@ public class Warzone {
return this.name;
}
@Override
public String toString() {
return this.getName();
}
public void setTeleport(Location location) {
this.teleport = location;
}
@ -381,6 +388,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 +426,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 +687,6 @@ public class Warzone {
playerGuards.clear();
}
public boolean getAutoAssignOnly() {
return this.isAutoAssignOnly();
}
public void setLobby(ZoneLobby lobby) {
this.lobby = lobby;
}
@ -754,7 +758,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 +1079,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());