Instance use of LinkedList for unknown length lists.

This commit is contained in:
MobiusDevelopment
2021-12-25 23:32:10 +00:00
parent 33b35efb3c
commit f5f80399c5
23 changed files with 309 additions and 244 deletions

View File

@@ -377,7 +377,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Player> getPlayersInsideRadius(ILocational object, int radius)
{
final List<Player> result = new ArrayList<>();
final List<Player> result = new LinkedList<>();
for (Player player : _players)
{
if (player.isInsideRadius3D(object, radius))
@@ -460,8 +460,11 @@ public class Instance implements IIdentifiable, INamable
*/
public List<SpawnGroup> getSpawnGroup(String name)
{
final List<SpawnGroup> spawns = new ArrayList<>();
_spawns.stream().forEach(spawnTemplate -> spawns.addAll(spawnTemplate.getGroupsByName(name)));
final List<SpawnGroup> spawns = new LinkedList<>();
for (SpawnTemplate spawnTemplate : _spawns)
{
spawns.addAll(spawnTemplate.getGroupsByName(name));
}
return spawns;
}
@@ -585,7 +588,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (CommonUtil.contains(id, npc.getId()))
@@ -607,7 +610,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && clazz.isInstance(npc))
@@ -624,7 +627,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (npc.getCurrentHp() > 0)
@@ -642,7 +645,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
@@ -664,7 +667,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getAliveNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && (npc.getCurrentHp() > 0)) && clazz.isInstance(npc))

View File

@@ -377,7 +377,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Player> getPlayersInsideRadius(ILocational object, int radius)
{
final List<Player> result = new ArrayList<>();
final List<Player> result = new LinkedList<>();
for (Player player : _players)
{
if (player.isInsideRadius3D(object, radius))
@@ -460,8 +460,11 @@ public class Instance implements IIdentifiable, INamable
*/
public List<SpawnGroup> getSpawnGroup(String name)
{
final List<SpawnGroup> spawns = new ArrayList<>();
_spawns.stream().forEach(spawnTemplate -> spawns.addAll(spawnTemplate.getGroupsByName(name)));
final List<SpawnGroup> spawns = new LinkedList<>();
for (SpawnTemplate spawnTemplate : _spawns)
{
spawns.addAll(spawnTemplate.getGroupsByName(name));
}
return spawns;
}
@@ -585,7 +588,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (CommonUtil.contains(id, npc.getId()))
@@ -607,7 +610,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && clazz.isInstance(npc))
@@ -624,7 +627,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (npc.getCurrentHp() > 0)
@@ -642,7 +645,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
@@ -664,7 +667,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getAliveNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && (npc.getCurrentHp() > 0)) && clazz.isInstance(npc))

View File

@@ -377,7 +377,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Player> getPlayersInsideRadius(ILocational object, int radius)
{
final List<Player> result = new ArrayList<>();
final List<Player> result = new LinkedList<>();
for (Player player : _players)
{
if (player.isInsideRadius3D(object, radius))
@@ -460,8 +460,11 @@ public class Instance implements IIdentifiable, INamable
*/
public List<SpawnGroup> getSpawnGroup(String name)
{
final List<SpawnGroup> spawns = new ArrayList<>();
_spawns.stream().forEach(spawnTemplate -> spawns.addAll(spawnTemplate.getGroupsByName(name)));
final List<SpawnGroup> spawns = new LinkedList<>();
for (SpawnTemplate spawnTemplate : _spawns)
{
spawns.addAll(spawnTemplate.getGroupsByName(name));
}
return spawns;
}
@@ -585,7 +588,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (CommonUtil.contains(id, npc.getId()))
@@ -607,7 +610,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && clazz.isInstance(npc))
@@ -624,7 +627,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (npc.getCurrentHp() > 0)
@@ -642,7 +645,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
@@ -664,7 +667,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getAliveNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && (npc.getCurrentHp() > 0)) && clazz.isInstance(npc))

