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 defaultBlockHeads = true;
private boolean defaultFriendlyFire = false; private boolean defaultFriendlyFire = false;
private boolean defaultAutoAssignOnly = false; private boolean defaultAutoAssignOnly = false;
private boolean defaultFlagPointsOnly = false;
private boolean defaultUnbreakableZoneBlocks = false; private boolean defaultUnbreakableZoneBlocks = false;
private boolean defaultNoCreatures = false; private boolean defaultNoCreatures = false;
private FlagReturn defaultFlagReturn = FlagReturn.BOTH; private FlagReturn defaultFlagReturn = FlagReturn.BOTH;
@ -424,7 +425,8 @@ public class War extends JavaPlugin {
+ " teamsize:" + zone.getTeamCap() + " teamsize:" + zone.getTeamCap()
+ " maxscore:" + zone.getScoreCap() + " maxscore:" + zone.getScoreCap()
+ " ff:" + String.valueOf(zone.getFriendlyFire()) + " 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()) + " blockheads:" + String.valueOf(zone.isBlockHeads())
+ " spawnstyle:" + zone.getSpawnStyle() + " spawnstyle:" + zone.getSpawnStyle()
+ " flagreturn:" + zone.getFlagReturn() + " flagreturn:" + zone.getFlagReturn()
@ -439,24 +441,25 @@ public class War extends JavaPlugin {
public String printConfig() { public String printConfig() {
return "War config -" return "War config -"
+ " pvpinzonesonly:" + String.valueOf(War.war.isPvpInZonesOnly()) + " pvpinzonesonly:" + String.valueOf(this.isPvpInZonesOnly())
+ " disablepvpmessage:" + String.valueOf(War.war.isDisablePvpMessage()) + " disablepvpmessage:" + String.valueOf(this.isDisablePvpMessage())
+ " buildinzonesonly:" + String.valueOf(War.war.isBuildInZonesOnly()) + " buildinzonesonly:" + String.valueOf(this.isBuildInZonesOnly())
+ " - Warzone defaults -" + " - Warzone defaults -"
+ " lifepool:" + War.war.getDefaultLifepool() + " lifepool:" + this.getDefaultLifepool()
+ " teamsize:" + War.war.getDefaultTeamCap() + " teamsize:" + this.getDefaultTeamCap()
+ " maxscore:" + War.war.getDefaultScoreCap() + " maxscore:" + this.getDefaultScoreCap()
+ " ff:" + String.valueOf(War.war.isDefaultFriendlyFire()) + " ff:" + String.valueOf(this.isDefaultFriendlyFire())
+ " autoassign:" + String.valueOf(War.war.isDefaultAutoAssignOnly()) + " autoassign:" + String.valueOf(this.isDefaultAutoAssignOnly())
+ " blockheads:" + String.valueOf(War.war.isDefaultBlockHeads()) + " flagpoints:" + String.valueOf(this.isDefaultFlagPointsOnly())
+ " spawnstyle:" + War.war.getDefaultSpawnStyle() + " blockheads:" + String.valueOf(this.isDefaultBlockHeads())
+ " flagreturn:" + War.war.getDefaultFlagReturn() + " spawnstyle:" + this.getDefaultSpawnStyle()
+ " monumentheal:" + War.war.getDefaultMonumentHeal() + " flagreturn:" + this.getDefaultFlagReturn()
+ " unbreakable:" + String.valueOf(War.war.isDefaultUnbreakableZoneBlocks()) + " monumentheal:" + this.getDefaultMonumentHeal()
+ " nocreatures:" + String.valueOf(War.war.isDefaultNoCreatures()) + " unbreakable:" + String.valueOf(this.isDefaultUnbreakableZoneBlocks())
+ " resetonempty:" + String.valueOf(War.war.isDefaultResetOnEmpty()) + " nocreatures:" + String.valueOf(this.isDefaultNoCreatures())
+ " resetonload:" + String.valueOf(War.war.isDefaultResetOnLoad()) + " resetonempty:" + String.valueOf(this.isDefaultResetOnEmpty())
+ " resetonunload:" + String.valueOf(War.war.isDefaultResetOnUnload()); + " resetonload:" + String.valueOf(this.isDefaultResetOnLoad())
+ " resetonunload:" + String.valueOf(this.isDefaultResetOnUnload());
} }
private void setZoneRallyPoint(String warzoneName, Player player) { private void setZoneRallyPoint(String warzoneName, Player player) {
@ -888,4 +891,12 @@ public class War extends JavaPlugin {
public void setDisconnected(HashMap<String, InventoryStash> disconnected) { public void setDisconnected(HashMap<String, InventoryStash> disconnected) {
this.disconnected = 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 List<ZoneWallGuard> zoneWallGuards = new ArrayList<ZoneWallGuard>();
private ZoneLobby lobby; private ZoneLobby lobby;
private boolean autoAssignOnly; private boolean autoAssignOnly;
private boolean flagPointsOnly;
private boolean blockHeads; private boolean blockHeads;
private boolean unbreakableZoneBlocks; private boolean unbreakableZoneBlocks;
private boolean disabled = false; private boolean disabled = false;
@ -167,6 +168,11 @@ public class Warzone {
return this.name; return this.name;
} }
@Override
public String toString() {
return this.getName();
}
public void setTeleport(Location location) { public void setTeleport(Location location) {
this.teleport = location; this.teleport = location;
} }
@ -381,6 +387,11 @@ public class Warzone {
return this.friendlyFire; return this.friendlyFire;
} }
public void setFriendlyFire(boolean ffOn) {
this.friendlyFire = ffOn;
}
public void setLoadout(HashMap<Integer, ItemStack> newLoadout) { public void setLoadout(HashMap<Integer, ItemStack> newLoadout) {
this.loadout.clear(); this.loadout.clear();
for (Integer slot : newLoadout.keySet()) { for (Integer slot : newLoadout.keySet()) {
@ -414,10 +425,6 @@ public class Warzone {
return this.monumentHeal; return this.monumentHeal;
} }
public void setFriendlyFire(boolean ffOn) {
this.friendlyFire = ffOn;
}
public boolean hasPlayerInventory(String playerName) { public boolean hasPlayerInventory(String playerName) {
return this.inventories.containsKey(playerName); return this.inventories.containsKey(playerName);
} }
@ -679,10 +686,6 @@ public class Warzone {
playerGuards.clear(); playerGuards.clear();
} }
public boolean getAutoAssignOnly() {
return this.isAutoAssignOnly();
}
public void setLobby(ZoneLobby lobby) { public void setLobby(ZoneLobby lobby) {
this.lobby = lobby; this.lobby = lobby;
} }
@ -754,7 +757,7 @@ public class Warzone {
for (Team t : teams) { 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."); 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())) { if (!t.getName().equals(playerTeam.getName())) {
// all other teams get a point // all other teams get a point
t.addPoint(); t.addPoint();
@ -1075,4 +1078,12 @@ public class Warzone {
public boolean isResetOnEmpty() { public boolean isResetOnEmpty() {
return this.resetOnEmpty; 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; rightSide = BlockFace.SOUTH;
} }
this.teamGateBlocks.clear(); this.teamGateBlocks.clear();
if (this.warzone.getAutoAssignOnly()) { if (this.warzone.isAutoAssignOnly()) {
this.autoAssignGate = new BlockInfo(lobbyMiddleWallBlock); this.autoAssignGate = new BlockInfo(lobbyMiddleWallBlock);
} else { } else {
this.autoAssignGate = null; this.autoAssignGate = null;

View File

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

View File

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