Replaced several CopyOnWriteArrayList occurrences with ConcurrentHashMap.newKeySet().
This commit is contained in:
@@ -17,7 +17,8 @@
|
||||
package ai.areas.FantasyIsle;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
@@ -120,7 +121,7 @@ public class Parade extends AbstractNpcAI
|
||||
// @formatter:on
|
||||
|
||||
int npcIndex;
|
||||
CopyOnWriteArrayList<Npc> spawns = new CopyOnWriteArrayList<>();
|
||||
Collection<Npc> spawns = ConcurrentHashMap.newKeySet();
|
||||
ScheduledFuture<?> spawnTask;
|
||||
ScheduledFuture<?> deleteTask;
|
||||
ScheduledFuture<?> cleanTask;
|
||||
|
||||
@@ -18,8 +18,9 @@ package ai.areas.ForgeOfTheGods;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
@@ -189,7 +190,7 @@ public class TarBeetleSpawn implements IXmlReader
|
||||
private final class SpawnZone
|
||||
{
|
||||
private final List<Zone> _zones = new ArrayList<>();
|
||||
private final List<Npc> _spawn = new CopyOnWriteArrayList<>();
|
||||
private final Collection<Npc> _spawn = ConcurrentHashMap.newKeySet();
|
||||
private final int _maxNpcCount;
|
||||
private final int _index;
|
||||
|
||||
|
||||
@@ -17,13 +17,12 @@
|
||||
package ai.areas.Hellbound.AI.Zones.TowerOfNaia;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
@@ -158,7 +157,7 @@ public class TowerOfNaia extends AbstractNpcAI
|
||||
private int _winIndex;
|
||||
|
||||
private final Map<Integer, Boolean> _activeRooms = new HashMap<>();
|
||||
private final Map<Integer, List<Npc>> _spawns = new ConcurrentHashMap<>();
|
||||
private final Map<Integer, Collection<Npc>> _spawns = new ConcurrentHashMap<>();
|
||||
private final Set<Npc> _sporeSpawn = ConcurrentHashMap.newKeySet();
|
||||
static
|
||||
{
|
||||
@@ -625,7 +624,7 @@ public class TowerOfNaia extends AbstractNpcAI
|
||||
|
||||
if ((managerId > 0) && _spawns.containsKey(managerId))
|
||||
{
|
||||
final List<Npc> spawned = _spawns.get(managerId);
|
||||
final Collection<Npc> spawned = _spawns.get(managerId);
|
||||
spawned.remove(npc);
|
||||
if (spawned.isEmpty() && DOORS.containsKey(managerId))
|
||||
{
|
||||
@@ -876,7 +875,7 @@ public class TowerOfNaia extends AbstractNpcAI
|
||||
if (SPAWNS.containsKey(managerId))
|
||||
{
|
||||
final int[][] spawnList = SPAWNS.get(managerId);
|
||||
final List<Npc> spawned = new CopyOnWriteArrayList<>();
|
||||
final Collection<Npc> spawned = ConcurrentHashMap.newKeySet();
|
||||
for (int[] spawn : spawnList)
|
||||
{
|
||||
final Npc spawnedNpc = addSpawn(spawn[0], spawn[1], spawn[2], spawn[3], spawn[4], false, 0, false);
|
||||
|
||||
@@ -16,11 +16,11 @@
|
||||
*/
|
||||
package ai.bosses.Core;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
@@ -50,7 +50,7 @@ public class Core extends AbstractNpcAI
|
||||
private static final int DOOM_WRAITH = 29008;
|
||||
private static final int SUSCEPTOR = 29011;
|
||||
// Spawns
|
||||
private static final Map<Integer, Location> MINNION_SPAWNS = new HashMap<>();
|
||||
private static final Map<Integer, Location> MINNION_SPAWNS = new HashMap<>();
|
||||
static
|
||||
{
|
||||
MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17191, 109298, -6488));
|
||||
@@ -79,7 +79,7 @@ public class Core extends AbstractNpcAI
|
||||
|
||||
private static boolean _firstAttacked;
|
||||
|
||||
private static final List<Attackable> _minions = new CopyOnWriteArrayList<>();
|
||||
private static final Collection<Attackable> _minions = ConcurrentHashMap.newKeySet();
|
||||
|
||||
private Core()
|
||||
{
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
*/
|
||||
package ai.bosses.Orfen;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
@@ -70,7 +70,7 @@ public class Orfen extends AbstractNpcAI
|
||||
private static final int RIBA_IREN = 29018;
|
||||
|
||||
private static boolean _IsTeleported;
|
||||
private static final List<Attackable> MINIONS = new CopyOnWriteArrayList<>();
|
||||
private static final Collection<Attackable> MINIONS = ConcurrentHashMap.newKeySet();
|
||||
private static BossZone ZONE;
|
||||
|
||||
private static final byte ALIVE = 0;
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
*/
|
||||
package ai.others;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
@@ -87,7 +87,7 @@ public class SiegeGuards extends AbstractNpcAI
|
||||
35134, 35135, 35136, 35176, 35177, 35178, 35218, 35219, 35220, 35261, 35262, 35263, 35264, 35265, 35308, 35309, 35310, 35352, 35353, 35354, 35497, 35498, 35499, 35500, 35501, 35544, 35545, 35546
|
||||
};
|
||||
//@formatter:on
|
||||
private static final List<Npc> SPAWNED_GUARDS = new CopyOnWriteArrayList<>();
|
||||
private static final Collection<Npc> SPAWNED_GUARDS = ConcurrentHashMap.newKeySet();
|
||||
|
||||
public SiegeGuards()
|
||||
{
|
||||
|
||||
@@ -71,7 +71,7 @@ public class SteelCitadelTeleport extends AbstractNpcAI
|
||||
{
|
||||
GrandBossManager.getInstance().setBossStatus(BELETH, 1);
|
||||
|
||||
for (Party party : channel.getPartys())
|
||||
for (Party party : channel.getParties())
|
||||
{
|
||||
if (party == null)
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
package handlers.admincommandhandlers;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
import java.util.StringTokenizer;
|
||||
|
||||
import org.l2jmobius.gameserver.handler.IAdminCommandHandler;
|
||||
@@ -132,7 +132,7 @@ public class AdminTerritoryWar implements IAdminCommandHandler
|
||||
// get,build & send current Wards list
|
||||
if (TerritoryWarManager.getInstance().isTWInProgress())
|
||||
{
|
||||
final List<TerritoryWard> territoryWardList = TerritoryWarManager.getInstance().getAllTerritoryWards();
|
||||
final Collection<TerritoryWard> territoryWardList = TerritoryWarManager.getInstance().getAllTerritoryWards();
|
||||
for (TerritoryWard ward : territoryWardList)
|
||||
{
|
||||
if (ward.getNpc() != null)
|
||||
|
||||
@@ -62,7 +62,7 @@ public abstract class AbstractInstance extends AbstractNpcAI
|
||||
}
|
||||
if (!inst.getEnterLocs().isEmpty())
|
||||
{
|
||||
teleportPlayer(player, inst.getEnterLocs().get(getRandom(inst.getEnterLocs().size())), world.getInstanceId(), false);
|
||||
teleportPlayer(player, inst.getEnterLocs().stream().findAny().get(), world.getInstanceId(), false);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -88,7 +88,7 @@ public abstract class AbstractInstance extends AbstractNpcAI
|
||||
}
|
||||
if (!inst.getEnterLocs().isEmpty())
|
||||
{
|
||||
teleportPlayer(player, inst.getEnterLocs().get(getRandom(inst.getEnterLocs().size())), instance.getInstanceId(), false);
|
||||
teleportPlayer(player, inst.getEnterLocs().stream().findAny().get(), instance.getInstanceId(), false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,11 +19,12 @@ package org.l2jmobius.commons.util;
|
||||
import java.io.File;
|
||||
import java.io.FileFilter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Predicate;
|
||||
@@ -167,7 +168,7 @@ public interface IXmlReader
|
||||
|
||||
if (Config.THREADS_FOR_LOADING)
|
||||
{
|
||||
final List<ScheduledFuture<?>> jobs = new CopyOnWriteArrayList<>();
|
||||
final Collection<ScheduledFuture<?>> jobs = ConcurrentHashMap.newKeySet();
|
||||
final File[] listOfFiles = dir.listFiles();
|
||||
for (File file : listOfFiles)
|
||||
{
|
||||
|
||||
@@ -19,10 +19,9 @@ package org.l2jmobius.gameserver.communitybbs.BB;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -46,7 +45,7 @@ public class Forum
|
||||
public static final int CLANMEMBERONLY = 2;
|
||||
public static final int OWNERONLY = 3;
|
||||
|
||||
private final List<Forum> _children;
|
||||
private final Collection<Forum> _children;
|
||||
private final Map<Integer, Topic> _topic = new ConcurrentHashMap<>();
|
||||
private final int _forumId;
|
||||
private String _forumName;
|
||||
@@ -66,7 +65,7 @@ public class Forum
|
||||
{
|
||||
_forumId = Forumid;
|
||||
_fParent = FParent;
|
||||
_children = new CopyOnWriteArrayList<>();
|
||||
_children = ConcurrentHashMap.newKeySet();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -85,7 +84,7 @@ public class Forum
|
||||
_forumPerm = perm;
|
||||
_fParent = parent;
|
||||
_ownerID = OwnerID;
|
||||
_children = new CopyOnWriteArrayList<>();
|
||||
_children = ConcurrentHashMap.newKeySet();
|
||||
parent._children.add(this);
|
||||
ForumsBBSManager.getInstance().addForum(this);
|
||||
_loaded = true;
|
||||
|
||||
@@ -19,8 +19,8 @@ package org.l2jmobius.gameserver.communitybbs.BB;
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class Post
|
||||
public String postTxt;
|
||||
}
|
||||
|
||||
private final List<CPost> _post;
|
||||
private final Collection<CPost> _post;
|
||||
|
||||
/**
|
||||
* @param _PostOwner
|
||||
@@ -57,7 +57,7 @@ public class Post
|
||||
*/
|
||||
public Post(String _PostOwner, int _PostOwnerID, long date, int tid, int _PostForumID, String txt)
|
||||
{
|
||||
_post = new CopyOnWriteArrayList<>();
|
||||
_post = ConcurrentHashMap.newKeySet();
|
||||
final CPost cp = new CPost();
|
||||
cp.postId = 0;
|
||||
cp.postOwner = _PostOwner;
|
||||
@@ -92,7 +92,7 @@ public class Post
|
||||
|
||||
public Post(Topic t)
|
||||
{
|
||||
_post = new CopyOnWriteArrayList<>();
|
||||
_post = ConcurrentHashMap.newKeySet();
|
||||
load(t);
|
||||
}
|
||||
|
||||
|
||||
@@ -19,8 +19,8 @@ package org.l2jmobius.gameserver.communitybbs.Manager;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
public class ForumsBBSManager extends BaseBBSManager
|
||||
{
|
||||
private static Logger LOGGER = Logger.getLogger(ForumsBBSManager.class.getName());
|
||||
private final List<Forum> _table;
|
||||
private final Collection<Forum> _table;
|
||||
private int _lastid = 1;
|
||||
|
||||
/**
|
||||
@@ -39,7 +39,7 @@ public class ForumsBBSManager extends BaseBBSManager
|
||||
*/
|
||||
protected ForumsBBSManager()
|
||||
{
|
||||
_table = new CopyOnWriteArrayList<>();
|
||||
_table = ConcurrentHashMap.newKeySet();
|
||||
try (Connection con = DatabaseFactory.getConnection();
|
||||
Statement s = con.createStatement();
|
||||
ResultSet rs = s.executeQuery("SELECT forum_id FROM forums WHERE forum_type = 0"))
|
||||
|
||||
@@ -18,12 +18,11 @@ package org.l2jmobius.gameserver.communitybbs.Manager;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.StringTokenizer;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
|
||||
import org.l2jmobius.gameserver.communitybbs.BB.Forum;
|
||||
import org.l2jmobius.gameserver.communitybbs.BB.Post;
|
||||
@@ -34,7 +33,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
public class TopicBBSManager extends BaseBBSManager
|
||||
{
|
||||
private final List<Topic> _table = new CopyOnWriteArrayList<>();
|
||||
private final Collection<Topic> _table = ConcurrentHashMap.newKeySet();
|
||||
private final Map<Forum, Integer> _maxId = new ConcurrentHashMap<>();
|
||||
|
||||
protected TopicBBSManager()
|
||||
|
||||
@@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.data.xml.impl;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
@@ -26,7 +27,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -57,7 +57,7 @@ public class NpcData implements IXmlReader
|
||||
{
|
||||
private final Map<Integer, NpcTemplate> _npcs = new ConcurrentHashMap<>();
|
||||
private final Map<String, Integer> _clans = new ConcurrentHashMap<>();
|
||||
private static final List<Integer> _masterMonsterIDs = new CopyOnWriteArrayList<>();
|
||||
private static final Collection<Integer> _masterMonsterIDs = ConcurrentHashMap.newKeySet();
|
||||
|
||||
protected NpcData()
|
||||
{
|
||||
@@ -789,7 +789,7 @@ public class NpcData implements IXmlReader
|
||||
/**
|
||||
* @return the IDs of monsters that have minions.
|
||||
*/
|
||||
public static List<Integer> getMasterMonsterIDs()
|
||||
public static Collection<Integer> getMasterMonsterIDs()
|
||||
{
|
||||
return _masterMonsterIDs;
|
||||
}
|
||||
|
||||
@@ -16,10 +16,11 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.datatables;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.gameserver.script.DateRange;
|
||||
import org.l2jmobius.gameserver.script.EventDrop;
|
||||
@@ -35,7 +36,7 @@ public class EventDroplist
|
||||
/**
|
||||
* The table containing all DataDrop object
|
||||
*/
|
||||
private static final List<DateDrop> ALL_NPC_DATE_DROPS = new CopyOnWriteArrayList<>();
|
||||
private static final Collection<DateDrop> ALL_NPC_DATE_DROPS = ConcurrentHashMap.newKeySet();
|
||||
|
||||
public static class DateDrop
|
||||
{
|
||||
|
||||
@@ -18,9 +18,10 @@ package org.l2jmobius.gameserver.engines;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -89,7 +90,7 @@ public class DocumentEngine
|
||||
{
|
||||
if (Config.THREADS_FOR_LOADING)
|
||||
{
|
||||
final List<ScheduledFuture<?>> jobs = new CopyOnWriteArrayList<>();
|
||||
final Collection<ScheduledFuture<?>> jobs = ConcurrentHashMap.newKeySet();
|
||||
for (File file : _skillFiles)
|
||||
{
|
||||
jobs.add(ThreadPool.schedule(() ->
|
||||
@@ -141,13 +142,13 @@ public class DocumentEngine
|
||||
* Return created items
|
||||
* @return List of {@link Item}
|
||||
*/
|
||||
public List<Item> loadItems()
|
||||
public Collection<Item> loadItems()
|
||||
{
|
||||
final List<Item> list = new CopyOnWriteArrayList<>();
|
||||
final Collection<Item> list = ConcurrentHashMap.newKeySet();
|
||||
|
||||
if (Config.THREADS_FOR_LOADING)
|
||||
{
|
||||
final List<ScheduledFuture<?>> jobs = new CopyOnWriteArrayList<>();
|
||||
final Collection<ScheduledFuture<?>> jobs = ConcurrentHashMap.newKeySet();
|
||||
for (File file : _itemFiles)
|
||||
{
|
||||
jobs.add(ThreadPool.schedule(() ->
|
||||
|
||||
@@ -21,8 +21,8 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -41,7 +41,7 @@ public class ItemsOnGroundManager implements Runnable
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(ItemsOnGroundManager.class.getName());
|
||||
|
||||
private final List<ItemInstance> _items = new CopyOnWriteArrayList<>();
|
||||
private final Collection<ItemInstance> _items = ConcurrentHashMap.newKeySet();
|
||||
|
||||
protected ItemsOnGroundManager()
|
||||
{
|
||||
|
||||
@@ -17,8 +17,9 @@
|
||||
package org.l2jmobius.gameserver.instancemanager;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.w3c.dom.Document;
|
||||
@@ -326,11 +327,11 @@ public class MapRegionManager implements IXmlReader
|
||||
if (castle.getSiege().isInProgress())
|
||||
{
|
||||
// Check if player's clan is attacker
|
||||
final List<Npc> flags = castle.getSiege().getFlag(player.getClan());
|
||||
final Collection<Npc> flags = castle.getSiege().getFlag(player.getClan());
|
||||
if ((flags != null) && !flags.isEmpty())
|
||||
{
|
||||
// Spawn to flag - Need more work to get player to the nearest flag
|
||||
return flags.get(0).getLocation();
|
||||
return flags.stream().findFirst().get().getLocation();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -339,21 +340,21 @@ public class MapRegionManager implements IXmlReader
|
||||
if (fort.getSiege().isInProgress())
|
||||
{
|
||||
// Check if player's clan is attacker
|
||||
final List<Npc> flags = fort.getSiege().getFlag(player.getClan());
|
||||
final Set<Npc> flags = fort.getSiege().getFlag(player.getClan());
|
||||
if ((flags != null) && !flags.isEmpty())
|
||||
{
|
||||
// Spawn to flag - Need more work to get player to the nearest flag
|
||||
return flags.get(0).getLocation();
|
||||
return flags.stream().findFirst().get().getLocation();
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((clanhall != null) && clanhall.isSiegableHall())
|
||||
{
|
||||
final SiegableHall sHall = (SiegableHall) clanhall;
|
||||
final List<Npc> flags = sHall.getSiege().getFlag(player.getClan());
|
||||
final Collection<Npc> flags = sHall.getSiege().getFlag(player.getClan());
|
||||
if ((flags != null) && !flags.isEmpty())
|
||||
{
|
||||
return flags.get(0).getLocation();
|
||||
return flags.stream().findFirst().get().getLocation();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,8 +19,8 @@ package org.l2jmobius.gameserver.instancemanager;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -46,7 +46,7 @@ public class MercTicketManager
|
||||
{
|
||||
private static final Logger LOGGER = Logger.getLogger(MercTicketManager.class.getName());
|
||||
|
||||
private static final List<ItemInstance> DROPPED_TICKETS = new CopyOnWriteArrayList<>();
|
||||
private static final Collection<ItemInstance> DROPPED_TICKETS = ConcurrentHashMap.newKeySet();
|
||||
|
||||
// TODO: move all these values into siege.properties
|
||||
// max tickets per merc type = 10 + (castleid * 2)?
|
||||
@@ -406,7 +406,7 @@ public class MercTicketManager
|
||||
return ITEM_IDS;
|
||||
}
|
||||
|
||||
public List<ItemInstance> getDroppedTickets()
|
||||
public Collection<ItemInstance> getDroppedTickets()
|
||||
{
|
||||
return DROPPED_TICKETS;
|
||||
}
|
||||
|
||||
@@ -21,10 +21,12 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Statement;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
@@ -100,8 +102,8 @@ public class TerritoryWarManager implements Siegable
|
||||
private final Map<Integer, List<Clan>> _registeredClans = new ConcurrentHashMap<>();
|
||||
private final Map<Integer, List<Integer>> _registeredMercenaries = new ConcurrentHashMap<>();
|
||||
private final Map<Integer, Territory> _territoryList = new ConcurrentHashMap<>();
|
||||
protected List<Integer> _disguisedPlayers = new CopyOnWriteArrayList<>();
|
||||
private final List<TerritoryWard> _territoryWards = new CopyOnWriteArrayList<>();
|
||||
protected Collection<Integer> _disguisedPlayers = ConcurrentHashMap.newKeySet();
|
||||
private final Collection<TerritoryWard> _territoryWards = ConcurrentHashMap.newKeySet();
|
||||
private final Map<Clan, SiegeFlagInstance> _clanFlags = new ConcurrentHashMap<>();
|
||||
private final Map<Integer, Integer[]> _participantPoints = new ConcurrentHashMap<>();
|
||||
protected Calendar _startTWDate = Calendar.getInstance();
|
||||
@@ -499,7 +501,7 @@ public class TerritoryWarManager implements Siegable
|
||||
_clanFlags.remove(clan);
|
||||
}
|
||||
|
||||
public List<TerritoryWard> getAllTerritoryWards()
|
||||
public Collection<TerritoryWard> getAllTerritoryWards()
|
||||
{
|
||||
return _territoryWards;
|
||||
}
|
||||
@@ -1750,7 +1752,7 @@ public class TerritoryWarManager implements Siegable
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Npc> getFlag(Clan clan)
|
||||
public Set<Npc> getFlag(Clan clan)
|
||||
{
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@@ -16,9 +16,10 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.function.Function;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
@@ -36,7 +37,7 @@ import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
||||
*/
|
||||
public class CommandChannel extends AbstractPlayerGroup
|
||||
{
|
||||
private final List<Party> _parties = new CopyOnWriteArrayList<>();
|
||||
private final Collection<Party> _parties = ConcurrentHashMap.newKeySet();
|
||||
private PlayerInstance _commandLeader;
|
||||
private int _channelLvl;
|
||||
|
||||
@@ -150,7 +151,7 @@ public class CommandChannel extends AbstractPlayerGroup
|
||||
/**
|
||||
* @return a list of all parties in this command channel
|
||||
*/
|
||||
public List<Party> getPartys()
|
||||
public Collection<Party> getParties()
|
||||
{
|
||||
return _parties;
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
|
||||
@@ -26,11 +26,11 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
*/
|
||||
public class PartyMatchWaitingList
|
||||
{
|
||||
private final List<PlayerInstance> _members;
|
||||
private final Collection<PlayerInstance> _members;
|
||||
|
||||
protected PartyMatchWaitingList()
|
||||
{
|
||||
_members = new CopyOnWriteArrayList<>();
|
||||
_members = ConcurrentHashMap.newKeySet();
|
||||
}
|
||||
|
||||
public void addPlayer(PlayerInstance player)
|
||||
@@ -51,7 +51,7 @@ public class PartyMatchWaitingList
|
||||
}
|
||||
}
|
||||
|
||||
public List<PlayerInstance> getPlayers()
|
||||
public Collection<PlayerInstance> getPlayers()
|
||||
{
|
||||
return _members;
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.PetitionState;
|
||||
import org.l2jmobius.gameserver.enums.PetitionType;
|
||||
@@ -41,7 +41,7 @@ public class Petition
|
||||
private final PetitionType _type;
|
||||
private PetitionState _state = PetitionState.PENDING;
|
||||
private final String _content;
|
||||
private final List<CreatureSay> _messageLog = new CopyOnWriteArrayList<>();
|
||||
private final Collection<CreatureSay> _messageLog = ConcurrentHashMap.newKeySet();
|
||||
private final PlayerInstance _petitioner;
|
||||
private PlayerInstance _responder;
|
||||
|
||||
@@ -58,7 +58,7 @@ public class Petition
|
||||
return _messageLog.add(cs);
|
||||
}
|
||||
|
||||
public List<CreatureSay> getLogMessages()
|
||||
public Collection<CreatureSay> getLogMessages()
|
||||
{
|
||||
return _messageLog;
|
||||
}
|
||||
|
||||
@@ -16,15 +16,15 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
|
||||
public class SiegeClan
|
||||
{
|
||||
private int _clanId = 0;
|
||||
private final List<Npc> _flag = new CopyOnWriteArrayList<>();
|
||||
private final Set<Npc> _flag = ConcurrentHashMap.newKeySet();
|
||||
private SiegeClanType _type;
|
||||
|
||||
public enum SiegeClanType
|
||||
@@ -69,7 +69,7 @@ public class SiegeClan
|
||||
return _clanId;
|
||||
}
|
||||
|
||||
public List<Npc> getFlag()
|
||||
public Set<Npc> getFlag()
|
||||
{
|
||||
return _flag;
|
||||
}
|
||||
|
||||
@@ -17,10 +17,10 @@
|
||||
package org.l2jmobius.gameserver.model;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.util.Collection;
|
||||
import java.util.Deque;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentLinkedDeque;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
@@ -73,7 +73,7 @@ public class Spawn extends Location implements IIdentifiable, INamable
|
||||
private Constructor<? extends Npc> _constructor;
|
||||
/** If True a NpcInstance is respawned each time that another is killed */
|
||||
private boolean _doRespawn = true;
|
||||
private static List<SpawnListener> _spawnListeners = new CopyOnWriteArrayList<>();
|
||||
private static Collection<SpawnListener> _spawnListeners = ConcurrentHashMap.newKeySet();
|
||||
private final Deque<Npc> _spawnedNpcs = new ConcurrentLinkedDeque<>();
|
||||
private boolean _randomWalk = false; // Is random walk
|
||||
private int _spawnTemplateId = 0;
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.actor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
@@ -48,7 +48,7 @@ import org.l2jmobius.gameserver.util.Util;
|
||||
public abstract class Vehicle extends Creature
|
||||
{
|
||||
protected int _dockId = 0;
|
||||
protected final List<PlayerInstance> _passengers = new CopyOnWriteArrayList<>();
|
||||
protected final Collection<PlayerInstance> _passengers = ConcurrentHashMap.newKeySet();
|
||||
protected Location _oustLoc = null;
|
||||
private Runnable _engine = null;
|
||||
|
||||
@@ -256,7 +256,7 @@ public abstract class Vehicle extends Creature
|
||||
return _passengers.isEmpty();
|
||||
}
|
||||
|
||||
public List<PlayerInstance> getPassengers()
|
||||
public Collection<PlayerInstance> getPassengers()
|
||||
{
|
||||
return _passengers;
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.actor.instance;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.InstanceType;
|
||||
@@ -31,7 +31,7 @@ import org.l2jmobius.gameserver.model.actor.templates.NpcTemplate;
|
||||
*/
|
||||
public class ControlTowerInstance extends Tower
|
||||
{
|
||||
private volatile List<Spawn> _guards;
|
||||
private volatile Collection<Spawn> _guards;
|
||||
|
||||
/**
|
||||
* Creates a control tower.
|
||||
@@ -75,7 +75,7 @@ public class ControlTowerInstance extends Tower
|
||||
getGuards().add(guard);
|
||||
}
|
||||
|
||||
private final List<Spawn> getGuards()
|
||||
private final Collection<Spawn> getGuards()
|
||||
{
|
||||
if (_guards == null)
|
||||
{
|
||||
@@ -83,7 +83,7 @@ public class ControlTowerInstance extends Tower
|
||||
{
|
||||
if (_guards == null)
|
||||
{
|
||||
_guards = new CopyOnWriteArrayList<>();
|
||||
_guards = ConcurrentHashMap.newKeySet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ import java.util.Set;
|
||||
import java.util.TreeMap;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ConcurrentSkipListMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
@@ -407,7 +406,7 @@ public class PlayerInstance extends Playable
|
||||
private static final int NEVIT_HOURGLASS_PAUSED = 1;
|
||||
private static final int NEVIT_HOURGLASS_MAINTAIN = 10;
|
||||
|
||||
private final List<IEventListener> _eventListeners = new CopyOnWriteArrayList<>();
|
||||
private final Collection<IEventListener> _eventListeners = ConcurrentHashMap.newKeySet();
|
||||
|
||||
private GameClient _client;
|
||||
private String _ip = "N/A";
|
||||
@@ -617,7 +616,7 @@ public class PlayerInstance extends Playable
|
||||
private int _agathionId = 0;
|
||||
// apparently, a PlayerInstance CAN have both a summon AND a tamed beast at the same time!!
|
||||
// after Freya players can control more than one tamed beast
|
||||
private List<TamedBeastInstance> _tamedBeast = null;
|
||||
private Collection<TamedBeastInstance> _tamedBeast = null;
|
||||
|
||||
private boolean _minimapAllowed = false;
|
||||
|
||||
@@ -1486,7 +1485,7 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
|
||||
/** List of all QuestState instance that needs to be notified of this PlayerInstance's or its pet's death */
|
||||
private volatile List<QuestState> _notifyQuestOfDeathList = new CopyOnWriteArrayList<>();
|
||||
private volatile Collection<QuestState> _notifyQuestOfDeathList = ConcurrentHashMap.newKeySet();
|
||||
|
||||
/**
|
||||
* Add QuestState instance that is to be notified of PlayerInstance's death.
|
||||
@@ -1521,7 +1520,7 @@ public class PlayerInstance extends Playable
|
||||
/**
|
||||
* @return a list of QuestStates which registered for notify of death of this PlayerInstance.
|
||||
*/
|
||||
public List<QuestState> getNotifyQuestOfDeath()
|
||||
public Collection<QuestState> getNotifyQuestOfDeath()
|
||||
{
|
||||
return _notifyQuestOfDeathList;
|
||||
}
|
||||
@@ -5704,7 +5703,7 @@ public class PlayerInstance extends Playable
|
||||
/**
|
||||
* @return the Summon of the PlayerInstance or null.
|
||||
*/
|
||||
public List<TamedBeastInstance> getTrainedBeasts()
|
||||
public Collection<TamedBeastInstance> getTrainedBeasts()
|
||||
{
|
||||
return _tamedBeast;
|
||||
}
|
||||
@@ -5717,7 +5716,7 @@ public class PlayerInstance extends Playable
|
||||
{
|
||||
if (_tamedBeast == null)
|
||||
{
|
||||
_tamedBeast = new CopyOnWriteArrayList<>();
|
||||
_tamedBeast = ConcurrentHashMap.newKeySet();
|
||||
}
|
||||
_tamedBeast.add(tamedBeast);
|
||||
}
|
||||
@@ -13389,9 +13388,9 @@ public class PlayerInstance extends Playable
|
||||
}
|
||||
|
||||
/** Friend list. */
|
||||
private final List<Integer> _friendList = new CopyOnWriteArrayList<>();
|
||||
private final Collection<Integer> _friendList = ConcurrentHashMap.newKeySet();
|
||||
|
||||
public List<Integer> getFriendList()
|
||||
public Collection<Integer> getFriendList()
|
||||
{
|
||||
return _friendList;
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ package org.l2jmobius.gameserver.model.actor.instance;
|
||||
|
||||
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
@@ -61,7 +61,7 @@ public class TamedBeastInstance extends FeedableBeastInstance
|
||||
private Future<?> _buffTask = null;
|
||||
private Future<?> _durationCheckTask = null;
|
||||
protected boolean _isFreyaBeast;
|
||||
private List<Skill> _beastSkills = null;
|
||||
private Collection<Skill> _beastSkills = null;
|
||||
|
||||
public TamedBeastInstance(int npcTemplateId)
|
||||
{
|
||||
@@ -204,7 +204,7 @@ public class TamedBeastInstance extends FeedableBeastInstance
|
||||
{
|
||||
if (_beastSkills == null)
|
||||
{
|
||||
_beastSkills = new CopyOnWriteArrayList<>();
|
||||
_beastSkills = ConcurrentHashMap.newKeySet();
|
||||
}
|
||||
_beastSkills.add(skill);
|
||||
}
|
||||
|
||||
@@ -16,11 +16,10 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.entity;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -67,7 +66,7 @@ public class BlockCheckerEngine
|
||||
// Current used arena
|
||||
protected int _arena = -1;
|
||||
// All blocks
|
||||
protected List<Spawn> _spawns = new CopyOnWriteArrayList<>();
|
||||
protected Collection<Spawn> _spawns = ConcurrentHashMap.newKeySet();
|
||||
// Sets if the red team won the event at the end of this (used for packets)
|
||||
protected boolean _isRedWinner;
|
||||
// Time when the event starts. Used on packet sending
|
||||
@@ -116,7 +115,7 @@ public class BlockCheckerEngine
|
||||
// Common z coordinate
|
||||
private static final int _zCoord = -2405;
|
||||
// List of dropped items in event (for later deletion)
|
||||
protected List<ItemInstance> _drops = new CopyOnWriteArrayList<>();
|
||||
protected Collection<ItemInstance> _drops = ConcurrentHashMap.newKeySet();
|
||||
// Default arena
|
||||
private static final byte DEFAULT_ARENA = -1;
|
||||
// Event is started
|
||||
|
||||
@@ -17,10 +17,11 @@
|
||||
package org.l2jmobius.gameserver.model.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Timer;
|
||||
import java.util.TimerTask;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.Future;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
@@ -57,8 +58,8 @@ public class DimensionalRift
|
||||
|
||||
protected byte _choosenRoom = -1;
|
||||
private boolean _hasJumped = false;
|
||||
protected List<PlayerInstance> _deadPlayers = new CopyOnWriteArrayList<>();
|
||||
protected List<PlayerInstance> _revivedInWaitingRoom = new CopyOnWriteArrayList<>();
|
||||
protected Collection<PlayerInstance> _deadPlayers = ConcurrentHashMap.newKeySet();
|
||||
protected Collection<PlayerInstance> _revivedInWaitingRoom = ConcurrentHashMap.newKeySet();
|
||||
private boolean isBossRoom = false;
|
||||
|
||||
public DimensionalRift(Party party, byte type, byte room)
|
||||
@@ -457,12 +458,12 @@ public class DimensionalRift
|
||||
}
|
||||
}
|
||||
|
||||
public List<PlayerInstance> getDeadMemberList()
|
||||
public Collection<PlayerInstance> getDeadMemberList()
|
||||
{
|
||||
return _deadPlayers;
|
||||
}
|
||||
|
||||
public List<PlayerInstance> getRevivedAtWaitingRoom()
|
||||
public Collection<PlayerInstance> getRevivedAtWaitingRoom()
|
||||
{
|
||||
return _revivedInWaitingRoom;
|
||||
}
|
||||
|
||||
@@ -614,7 +614,7 @@ public class Duel
|
||||
}
|
||||
|
||||
_duelInstanceId = InstanceManager.getInstance().createDynamicInstance(Rnd.get(147, 150)).getId(); // Random Olympiad arena.
|
||||
final OlympiadStadiumZone zone = ZoneManager.getInstance().getZone(InstanceManager.getInstance().getInstance(_duelInstanceId).getNpcs().get(0), OlympiadStadiumZone.class);
|
||||
final OlympiadStadiumZone zone = ZoneManager.getInstance().getZone(InstanceManager.getInstance().getInstance(_duelInstanceId).getNpcs().stream().findFirst().get(), OlympiadStadiumZone.class);
|
||||
if (zone == null)
|
||||
{
|
||||
throw new RuntimeException("Unable to find a party duel arena!");
|
||||
|
||||
@@ -21,13 +21,13 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Level;
|
||||
@@ -81,9 +81,9 @@ public class Fort extends AbstractResidence
|
||||
|
||||
// Spawn Data
|
||||
private boolean _isSuspiciousMerchantSpawned = false;
|
||||
private final List<Spawn> _siegeNpcs = new CopyOnWriteArrayList<>();
|
||||
private final List<Spawn> _npcCommanders = new CopyOnWriteArrayList<>();
|
||||
private final List<Spawn> _specialEnvoys = new CopyOnWriteArrayList<>();
|
||||
private final Collection<Spawn> _siegeNpcs = ConcurrentHashMap.newKeySet();
|
||||
private final Collection<Spawn> _npcCommanders = ConcurrentHashMap.newKeySet();
|
||||
private final Collection<Spawn> _specialEnvoys = ConcurrentHashMap.newKeySet();
|
||||
|
||||
private final Map<Integer, Integer> _envoyCastles = new HashMap<>(2);
|
||||
private final Set<Integer> _availableCastles = new HashSet<>(1);
|
||||
|
||||
@@ -20,9 +20,11 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -224,10 +226,10 @@ public class FortSiege implements Siegable
|
||||
}
|
||||
}
|
||||
|
||||
private final List<SiegeClan> _attackerClans = new CopyOnWriteArrayList<>();
|
||||
private final Collection<SiegeClan> _attackerClans = ConcurrentHashMap.newKeySet();
|
||||
|
||||
// Fort setting
|
||||
protected List<Spawn> _commanders = new CopyOnWriteArrayList<>();
|
||||
protected Collection<Spawn> _commanders = ConcurrentHashMap.newKeySet();
|
||||
protected final Fort _fort;
|
||||
boolean _isInProgress = false;
|
||||
private FortSiegeGuardManager _siegeGuardManager;
|
||||
@@ -1166,7 +1168,7 @@ public class FortSiege implements Siegable
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SiegeClan> getAttackerClans()
|
||||
public Collection<SiegeClan> getAttackerClans()
|
||||
{
|
||||
return _attackerClans;
|
||||
}
|
||||
@@ -1188,7 +1190,7 @@ public class FortSiege implements Siegable
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Npc> getFlag(Clan clan)
|
||||
public Set<Npc> getFlag(Clan clan)
|
||||
{
|
||||
if (clan != null)
|
||||
{
|
||||
@@ -1220,7 +1222,7 @@ public class FortSiege implements Siegable
|
||||
_fort.resetDoors();
|
||||
}
|
||||
|
||||
public List<Spawn> getCommanders()
|
||||
public Collection<Spawn> getCommanders()
|
||||
{
|
||||
return _commanders;
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.entity;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.FileReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
@@ -57,7 +58,7 @@ public class GameEvent
|
||||
public static String _eventInfo = "";
|
||||
public static int _teamsNumber = 0;
|
||||
public static final Map<Integer, String> _teamNames = new ConcurrentHashMap<>();
|
||||
public static final List<PlayerInstance> _registeredPlayers = new CopyOnWriteArrayList<>();
|
||||
public static final Collection<PlayerInstance> _registeredPlayers = ConcurrentHashMap.newKeySet();
|
||||
public static final Map<Integer, List<PlayerInstance>> _teams = new ConcurrentHashMap<>();
|
||||
public static int _npcId = 0;
|
||||
private static final Map<PlayerInstance, PlayerEventHolder> _connectionLossData = new ConcurrentHashMap<>();
|
||||
|
||||
@@ -19,6 +19,7 @@ package org.l2jmobius.gameserver.model.entity;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.l2jmobius.gameserver.model.SiegeClan;
|
||||
import org.l2jmobius.gameserver.model.actor.Npc;
|
||||
@@ -48,11 +49,11 @@ public interface Siegable
|
||||
|
||||
SiegeClan getDefenderClan(Clan clan);
|
||||
|
||||
List<SiegeClan> getDefenderClans();
|
||||
Collection<SiegeClan> getDefenderClans();
|
||||
|
||||
boolean checkIsDefender(Clan clan);
|
||||
|
||||
List<Npc> getFlag(Clan clan);
|
||||
Set<Npc> getFlag(Clan clan);
|
||||
|
||||
Calendar getSiegeDate();
|
||||
|
||||
|
||||
@@ -21,10 +21,12 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -219,9 +221,9 @@ public class Siege implements Siegable
|
||||
}
|
||||
|
||||
// must support Concurrent Modifications
|
||||
private final List<SiegeClan> _attackerClans = new CopyOnWriteArrayList<>();
|
||||
private final List<SiegeClan> _defenderClans = new CopyOnWriteArrayList<>();
|
||||
private final List<SiegeClan> _defenderWaitingClans = new CopyOnWriteArrayList<>();
|
||||
private final Collection<SiegeClan> _attackerClans = ConcurrentHashMap.newKeySet();
|
||||
private final Collection<SiegeClan> _defenderClans = ConcurrentHashMap.newKeySet();
|
||||
private final Collection<SiegeClan> _defenderWaitingClans = ConcurrentHashMap.newKeySet();
|
||||
|
||||
// Castle setting
|
||||
private final List<ControlTowerInstance> _controlTowers = new ArrayList<>();
|
||||
@@ -1571,7 +1573,7 @@ public class Siege implements Siegable
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SiegeClan> getAttackerClans()
|
||||
public Collection<SiegeClan> getAttackerClans()
|
||||
{
|
||||
return _isNormalSide ? _attackerClans : _defenderClans;
|
||||
}
|
||||
@@ -1606,7 +1608,7 @@ public class Siege implements Siegable
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<SiegeClan> getDefenderClans()
|
||||
public Collection<SiegeClan> getDefenderClans()
|
||||
{
|
||||
return _isNormalSide ? _defenderClans : _attackerClans;
|
||||
}
|
||||
@@ -1628,7 +1630,7 @@ public class Siege implements Siegable
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<SiegeClan> getDefenderWaitingClans()
|
||||
public Collection<SiegeClan> getDefenderWaitingClans()
|
||||
{
|
||||
return _defenderWaitingClans;
|
||||
}
|
||||
@@ -1669,7 +1671,7 @@ public class Siege implements Siegable
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Npc> getFlag(Clan clan)
|
||||
public Set<Npc> getFlag(Clan clan)
|
||||
{
|
||||
if (clan != null)
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@ import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Logger;
|
||||
@@ -197,9 +198,9 @@ public abstract class ClanHallSiegeEngine extends Quest implements Siegable
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Npc> getFlag(Clan clan)
|
||||
public Set<Npc> getFlag(Clan clan)
|
||||
{
|
||||
List<Npc> result = null;
|
||||
Set<Npc> result = null;
|
||||
final SiegeClan sClan = getAttackerClan(clan);
|
||||
if (sClan != null)
|
||||
{
|
||||
|
||||
@@ -26,7 +26,6 @@ import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.logging.Level;
|
||||
@@ -137,7 +136,7 @@ public abstract class AbstractScript extends ManagedScript
|
||||
{
|
||||
public static final Logger LOGGER = Logger.getLogger(AbstractScript.class.getName());
|
||||
private final Map<ListenerRegisterType, Set<Integer>> _registeredIds = new ConcurrentHashMap<>();
|
||||
private final List<AbstractEventListener> _listeners = new CopyOnWriteArrayList<>();
|
||||
private final Collection<AbstractEventListener> _listeners = ConcurrentHashMap.newKeySet();
|
||||
|
||||
public AbstractScript()
|
||||
{
|
||||
@@ -1604,7 +1603,7 @@ public abstract class AbstractScript extends ManagedScript
|
||||
return _registeredIds.containsKey(type) ? _registeredIds.get(type) : Collections.emptySet();
|
||||
}
|
||||
|
||||
public List<AbstractEventListener> getListeners()
|
||||
public Collection<AbstractEventListener> getListeners()
|
||||
{
|
||||
return _listeners;
|
||||
}
|
||||
@@ -2901,7 +2900,7 @@ public abstract class AbstractScript extends ManagedScript
|
||||
* @param players list with PlayerInstance
|
||||
* @param movie the movie
|
||||
*/
|
||||
public void playMovie(List<PlayerInstance> players, Movie movie)
|
||||
public void playMovie(Collection<PlayerInstance> players, Movie movie)
|
||||
{
|
||||
new MovieHolder(players, movie);
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.holders;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.gameserver.enums.Movie;
|
||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
@@ -27,9 +27,9 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||
public class MovieHolder
|
||||
{
|
||||
private final Movie _movie;
|
||||
private final List<PlayerInstance> _players;
|
||||
private final Collection<PlayerInstance> _players;
|
||||
|
||||
public MovieHolder(List<PlayerInstance> players, Movie movie)
|
||||
public MovieHolder(Collection<PlayerInstance> players, Movie movie)
|
||||
{
|
||||
_players = players;
|
||||
_movie = movie;
|
||||
@@ -42,7 +42,7 @@ public class MovieHolder
|
||||
return _movie;
|
||||
}
|
||||
|
||||
public List<PlayerInstance> getPlayers()
|
||||
public Collection<PlayerInstance> getPlayers()
|
||||
{
|
||||
return _players;
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.holders;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import org.l2jmobius.gameserver.model.Location;
|
||||
@@ -48,7 +48,7 @@ public class PlayerEventHolder
|
||||
private final int _pkKills;
|
||||
private final int _karma;
|
||||
|
||||
private final List<PlayerInstance> _kills = new CopyOnWriteArrayList<>();
|
||||
private final Collection<PlayerInstance> _kills = ConcurrentHashMap.newKeySet();
|
||||
private boolean _sitForced;
|
||||
|
||||
public PlayerEventHolder(PlayerInstance player)
|
||||
@@ -92,7 +92,7 @@ public class PlayerEventHolder
|
||||
return _sitForced;
|
||||
}
|
||||
|
||||
public List<PlayerInstance> getKills()
|
||||
public Collection<PlayerInstance> getKills()
|
||||
{
|
||||
return _kills;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,6 @@ import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -72,12 +71,12 @@ public class Instance
|
||||
private int _ejectTime = Config.EJECT_DEAD_PLAYER_TIME;
|
||||
/** Allow random walk for NPCs, global parameter. */
|
||||
private boolean _allowRandomWalk = true;
|
||||
private final List<Integer> _players = new CopyOnWriteArrayList<>();
|
||||
private final List<Npc> _npcs = new CopyOnWriteArrayList<>();
|
||||
private final List<StatsSet> _doorTemplates = new CopyOnWriteArrayList<>();
|
||||
private final Collection<Integer> _players = ConcurrentHashMap.newKeySet();
|
||||
private final Collection<Npc> _npcs = ConcurrentHashMap.newKeySet();
|
||||
private final Collection<StatsSet> _doorTemplates = ConcurrentHashMap.newKeySet();
|
||||
private final Map<Integer, DoorInstance> _doors = new ConcurrentHashMap<>();
|
||||
private final List<StatsSet> _spawnTemplates = new CopyOnWriteArrayList<>();
|
||||
private List<Location> _enterLocations = new CopyOnWriteArrayList<>();
|
||||
private final Collection<StatsSet> _spawnTemplates = ConcurrentHashMap.newKeySet();
|
||||
private Collection<Location> _enterLocations = ConcurrentHashMap.newKeySet();
|
||||
private Location _exitLocation = null;
|
||||
private boolean _allowSummon = true;
|
||||
private long _emptyDestroyTime = -1;
|
||||
@@ -277,12 +276,12 @@ public class Instance
|
||||
}
|
||||
}
|
||||
|
||||
public List<Integer> getPlayers()
|
||||
public Collection<Integer> getPlayers()
|
||||
{
|
||||
return _players;
|
||||
}
|
||||
|
||||
public List<Npc> getNpcs()
|
||||
public Collection<Npc> getNpcs()
|
||||
{
|
||||
return _npcs;
|
||||
}
|
||||
@@ -325,7 +324,7 @@ public class Instance
|
||||
/**
|
||||
* @return the spawn location for this instance to be used when enter in instance
|
||||
*/
|
||||
public List<Location> getEnterLocs()
|
||||
public Collection<Location> getEnterLocs()
|
||||
{
|
||||
return _enterLocations;
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.model.instancezone;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@@ -157,7 +158,7 @@ public class InstanceWorld
|
||||
* Get spawned NPCs from instance.
|
||||
* @return set of NPCs from instance
|
||||
*/
|
||||
public List<Npc> getNpcs()
|
||||
public Collection<Npc> getNpcs()
|
||||
{
|
||||
return _instance.getNpcs();
|
||||
}
|
||||
|
||||
@@ -533,7 +533,7 @@ public class Formulas
|
||||
}
|
||||
|
||||
final SiegeClan siegeClan = siege.getAttackerClan(player.getClan().getId());
|
||||
if ((siegeClan == null) || siegeClan.getFlag().isEmpty() || !Util.checkIfInRange(200, player, siegeClan.getFlag().get(0), true))
|
||||
if ((siegeClan == null) || siegeClan.getFlag().isEmpty() || !Util.checkIfInRange(200, player, siegeClan.getFlag().stream().findFirst().get(), true))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -47,8 +47,8 @@ public class ExMultiPartyCommandChannelInfo implements IClientOutgoingPacket
|
||||
packet.writeD(0x00); // Channel loot 0 or 1
|
||||
packet.writeD(_channel.getMemberCount());
|
||||
|
||||
packet.writeD(_channel.getPartys().size());
|
||||
for (Party p : _channel.getPartys())
|
||||
packet.writeD(_channel.getParties().size());
|
||||
for (Party p : _channel.getParties())
|
||||
{
|
||||
packet.writeS(p.getLeader().getName());
|
||||
packet.writeD(p.getLeaderObjectId());
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
*/
|
||||
package org.l2jmobius.gameserver.network.serverpackets;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Collection;
|
||||
|
||||
import org.l2jmobius.commons.network.PacketWriter;
|
||||
import org.l2jmobius.gameserver.instancemanager.TerritoryWarManager;
|
||||
@@ -41,7 +41,7 @@ public class ExShowOwnthingPos implements IClientOutgoingPacket
|
||||
|
||||
if (TerritoryWarManager.getInstance().isTWInProgress())
|
||||
{
|
||||
final List<TerritoryWard> territoryWardList = TerritoryWarManager.getInstance().getAllTerritoryWards();
|
||||
final Collection<TerritoryWard> territoryWardList = TerritoryWarManager.getInstance().getAllTerritoryWards();
|
||||
packet.writeD(territoryWardList.size());
|
||||
for (TerritoryWard ward : territoryWardList)
|
||||
{
|
||||
|
||||
@@ -26,11 +26,10 @@ import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.text.DateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
@@ -58,7 +57,7 @@ public class TaskManager
|
||||
static final Logger LOGGER = Logger.getLogger(TaskManager.class.getName());
|
||||
|
||||
private final Map<Integer, Task> _tasks = new ConcurrentHashMap<>();
|
||||
final List<ExecutedTask> _currentTasks = new CopyOnWriteArrayList<>();
|
||||
final Collection<ExecutedTask> _currentTasks = ConcurrentHashMap.newKeySet();
|
||||
|
||||
static final String[] SQL_STATEMENTS =
|
||||
{
|
||||
|
||||
@@ -18,8 +18,8 @@ package org.l2jmobius.loginserver;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.Socket;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
|
||||
@@ -28,7 +28,7 @@ import org.l2jmobius.Config;
|
||||
*/
|
||||
public class GameServerListener extends FloodProtectedListener
|
||||
{
|
||||
private static List<GameServerThread> _gameServers = new CopyOnWriteArrayList<>();
|
||||
private static Collection<GameServerThread> _gameServers = ConcurrentHashMap.newKeySet();
|
||||
|
||||
public GameServerListener() throws IOException
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user