View File

@@ -377,7 +377,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Player> getPlayersInsideRadius(ILocational object, int radius)
{
final List<Player> result = new ArrayList<>();
final List<Player> result = new LinkedList<>();
for (Player player : _players)
{
if (player.isInsideRadius3D(object, radius))
@@ -460,8 +460,11 @@ public class Instance implements IIdentifiable, INamable
*/
public List<SpawnGroup> getSpawnGroup(String name)
{
final List<SpawnGroup> spawns = new ArrayList<>();
_spawns.stream().forEach(spawnTemplate -> spawns.addAll(spawnTemplate.getGroupsByName(name)));
final List<SpawnGroup> spawns = new LinkedList<>();
for (SpawnTemplate spawnTemplate : _spawns)
{
spawns.addAll(spawnTemplate.getGroupsByName(name));
}
return spawns;
}
@@ -585,7 +588,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (CommonUtil.contains(id, npc.getId()))
@@ -607,7 +610,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && clazz.isInstance(npc))
@@ -624,7 +627,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (npc.getCurrentHp() > 0)
@@ -642,7 +645,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
@@ -664,7 +667,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getAliveNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && (npc.getCurrentHp() > 0)) && clazz.isInstance(npc))

View File

@@ -377,7 +377,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Player> getPlayersInsideRadius(ILocational object, int radius)
{
final List<Player> result = new ArrayList<>();
final List<Player> result = new LinkedList<>();
for (Player player : _players)
{
if (player.isInsideRadius3D(object, radius))
@@ -460,8 +460,11 @@ public class Instance implements IIdentifiable, INamable
*/
public List<SpawnGroup> getSpawnGroup(String name)
{
final List<SpawnGroup> spawns = new ArrayList<>();
_spawns.stream().forEach(spawnTemplate -> spawns.addAll(spawnTemplate.getGroupsByName(name)));
final List<SpawnGroup> spawns = new LinkedList<>();
for (SpawnTemplate spawnTemplate : _spawns)
{
spawns.addAll(spawnTemplate.getGroupsByName(name));
}
return spawns;
}
@@ -585,7 +588,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (CommonUtil.contains(id, npc.getId()))
@@ -607,7 +610,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && clazz.isInstance(npc))
@@ -624,7 +627,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (npc.getCurrentHp() > 0)
@@ -642,7 +645,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
@@ -664,7 +667,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getAliveNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && (npc.getCurrentHp() > 0)) && clazz.isInstance(npc))

View File

@@ -377,7 +377,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Player> getPlayersInsideRadius(ILocational object, int radius)
{
final List<Player> result = new ArrayList<>();
final List<Player> result = new LinkedList<>();
for (Player player : _players)
{
if (player.isInsideRadius3D(object, radius))
@@ -460,8 +460,11 @@ public class Instance implements IIdentifiable, INamable
*/
public List<SpawnGroup> getSpawnGroup(String name)
{
final List<SpawnGroup> spawns = new ArrayList<>();
_spawns.stream().forEach(spawnTemplate -> spawns.addAll(spawnTemplate.getGroupsByName(name)));
final List<SpawnGroup> spawns = new LinkedList<>();
for (SpawnTemplate spawnTemplate : _spawns)
{
spawns.addAll(spawnTemplate.getGroupsByName(name));
}
return spawns;
}
@@ -585,7 +588,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (CommonUtil.contains(id, npc.getId()))
@@ -607,7 +610,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && clazz.isInstance(npc))
@@ -624,7 +627,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (npc.getCurrentHp() > 0)
@@ -642,7 +645,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
@@ -664,7 +667,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getAliveNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && (npc.getCurrentHp() > 0)) && clazz.isInstance(npc))

View File

