Fix for players being able to hurt members of their own faction while in their own land if the "enablePVPAgainstFactionlessInAttackersLand" option is enabled

This commit is contained in:
Brettflan 2011-09-16 01:45:23 -05:00
parent 443e083f23
commit 538b387f2f

View File

@ -204,21 +204,23 @@ public class FactionsEntityListener extends EntityListener {
return true;
}
if (!attacker.hasFaction() && Conf.disablePVPForFactionlessPlayers) {
Faction defendFaction = defender.getFaction();
Faction attackFaction = attacker.getFaction();
if (attackFaction.isNone() && Conf.disablePVPForFactionlessPlayers) {
attacker.sendMessage("You can't hurt other players until you join a faction.");
return false;
}
else if (defLocFaction == attacker.getFaction() && Conf.enablePVPAgainstFactionlessInAttackersLand) {
else if (defendFaction.isNone()) {
if (defLocFaction == attackFaction && Conf.enablePVPAgainstFactionlessInAttackersLand) {
// Allow PVP vs. Factionless in attacker's faction territory
return true;
}
else if (!defender.hasFaction() && Conf.disablePVPForFactionlessPlayers) {
else if (Conf.disablePVPForFactionlessPlayers) {
attacker.sendMessage("You can't hurt players who are not currently in a faction.");
return false;
}
Faction defendFaction = defender.getFaction();
Faction attackFaction = attacker.getFaction();
}
if (defendFaction.isPeaceful()) {
attacker.sendMessage("You can't hurt players who are in a peaceful faction.");