Access zone character list only by getter method.

This commit is contained in:
MobiusDevelopment 2020-02-04 05:21:24 +00:00
parent 232a3bb69b
commit 407ff24524
74 changed files with 126 additions and 224 deletions

View File

@ -49,7 +49,7 @@ public abstract class ZoneType extends ListenersContainer
private final int _id;
protected ZoneForm _zone;
protected List<ZoneForm> _blockedZone;
protected Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
private final Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
/** Parameters to affect specific characters */
private boolean _checkAffected = false;

View File

@ -130,7 +130,7 @@ public class DamageZone extends ZoneType
@Override
protected void onExit(Creature creature)
{
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -183,7 +183,7 @@ public class EffectZone extends ZoneType
}
}
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -49,7 +49,7 @@ public abstract class ZoneType extends ListenersContainer
private final int _id;
protected ZoneForm _zone;
protected List<ZoneForm> _blockedZone;
protected Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
private final Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
/** Parameters to affect specific characters */
private boolean _checkAffected = false;

View File

@ -130,7 +130,7 @@ public class DamageZone extends ZoneType
@Override
protected void onExit(Creature creature)
{
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -183,7 +183,7 @@ public class EffectZone extends ZoneType
}
}
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -49,7 +49,7 @@ public abstract class ZoneType extends ListenersContainer
private final int _id;
protected ZoneForm _zone;
protected List<ZoneForm> _blockedZone;
protected Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
private final Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
/** Parameters to affect specific characters */
private boolean _checkAffected = false;

View File

@ -130,7 +130,7 @@ public class DamageZone extends ZoneType
@Override
protected void onExit(Creature creature)
{
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -183,7 +183,7 @@ public class EffectZone extends ZoneType
}
}
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -49,7 +49,7 @@ public abstract class ZoneType extends ListenersContainer
private final int _id;
protected ZoneForm _zone;
protected List<ZoneForm> _blockedZone;
protected Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
private final Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
/** Parameters to affect specific characters */
private boolean _checkAffected = false;

View File

@ -130,7 +130,7 @@ public class DamageZone extends ZoneType
@Override
protected void onExit(Creature creature)
{
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -183,7 +183,7 @@ public class EffectZone extends ZoneType
}
}
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -49,7 +49,7 @@ public abstract class ZoneType extends ListenersContainer
private final int _id;
protected ZoneForm _zone;
protected List<ZoneForm> _blockedZone;
protected Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
private final Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
/** Parameters to affect specific characters */
private boolean _checkAffected = false;

View File

@ -130,7 +130,7 @@ public class DamageZone extends ZoneType
@Override
protected void onExit(Creature creature)
{
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -183,7 +183,7 @@ public class EffectZone extends ZoneType
}
}
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -49,7 +49,7 @@ public abstract class ZoneType extends ListenersContainer
private final int _id;
protected ZoneForm _zone;
protected List<ZoneForm> _blockedZone;
protected Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
private final Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
/** Parameters to affect specific characters */
private boolean _checkAffected = false;

View File

@ -130,7 +130,7 @@ public class DamageZone extends ZoneType
@Override
protected void onExit(Creature creature)
{
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -183,7 +183,7 @@ public class EffectZone extends ZoneType
}
}
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -49,7 +49,7 @@ public abstract class ZoneType extends ListenersContainer
private final int _id;
protected ZoneForm _zone;
protected List<ZoneForm> _blockedZone;
protected Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
private final Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
/** Parameters to affect specific characters */
private boolean _checkAffected = false;

View File

@ -130,7 +130,7 @@ public class DamageZone extends ZoneType
@Override
protected void onExit(Creature creature)
{
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -183,7 +183,7 @@ public class EffectZone extends ZoneType
}
}
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -49,7 +49,7 @@ public abstract class ZoneType extends ListenersContainer
private final int _id;
protected ZoneForm _zone;
protected List<ZoneForm> _blockedZone;
protected Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
private final Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
/** Parameters to affect specific characters */
private boolean _checkAffected = false;

View File