@@ -377,7 +377,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Player> getPlayersInsideRadius(ILocational object, int radius)
{
final List<Player> result = new ArrayList<>();
final List<Player> result = new LinkedList<>();
for (Player player : _players)
{
if (player.isInsideRadius3D(object, radius))
@@ -460,8 +460,11 @@ public class Instance implements IIdentifiable, INamable
*/
public List<SpawnGroup> getSpawnGroup(String name)
{
final List<SpawnGroup> spawns = new ArrayList<>();
_spawns.stream().forEach(spawnTemplate -> spawns.addAll(spawnTemplate.getGroupsByName(name)));
final List<SpawnGroup> spawns = new LinkedList<>();
for (SpawnTemplate spawnTemplate : _spawns)
{
spawns.addAll(spawnTemplate.getGroupsByName(name));
}
return spawns;
}
@@ -585,7 +588,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (CommonUtil.contains(id, npc.getId()))
@@ -607,7 +610,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && clazz.isInstance(npc))
@@ -624,7 +627,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (npc.getCurrentHp() > 0)
@@ -642,7 +645,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
@@ -664,7 +667,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getAliveNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && (npc.getCurrentHp() > 0)) && clazz.isInstance(npc))

View File

@@ -377,7 +377,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Player> getPlayersInsideRadius(ILocational object, int radius)
{
final List<Player> result = new ArrayList<>();
final List<Player> result = new LinkedList<>();
for (Player player : _players)
{
if (player.isInsideRadius3D(object, radius))
@@ -460,8 +460,11 @@ public class Instance implements IIdentifiable, INamable
*/
public List<SpawnGroup> getSpawnGroup(String name)
{
final List<SpawnGroup> spawns = new ArrayList<>();
_spawns.stream().forEach(spawnTemplate -> spawns.addAll(spawnTemplate.getGroupsByName(name)));
final List<SpawnGroup> spawns = new LinkedList<>();
for (SpawnTemplate spawnTemplate : _spawns)
{
spawns.addAll(spawnTemplate.getGroupsByName(name));
}
return spawns;
}
@@ -585,7 +588,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (CommonUtil.contains(id, npc.getId()))
@@ -607,7 +610,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && clazz.isInstance(npc))
@@ -624,7 +627,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (npc.getCurrentHp() > 0)
@@ -642,7 +645,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
@@ -664,7 +667,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getAliveNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && (npc.getCurrentHp() > 0)) && clazz.isInstance(npc))

View File

@@ -377,7 +377,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Player> getPlayersInsideRadius(ILocational object, int radius)
{
final List<Player> result = new ArrayList<>();
final List<Player> result = new LinkedList<>();
for (Player player : _players)
{
if (player.isInsideRadius3D(object, radius))
@@ -460,8 +460,11 @@ public class Instance implements IIdentifiable, INamable
*/
public List<SpawnGroup> getSpawnGroup(String name)
{
final List<SpawnGroup> spawns = new ArrayList<>();
_spawns.stream().forEach(spawnTemplate -> spawns.addAll(spawnTemplate.getGroupsByName(name)));
final List<SpawnGroup> spawns = new LinkedList<>();
for (SpawnTemplate spawnTemplate : _spawns)
{
spawns.addAll(spawnTemplate.getGroupsByName(name));
}
return spawns;
}
@@ -585,7 +588,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (CommonUtil.contains(id, npc.getId()))
@@ -607,7 +610,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && clazz.isInstance(npc))
@@ -624,7 +627,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (npc.getCurrentHp() > 0)
@@ -642,7 +645,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
@@ -664,7 +667,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getAliveNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && (npc.getCurrentHp() > 0)) && clazz.isInstance(npc))

View File

