From dcbb9a5cd91361bc93d4c642664ac3e9f99fea99 Mon Sep 17 00:00:00 2001 From: MobiusDevelopment <8391001+MobiusDevelopment@users.noreply.github.com> Date: Mon, 16 Aug 2021 21:33:25 +0000 Subject: [PATCH] ZoneType stream removal. --- .../gameserver/model/zone/ZoneType.java | 31 +++++++++++++------ .../gameserver/model/zone/ZoneType.java | 31 +++++++++++++------ .../gameserver/model/zone/ZoneType.java | 31 +++++++++++++------ .../gameserver/model/zone/ZoneType.java | 31 +++++++++++++------ .../gameserver/model/zone/ZoneType.java | 31 +++++++++++++------ .../gameserver/model/zone/ZoneType.java | 31 +++++++++++++------ .../gameserver/model/zone/ZoneType.java | 31 +++++++++++++------ .../gameserver/model/zone/ZoneType.java | 31 +++++++++++++------ .../gameserver/model/zone/ZoneType.java | 31 +++++++++++++------ .../gameserver/model/zone/ZoneType.java | 31 +++++++++++++------ .../gameserver/model/zone/ZoneType.java | 31 +++++++++++++------ .../gameserver/model/zone/ZoneType.java | 31 +++++++++++++------ .../gameserver/model/zone/ZoneType.java | 31 +++++++++++++------ .../gameserver/model/zone/ZoneType.java | 31 +++++++++++++------ .../gameserver/model/zone/ZoneType.java | 31 +++++++++++++------ .../gameserver/model/zone/ZoneType.java | 31 +++++++++++++------ .../gameserver/model/zone/ZoneType.java | 31 +++++++++++++------ .../gameserver/model/zone/ZoneType.java | 31 +++++++++++++------ .../gameserver/model/zone/ZoneType.java | 31 +++++++++++++------ .../gameserver/model/zone/ZoneType.java | 31 +++++++++++++------ .../gameserver/model/zone/ZoneType.java | 31 +++++++++++++------ 21 files changed, 462 insertions(+), 189 deletions(-) diff --git a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/zone/ZoneType.java b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/zone/ZoneType.java index af436d2882..1383aefa9c 100644 --- a/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/zone/ZoneType.java +++ b/L2J_Mobius_1.0_Ertheia/java/org/l2jmobius/gameserver/model/zone/ZoneType.java @@ -47,7 +47,7 @@ public abstract class ZoneType extends ListenersContainer private final int _id; protected ZoneForm _zone; - protected List _blockedZone; + protected List _blockedZones; private final Map _characterList = new ConcurrentHashMap<>(); /** Parameters to affect specific characters */ @@ -306,16 +306,16 @@ public abstract class ZoneType extends ListenersContainer public void setBlockedZones(List blockedZones) { - if (_blockedZone != null) + if (_blockedZones != null) { throw new IllegalStateException("Blocked zone already set"); } - _blockedZone = blockedZones; + _blockedZones = blockedZones; } public List getBlockedZones() { - return _blockedZone; + return _blockedZones; } /** @@ -337,7 +337,7 @@ public abstract class ZoneType extends ListenersContainer } /** - * Checks if the given coordinates are within the zone, ignores instanceId check + * Checks if the given coordinates are within the zone, ignores instanceId check. * @param x * @param y * @param z @@ -345,18 +345,31 @@ public abstract class ZoneType extends ListenersContainer */ public boolean isInsideZone(int x, int y, int z) { - return _zone.isInsideZone(x, y, z) && !isInsideBannedZone(x, y, z); + return (_zone != null) && _zone.isInsideZone(x, y, z) && !isInsideBlockedZone(x, y, z); } /** * @param x * @param y * @param z - * @return {@code true} if this location is within banned zone boundaries, {@code false} otherwise + * @return {@code true} if this location is within blocked zone boundaries, {@code false} otherwise. */ - public boolean isInsideBannedZone(int x, int y, int z) + public boolean isInsideBlockedZone(int x, int y, int z) { - return (_blockedZone != null) && _blockedZone.stream().allMatch(zone -> !zone.isInsideZone(x, y, z)); + if ((_blockedZones == null) || _blockedZones.isEmpty()) + { + return false; + } + + for (ZoneForm zone : _blockedZones) + { + if (zone.isInsideZone(x, y, z)) + { + return true; + } + } + + return false; } /** diff --git a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/zone/ZoneType.java b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/zone/ZoneType.java index af436d2882..1383aefa9c 100644 --- a/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/zone/ZoneType.java +++ b/L2J_Mobius_2.5_Underground/java/org/l2jmobius/gameserver/model/zone/ZoneType.java @@ -47,7 +47,7 @@ public abstract class ZoneType extends ListenersContainer private final int _id; protected ZoneForm _zone; - protected List _blockedZone; + protected List _blockedZones; private final Map _characterList = new ConcurrentHashMap<>(); /** Parameters to affect specific characters */ @@ -306,16 +306,16 @@ public abstract class ZoneType extends ListenersContainer public void setBlockedZones(List blockedZones) { - if (_blockedZone != null) + if (_blockedZones != null) { throw new IllegalStateException("Blocked zone already set"); } - _blockedZone = blockedZones; + _blockedZones = blockedZones; } public List getBlockedZones() { - return _blockedZone; + return _blockedZones; } /** @@ -337,7 +337,7 @@ public abstract class ZoneType extends ListenersContainer } /** - * Checks if the given coordinates are within the zone, ignores instanceId check + * Checks if the given coordinates are within the zone, ignores instanceId check. * @param x * @param y * @param z @@ -345,18 +345,31 @@ public abstract class ZoneType extends ListenersContainer */ public boolean isInsideZone(int x, int y, int z) { - return _zone.isInsideZone(x, y, z) && !isInsideBannedZone(x, y, z); + return (_zone != null) && _zone.isInsideZone(x, y, z) && !isInsideBlockedZone(x, y, z); } /** * @param x * @param y * @param z - * @return {@code true} if this location is within banned zone boundaries, {@code false} otherwise + * @return {@code true} if this location is within blocked zone boundaries, {@code false} otherwise. */ - public boolean isInsideBannedZone(int x, int y, int z) + public boolean isInsideBlockedZone(int x, int y, int z) { - return (_blockedZone != null) && _blockedZone.stream().allMatch(zone -> !zone.isInsideZone(x, y, z)); + if ((_blockedZones == null) || _blockedZones.isEmpty()) + { + return false; + } + + for (ZoneForm zone : _blockedZones) + { + if (zone.isInsideZone(x, y, z)) + { + return true; + } + } + + return false; } /** diff --git a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/zone/ZoneType.java b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/zone/ZoneType.java index af436d2882..1383aefa9c 100644 --- a/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/zone/ZoneType.java +++ b/L2J_Mobius_3.0_Helios/java/org/l2jmobius/gameserver/model/zone/ZoneType.java @@ -47,7 +47,7 @@ public abstract class ZoneType extends ListenersContainer private final int _id; protected ZoneForm _zone; - protected List _blockedZone; + protected List _blockedZones; private final Map _characterList = new ConcurrentHashMap<>(); /** Parameters to affect specific characters */ @@ -306,16 +306,16 @@ public abstract class ZoneType extends ListenersContainer public void setBlockedZones(List blockedZones) { - if (_blockedZone != null) + if (_blockedZones != null) { throw new IllegalStateException("Blocked zone already set"); } - _blockedZone = blockedZones; + _blockedZones = blockedZones; } public List getBlockedZones() { - return _blockedZone; + return _blockedZones; } /** @@ -337,7 +337,7 @@ public abstract class ZoneType extends ListenersContainer } /** - * Checks if the given coordinates are within the zone, ignores instanceId check + * Checks if the given coordinates are within the zone, ignores instanceId check. * @param x * @param y * @param z @@ -345,18 +345,31 @@ public abstract class ZoneType extends ListenersContainer */ public boolean isInsideZone(int x, int y, int z) { - return _zone.isInsideZone(x, y, z) && !isInsideBannedZone(x, y, z); + return (_zone != null) && _zone.isInsideZone(x, y, z) && !isInsideBlockedZone(x, y, z); } /** * @param x * @param y * @param z - * @return {@code true} if this location is within banned zone boundaries, {@code false} otherwise + * @return {@code true} if this location is within blocked zone boundaries, {@code false} otherwise. */ - public boolean isInsideBannedZone(int x, int y, int z) + public boolean isInsideBlockedZone(int x, int y, int z) { - return (_blockedZone != null) && _blockedZone.stream().allMatch(zone -> !zone.isInsideZone(x, y, z)); + if ((_blockedZones == null) || _blockedZones.isEmpty()) + { + return false; + } + + for (ZoneForm zone : _blockedZones) + { + if (zone.isInsideZone(x, y, z)) + { + return true; + } + } + + return false; } /** diff --git a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/zone/ZoneType.java b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/zone/ZoneType.java index af436d2882..1383aefa9c 100644 --- a/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/zone/ZoneType.java +++ b/L2J_Mobius_4.0_GrandCrusade/java/org/l2jmobius/gameserver/model/zone/ZoneType.java @@ -47,7 +47,7 @@ public abstract class ZoneType extends ListenersContainer private final int _id; protected ZoneForm _zone; - protected List _blockedZone; + protected List _blockedZones; private final Map _characterList = new ConcurrentHashMap<>(); /** Parameters to affect specific characters */ @@ -306,16 +306,16 @@ public abstract class ZoneType extends ListenersContainer public void setBlockedZones(List blockedZones) { - if (_blockedZone != null) + if (_blockedZones != null) { throw new IllegalStateException("Blocked zone already set"); } - _blockedZone = blockedZones; + _blockedZones = blockedZones; } public List getBlockedZones() { - return _blockedZone; + return _blockedZones; } /** @@ -337,7 +337,7 @@ public abstract class ZoneType extends ListenersContainer } /** - * Checks if the given coordinates are within the zone, ignores instanceId check + * Checks if the given coordinates are within the zone, ignores instanceId check. * @param x * @param y * @param z @@ -345,18 +345,31 @@ public abstract class ZoneType extends ListenersContainer */ public boolean isInsideZone(int x, int y, int z) { - return _zone.isInsideZone(x, y, z) && !isInsideBannedZone(x, y, z); + return (_zone != null) && _zone.isInsideZone(x, y, z) && !isInsideBlockedZone(x, y, z); } /** * @param x * @param y * @param z - * @return {@code true} if this location is within banned zone boundaries, {@code false} otherwise + * @return {@code true} if this location is within blocked zone boundaries, {@code false} otherwise. */ - public boolean isInsideBannedZone(int x, int y, int z) + public boolean isInsideBlockedZone(int x, int y, int z) { - return (_blockedZone != null) && _blockedZone.stream().allMatch(zone -> !zone.isInsideZone(x, y, z)); + if ((_blockedZones == null) || _blockedZones.isEmpty()) + { + return false; + } + + for (ZoneForm zone : _blockedZones) + { + if (zone.isInsideZone(x, y, z)) + { + return true; + } + } + + return false; } /** diff --git a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/zone/ZoneType.java b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/zone/ZoneType.java index af436d2882..1383aefa9c 100644 --- a/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/zone/ZoneType.java +++ b/L2J_Mobius_5.0_Salvation/java/org/l2jmobius/gameserver/model/zone/ZoneType.java @@ -47,7 +47,7 @@ public abstract class ZoneType extends ListenersContainer private final int _id; protected ZoneForm _zone; - protected List _blockedZone; + protected List _blockedZones; private final Map _characterList = new ConcurrentHashMap<>(); /** Parameters to affect specific characters */ @@ -306,16 +306,16 @@ public abstract class ZoneType extends ListenersContainer public void setBlockedZones(List blockedZones) { - if (_blockedZone != null) + if (_blockedZones != null) { throw new IllegalStateException("Blocked zone already set"); } - _blockedZone = blockedZones; + _blockedZones = blockedZones; } public List getBlockedZones() { - return _blockedZone; + return _blockedZones; } /** @@ -337,7 +337,7 @@ public abstract class ZoneType extends ListenersContainer } /** - * Checks if the given coordinates are within the zone, ignores instanceId check + * Checks if the given coordinates are within the zone, ignores instanceId check. * @param x * @param y * @param z @@ -345,18 +345,31 @@ public abstract class ZoneType extends ListenersContainer */ public boolean isInsideZone(int x, int y, int z) { - return _zone.isInsideZone(x, y, z) && !isInsideBannedZone(x, y, z); + return (_zone != null) && _zone.isInsideZone(x, y, z) && !isInsideBlockedZone(x, y, z); } /** * @param x * @param y * @param z - * @return {@code true} if this location is within banned zone boundaries, {@code false} otherwise + * @return {@code true} if this location is within blocked zone boundaries, {@code false} otherwise. */ - public boolean isInsideBannedZone(int x, int y, int z) + public boolean isInsideBlockedZone(int x, int y, int z) { - return (_blockedZone != null) && _blockedZone.stream().allMatch(zone -> !zone.isInsideZone(x, y, z)); + if ((_blockedZones == null) || _blockedZones.isEmpty()) + { + return false; + } + + for (ZoneForm zone : _blockedZones) + { + if (zone.isInsideZone(x, y, z)) + { + return true; + } + } + + return false; } /** diff --git a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/zone/ZoneType.java b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/zone/ZoneType.java index af436d2882..1383aefa9c 100644 --- a/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/zone/ZoneType.java +++ b/L2J_Mobius_5.5_EtinasFate/java/org/l2jmobius/gameserver/model/zone/ZoneType.java @@ -47,7 +47,7 @@ public abstract class ZoneType extends ListenersContainer private final int _id; protected ZoneForm _zone; - protected List _blockedZone; + protected List _blockedZones; private final Map _characterList = new ConcurrentHashMap<>(); /** Parameters to affect specific characters */ @@ -306,16 +306,16 @@ public abstract class ZoneType extends ListenersContainer public void setBlockedZones(List blockedZones) { - if (_blockedZone != null) + if (_blockedZones != null) { throw new IllegalStateException("Blocked zone already set"); } - _blockedZone = blockedZones; + _blockedZones = blockedZones; } public List getBlockedZones() { - return _blockedZone; + return _blockedZones; } /** @@ -337,7 +337,7 @@ public abstract class ZoneType extends ListenersContainer } /** - * Checks if the given coordinates are within the zone, ignores instanceId check + * Checks if the given coordinates are within the zone, ignores instanceId check. * @param x * @param y * @param z @@ -345,18 +345,31 @@ public abstract class ZoneType extends ListenersContainer */ public boolean isInsideZone(int x, int y, int z) { - return _zone.isInsideZone(x, y, z) && !isInsideBannedZone(x, y, z); + return (_zone != null) && _zone.isInsideZone(x, y, z) && !isInsideBlockedZone(x, y, z); } /** * @param x * @param y * @param z - * @return {@code true} if this location is within banned zone boundaries, {@code false} otherwise + * @return {@code true} if this location is within blocked zone boundaries, {@code false} otherwise. */ - public boolean isInsideBannedZone(int x, int y, int z) + public boolean isInsideBlockedZone(int x, int y, int z) { - return (_blockedZone != null) && _blockedZone.stream().allMatch(zone -> !zone.isInsideZone(x, y, z)); + if ((_blockedZones == null) || _blockedZones.isEmpty()) + { + return false; + } + + for (ZoneForm zone : _blockedZones) + { + if (zone.isInsideZone(x, y, z)) + { + return true; + } + } + + return false; } /** diff --git a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/zone/ZoneType.java b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/zone/ZoneType.java index af436d2882..1383aefa9c 100644 --- a/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/zone/ZoneType.java +++ b/L2J_Mobius_6.0_Fafurion/java/org/l2jmobius/gameserver/model/zone/ZoneType.java @@ -47,7 +47,7 @@ public abstract class ZoneType extends ListenersContainer private final int _id; protected ZoneForm _zone; - protected List _blockedZone; + protected List _blockedZones; private final Map _characterList = new ConcurrentHashMap<>(); /** Parameters to affect specific characters */ @@ -306,16 +306,16 @@ public abstract class ZoneType extends ListenersContainer public void setBlockedZones(List blockedZones) { - if (_blockedZone != null) + if (_blockedZones != null) { throw new IllegalStateException("Blocked zone already set"); } - _blockedZone = blockedZones; + _blockedZones = blockedZones; } public List getBlockedZones() { - return _blockedZone; + return _blockedZones; } /** @@ -337,7 +337,7 @@ public abstract class ZoneType extends ListenersContainer } /** - * Checks if the given coordinates are within the zone, ignores instanceId check + * Checks if the given coordinates are within the zone, ignores instanceId check. * @param x * @param y * @param z @@ -345,18 +345,31 @@ public abstract class ZoneType extends ListenersContainer */ public boolean isInsideZone(int x, int y, int z) { - return _zone.isInsideZone(x, y, z) && !isInsideBannedZone(x, y, z); + return (_zone != null) && _zone.isInsideZone(x, y, z) && !isInsideBlockedZone(x, y, z); } /** * @param x * @param y * @param z - * @return {@code true} if this location is within banned zone boundaries, {@code false} otherwise + * @return {@code true} if this location is within blocked zone boundaries, {@code false} otherwise. */ - public boolean isInsideBannedZone(int x, int y, int z) + public boolean isInsideBlockedZone(int x, int y, int z) { - return (_blockedZone != null) && _blockedZone.stream().allMatch(zone -> !zone.isInsideZone(x, y, z)); + if ((_blockedZones == null) || _blockedZones.isEmpty()) + { + return false; + } + + for (ZoneForm zone : _blockedZones) + { + if (zone.isInsideZone(x, y, z)) + { + return true; + } + } + + return false; } /** diff --git a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/zone/ZoneType.java b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/zone/ZoneType.java index af436d2882..1383aefa9c 100644 --- a/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/zone/ZoneType.java +++ b/L2J_Mobius_7.0_PreludeOfWar/java/org/l2jmobius/gameserver/model/zone/ZoneType.java @@ -47,7 +47,7 @@ public abstract class ZoneType extends ListenersContainer private final int _id; protected ZoneForm _zone; - protected List _blockedZone; + protected List _blockedZones; private final Map _characterList = new ConcurrentHashMap<>(); /** Parameters to affect specific characters */ @@ -306,16 +306,16 @@ public abstract class ZoneType extends ListenersContainer public void setBlockedZones(List blockedZones) { - if (_blockedZone != null) + if (_blockedZones != null) { throw new IllegalStateException("Blocked zone already set"); } - _blockedZone = blockedZones; + _blockedZones = blockedZones; } public List getBlockedZones() { - return _blockedZone; + return _blockedZones; } /** @@ -337,7 +337,7 @@ public abstract class ZoneType extends ListenersContainer } /** - * Checks if the given coordinates are within the zone, ignores instanceId check + * Checks if the given coordinates are within the zone, ignores instanceId check. * @param x * @param y * @param z @@ -345,18 +345,31 @@ public abstract class ZoneType extends ListenersContainer */ public boolean isInsideZone(int x, int y, int z) { - return _zone.isInsideZone(x, y, z) && !isInsideBannedZone(x, y, z); + return (_zone != null) && _zone.isInsideZone(x, y, z) && !isInsideBlockedZone(x, y, z); } /** * @param x * @param y * @param z - * @return {@code true} if this location is within banned zone boundaries, {@code false} otherwise + * @return {@code true} if this location is within blocked zone boundaries, {@code false} otherwise. */ - public boolean isInsideBannedZone(int x, int y, int z) + public boolean isInsideBlockedZone(int x, int y, int z) { - return (_blockedZone != null) && _blockedZone.stream().allMatch(zone -> !zone.isInsideZone(x, y, z)); + if ((_blockedZones == null) || _blockedZones.isEmpty()) + { + return false; + } + + for (ZoneForm zone : _blockedZones) + { + if (zone.isInsideZone(x, y, z)) + { + return true; + } + } + + return false; } /** diff --git a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/zone/ZoneType.java b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/zone/ZoneType.java index af436d2882..1383aefa9c 100644 --- a/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/zone/ZoneType.java +++ b/L2J_Mobius_8.0_Homunculus/java/org/l2jmobius/gameserver/model/zone/ZoneType.java @@ -47,7 +47,7 @@ public abstract class ZoneType extends ListenersContainer private final int _id; protected ZoneForm _zone; - protected List _blockedZone; + protected List _blockedZones; private final Map _characterList = new ConcurrentHashMap<>(); /** Parameters to affect specific characters */ @@ -306,16 +306,16 @@ public abstract class ZoneType extends ListenersContainer public void setBlockedZones(List blockedZones) { - if (_blockedZone != null) + if (_blockedZones != null) { throw new IllegalStateException("Blocked zone already set"); } - _blockedZone = blockedZones; + _blockedZones = blockedZones; } public List getBlockedZones() { - return _blockedZone; + return _blockedZones; } /** @@ -337,7 +337,7 @@ public abstract class ZoneType extends ListenersContainer } /** - * Checks if the given coordinates are within the zone, ignores instanceId check + * Checks if the given coordinates are within the zone, ignores instanceId check. * @param x * @param y * @param z @@ -345,18 +345,31 @@ public abstract class ZoneType extends ListenersContainer */ public boolean isInsideZone(int x, int y, int z) { - return _zone.isInsideZone(x, y, z) && !isInsideBannedZone(x, y, z); + return (_zone != null) && _zone.isInsideZone(x, y, z) && !isInsideBlockedZone(x, y, z); } /** * @param x * @param y * @param z - * @return {@code true} if this location is within banned zone boundaries, {@code false} otherwise + * @return {@code true} if this location is within blocked zone boundaries, {@code false} otherwise. */ - public boolean isInsideBannedZone(int x, int y, int z) + public boolean isInsideBlockedZone(int x, int y, int z) { - return (_blockedZone != null) && _blockedZone.stream().allMatch(zone -> !zone.isInsideZone(x, y, z)); + if ((_blockedZones == null) || _blockedZones.isEmpty()) + { + return false; + } + + for (ZoneForm zone : _blockedZones) + { + if (zone.isInsideZone(x, y, z)) + { + return true; + } + } + + return false; } /** diff --git a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/zone/ZoneType.java b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/zone/ZoneType.java index af436d2882..1383aefa9c 100644 --- a/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/zone/ZoneType.java +++ b/L2J_Mobius_9.0_ReturnOfTheQueenAnt/java/org/l2jmobius/gameserver/model/zone/ZoneType.java @@ -47,7 +47,7 @@ public abstract class ZoneType extends ListenersContainer private final int _id; protected ZoneForm _zone; - protected List _blockedZone; + protected List _blockedZones; private final Map _characterList = new ConcurrentHashMap<>(); /** Parameters to affect specific characters */ @@ -306,16 +306,16 @@ public abstract class ZoneType extends ListenersContainer public void setBlockedZones(List blockedZones) { - if (_blockedZone != null) + if (_blockedZones != null) { throw new IllegalStateException("Blocked zone already set"); } - _blockedZone = blockedZones; + _blockedZones = blockedZones; } public List getBlockedZones() { - return _blockedZone; + return _blockedZones; } /** @@ -337,7 +337,7 @@ public abstract class ZoneType extends ListenersContainer } /** - * Checks if the given coordinates are within the zone, ignores instanceId check + * Checks if the given coordinates are within the zone, ignores instanceId check. * @param x * @param y * @param z @@ -345,18 +345,31 @@ public abstract class ZoneType extends ListenersContainer */ public boolean isInsideZone(int x, int y, int z) { - return _zone.isInsideZone(x, y, z) && !isInsideBannedZone(x, y, z); + return (_zone != null) && _zone.isInsideZone(x, y, z) && !isInsideBlockedZone(x, y, z); } /** * @param x * @param y * @param z - * @return {@code true} if this location is within banned zone boundaries, {@code false} otherwise + * @return {@code true} if this location is within blocked zone boundaries, {@code false} otherwise. */ - public boolean isInsideBannedZone(int x, int y, int z) + public boolean isInsideBlockedZone(int x, int y, int z) { - return (_blockedZone != null) && _blockedZone.stream().allMatch(zone -> !zone.isInsideZone(x, y, z)); + if ((_blockedZones == null) || _blockedZones.isEmpty()) + { + return false; + } + + for (ZoneForm zone : _blockedZones) + { + if (zone.isInsideZone(x, y, z)) + { + return true; + } + } + + return false; } /** diff --git a/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/java/org/l2jmobius/gameserver/model/zone/ZoneType.java b/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/java/org/l2jmobius/gameserver/model/zone/ZoneType.java index af436d2882..1383aefa9c 100644 --- a/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/java/org/l2jmobius/gameserver/model/zone/ZoneType.java +++ b/L2J_Mobius_9.2_ReturnOfTheQueenAnt_Ch2/java/org/l2jmobius/gameserver/model/zone/ZoneType.java @@ -47,7 +47,7 @@ public abstract class ZoneType extends ListenersContainer private final int _id; protected ZoneForm _zone; - protected List _blockedZone; + protected List _blockedZones; private final Map _characterList = new ConcurrentHashMap<>(); /** Parameters to affect specific characters */ @@ -306,16 +306,16 @@ public abstract class ZoneType extends ListenersContainer public void setBlockedZones(List blockedZones) { - if (_blockedZone != null) + if (_blockedZones != null) { throw new IllegalStateException("Blocked zone already set"); } - _blockedZone = blockedZones; + _blockedZones = blockedZones; } public List getBlockedZones() { - return _blockedZone; + return _blockedZones; } /** @@ -337,7 +337,7 @@ public abstract class ZoneType extends ListenersContainer } /** - * Checks if the given coordinates are within the zone, ignores instanceId check + * Checks if the given coordinates are within the zone, ignores instanceId check. * @param x * @param y * @param z @@ -345,18 +345,31 @@ public abstract class ZoneType extends ListenersContainer */ public boolean isInsideZone(int x, int y, int z) { - return _zone.isInsideZone(x, y, z) && !isInsideBannedZone(x, y, z); + return (_zone != null) && _zone.isInsideZone(x, y, z) && !isInsideBlockedZone(x, y, z); } /** * @param x * @param y * @param z - * @return {@code true} if this location is within banned zone boundaries, {@code false} otherwise + * @return {@code true} if this location is within blocked zone boundaries, {@code false} otherwise. */ - public boolean isInsideBannedZone(int x, int y, int z) + public boolean isInsideBlockedZone(int x, int y, int z) { - return (_blockedZone != null) && _blockedZone.stream().allMatch(zone -> !zone.isInsideZone(x, y, z)); + if ((_blockedZones == null) || _blockedZones.isEmpty()) + { + return false; + } + + for (ZoneForm zone : _blockedZones) + { + if (zone.isInsideZone(x, y, z)) + { + return true; + } + } + + return false; } /** diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/zone/ZoneType.java b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/zone/ZoneType.java index af436d2882..1383aefa9c 100644 --- a/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/zone/ZoneType.java +++ b/L2J_Mobius_Classic_2.0_Saviors/java/org/l2jmobius/gameserver/model/zone/ZoneType.java @@ -47,7 +47,7 @@ public abstract class ZoneType extends ListenersContainer private final int _id; protected ZoneForm _zone; - protected List _blockedZone; + protected List _blockedZones; private final Map _characterList = new ConcurrentHashMap<>(); /** Parameters to affect specific characters */ @@ -306,16 +306,16 @@ public abstract class ZoneType extends ListenersContainer public void setBlockedZones(List blockedZones) { - if (_blockedZone != null) + if (_blockedZones != null) { throw new IllegalStateException("Blocked zone already set"); } - _blockedZone = blockedZones; + _blockedZones = blockedZones; } public List getBlockedZones() { - return _blockedZone; + return _blockedZones; } /** @@ -337,7 +337,7 @@ public abstract class ZoneType extends ListenersContainer } /** - * Checks if the given coordinates are within the zone, ignores instanceId check + * Checks if the given coordinates are within the zone, ignores instanceId check. * @param x * @param y * @param z @@ -345,18 +345,31 @@ public abstract class ZoneType extends ListenersContainer */ public boolean isInsideZone(int x, int y, int z) { - return _zone.isInsideZone(x, y, z) && !isInsideBannedZone(x, y, z); + return (_zone != null) && _zone.isInsideZone(x, y, z) && !isInsideBlockedZone(x, y, z); } /** * @param x * @param y * @param z - * @return {@code true} if this location is within banned zone boundaries, {@code false} otherwise + * @return {@code true} if this location is within blocked zone boundaries, {@code false} otherwise. */ - public boolean isInsideBannedZone(int x, int y, int z) + public boolean isInsideBlockedZone(int x, int y, int z) { - return (_blockedZone != null) && _blockedZone.stream().allMatch(zone -> !zone.isInsideZone(x, y, z)); + if ((_blockedZones == null) || _blockedZones.isEmpty()) + { + return false; + } + + for (ZoneForm zone : _blockedZones) + { + if (zone.isInsideZone(x, y, z)) + { + return true; + } + } + + return false; } /** diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/zone/ZoneType.java b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/zone/ZoneType.java index af436d2882..1383aefa9c 100644 --- a/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/zone/ZoneType.java +++ b/L2J_Mobius_Classic_2.1_Zaken/java/org/l2jmobius/gameserver/model/zone/ZoneType.java @@ -47,7 +47,7 @@ public abstract class ZoneType extends ListenersContainer private final int _id; protected ZoneForm _zone; - protected List _blockedZone; + protected List _blockedZones; private final Map _characterList = new ConcurrentHashMap<>(); /** Parameters to affect specific characters */ @@ -306,16 +306,16 @@ public abstract class ZoneType extends ListenersContainer public void setBlockedZones(List blockedZones) { - if (_blockedZone != null) + if (_blockedZones != null) { throw new IllegalStateException("Blocked zone already set"); } - _blockedZone = blockedZones; + _blockedZones = blockedZones; } public List getBlockedZones() { - return _blockedZone; + return _blockedZones; } /** @@ -337,7 +337,7 @@ public abstract class ZoneType extends ListenersContainer } /** - * Checks if the given coordinates are within the zone, ignores instanceId check + * Checks if the given coordinates are within the zone, ignores instanceId check. * @param x * @param y * @param z @@ -345,18 +345,31 @@ public abstract class ZoneType extends ListenersContainer */ public boolean isInsideZone(int x, int y, int z) { - return _zone.isInsideZone(x, y, z) && !isInsideBannedZone(x, y, z); + return (_zone != null) && _zone.isInsideZone(x, y, z) && !isInsideBlockedZone(x, y, z); } /** * @param x * @param y * @param z - * @return {@code true} if this location is within banned zone boundaries, {@code false} otherwise + * @return {@code true} if this location is within blocked zone boundaries, {@code false} otherwise. */ - public boolean isInsideBannedZone(int x, int y, int z) + public boolean isInsideBlockedZone(int x, int y, int z) { - return (_blockedZone != null) && _blockedZone.stream().allMatch(zone -> !zone.isInsideZone(x, y, z)); + if ((_blockedZones == null) || _blockedZones.isEmpty()) + { + return false; + } + + for (ZoneForm zone : _blockedZones) + { + if (zone.isInsideZone(x, y, z)) + { + return true; + } + } + + return false; } /** diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/zone/ZoneType.java b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/zone/ZoneType.java index af436d2882..1383aefa9c 100644 --- a/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/zone/ZoneType.java +++ b/L2J_Mobius_Classic_2.2_Antharas/java/org/l2jmobius/gameserver/model/zone/ZoneType.java @@ -47,7 +47,7 @@ public abstract class ZoneType extends ListenersContainer private final int _id; protected ZoneForm _zone; - protected List _blockedZone; + protected List _blockedZones; private final Map _characterList = new ConcurrentHashMap<>(); /** Parameters to affect specific characters */ @@ -306,16 +306,16 @@ public abstract class ZoneType extends ListenersContainer public void setBlockedZones(List blockedZones) { - if (_blockedZone != null) + if (_blockedZones != null) { throw new IllegalStateException("Blocked zone already set"); } - _blockedZone = blockedZones; + _blockedZones = blockedZones; } public List getBlockedZones() { - return _blockedZone; + return _blockedZones; } /** @@ -337,7 +337,7 @@ public abstract class ZoneType extends ListenersContainer } /** - * Checks if the given coordinates are within the zone, ignores instanceId check + * Checks if the given coordinates are within the zone, ignores instanceId check. * @param x * @param y * @param z @@ -345,18 +345,31 @@ public abstract class ZoneType extends ListenersContainer */ public boolean isInsideZone(int x, int y, int z) { - return _zone.isInsideZone(x, y, z) && !isInsideBannedZone(x, y, z); + return (_zone != null) && _zone.isInsideZone(x, y, z) && !isInsideBlockedZone(x, y, z); } /** * @param x * @param y * @param z - * @return {@code true} if this location is within banned zone boundaries, {@code false} otherwise + * @return {@code true} if this location is within blocked zone boundaries, {@code false} otherwise. */ - public boolean isInsideBannedZone(int x, int y, int z) + public boolean isInsideBlockedZone(int x, int y, int z) { - return (_blockedZone != null) && _blockedZone.stream().allMatch(zone -> !zone.isInsideZone(x, y, z)); + if ((_blockedZones == null) || _blockedZones.isEmpty()) + { + return false; + } + + for (ZoneForm zone : _blockedZones) + { + if (zone.isInsideZone(x, y, z)) + { + return true; + } + } + + return false; } /** diff --git a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/zone/ZoneType.java b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/zone/ZoneType.java index af436d2882..1383aefa9c 100644 --- a/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/zone/ZoneType.java +++ b/L2J_Mobius_Classic_2.3_SevenSigns/java/org/l2jmobius/gameserver/model/zone/ZoneType.java @@ -47,7 +47,7 @@ public abstract class ZoneType extends ListenersContainer private final int _id; protected ZoneForm _zone; - protected List _blockedZone; + protected List _blockedZones; private final Map _characterList = new ConcurrentHashMap<>(); /** Parameters to affect specific characters */ @@ -306,16 +306,16 @@ public abstract class ZoneType extends ListenersContainer public void setBlockedZones(List blockedZones) { - if (_blockedZone != null) + if (_blockedZones != null) { throw new IllegalStateException("Blocked zone already set"); } - _blockedZone = blockedZones; + _blockedZones = blockedZones; } public List getBlockedZones() { - return _blockedZone; + return _blockedZones; } /** @@ -337,7 +337,7 @@ public abstract class ZoneType extends ListenersContainer } /** - * Checks if the given coordinates are within the zone, ignores instanceId check + * Checks if the given coordinates are within the zone, ignores instanceId check. * @param x * @param y * @param z @@ -345,18 +345,31 @@ public abstract class ZoneType extends ListenersContainer */ public boolean isInsideZone(int x, int y, int z) { - return _zone.isInsideZone(x, y, z) && !isInsideBannedZone(x, y, z); + return (_zone != null) && _zone.isInsideZone(x, y, z) && !isInsideBlockedZone(x, y, z); } /** * @param x * @param y * @param z - * @return {@code true} if this location is within banned zone boundaries, {@code false} otherwise + * @return {@code true} if this location is within blocked zone boundaries, {@code false} otherwise. */ - public boolean isInsideBannedZone(int x, int y, int z) + public boolean isInsideBlockedZone(int x, int y, int z) { - return (_blockedZone != null) && _blockedZone.stream().allMatch(zone -> !zone.isInsideZone(x, y, z)); + if ((_blockedZones == null) || _blockedZones.isEmpty()) + { + return false; + } + + for (ZoneForm zone : _blockedZones) + { + if (zone.isInsideZone(x, y, z)) + { + return true; + } + } + + return false; } /** diff --git a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/zone/ZoneType.java b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/zone/ZoneType.java index af436d2882..1383aefa9c 100644 --- a/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/zone/ZoneType.java +++ b/L2J_Mobius_Classic_2.4_SecretOfEmpire/java/org/l2jmobius/gameserver/model/zone/ZoneType.java @@ -47,7 +47,7 @@ public abstract class ZoneType extends ListenersContainer private final int _id; protected ZoneForm _zone; - protected List _blockedZone; + protected List _blockedZones; private final Map _characterList = new ConcurrentHashMap<>(); /** Parameters to affect specific characters */ @@ -306,16 +306,16 @@ public abstract class ZoneType extends ListenersContainer public void setBlockedZones(List blockedZones) { - if (_blockedZone != null) + if (_blockedZones != null) { throw new IllegalStateException("Blocked zone already set"); } - _blockedZone = blockedZones; + _blockedZones = blockedZones; } public List getBlockedZones() { - return _blockedZone; + return _blockedZones; } /** @@ -337,7 +337,7 @@ public abstract class ZoneType extends ListenersContainer } /** - * Checks if the given coordinates are within the zone, ignores instanceId check + * Checks if the given coordinates are within the zone, ignores instanceId check. * @param x * @param y * @param z @@ -345,18 +345,31 @@ public abstract class ZoneType extends ListenersContainer */ public boolean isInsideZone(int x, int y, int z) { - return _zone.isInsideZone(x, y, z) && !isInsideBannedZone(x, y, z); + return (_zone != null) && _zone.isInsideZone(x, y, z) && !isInsideBlockedZone(x, y, z); } /** * @param x * @param y * @param z - * @return {@code true} if this location is within banned zone boundaries, {@code false} otherwise + * @return {@code true} if this location is within blocked zone boundaries, {@code false} otherwise. */ - public boolean isInsideBannedZone(int x, int y, int z) + public boolean isInsideBlockedZone(int x, int y, int z) { - return (_blockedZone != null) && _blockedZone.stream().allMatch(zone -> !zone.isInsideZone(x, y, z)); + if ((_blockedZones == null) || _blockedZones.isEmpty()) + { + return false; + } + + for (ZoneForm zone : _blockedZones) + { + if (zone.isInsideZone(x, y, z)) + { + return true; + } + } + + return false; } /** diff --git a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/zone/ZoneType.java b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/zone/ZoneType.java index af436d2882..1383aefa9c 100644 --- a/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/zone/ZoneType.java +++ b/L2J_Mobius_Classic_3.0_TheKamael/java/org/l2jmobius/gameserver/model/zone/ZoneType.java @@ -47,7 +47,7 @@ public abstract class ZoneType extends ListenersContainer private final int _id; protected ZoneForm _zone; - protected List _blockedZone; + protected List _blockedZones; private final Map _characterList = new ConcurrentHashMap<>(); /** Parameters to affect specific characters */ @@ -306,16 +306,16 @@ public abstract class ZoneType extends ListenersContainer public void setBlockedZones(List blockedZones) { - if (_blockedZone != null) + if (_blockedZones != null) { throw new IllegalStateException("Blocked zone already set"); } - _blockedZone = blockedZones; + _blockedZones = blockedZones; } public List getBlockedZones() { - return _blockedZone; + return _blockedZones; } /** @@ -337,7 +337,7 @@ public abstract class ZoneType extends ListenersContainer } /** - * Checks if the given coordinates are within the zone, ignores instanceId check + * Checks if the given coordinates are within the zone, ignores instanceId check. * @param x * @param y * @param z @@ -345,18 +345,31 @@ public abstract class ZoneType extends ListenersContainer */ public boolean isInsideZone(int x, int y, int z) { - return _zone.isInsideZone(x, y, z) && !isInsideBannedZone(x, y, z); + return (_zone != null) && _zone.isInsideZone(x, y, z) && !isInsideBlockedZone(x, y, z); } /** * @param x * @param y * @param z - * @return {@code true} if this location is within banned zone boundaries, {@code false} otherwise + * @return {@code true} if this location is within blocked zone boundaries, {@code false} otherwise. */ - public boolean isInsideBannedZone(int x, int y, int z) + public boolean isInsideBlockedZone(int x, int y, int z) { - return (_blockedZone != null) && _blockedZone.stream().allMatch(zone -> !zone.isInsideZone(x, y, z)); + if ((_blockedZones == null) || _blockedZones.isEmpty()) + { + return false; + } + + for (ZoneForm zone : _blockedZones) + { + if (zone.isInsideZone(x, y, z)) + { + return true; + } + } + + return false; } /** diff --git a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/zone/ZoneType.java b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/zone/ZoneType.java index af436d2882..1383aefa9c 100644 --- a/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/zone/ZoneType.java +++ b/L2J_Mobius_Classic_Interlude/java/org/l2jmobius/gameserver/model/zone/ZoneType.java @@ -47,7 +47,7 @@ public abstract class ZoneType extends ListenersContainer private final int _id; protected ZoneForm _zone; - protected List _blockedZone; + protected List _blockedZones; private final Map _characterList = new ConcurrentHashMap<>(); /** Parameters to affect specific characters */ @@ -306,16 +306,16 @@ public abstract class ZoneType extends ListenersContainer public void setBlockedZones(List blockedZones) { - if (_blockedZone != null) + if (_blockedZones != null) { throw new IllegalStateException("Blocked zone already set"); } - _blockedZone = blockedZones; + _blockedZones = blockedZones; } public List getBlockedZones() { - return _blockedZone; + return _blockedZones; } /** @@ -337,7 +337,7 @@ public abstract class ZoneType extends ListenersContainer } /** - * Checks if the given coordinates are within the zone, ignores instanceId check + * Checks if the given coordinates are within the zone, ignores instanceId check. * @param x * @param y * @param z @@ -345,18 +345,31 @@ public abstract class ZoneType extends ListenersContainer */ public boolean isInsideZone(int x, int y, int z) { - return _zone.isInsideZone(x, y, z) && !isInsideBannedZone(x, y, z); + return (_zone != null) && _zone.isInsideZone(x, y, z) && !isInsideBlockedZone(x, y, z); } /** * @param x * @param y * @param z - * @return {@code true} if this location is within banned zone boundaries, {@code false} otherwise + * @return {@code true} if this location is within blocked zone boundaries, {@code false} otherwise. */ - public boolean isInsideBannedZone(int x, int y, int z) + public boolean isInsideBlockedZone(int x, int y, int z) { - return (_blockedZone != null) && _blockedZone.stream().allMatch(zone -> !zone.isInsideZone(x, y, z)); + if ((_blockedZones == null) || _blockedZones.isEmpty()) + { + return false; + } + + for (ZoneForm zone : _blockedZones) + { + if (zone.isInsideZone(x, y, z)) + { + return true; + } + } + + return false; } /** diff --git a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/zone/ZoneType.java b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/zone/ZoneType.java index af436d2882..1383aefa9c 100644 --- a/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/zone/ZoneType.java +++ b/L2J_Mobius_Essence_4.0_DwellingOfSpirits/java/org/l2jmobius/gameserver/model/zone/ZoneType.java @@ -47,7 +47,7 @@ public abstract class ZoneType extends ListenersContainer private final int _id; protected ZoneForm _zone; - protected List _blockedZone; + protected List _blockedZones; private final Map _characterList = new ConcurrentHashMap<>(); /** Parameters to affect specific characters */ @@ -306,16 +306,16 @@ public abstract class ZoneType extends ListenersContainer public void setBlockedZones(List blockedZones) { - if (_blockedZone != null) + if (_blockedZones != null) { throw new IllegalStateException("Blocked zone already set"); } - _blockedZone = blockedZones; + _blockedZones = blockedZones; } public List getBlockedZones() { - return _blockedZone; + return _blockedZones; } /** @@ -337,7 +337,7 @@ public abstract class ZoneType extends ListenersContainer } /** - * Checks if the given coordinates are within the zone, ignores instanceId check + * Checks if the given coordinates are within the zone, ignores instanceId check. * @param x * @param y * @param z @@ -345,18 +345,31 @@ public abstract class ZoneType extends ListenersContainer */ public boolean isInsideZone(int x, int y, int z) { - return _zone.isInsideZone(x, y, z) && !isInsideBannedZone(x, y, z); + return (_zone != null) && _zone.isInsideZone(x, y, z) && !isInsideBlockedZone(x, y, z); } /** * @param x * @param y * @param z - * @return {@code true} if this location is within banned zone boundaries, {@code false} otherwise + * @return {@code true} if this location is within blocked zone boundaries, {@code false} otherwise. */ - public boolean isInsideBannedZone(int x, int y, int z) + public boolean isInsideBlockedZone(int x, int y, int z) { - return (_blockedZone != null) && _blockedZone.stream().allMatch(zone -> !zone.isInsideZone(x, y, z)); + if ((_blockedZones == null) || _blockedZones.isEmpty()) + { + return false; + } + + for (ZoneForm zone : _blockedZones) + { + if (zone.isInsideZone(x, y, z)) + { + return true; + } + } + + return false; } /** diff --git a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/zone/ZoneType.java b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/zone/ZoneType.java index af436d2882..1383aefa9c 100644 --- a/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/zone/ZoneType.java +++ b/L2J_Mobius_Essence_5.0_Sylph/java/org/l2jmobius/gameserver/model/zone/ZoneType.java @@ -47,7 +47,7 @@ public abstract class ZoneType extends ListenersContainer private final int _id; protected ZoneForm _zone; - protected List _blockedZone; + protected List _blockedZones; private final Map _characterList = new ConcurrentHashMap<>(); /** Parameters to affect specific characters */ @@ -306,16 +306,16 @@ public abstract class ZoneType extends ListenersContainer public void setBlockedZones(List blockedZones) { - if (_blockedZone != null) + if (_blockedZones != null) { throw new IllegalStateException("Blocked zone already set"); } - _blockedZone = blockedZones; + _blockedZones = blockedZones; } public List getBlockedZones() { - return _blockedZone; + return _blockedZones; } /** @@ -337,7 +337,7 @@ public abstract class ZoneType extends ListenersContainer } /** - * Checks if the given coordinates are within the zone, ignores instanceId check + * Checks if the given coordinates are within the zone, ignores instanceId check. * @param x * @param y * @param z @@ -345,18 +345,31 @@ public abstract class ZoneType extends ListenersContainer */ public boolean isInsideZone(int x, int y, int z) { - return _zone.isInsideZone(x, y, z) && !isInsideBannedZone(x, y, z); + return (_zone != null) && _zone.isInsideZone(x, y, z) && !isInsideBlockedZone(x, y, z); } /** * @param x * @param y * @param z - * @return {@code true} if this location is within banned zone boundaries, {@code false} otherwise + * @return {@code true} if this location is within blocked zone boundaries, {@code false} otherwise. */ - public boolean isInsideBannedZone(int x, int y, int z) + public boolean isInsideBlockedZone(int x, int y, int z) { - return (_blockedZone != null) && _blockedZone.stream().allMatch(zone -> !zone.isInsideZone(x, y, z)); + if ((_blockedZones == null) || _blockedZones.isEmpty()) + { + return false; + } + + for (ZoneForm zone : _blockedZones) + { + if (zone.isInsideZone(x, y, z)) + { + return true; + } + } + + return false; } /** diff --git a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/zone/ZoneType.java b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/zone/ZoneType.java index af436d2882..1383aefa9c 100644 --- a/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/zone/ZoneType.java +++ b/L2J_Mobius_Essence_5.2_FrostLord/java/org/l2jmobius/gameserver/model/zone/ZoneType.java @@ -47,7 +47,7 @@ public abstract class ZoneType extends ListenersContainer private final int _id; protected ZoneForm _zone; - protected List _blockedZone; + protected List _blockedZones; private final Map _characterList = new ConcurrentHashMap<>(); /** Parameters to affect specific characters */ @@ -306,16 +306,16 @@ public abstract class ZoneType extends ListenersContainer public void setBlockedZones(List blockedZones) { - if (_blockedZone != null) + if (_blockedZones != null) { throw new IllegalStateException("Blocked zone already set"); } - _blockedZone = blockedZones; + _blockedZones = blockedZones; } public List getBlockedZones() { - return _blockedZone; + return _blockedZones; } /** @@ -337,7 +337,7 @@ public abstract class ZoneType extends ListenersContainer } /** - * Checks if the given coordinates are within the zone, ignores instanceId check + * Checks if the given coordinates are within the zone, ignores instanceId check. * @param x * @param y * @param z @@ -345,18 +345,31 @@ public abstract class ZoneType extends ListenersContainer */ public boolean isInsideZone(int x, int y, int z) { - return _zone.isInsideZone(x, y, z) && !isInsideBannedZone(x, y, z); + return (_zone != null) && _zone.isInsideZone(x, y, z) && !isInsideBlockedZone(x, y, z); } /** * @param x * @param y * @param z - * @return {@code true} if this location is within banned zone boundaries, {@code false} otherwise + * @return {@code true} if this location is within blocked zone boundaries, {@code false} otherwise. */ - public boolean isInsideBannedZone(int x, int y, int z) + public boolean isInsideBlockedZone(int x, int y, int z) { - return (_blockedZone != null) && _blockedZone.stream().allMatch(zone -> !zone.isInsideZone(x, y, z)); + if ((_blockedZones == null) || _blockedZones.isEmpty()) + { + return false; + } + + for (ZoneForm zone : _blockedZones) + { + if (zone.isInsideZone(x, y, z)) + { + return true; + } + } + + return false; } /**