@ -130,7 +130,7 @@ public class DamageZone extends ZoneType
@Override
protected void onExit(Creature creature)
{
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -183,7 +183,7 @@ public class EffectZone extends ZoneType
}
}
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -119,7 +119,7 @@ public class Antharas extends Quest
protected static long _LastAction = 0;
protected static BossZone _Zone;
protected static BossZone _zone;
// Boss: Antharas
public Antharas()
@ -160,7 +160,7 @@ public class Antharas extends Quest
// Setting spawn data of monsters.
try
{
_Zone = GrandBossManager.getInstance().getZone(179700, 113800, -7709);
_zone = GrandBossManager.getInstance().getZone(179700, 113800, -7709);
NpcTemplate template1;
Spawn tempSpawn;
@ -417,9 +417,9 @@ public class Antharas extends Quest
AntharasSpawn(int taskId)
{
_taskId = taskId;
if (_Zone.getCharactersInside() != null)
if (_zone.getCharactersInside() != null)
{
_players = _Zone.getCharactersInside().values();
_players = _zone.getCharactersInside();
}
}
@ -565,9 +565,9 @@ public class Antharas extends Quest
protected void broadcastPacket(GameServerPacket mov)
{
if (_Zone != null)
if (_zone != null)
{
for (Creature creatures : _Zone.getCharactersInside().values())
for (Creature creatures : _zone.getCharactersInside())
{
if (creatures instanceof PlayerInstance)
{
@ -760,7 +760,7 @@ public class Antharas extends Quest
public void setUnspawn()
{
// Eliminate players.
_Zone.oustAllPlayers();
_zone.oustAllPlayers();
// Not executed tasks is canceled.
if (_cubeSpawnTask != null)

View File

@ -225,7 +225,7 @@ public class Baium extends Quest
// baium.setImobilised(false);
// for (NpcInstance minion : _Minions)
// minion.setShowSummonAnimation(false);
baium.getAttackByList().addAll(_zone.getCharactersInside().values());
baium.getAttackByList().addAll(_zone.getCharactersInside());
}
catch (Exception e)
{
@ -239,7 +239,7 @@ public class Baium extends Quest
final MonsterInstance angel = (MonsterInstance) addSpawn(ARCHANGEL, element[0], element[1], element[2], element[3], false, 0);
angel.setInvul(true);
_minions.add(angel);
angel.getAttackByList().addAll(_zone.getCharactersInside().values());
angel.getAttackByList().addAll(_zone.getCharactersInside());
angel.isAggressive();
}
}

View File

@ -649,7 +649,7 @@ public class Frintezza extends Quest
_zone.broadcastPacket(new SocialAction(_demon1.getObjectId(), 1));
_zone.broadcastPacket(new SocialAction(_demon4.getObjectId(), 1));
for (Creature pc : _zone.getCharactersInside().values())
for (Creature pc : _zone.getCharactersInside())
{
if (pc instanceof PlayerInstance)
{
@ -667,7 +667,7 @@ public class Frintezza extends Quest
}
else if (event.equals("camera_9c"))
{
for (Creature pc : _zone.getCharactersInside().values())
for (Creature pc : _zone.getCharactersInside())
{
if (pc instanceof PlayerInstance)
{
@ -830,7 +830,7 @@ public class Frintezza extends Quest
}
else if (event.equals("stop_pc"))
{
for (Creature creature : _zone.getCharactersInside().values())
for (Creature creature : _zone.getCharactersInside())
{
creature.abortAttack();
creature.abortCast();
@ -855,7 +855,7 @@ public class Frintezza extends Quest
}
else if (event.equals("start_pc"))
{
for (Creature creature : _zone.getCharactersInside().values())
for (Creature creature : _zone.getCharactersInside())
{
if (creature != _frintezza)
{
@ -1169,7 +1169,7 @@ public class Frintezza extends Quest
}
else if (_onSong == 4)
{
for (Creature creature : _zone.getCharactersInside().values())
for (Creature creature : _zone.getCharactersInside())
{
if ((creature instanceof PlayerInstance) && (Rnd.get(100) < 80))
{
@ -1180,7 +1180,7 @@ public class Frintezza extends Quest
}
else if (_onSong == 5)
{
for (Creature creature : _zone.getCharactersInside().values())
for (Creature creature : _zone.getCharactersInside())
{
if ((creature instanceof PlayerInstance) && (Rnd.get(100) < 70))
{
@ -1201,7 +1201,7 @@ public class Frintezza extends Quest
}
else if (event.equals("stop_effect"))
{
for (Creature creature : _zone.getCharactersInside().values())
for (Creature creature : _zone.getCharactersInside())
{
if (creature instanceof PlayerInstance)
{
@ -1336,7 +1336,7 @@ public class Frintezza extends Quest
}
else
{
for (Creature creature : _zone.getCharactersInside().values())
for (Creature creature : _zone.getCharactersInside())
{
if ((creature instanceof PlayerInstance) && (creature.getFirstEffect(5016) != null))
{

View File

@ -1,25 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<list xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../xsd/zones.xsd">
<!-- Custom zone for Q636 -->
<zone id="100000" type="ScriptZone" shape="Cuboid" minZ="-10735" maxZ="-10720"> <!-- Pagans mark -->
<node X="-16100" Y="-36800" />
<node X="-16600" Y="-37100" />
</zone>
<!-- Custom zones for Q114 -->
<zone id="100001" type="ScriptZone" shape="Cuboid" minZ="-3300" maxZ="-3400"> <!-- archaic_laboratory_gate1 -->
<node X="89953" Y="-106250" />
<node X="90242" Y="-106143" />
</zone>
<zone id="100002" type="ScriptZone" shape="NPoly" minZ="-3300" maxZ="-3400"> <!-- archaic_laboratory_gate2 -->
<node X="91491" Y="-108277" />
<node X="91409" Y="-108192" />
<node X="91623" Y="-107981" />
<node X="91703" Y="-108064" />
</zone>
<zone id="100003" type="ScriptZone" shape="NPoly" minZ="-3300" maxZ="-3400"> <!-- archaic_laboratory_gate3 -->
<node X="88468" Y="-108063" />
<node X="88549" Y="-107983" />
<node X="88759" Y="-108195" />
<node X="88677" Y="-108275" />
</zone>
</list>

View File

@ -40,7 +40,7 @@ import org.l2jmobius.gameserver.model.WorldObject;
import org.l2jmobius.gameserver.model.WorldRegion;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.items.instance.ItemInstance;
import org.l2jmobius.gameserver.model.zone.SpawnZone;
import org.l2jmobius.gameserver.model.zone.ZoneRespawn;
import org.l2jmobius.gameserver.model.zone.ZoneType;
import org.l2jmobius.gameserver.model.zone.form.ZoneCuboid;
import org.l2jmobius.gameserver.model.zone.form.ZoneCylinder;
@ -445,7 +445,7 @@ public class ZoneData
temp.setParameter(name, val);
}
else if ("spawn".equalsIgnoreCase(cd.getNodeName()) && (temp instanceof SpawnZone))
else if ("spawn".equalsIgnoreCase(cd.getNodeName()) && (temp instanceof ZoneRespawn))
{
attrs = cd.getAttributes();
int spawnX = Integer.parseInt(attrs.getNamedItem("X").getNodeValue());
@ -455,11 +455,11 @@ public class ZoneData
Node val = attrs.getNamedItem("isChaotic");
if ((val != null) && Boolean.parseBoolean(val.getNodeValue()))
{
((SpawnZone) temp).addChaoticSpawn(spawnX, spawnY, spawnZ);
((ZoneRespawn) temp).addChaoticSpawn(spawnX, spawnY, spawnZ);
}
else
{
((SpawnZone) temp).addSpawn(spawnX, spawnY, spawnZ);
((ZoneRespawn) temp).addSpawn(spawnX, spawnY, spawnZ);
}
}
}

View File

@ -196,7 +196,7 @@ public class BanditStrongholdSiege extends ClanHallSiege
public void teleportPlayers()
{
final ClanHallZone zone = clanhall.getZone();
for (Creature creature : zone.getCharactersInside().values())
for (Creature creature : zone.getCharactersInside())
{
if (creature instanceof PlayerInstance)
{

View File

@ -189,7 +189,7 @@ public class WildBeastFarmSiege extends ClanHallSiege
public void teleportPlayers()
{
final ClanHallZone zone = clanhall.getZone();
for (Creature creature : zone.getCharactersInside().values())
for (Creature creature : zone.getCharactersInside())
{
if (creature instanceof PlayerInstance)
{

View File

@ -23,20 +23,20 @@ import org.l2jmobius.commons.util.Rnd;
import org.l2jmobius.gameserver.model.Location;
/**
* Abstract zone with spawn locations.<br>
* It inherits regular ZoneType behavior, with the possible addition of 2 Lists holding Locations.
* Abstract zone with spawn locations
* @author DS, Nyaran (rework 10/07/2011)
*/
public abstract class SpawnZone extends ZoneType
public abstract class ZoneRespawn extends ZoneType
{
private List<Location> _spawnLocs = null;
private List<Location> _chaoticSpawnLocs = null;
public SpawnZone(int id)
public ZoneRespawn(int id)
{
super(id);
}
public final void addSpawn(int x, int y, int z)
public void addSpawn(int x, int y, int z)
{
if (_spawnLocs == null)
{
@ -46,7 +46,7 @@ public abstract class SpawnZone extends ZoneType
_spawnLocs.add(new Location(x, y, z));
}
public final void addChaoticSpawn(int x, int y, int z)
public void addChaoticSpawn(int x, int y, int z)
{
if (_chaoticSpawnLocs == null)
{
@ -56,17 +56,17 @@ public abstract class SpawnZone extends ZoneType
_chaoticSpawnLocs.add(new Location(x, y, z));
}
public final List<Location> getSpawns()
public List<Location> getSpawns()
{
return _spawnLocs;
}
public final Location getSpawnLoc()
public Location getSpawnLoc()
{
return _spawnLocs.get(Rnd.get(_spawnLocs.size()));
}
public final Location getChaoticSpawnLoc()
public Location getChaoticSpawnLoc()
{
if (_chaoticSpawnLocs != null)
{

View File

@ -16,6 +16,7 @@
*/
package org.l2jmobius.gameserver.model.zone;
import java.util.Collection;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@ -32,7 +33,7 @@ public abstract class ZoneType
{
private final int _id;
protected ZoneForm _zone;
public Map<Integer, Creature> _characterList;
private final Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
/** Parameters to affect specific characters */
private boolean _checkAffected;
@ -46,7 +47,6 @@ public abstract class ZoneType
protected ZoneType(int id)
{
_id = id;
_characterList = new ConcurrentHashMap<>();
_checkAffected = false;
@ -354,9 +354,9 @@ public abstract class ZoneType
}
}
public Map<Integer, Creature> getCharactersInside()
public Collection<Creature> getCharactersInside()
{
return _characterList;
return _characterList.values();
}
public void visualizeZone(int z)

View File

@ -19,7 +19,7 @@ package org.l2jmobius.gameserver.model.zone.type;
import org.l2jmobius.gameserver.enums.TeleportWhereType;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.zone.SpawnZone;
import org.l2jmobius.gameserver.model.zone.ZoneRespawn;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.SystemMessageId;
@ -27,7 +27,7 @@ import org.l2jmobius.gameserver.network.SystemMessageId;
* An arena
* @author durgus
*/
public class ArenaZone extends SpawnZone
public class ArenaZone extends ZoneRespawn
{
public ArenaZone(int id)
{
@ -70,17 +70,7 @@ public class ArenaZone extends SpawnZone
public void oustAllPlayers()
{
if (_characterList == null)
{
return;
}
if (_characterList.isEmpty())
{
return;
}
for (Creature creature : _characterList.values())
for (Creature creature : getCharactersInside())
{
if (creature == null)
{

View File

@ -173,12 +173,7 @@ public class BossZone extends ZoneType
*/
public void movePlayersTo(int x, int y, int z)
{
if (_characterList.isEmpty())
{
return;
}
for (Creature creature : _characterList.values())
for (Creature creature : getCharactersInside())
{
if (creature instanceof PlayerInstance)
{
@ -277,17 +272,12 @@ public class BossZone extends ZoneType
*/
public void oustAllPlayers()
{
if (_characterList == null)
if (getCharactersInside().isEmpty())
{
return;
}
if (_characterList.isEmpty())
{
return;
}
for (Creature creature : _characterList.values())
for (Creature creature : getCharactersInside())
{
if (creature == null)
{
@ -336,13 +326,13 @@ public class BossZone extends ZoneType
public void updateKnownList(NpcInstance npc)
{
if ((_characterList == null) || _characterList.isEmpty())
if (getCharactersInside().isEmpty())
{
return;
}
final Map<Integer, PlayerInstance> npcKnownPlayers = npc.getKnownList().getKnownPlayers();
for (Creature creature : _characterList.values())
for (Creature creature : getCharactersInside())
{
if (creature == null)
{

View File

@ -107,7 +107,7 @@ public class CastleTeleportZone extends ZoneType
public List<Creature> getAllPlayers()
{
final List<Creature> players = new ArrayList<>();
for (Creature creature : _characterList.values())
for (Creature creature : getCharactersInside())
{
if (creature instanceof PlayerInstance)
{
@ -119,17 +119,7 @@ public class CastleTeleportZone extends ZoneType
public void oustAllPlayers()
{
if (_characterList == null)
{
return;
}
if (_characterList.isEmpty())
{
return;
}
for (Creature creature : _characterList.values())
for (Creature creature : getCharactersInside())
{
if ((creature != null) && (creature instanceof PlayerInstance))
{

View File

@ -24,7 +24,7 @@ import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.instance.SiegeSummonInstance;
import org.l2jmobius.gameserver.model.entity.siege.Castle;
import org.l2jmobius.gameserver.model.zone.SpawnZone;
import org.l2jmobius.gameserver.model.zone.ZoneRespawn;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.SystemMessageId;
@ -32,7 +32,7 @@ import org.l2jmobius.gameserver.network.SystemMessageId;
* A castle zone
* @author durgus
*/
public class CastleZone extends SpawnZone
public class CastleZone extends ZoneRespawn
{
private Castle _castle;
@ -120,7 +120,7 @@ public class CastleZone extends SpawnZone
{
if (_castle.getSiege().isInProgress())
{
for (Creature creature : _characterList.values())
for (Creature creature : getCharactersInside())
{
try
{
@ -133,7 +133,7 @@ public class CastleZone extends SpawnZone
}
else
{
for (Creature creature : _characterList.values())
for (Creature creature : getCharactersInside())
{
try
{
@ -163,7 +163,7 @@ public class CastleZone extends SpawnZone
*/
public void banishForeigners(int owningClanId)
{
for (Creature temp : _characterList.values())
for (Creature temp : getCharactersInside())
{
if (!(temp instanceof PlayerInstance))
{
@ -185,7 +185,7 @@ public class CastleZone extends SpawnZone
*/
public void announceToPlayers(String message)
{
for (Creature temp : _characterList.values())
for (Creature temp : getCharactersInside())
{
if (temp instanceof PlayerInstance)
{
@ -201,15 +201,13 @@ public class CastleZone extends SpawnZone
public List<PlayerInstance> getAllPlayers()
{
final List<PlayerInstance> players = new ArrayList<>();
for (Creature temp : _characterList.values())
for (Creature temp : getCharactersInside())
{
if (temp instanceof PlayerInstance)
{
players.add((PlayerInstance) temp);
}
}
return players;
}
@ -219,7 +217,6 @@ public class CastleZone extends SpawnZone
{
return _castle.isSiegeInProgress();
}
return false;
}
}

View File

@ -16,14 +16,12 @@
*/
package org.l2jmobius.gameserver.model.zone.type;
import java.util.Map;
import org.l2jmobius.gameserver.enums.TeleportWhereType;
import org.l2jmobius.gameserver.instancemanager.ClanHallManager;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.entity.ClanHall;
import org.l2jmobius.gameserver.model.zone.SpawnZone;
import org.l2jmobius.gameserver.model.zone.ZoneRespawn;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.serverpackets.ClanHallDecoration;
@ -31,7 +29,7 @@ import org.l2jmobius.gameserver.network.serverpackets.ClanHallDecoration;
* A clan hall zone
* @author durgus
*/
public class ClanHallZone extends SpawnZone
public class ClanHallZone extends ZoneRespawn
{
private int _clanHallId;
@ -118,7 +116,7 @@ public class ClanHallZone extends SpawnZone
*/
public void banishForeigners(int owningClanId)
{
for (Creature temp : _characterList.values())
for (Creature temp : getCharactersInside())
{
if (!(temp instanceof PlayerInstance))
{
@ -133,10 +131,4 @@ public class ClanHallZone extends SpawnZone
((PlayerInstance) temp).teleToLocation(TeleportWhereType.TOWN);
}
}
@Override
public Map<Integer, Creature> getCharactersInside()
{
return _characterList;
}
}

View File

@ -16,7 +16,6 @@
*/
package org.l2jmobius.gameserver.model.zone.type;
import java.util.Collection;
import java.util.concurrent.Future;
import org.l2jmobius.commons.concurrent.ThreadPool;
@ -66,18 +65,13 @@ public class DamageZone extends ZoneType
@Override
protected void onExit(Creature creature)
{
if (_characterList.isEmpty())
if (getCharactersInside().isEmpty())
{
_task.cancel(true);
_task = null;
}
}
protected Collection<Creature> getCharacterList()
{
return _characterList.values();
}
protected int getDamagePerSecond()
{
return _damagePerSec;
@ -95,7 +89,7 @@ public class DamageZone extends ZoneType
@Override
public void run()
{
for (Creature temp : _dmgZone.getCharacterList())
for (Creature temp : _dmgZone.getCharactersInside())
{
if ((temp != null) && !temp.isDead() && (temp instanceof PlayerInstance))
{

View File

@ -97,7 +97,7 @@ public class DynamicZone extends ZoneType
_region.removeZone(this);
for (Creature member : _characterList.values())
for (Creature member : getCharactersInside())
{
try
{

View File

@ -16,7 +16,6 @@
*/
package org.l2jmobius.gameserver.model.zone.type;
import java.util.Collection;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
@ -160,7 +159,7 @@ public class EffectZone extends ZoneType
}
}
if (_characterList.isEmpty() && (_task != null))
if (getCharactersInside().isEmpty() && (_task != null))
{
_task.cancel(true);
_task = null;
@ -233,11 +232,6 @@ public class EffectZone extends ZoneType
_enabled = value;
}
protected Collection<Creature> getCharacterList()
{
return _characterList.values();
}
class ApplySkill implements Runnable
{
ApplySkill()
@ -253,7 +247,7 @@ public class EffectZone extends ZoneType
{
if (_enabled)
{
for (Creature temp : getCharacterList())
for (Creature temp : getCharactersInside())
{
if ((temp != null) && !temp.isDead())
{

View File

@ -25,7 +25,7 @@ import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.actor.instance.SiegeSummonInstance;
import org.l2jmobius.gameserver.model.entity.siege.Fort;
import org.l2jmobius.gameserver.model.zone.SpawnZone;
import org.l2jmobius.gameserver.model.zone.ZoneRespawn;
import org.l2jmobius.gameserver.model.zone.ZoneId;
import org.l2jmobius.gameserver.network.SystemMessageId;
@ -33,7 +33,7 @@ import org.l2jmobius.gameserver.network.SystemMessageId;
* A castle zone
* @author programmos
*/
public class FortZone extends SpawnZone
public class FortZone extends ZoneRespawn
{
private Fort _fort;
@ -117,7 +117,7 @@ public class FortZone extends SpawnZone
{
if (_fort.getSiege().isInProgress())
{
for (Creature creature : _characterList.values())
for (Creature creature : getCharactersInside())
{
try
{
@ -130,7 +130,7 @@ public class FortZone extends SpawnZone
}
else
{
for (Creature creature : _characterList.values())
for (Creature creature : getCharactersInside())
{
try
{
@ -160,7 +160,7 @@ public class FortZone extends SpawnZone
*/
public void banishForeigners(int owningClanId)
{
for (Creature temp : _characterList.values())
for (Creature temp : getCharactersInside())
{
if (!(temp instanceof PlayerInstance))
{
@ -182,7 +182,7 @@ public class FortZone extends SpawnZone
*/
public void announceToPlayers(String message)
{
for (Creature temp : _characterList.values())
for (Creature temp : getCharactersInside())
{
if (temp instanceof PlayerInstance)
{
@ -198,7 +198,7 @@ public class FortZone extends SpawnZone
public List<PlayerInstance> getAllPlayers()
{
final List<PlayerInstance> players = new ArrayList<>();
for (Creature temp : _characterList.values())
for (Creature temp : getCharactersInside())
{
if (temp instanceof PlayerInstance)
{

View File

@ -113,7 +113,7 @@ public class PoisonZone extends ZoneType
@Override
protected void onExit(Creature creature)
{
if (_characterList.isEmpty() && (_task != null))
if (getCharactersInside().isEmpty() && (_task != null))
{
_task.cancel(true);
_task = null;
@ -152,7 +152,7 @@ public class PoisonZone extends ZoneType
{
if (_enabled)
{
for (Creature temp : _characterList.values())
for (Creature temp : getCharactersInside())
{
if ((temp != null) && !temp.isDead() && (((temp instanceof Playable) && _target.equalsIgnoreCase("pc")) || ((temp instanceof PlayerInstance) && _target.equalsIgnoreCase("pc_only")) || ((temp instanceof MonsterInstance) && _target.equalsIgnoreCase("npc"))) && (Rnd.get(100) < _chance))
{

View File

@ -19,14 +19,14 @@ package org.l2jmobius.gameserver.model.zone.type;
import org.l2jmobius.Config;
import org.l2jmobius.gameserver.model.actor.Creature;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
import org.l2jmobius.gameserver.model.zone.SpawnZone;
import org.l2jmobius.gameserver.model.zone.ZoneRespawn;
import org.l2jmobius.gameserver.model.zone.ZoneId;
/**
* A Town zone
* @author durgus
*/
public class TownZone extends SpawnZone
public class TownZone extends ZoneRespawn
{
private String _townName;
private int _townId;

View File

@ -193,7 +193,7 @@ public class Broadcast
{
for (ZoneType zone : ZoneData.getInstance().getAllZones(zoneType))
{
for (Creature creature : zone.getCharactersInside().values())
for (Creature creature : zone.getCharactersInside())
{
if (creature == null)
{

View File

@ -46,7 +46,7 @@ public abstract class ZoneType extends ListenersContainer
private final int _id;
protected ZoneForm _zone;
protected Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
private final Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
/** Parameters to affect specific characters */
protected boolean _checkAffected = false;
@ -489,11 +489,6 @@ public abstract class ZoneType extends ListenersContainer
{
}
public Map<Integer, Creature> getCharacters()
{
return _characterList;
}
public Collection<Creature> getCharactersInside()
{
return _characterList.values();

View File

@ -343,11 +343,6 @@ public class BossZone extends ZoneType
*/
public void movePlayersTo(Location loc)
{
if (_characterList.isEmpty())
{
return;
}
for (Creature creature : getCharactersInside())
{
if ((creature != null) && creature.isPlayer())
@ -367,7 +362,7 @@ public class BossZone extends ZoneType
*/
public void oustAllPlayers()
{
if (_characterList.isEmpty())
if (getCharactersInside().isEmpty())
{
return;
}

View File

@ -129,7 +129,7 @@ public class DamageZone extends ZoneType
@Override
protected void onExit(Creature creature)
{
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -167,7 +167,7 @@ public class EffectZone extends ZoneType
}
}
}
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -46,7 +46,7 @@ public abstract class ZoneType extends ListenersContainer
private final int _id;
protected ZoneForm _zone;
protected Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
private final Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
/** Parameters to affect specific characters */
protected boolean _checkAffected = false;
@ -489,11 +489,6 @@ public abstract class ZoneType extends ListenersContainer
{
}
public Map<Integer, Creature> getCharacters()
{
return _characterList;
}
public Collection<Creature> getCharactersInside()
{
return _characterList.values();

View File

@ -343,11 +343,6 @@ public class BossZone extends ZoneType
*/
public void movePlayersTo(Location loc)
{
if (_characterList.isEmpty())
{
return;
}
for (Creature creature : getCharactersInside())
{
if ((creature != null) && creature.isPlayer())
@ -367,7 +362,7 @@ public class BossZone extends ZoneType
*/
public void oustAllPlayers()
{
if (_characterList.isEmpty())
if (getCharactersInside().isEmpty())
{
return;
}

View File

@ -129,7 +129,7 @@ public class DamageZone extends ZoneType
@Override
protected void onExit(Creature creature)
{
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -167,7 +167,7 @@ public class EffectZone extends ZoneType
}
}
}
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -49,7 +49,7 @@ public abstract class ZoneType extends ListenersContainer
private final int _id;
protected ZoneForm _zone;
protected List<ZoneForm> _blockedZone;
protected Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
private final Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
/** Parameters to affect specific characters */
private boolean _checkAffected = false;

View File

@ -130,7 +130,7 @@ public class DamageZone extends ZoneType
@Override
protected void onExit(Creature creature)
{
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -183,7 +183,7 @@ public class EffectZone extends ZoneType
}
}
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -49,7 +49,7 @@ public abstract class ZoneType extends ListenersContainer
private final int _id;
protected ZoneForm _zone;
protected List<ZoneForm> _blockedZone;
protected Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
private final Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
/** Parameters to affect specific characters */
private boolean _checkAffected = false;

View File

@ -130,7 +130,7 @@ public class DamageZone extends ZoneType
@Override
protected void onExit(Creature creature)
{
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -183,7 +183,7 @@ public class EffectZone extends ZoneType
}
}
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -49,7 +49,7 @@ public abstract class ZoneType extends ListenersContainer
private final int _id;
protected ZoneForm _zone;
protected List<ZoneForm> _blockedZone;
protected Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
private final Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
/** Parameters to affect specific characters */
private boolean _checkAffected = false;

View File

@ -130,7 +130,7 @@ public class DamageZone extends ZoneType
@Override
protected void onExit(Creature creature)
{
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -183,7 +183,7 @@ public class EffectZone extends ZoneType
}
}
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -49,7 +49,7 @@ public abstract class ZoneType extends ListenersContainer
private final int _id;
protected ZoneForm _zone;
protected List<ZoneForm> _blockedZone;
protected Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
private final Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
/** Parameters to affect specific characters */
private boolean _checkAffected = false;

View File

@ -130,7 +130,7 @@ public class DamageZone extends ZoneType
@Override
protected void onExit(Creature creature)
{
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -183,7 +183,7 @@ public class EffectZone extends ZoneType
}
}
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -49,7 +49,7 @@ public abstract class ZoneType extends ListenersContainer
private final int _id;
protected ZoneForm _zone;
protected List<ZoneForm> _blockedZone;
protected Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
private final Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
/** Parameters to affect specific characters */
private boolean _checkAffected = false;

View File

@ -130,7 +130,7 @@ public class DamageZone extends ZoneType
@Override
protected void onExit(Creature creature)
{
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -183,7 +183,7 @@ public class EffectZone extends ZoneType
}
}
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -49,7 +49,7 @@ public abstract class ZoneType extends ListenersContainer
private final int _id;
protected ZoneForm _zone;
protected List<ZoneForm> _blockedZone;
protected Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
private final Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
/** Parameters to affect specific characters */
private boolean _checkAffected = false;

View File

@ -130,7 +130,7 @@ public class DamageZone extends ZoneType
@Override
protected void onExit(Creature creature)
{
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -183,7 +183,7 @@ public class EffectZone extends ZoneType
}
}
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -49,7 +49,7 @@ public abstract class ZoneType extends ListenersContainer
private final int _id;
protected ZoneForm _zone;
protected List<ZoneForm> _blockedZone;
protected Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
private final Map<Integer, Creature> _characterList = new ConcurrentHashMap<>();
/** Parameters to affect specific characters */
private boolean _checkAffected = false;

View File

@ -130,7 +130,7 @@ public class DamageZone extends ZoneType
@Override
protected void onExit(Creature creature)
{
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}

View File

@ -183,7 +183,7 @@ public class EffectZone extends ZoneType
}
}
if (_characterList.isEmpty() && (getSettings().getTask() != null))
if (getCharactersInside().isEmpty() && (getSettings().getTask() != null))
{
getSettings().clear();
}