@@ -377,7 +377,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Player> getPlayersInsideRadius(ILocational object, int radius)
{
final List<Player> result = new ArrayList<>();
final List<Player> result = new LinkedList<>();
for (Player player : _players)
{
if (player.isInsideRadius3D(object, radius))
@@ -460,8 +460,11 @@ public class Instance implements IIdentifiable, INamable
*/
public List<SpawnGroup> getSpawnGroup(String name)
{
final List<SpawnGroup> spawns = new ArrayList<>();
_spawns.stream().forEach(spawnTemplate -> spawns.addAll(spawnTemplate.getGroupsByName(name)));
final List<SpawnGroup> spawns = new LinkedList<>();
for (SpawnTemplate spawnTemplate : _spawns)
{
spawns.addAll(spawnTemplate.getGroupsByName(name));
}
return spawns;
}
@@ -585,7 +588,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (CommonUtil.contains(id, npc.getId()))
@@ -607,7 +610,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && clazz.isInstance(npc))
@@ -624,7 +627,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (npc.getCurrentHp() > 0)
@@ -642,7 +645,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
@@ -664,7 +667,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getAliveNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && (npc.getCurrentHp() > 0)) && clazz.isInstance(npc))

View File

@@ -377,7 +377,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Player> getPlayersInsideRadius(ILocational object, int radius)
{
final List<Player> result = new ArrayList<>();
final List<Player> result = new LinkedList<>();
for (Player player : _players)
{
if (player.isInsideRadius3D(object, radius))
@@ -460,8 +460,11 @@ public class Instance implements IIdentifiable, INamable
*/
public List<SpawnGroup> getSpawnGroup(String name)
{
final List<SpawnGroup> spawns = new ArrayList<>();
_spawns.stream().forEach(spawnTemplate -> spawns.addAll(spawnTemplate.getGroupsByName(name)));
final List<SpawnGroup> spawns = new LinkedList<>();
for (SpawnTemplate spawnTemplate : _spawns)
{
spawns.addAll(spawnTemplate.getGroupsByName(name));
}
return spawns;
}
@@ -585,7 +588,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (CommonUtil.contains(id, npc.getId()))
@@ -607,7 +610,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && clazz.isInstance(npc))
@@ -624,7 +627,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (npc.getCurrentHp() > 0)
@@ -642,7 +645,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
@@ -664,7 +667,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getAliveNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && (npc.getCurrentHp() > 0)) && clazz.isInstance(npc))

View File

