mirror of
https://github.com/taoneill/war.git
synced 2024-11-14 06:17:01 +01:00
Tested that zone maker can play all games.
This commit is contained in:
parent
eaf713fb1e
commit
28d2e90ee0
File diff suppressed because it is too large
Load Diff
@ -34,13 +34,12 @@ public class WarBlockListener extends BlockListener {
|
|||||||
boolean captured = false;
|
boolean captured = false;
|
||||||
if(player != null && block != null) {
|
if(player != null && block != null) {
|
||||||
Team team = war.getPlayerTeam(player.getName());
|
Team team = war.getPlayerTeam(player.getName());
|
||||||
Warzone zone = war.getPlayerTeamWarzone(player.getName());
|
Warzone zone = war.warzone(player.getLocation());
|
||||||
boolean isZoneMaker = war.isZoneMaker(player);
|
|
||||||
if(team != null && block != null && zone != null
|
if(team != null && block != null && zone != null
|
||||||
&& zone.isMonumentCenterBlock(block)
|
&& zone.isMonumentCenterBlock(block)
|
||||||
&& block.getType() == team.getMaterial()) {
|
&& block.getType() == team.getMaterial()) {
|
||||||
Monument monument = zone.getMonumentFromCenterBlock(block);
|
Monument monument = zone.getMonumentFromCenterBlock(block);
|
||||||
if(!monument.hasOwner()) {
|
if(monument != null && !monument.hasOwner()) {
|
||||||
monument.capture(team);
|
monument.capture(team);
|
||||||
List<Team> teams = zone.getTeams();
|
List<Team> teams = zone.getTeams();
|
||||||
for(Team t : teams) {
|
for(Team t : teams) {
|
||||||
@ -61,14 +60,12 @@ public class WarBlockListener extends BlockListener {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// protect warzone lobbies
|
// protect warzone lobbies
|
||||||
if(block != null) {
|
for(Warzone wz: war.getWarzones()) {
|
||||||
for(Warzone wz: war.getWarzones()) {
|
if(wz.getLobby() != null && wz.getLobby().getVolume().contains(block)) {
|
||||||
if(wz.getLobby() != null && wz.getLobby().getVolume().contains(block)) {
|
player.sendMessage(war.str("Can't build here."));
|
||||||
player.sendMessage(war.str("Can't build here."));
|
event.setCancelled(true);
|
||||||
event.setCancelled(true);
|
return;
|
||||||
return;
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// protect the hub
|
// protect the hub
|
||||||
if(war.getWarHub() != null && war.getWarHub().getVolume().contains(block)) {
|
if(war.getWarHub() != null && war.getWarHub().getVolume().contains(block)) {
|
||||||
|
@ -255,27 +255,31 @@ public class WarPlayerListener extends PlayerListener {
|
|||||||
if(playerWarzone.isFlagThief(player.getName())
|
if(playerWarzone.isFlagThief(player.getName())
|
||||||
&& (team.getSpawnVolume().contains(player.getLocation())
|
&& (team.getSpawnVolume().contains(player.getLocation())
|
||||||
|| (team.getFlagVolume() != null && team.getFlagVolume().contains(player.getLocation())))) {
|
|| (team.getFlagVolume() != null && team.getFlagVolume().contains(player.getLocation())))) {
|
||||||
synchronized(playerWarzone) {
|
if(playerWarzone.isTeamFlagStolen(team)) {
|
||||||
// flags can be captured at own spawn or own flag pole
|
player.sendMessage(war.str("You can't capture the enemy flag until your team flag is returned."));
|
||||||
team.addPoint();
|
} else {
|
||||||
if(team.getPoints() >= playerWarzone.getScoreCap()) {
|
synchronized(playerWarzone) {
|
||||||
event.setFrom(playerWarzone.getTeleport());
|
// flags can be captured at own spawn or own flag pole
|
||||||
handleScoreCapReached(team.getName(), playerWarzone);
|
team.addPoint();
|
||||||
event.setCancelled(true);
|
if(team.getPoints() >= playerWarzone.getScoreCap()) {
|
||||||
} else {
|
event.setFrom(playerWarzone.getTeleport());
|
||||||
// added a point
|
handleScoreCapReached(team.getName(), playerWarzone);
|
||||||
Team victim = playerWarzone.getVictimTeamForThief(player.getName());
|
event.setCancelled(true);
|
||||||
victim.getFlagVolume().resetBlocks(); // bring back flag to team that lost it
|
} else {
|
||||||
victim.initializeTeamFlag();
|
// added a point
|
||||||
for(Team t : playerWarzone.getTeams()) {
|
Team victim = playerWarzone.getVictimTeamForThief(player.getName());
|
||||||
t.teamcast(war.str(player.getName() + " captured team " + victim.getName()
|
victim.getFlagVolume().resetBlocks(); // bring back flag to team that lost it
|
||||||
+ "'s flag. Team " + team.getName() + " scores one point." ));
|
victim.initializeTeamFlag();
|
||||||
}
|
for(Team t : playerWarzone.getTeams()) {
|
||||||
playerWarzone.respawnPlayer(event, team, player);
|
t.teamcast(war.str(player.getName() + " captured team " + victim.getName()
|
||||||
team.resetSign();
|
+ "'s flag. Team " + team.getName() + " scores one point." ));
|
||||||
playerWarzone.getLobby().resetTeamGateSign(team);
|
}
|
||||||
}
|
playerWarzone.respawnPlayer(event, team, player);
|
||||||
playerWarzone.removeThief(player.getName());
|
team.resetSign();
|
||||||
|
playerWarzone.getLobby().resetTeamGateSign(team);
|
||||||
|
}
|
||||||
|
playerWarzone.removeThief(player.getName());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (locZone != null && locZone.getLobby() != null
|
} else if (locZone != null && locZone.getLobby() != null
|
||||||
|
@ -862,6 +862,15 @@ public class Warzone {
|
|||||||
public void clearFlagThieves() {
|
public void clearFlagThieves() {
|
||||||
flagThieves.clear();
|
flagThieves.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean isTeamFlagStolen(Team team) {
|
||||||
|
for(String playerKey : flagThieves.keySet()) {
|
||||||
|
if(flagThieves.get(playerKey).getName().equals(team.getName())) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user