Closes gh-97. Closes gh-171. Closes gh-108. Closes gh-85. Closes gh-67. Zonemakers see magic walls when on a team, which should work instead of forcing zonemakers to use /zonemaker to enable zonemaker mode. Friendly fire setting should now get persisted properly. When a bouncing arrow hits you you shouldn't get a friendly fire message anymore. No scoring can occur if other teams are empty.

This commit is contained in:
taoneill 2011-05-15 11:35:08 -04:00
parent eb2e7ed91c
commit 04b917807c
8 changed files with 25 additions and 13 deletions

View File

@ -582,7 +582,7 @@ public class War extends JavaPlugin {
p.teleport(warzone.getTeleport());
this.msg(player, "You have left the warzone. Your inventory has (hopefully) been restored.");
}
team.setPoints(0);
team.resetPoints();
team.getPlayers().clear();
}
@ -1235,7 +1235,7 @@ public class War extends JavaPlugin {
wandBearers.put(player.getName(), zoneName);
player.getInventory().addItem(new ItemStack(Material.WOOD_SWORD, 1, (byte) 8));
//player.getWorld().dropItem(player.getLocation(), new ItemStack(Material.WOOD_SWORD));
this.msg(player, "You now have a wand for zone " + zoneName + ". Left-click for corner 1. Right-click for corner 2.");
this.msg(player, "You now have a wand for zone " + zoneName + ". Left-click with wodden sword for corner 1. Right-click for corner 2.");
}
}
}

View File

@ -185,7 +185,7 @@ public class WarBlockListener extends BlockListener {
}
war.msg(player, "You have team " + lostFlagTeam.getName() + "'s flag. Reach your team spawn or flag to capture it!");
} else {
war.msg(player, "You can't steal team " + lostFlagTeam.getName() + "'s flag since there are no players there.");
war.msg(player, "You can't steal team " + lostFlagTeam.getName() + "'s flag since no players are on that team.");
}
}
event.setCancelled(true);

View File

@ -105,6 +105,8 @@ public class WarEntityListener extends EntityListener {
"in the other teams in that warzone.");
} else if (defenderTeam == null) {
war.badMsg(a, "Your target is not in a team.");
} else if (attacker != null && defender != null && attacker.getEntityId() == defender.getEntityId()) {
// You just hit yourself, probably with a bouncing arrow
} else if (attackerTeam == defenderTeam) {
war.badMsg(a, "Your target is on your team.");
} else if (attackerWarzone != defenderWarzone) {
@ -113,9 +115,6 @@ public class WarEntityListener extends EntityListener {
event.setCancelled(true); // can't attack someone inside a warzone if you're not in a team
}
// if(event.isCancelled() && event instanceof EntityDamageByProjectileEvent) {
// //((EntityDamageByProjectileEvent)event).setBounce(true);
// }
} else if (defender instanceof Player && event instanceof EntityDamageByProjectileEvent) {
// attacked by dispenser arrow most probably
// Detect death, prevent it and respawn the player

View File

@ -261,7 +261,8 @@ public class WarPlayerListener extends PlayerListener {
// Zone walls
Warzone nearbyZone = war.zoneOfZoneWallAtProximity(playerLoc);
if(nearbyZone != null && !isMaker) { // zone makers don't get bothered with guard walls
Team currentTeam = war.getPlayerTeam(player.getName());
if(nearbyZone != null && (!isMaker || (isMaker && currentTeam != null))) { // zone makers don't get bothered with guard walls
nearbyZone.protectZoneWallAgainstPlayer(player);
} else { // zone makers still need to delete their walls
// make sure to delete any wall guards as you leave

View File

@ -349,7 +349,19 @@ public class Team {
}
public void addPoint() {
if (players.size()!=0) points++;
boolean atLeastOnePlayerOnTeam = players.size() != 0;
boolean atLeastOnePlayerOnOtherTeam = false;
for(Team team : warzone.getTeams()) {
if(!team.getName().equals(this.getName())
&& team.getPlayers().size() > 0) {
atLeastOnePlayerOnOtherTeam = true;
}
}
if (atLeastOnePlayerOnTeam && atLeastOnePlayerOnOtherTeam) {
points++;
} else if (!atLeastOnePlayerOnOtherTeam) {
this.teamcast("Can't score until at least one player joins another team.");
}
}
public int getPoints() {
@ -402,8 +414,8 @@ public class Team {
this.spawnVolume = volume;
}
public void setPoints(int score) {
if (players.size()!=0) this.points = score;
public void resetPoints() {
this.points = 0;
}
public void setFlagVolume(Volume flagVolume) {

View File

@ -932,7 +932,7 @@ public class Warzone {
if(zoneEmpty) {
// reset the zone for a new game when the last player leaves
for(Team team : this.getTeams()) {
team.setPoints(0);
team.resetPoints();
team.setRemainingLives(this.getLifePool());
}
this.getVolume().resetBlocksAsJob();

View File

@ -38,7 +38,7 @@ public class ScoreCapReachedJob implements Runnable {
}
}
}
t.setPoints(0);
t.resetPoints();
t.getPlayers().clear(); // empty the team
}
}

View File

@ -338,7 +338,7 @@ public class WarzoneMapper {
warzoneConfig.setString("teamFlags", teamFlagsStr);
// ff
warzoneConfig.setBoolean("firendlyFire", warzone.getFriendlyFire());
warzoneConfig.setBoolean("friendlyFire", warzone.getFriendlyFire());
// loadout
String loadoutStr = "";