@@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.model.instancezone;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
@@ -175,23 +176,6 @@ public class InstanceWorld
return _instance.getNpcs();
}
/**
* Get alive NPCs from instance.
* @return set of NPCs from instance
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new ArrayList<>();
for (Npc npc : _instance.getNpcs())
{
if (npc.getCurrentHp() > 0)
{
result.add(npc);
}
}
return result;
}
/**
* Get spawned NPCs from instance with specific IDs.
* @param id IDs of NPCs which should be found
@@ -199,7 +183,7 @@ public class InstanceWorld
*/
public List<Npc> getNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _instance.getNpcs())
{
if (CommonUtil.contains(id, npc.getId()))
@@ -221,7 +205,7 @@ public class InstanceWorld
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _instance.getNpcs())
{
if (((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && clazz.isInstance(npc))
@@ -232,6 +216,41 @@ public class InstanceWorld
return result;
}
/**
* Get alive NPCs from instance.
* @return set of NPCs from instance
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new LinkedList<>();
for (Npc npc : _instance.getNpcs())
{
if (npc.getCurrentHp() > 0)
{
result.add(npc);
}
}
return result;
}
/**
* Get alive NPCs from instance with specific IDs.
* @param id IDs of NPCs which should be found
* @return list of filtered NPCs from instance
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new LinkedList<>();
for (Npc npc : _instance.getNpcs())
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
{
result.add(npc);
}
}
return result;
}
/**
* Get spawned and alive NPCs from instance with specific IDs and class type.
* @param <T>
@@ -243,7 +262,7 @@ public class InstanceWorld
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getAliveNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _instance.getNpcs())
{
if ((((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && (npc.getCurrentHp() > 0)) && clazz.isInstance(npc))
@@ -254,24 +273,6 @@ public class InstanceWorld
return result;
}
/**
* Get alive NPCs from instance with specific IDs.
* @param id IDs of NPCs which should be found
* @return list of filtered NPCs from instance
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
for (Npc npc : _instance.getNpcs())
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
{
result.add(npc);
}
}
return result;
}
/**
* Get first found spawned NPC with specific ID.
* @param id ID of NPC to be found

View File

@@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.model.instancezone;
import java.util.ArrayList;
import java.util.Collection;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
@@ -175,23 +176,6 @@ public class InstanceWorld
return _instance.getNpcs();
}
/**
* Get alive NPCs from instance.
* @return set of NPCs from instance
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new ArrayList<>();
for (Npc npc : _instance.getNpcs())
{
if (npc.getCurrentHp() > 0)
{
result.add(npc);
}
}
return result;
}
/**
* Get spawned NPCs from instance with specific IDs.
* @param id IDs of NPCs which should be found
@@ -199,7 +183,7 @@ public class InstanceWorld
*/
public List<Npc> getNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _instance.getNpcs())
{
if (CommonUtil.contains(id, npc.getId()))
@@ -221,7 +205,7 @@ public class InstanceWorld
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _instance.getNpcs())
{
if (((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && clazz.isInstance(npc))
@@ -232,6 +216,41 @@ public class InstanceWorld
return result;
}
/**
* Get alive NPCs from instance.
* @return set of NPCs from instance
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new LinkedList<>();
for (Npc npc : _instance.getNpcs())
{
if (npc.getCurrentHp() > 0)
{
result.add(npc);
}
}
return result;
}
/**
* Get alive NPCs from instance with specific IDs.
* @param id IDs of NPCs which should be found
* @return list of filtered NPCs from instance
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new LinkedList<>();
for (Npc npc : _instance.getNpcs())
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
{
result.add(npc);
}
}
return result;
}
/**
* Get spawned and alive NPCs from instance with specific IDs and class type.
* @param <T>
@@ -243,7 +262,7 @@ public class InstanceWorld
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getAliveNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _instance.getNpcs())
{
if ((((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && (npc.getCurrentHp() > 0)) && clazz.isInstance(npc))
@@ -254,24 +273,6 @@ public class InstanceWorld
return result;
}
/**
* Get alive NPCs from instance with specific IDs.
* @param id IDs of NPCs which should be found
* @return list of filtered NPCs from instance
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
for (Npc npc : _instance.getNpcs())
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
{
result.add(npc);
}
}
return result;
}
/**
* Get first found spawned NPC with specific ID.
* @param id ID of NPC to be found

View File

@@ -377,7 +377,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Player> getPlayersInsideRadius(ILocational object, int radius)
{
final List<Player> result = new ArrayList<>();
final List<Player> result = new LinkedList<>();
for (Player player : _players)
{
if (player.isInsideRadius3D(object, radius))
@@ -460,8 +460,11 @@ public class Instance implements IIdentifiable, INamable
*/
public List<SpawnGroup> getSpawnGroup(String name)
{
final List<SpawnGroup> spawns = new ArrayList<>();
_spawns.stream().forEach(spawnTemplate -> spawns.addAll(spawnTemplate.getGroupsByName(name)));
final List<SpawnGroup> spawns = new LinkedList<>();
for (SpawnTemplate spawnTemplate : _spawns)
{
spawns.addAll(spawnTemplate.getGroupsByName(name));
}
return spawns;
}
@@ -585,7 +588,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (CommonUtil.contains(id, npc.getId()))
@@ -607,7 +610,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && clazz.isInstance(npc))
@@ -624,7 +627,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (npc.getCurrentHp() > 0)
@@ -642,7 +645,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
@@ -664,7 +667,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getAliveNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && (npc.getCurrentHp() > 0)) && clazz.isInstance(npc))

View File

