mirror of
https://github.com/taoneill/war.git
synced 2025-03-11 06:00:48 +01:00
Fixed pvp being broken. Tim's refactor prevented attackers from being registered, messing up all of the damage checks.
This commit is contained in:
parent
5dcaac9351
commit
27584c51bb
@ -40,7 +40,7 @@ public class WarEntityListener extends EntityListener {
|
||||
Entity attacker = event.getDamager();
|
||||
Entity defender = event.getEntity();
|
||||
|
||||
if (attacker == null && defender != null && attacker instanceof Player && defender instanceof Player) {
|
||||
if (attacker != null && defender != null && attacker instanceof Player && defender instanceof Player) {
|
||||
// only let adversaries (same warzone, different team) attack each other
|
||||
Player a = (Player) attacker;
|
||||
Player d = (Player) defender;
|
||||
@ -86,12 +86,10 @@ public class WarEntityListener extends EntityListener {
|
||||
}
|
||||
} else if (attackerTeam == null && defenderTeam == null && War.war.canPvpOutsideZones(a)) {
|
||||
// let normal PVP through is its not turned off or if you have perms
|
||||
War.war.log("Allowed " + a.getDisplayName() + " to hit " + d.getDisplayName() + " ouside zone.", Level.INFO);
|
||||
} else if (attackerTeam == null && defenderTeam == null && !War.war.canPvpOutsideZones(a)) {
|
||||
if (!War.war.isDisablePvpMessage()) {
|
||||
War.war.badMsg(a, "You need the 'war.pvp' permission to attack players outside warzones.");
|
||||
}
|
||||
War.war.log("Prevented " + a.getDisplayName() + " from hitting " + d.getDisplayName() + " ouside zone.", Level.INFO);
|
||||
event.setCancelled(true); // global pvp is off
|
||||
} else {
|
||||
War.war.badMsg(a, "Your attack missed!");
|
||||
@ -106,7 +104,6 @@ public class WarEntityListener extends EntityListener {
|
||||
} else if (attackerWarzone != defenderWarzone) {
|
||||
War.war.badMsg(a, "Your target is playing in another warzone.");
|
||||
}
|
||||
War.war.log("Prevented " + a.getDisplayName() + " from hitting " + d.getDisplayName() + " somehow.", Level.INFO);
|
||||
event.setCancelled(true); // can't attack someone inside a warzone if you're not in a team
|
||||
}
|
||||
} else if (defender instanceof Player) {
|
||||
|
@ -290,7 +290,7 @@ public class WarPlayerListener extends PlayerListener {
|
||||
War.war.getWarHub().resetZoneSign(zone);
|
||||
}
|
||||
zone.keepPlayerInventory(player);
|
||||
War.war.msg(player, "Your inventory is in storage until you /leave.");
|
||||
War.war.msg(player, "Your inventory is in storage until you use '/war leave'.");
|
||||
zone.respawnPlayer(event, team, player);
|
||||
for (Team t : zone.getTeams()) {
|
||||
t.teamcast("" + player.getName() + " joined team " + team.getName() + ".");
|
||||
@ -342,7 +342,7 @@ public class WarPlayerListener extends PlayerListener {
|
||||
if (playerWarzone != null) {
|
||||
// Player belongs to a warzone team but is outside: he snuck out or is at spawn and died
|
||||
if (locZone == null && playerTeam != null && playerWarzone.getLobby() != null && !playerWarzone.getLobby().getVolume().contains(playerLoc) && !isLeaving) {
|
||||
War.war.badMsg(player, "Use /leave to exit the zone.");
|
||||
War.war.badMsg(player, "Use /leave (or /war leave) to exit the zone.");
|
||||
event.setTo(playerTeam.getTeamSpawn());
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user