Tested that zone maker can play all games.

This commit is contained in:
taoneill 2011-01-29 20:10:03 -05:00
parent eaf713fb1e
commit 28d2e90ee0
4 changed files with 804 additions and 789 deletions

File diff suppressed because it is too large Load Diff

View File

@ -34,13 +34,12 @@ public class WarBlockListener extends BlockListener {
boolean captured = false;
if(player != null && block != null) {
Team team = war.getPlayerTeam(player.getName());
Warzone zone = war.getPlayerTeamWarzone(player.getName());
boolean isZoneMaker = war.isZoneMaker(player);
Warzone zone = war.warzone(player.getLocation());
if(team != null && block != null && zone != null
&& zone.isMonumentCenterBlock(block)
&& block.getType() == team.getMaterial()) {
Monument monument = zone.getMonumentFromCenterBlock(block);
if(!monument.hasOwner()) {
if(monument != null && !monument.hasOwner()) {
monument.capture(team);
List<Team> teams = zone.getTeams();
for(Team t : teams) {
@ -61,14 +60,12 @@ public class WarBlockListener extends BlockListener {
return;
}
// protect warzone lobbies
if(block != null) {
for(Warzone wz: war.getWarzones()) {
if(wz.getLobby() != null && wz.getLobby().getVolume().contains(block)) {
player.sendMessage(war.str("Can't build here."));
event.setCancelled(true);
return;
}
}
for(Warzone wz: war.getWarzones()) {
if(wz.getLobby() != null && wz.getLobby().getVolume().contains(block)) {
player.sendMessage(war.str("Can't build here."));
event.setCancelled(true);
return;
}
}
// protect the hub
if(war.getWarHub() != null && war.getWarHub().getVolume().contains(block)) {

View File

@ -255,27 +255,31 @@ public class WarPlayerListener extends PlayerListener {
if(playerWarzone.isFlagThief(player.getName())
&& (team.getSpawnVolume().contains(player.getLocation())
|| (team.getFlagVolume() != null && team.getFlagVolume().contains(player.getLocation())))) {
synchronized(playerWarzone) {
// flags can be captured at own spawn or own flag pole
team.addPoint();
if(team.getPoints() >= playerWarzone.getScoreCap()) {
event.setFrom(playerWarzone.getTeleport());
handleScoreCapReached(team.getName(), playerWarzone);
event.setCancelled(true);
} else {
// added a point
Team victim = playerWarzone.getVictimTeamForThief(player.getName());
victim.getFlagVolume().resetBlocks(); // bring back flag to team that lost it
victim.initializeTeamFlag();
for(Team t : playerWarzone.getTeams()) {
t.teamcast(war.str(player.getName() + " captured team " + victim.getName()
+ "'s flag. Team " + team.getName() + " scores one point." ));
}
playerWarzone.respawnPlayer(event, team, player);
team.resetSign();
playerWarzone.getLobby().resetTeamGateSign(team);
}
playerWarzone.removeThief(player.getName());
if(playerWarzone.isTeamFlagStolen(team)) {
player.sendMessage(war.str("You can't capture the enemy flag until your team flag is returned."));
} else {
synchronized(playerWarzone) {
// flags can be captured at own spawn or own flag pole
team.addPoint();
if(team.getPoints() >= playerWarzone.getScoreCap()) {
event.setFrom(playerWarzone.getTeleport());
handleScoreCapReached(team.getName(), playerWarzone);
event.setCancelled(true);
} else {
// added a point
Team victim = playerWarzone.getVictimTeamForThief(player.getName());
victim.getFlagVolume().resetBlocks(); // bring back flag to team that lost it
victim.initializeTeamFlag();
for(Team t : playerWarzone.getTeams()) {
t.teamcast(war.str(player.getName() + " captured team " + victim.getName()
+ "'s flag. Team " + team.getName() + " scores one point." ));
}
playerWarzone.respawnPlayer(event, team, player);
team.resetSign();
playerWarzone.getLobby().resetTeamGateSign(team);
}
playerWarzone.removeThief(player.getName());
}
}
}
} else if (locZone != null && locZone.getLobby() != null

View File

@ -862,6 +862,15 @@ public class Warzone {
public void clearFlagThieves() {
flagThieves.clear();
}
public boolean isTeamFlagStolen(Team team) {
for(String playerKey : flagThieves.keySet()) {
if(flagThieves.get(playerKey).getName().equals(team.getName())) {
return true;
}
}
return false;
}
}