@@ -377,7 +377,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Player> getPlayersInsideRadius(ILocational object, int radius)
{
final List<Player> result = new ArrayList<>();
final List<Player> result = new LinkedList<>();
for (Player player : _players)
{
if (player.isInsideRadius3D(object, radius))
@@ -460,8 +460,11 @@ public class Instance implements IIdentifiable, INamable
*/
public List<SpawnGroup> getSpawnGroup(String name)
{
final List<SpawnGroup> spawns = new ArrayList<>();
_spawns.stream().forEach(spawnTemplate -> spawns.addAll(spawnTemplate.getGroupsByName(name)));
final List<SpawnGroup> spawns = new LinkedList<>();
for (SpawnTemplate spawnTemplate : _spawns)
{
spawns.addAll(spawnTemplate.getGroupsByName(name));
}
return spawns;
}
@@ -585,7 +588,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (CommonUtil.contains(id, npc.getId()))
@@ -607,7 +610,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && clazz.isInstance(npc))
@@ -624,7 +627,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (npc.getCurrentHp() > 0)
@@ -642,7 +645,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
@@ -664,7 +667,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getAliveNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && (npc.getCurrentHp() > 0)) && clazz.isInstance(npc))

View File

@@ -377,7 +377,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Player> getPlayersInsideRadius(ILocational object, int radius)
{
final List<Player> result = new ArrayList<>();
final List<Player> result = new LinkedList<>();
for (Player player : _players)
{
if (player.isInsideRadius3D(object, radius))
@@ -460,8 +460,11 @@ public class Instance implements IIdentifiable, INamable
*/
public List<SpawnGroup> getSpawnGroup(String name)
{
final List<SpawnGroup> spawns = new ArrayList<>();
_spawns.stream().forEach(spawnTemplate -> spawns.addAll(spawnTemplate.getGroupsByName(name)));
final List<SpawnGroup> spawns = new LinkedList<>();
for (SpawnTemplate spawnTemplate : _spawns)
{
spawns.addAll(spawnTemplate.getGroupsByName(name));
}
return spawns;
}
@@ -585,7 +588,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (CommonUtil.contains(id, npc.getId()))
@@ -607,7 +610,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && clazz.isInstance(npc))
@@ -624,7 +627,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (npc.getCurrentHp() > 0)
@@ -642,7 +645,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
@@ -664,7 +667,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getAliveNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && (npc.getCurrentHp() > 0)) && clazz.isInstance(npc))

View File

@@ -377,7 +377,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Player> getPlayersInsideRadius(ILocational object, int radius)
{
final List<Player> result = new ArrayList<>();
final List<Player> result = new LinkedList<>();
for (Player player : _players)
{
if (player.isInsideRadius3D(object, radius))
@@ -460,8 +460,11 @@ public class Instance implements IIdentifiable, INamable
*/
public List<SpawnGroup> getSpawnGroup(String name)
{
final List<SpawnGroup> spawns = new ArrayList<>();
_spawns.stream().forEach(spawnTemplate -> spawns.addAll(spawnTemplate.getGroupsByName(name)));
final List<SpawnGroup> spawns = new LinkedList<>();
for (SpawnTemplate spawnTemplate : _spawns)
{
spawns.addAll(spawnTemplate.getGroupsByName(name));
}
return spawns;
}
@@ -585,7 +588,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (CommonUtil.contains(id, npc.getId()))
@@ -607,7 +610,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && clazz.isInstance(npc))
@@ -624,7 +627,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (npc.getCurrentHp() > 0)
@@ -642,7 +645,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
@@ -664,7 +667,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getAliveNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && (npc.getCurrentHp() > 0)) && clazz.isInstance(npc))

View File

