Fixed bug where some NPCs near the wilderness were incorrectly considered to be in the wilderness for aggression checks
This commit is contained in:
@@ -72,7 +72,7 @@ public class AggressiveBehavior {
|
||||
}
|
||||
if (entity instanceof NPC && target instanceof Player) {
|
||||
NPC npc = (NPC) entity;
|
||||
if (npc.getAggressiveHandler() != null && npc.getAggressiveHandler().isAllowTolerance() && WildernessZone.getWilderness(npc) == -1) {
|
||||
if (npc.getAggressiveHandler() != null && npc.getAggressiveHandler().isAllowTolerance() && !WildernessZone.isInZone(npc)) {
|
||||
if (RegionManager.forId(regionId).isTolerated(target.asPlayer())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -296,10 +296,9 @@ public final class WildernessZone extends MapZone {
|
||||
*/
|
||||
public static boolean isInZone(Entity e) {
|
||||
Location l = e.getLocation();
|
||||
for (RegionZone zone : e.getViewport().getRegion().getRegionZones()) {
|
||||
if (zone.getZone() == INSTANCE && zone.getBorders().insideBorder(l.getX(), l.getY())) {
|
||||
for (ZoneBorders z : INSTANCE.borders) {
|
||||
if (z.insideBorder(e))
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user