@@ -377,7 +377,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Player> getPlayersInsideRadius(ILocational object, int radius)
{
final List<Player> result = new ArrayList<>();
final List<Player> result = new LinkedList<>();
for (Player player : _players)
{
if (player.isInsideRadius3D(object, radius))
@@ -460,8 +460,11 @@ public class Instance implements IIdentifiable, INamable
*/
public List<SpawnGroup> getSpawnGroup(String name)
{
final List<SpawnGroup> spawns = new ArrayList<>();
_spawns.stream().forEach(spawnTemplate -> spawns.addAll(spawnTemplate.getGroupsByName(name)));
final List<SpawnGroup> spawns = new LinkedList<>();
for (SpawnTemplate spawnTemplate : _spawns)
{
spawns.addAll(spawnTemplate.getGroupsByName(name));
}
return spawns;
}
@@ -585,7 +588,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (CommonUtil.contains(id, npc.getId()))
@@ -607,7 +610,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && clazz.isInstance(npc))
@@ -624,7 +627,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (npc.getCurrentHp() > 0)
@@ -642,7 +645,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
@@ -664,7 +667,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getAliveNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && (npc.getCurrentHp() > 0)) && clazz.isInstance(npc))

View File

@@ -377,7 +377,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Player> getPlayersInsideRadius(ILocational object, int radius)
{
final List<Player> result = new ArrayList<>();
final List<Player> result = new LinkedList<>();
for (Player player : _players)
{
if (player.isInsideRadius3D(object, radius))
@@ -460,8 +460,11 @@ public class Instance implements IIdentifiable, INamable
*/
public List<SpawnGroup> getSpawnGroup(String name)
{
final List<SpawnGroup> spawns = new ArrayList<>();
_spawns.stream().forEach(spawnTemplate -> spawns.addAll(spawnTemplate.getGroupsByName(name)));
final List<SpawnGroup> spawns = new LinkedList<>();
for (SpawnTemplate spawnTemplate : _spawns)
{
spawns.addAll(spawnTemplate.getGroupsByName(name));
}
return spawns;
}
@@ -585,7 +588,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (CommonUtil.contains(id, npc.getId()))
@@ -607,7 +610,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && clazz.isInstance(npc))
@@ -624,7 +627,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (npc.getCurrentHp() > 0)
@@ -642,7 +645,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
@@ -664,7 +667,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getAliveNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && (npc.getCurrentHp() > 0)) && clazz.isInstance(npc))

View File

@@ -377,7 +377,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Player> getPlayersInsideRadius(ILocational object, int radius)
{
final List<Player> result = new ArrayList<>();
final List<Player> result = new LinkedList<>();
for (Player player : _players)
{
if (player.isInsideRadius3D(object, radius))
@@ -460,8 +460,11 @@ public class Instance implements IIdentifiable, INamable
*/
public List<SpawnGroup> getSpawnGroup(String name)
{
final List<SpawnGroup> spawns = new ArrayList<>();
_spawns.stream().forEach(spawnTemplate -> spawns.addAll(spawnTemplate.getGroupsByName(name)));
final List<SpawnGroup> spawns = new LinkedList<>();
for (SpawnTemplate spawnTemplate : _spawns)
{
spawns.addAll(spawnTemplate.getGroupsByName(name));
}
return spawns;
}
@@ -585,7 +588,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (CommonUtil.contains(id, npc.getId()))
@@ -607,7 +610,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && clazz.isInstance(npc))
@@ -624,7 +627,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (npc.getCurrentHp() > 0)
@@ -642,7 +645,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
@@ -664,7 +667,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getAliveNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && (npc.getCurrentHp() > 0)) && clazz.isInstance(npc))

View File

@@ -377,7 +377,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Player> getPlayersInsideRadius(ILocational object, int radius)
{
final List<Player> result = new ArrayList<>();
final List<Player> result = new LinkedList<>();
for (Player player : _players)
{
if (player.isInsideRadius3D(object, radius))
@@ -460,8 +460,11 @@ public class Instance implements IIdentifiable, INamable
*/
public List<SpawnGroup> getSpawnGroup(String name)
{
final List<SpawnGroup> spawns = new ArrayList<>();
_spawns.stream().forEach(spawnTemplate -> spawns.addAll(spawnTemplate.getGroupsByName(name)));
final List<SpawnGroup> spawns = new LinkedList<>();
for (SpawnTemplate spawnTemplate : _spawns)
{
spawns.addAll(spawnTemplate.getGroupsByName(name));
}
return spawns;
}
@@ -585,7 +588,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (CommonUtil.contains(id, npc.getId()))
@@ -607,7 +610,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && clazz.isInstance(npc))
@@ -624,7 +627,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (npc.getCurrentHp() > 0)
@@ -642,7 +645,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
@@ -664,7 +667,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getAliveNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && (npc.getCurrentHp() > 0)) && clazz.isInstance(npc))

View File

@@ -377,7 +377,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Player> getPlayersInsideRadius(ILocational object, int radius)
{
final List<Player> result = new ArrayList<>();
final List<Player> result = new LinkedList<>();
for (Player player : _players)
{
if (player.isInsideRadius3D(object, radius))
@@ -460,8 +460,11 @@ public class Instance implements IIdentifiable, INamable
*/
public List<SpawnGroup> getSpawnGroup(String name)
{
final List<SpawnGroup> spawns = new ArrayList<>();
_spawns.stream().forEach(spawnTemplate -> spawns.addAll(spawnTemplate.getGroupsByName(name)));
final List<SpawnGroup> spawns = new LinkedList<>();
for (SpawnTemplate spawnTemplate : _spawns)
{
spawns.addAll(spawnTemplate.getGroupsByName(name));
}
return spawns;
}
@@ -585,7 +588,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (CommonUtil.contains(id, npc.getId()))
@@ -607,7 +610,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && clazz.isInstance(npc))
@@ -624,7 +627,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (npc.getCurrentHp() > 0)
@@ -642,7 +645,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
@@ -664,7 +667,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getAliveNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && (npc.getCurrentHp() > 0)) && clazz.isInstance(npc))

View File

@@ -377,7 +377,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Player> getPlayersInsideRadius(ILocational object, int radius)
{
final List<Player> result = new ArrayList<>();
final List<Player> result = new LinkedList<>();
for (Player player : _players)
{
if (player.isInsideRadius3D(object, radius))
@@ -460,8 +460,11 @@ public class Instance implements IIdentifiable, INamable
*/
public List<SpawnGroup> getSpawnGroup(String name)
{
final List<SpawnGroup> spawns = new ArrayList<>();
_spawns.stream().forEach(spawnTemplate -> spawns.addAll(spawnTemplate.getGroupsByName(name)));
final List<SpawnGroup> spawns = new LinkedList<>();
for (SpawnTemplate spawnTemplate : _spawns)
{
spawns.addAll(spawnTemplate.getGroupsByName(name));
}
return spawns;
}
@@ -585,7 +588,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (CommonUtil.contains(id, npc.getId()))
@@ -607,7 +610,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && clazz.isInstance(npc))
@@ -624,7 +627,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs()
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if (npc.getCurrentHp() > 0)
@@ -642,7 +645,7 @@ public class Instance implements IIdentifiable, INamable
*/
public List<Npc> getAliveNpcs(int... id)
{
final List<Npc> result = new ArrayList<>();
final List<Npc> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((npc.getCurrentHp() > 0) && CommonUtil.contains(id, npc.getId()))
@@ -664,7 +667,7 @@ public class Instance implements IIdentifiable, INamable
@SuppressWarnings("unchecked")
public final <T extends Creature> List<T> getAliveNpcs(Class<T> clazz, int... ids)
{
final List<T> result = new ArrayList<>();
final List<T> result = new LinkedList<>();
for (Npc npc : _npcs)
{
if ((((ids.length == 0) || CommonUtil.contains(ids, npc.getId())) && (npc.getCurrentHp() > 0)) && clazz.isInstance(npc))