Replaced several CopyOnWriteArrayList occurrences with ConcurrentHashMap.newKeySet().

This commit is contained in:
MobiusDevelopment 2019-08-07 01:57:06 +00:00
parent c3a6557797
commit 9048735b73
395 changed files with 1430 additions and 1315 deletions

View File

@ -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;

View File

@ -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;
@ -49,7 +49,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));
@ -78,7 +78,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()
{

View File

@ -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()
{

View File

@ -17,8 +17,9 @@
package custom.events.Rabbits;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.CommonUtil;
@ -49,7 +50,7 @@ public class Rabbits extends Event
private static final int EVENT_TIME = 10;
private static final int TOTAL_CHEST_COUNT = 75;
private static final int TRANSFORMATION_ID = 105;
private final List<Npc> _npcs = new CopyOnWriteArrayList<>();
private final Collection<Npc> _npcs = ConcurrentHashMap.newKeySet();
private final List<PlayerInstance> _players = new ArrayList<>();
private boolean _isActive = false;
@ -253,7 +254,7 @@ public class Rabbits extends Event
}
}
private void recordSpawn(List<Npc> npcs, int npcId, int x, int y, int z, int heading, boolean randomOffSet, long despawnDelay)
private void recordSpawn(Collection<Npc> npcs, int npcId, int x, int y, int z, int heading, boolean randomOffSet, long despawnDelay)
{
final Npc npc = addSpawn(npcId, x, y, z, heading, randomOffSet, despawnDelay);
if (npc.getId() == CHEST)

View File

@ -17,8 +17,9 @@
package custom.events.Race;
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.l2jmobius.Config;
@ -45,7 +46,7 @@ public class Race extends Event
// Npc
private Npc _npc;
// Player list
private List<PlayerInstance> _players;
private Collection<PlayerInstance> _players;
// Event Task
ScheduledFuture<?> _eventTask = null;
// Event state
@ -127,7 +128,7 @@ public class Race extends Event
}
// Initialize list
_npclist = new ArrayList<>();
_players = new CopyOnWriteArrayList<>();
_players = ConcurrentHashMap.newKeySet();
// Set Event active
_isactive = true;
// Spawn Manager

View File

@ -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)
{

View File

@ -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;

View File

@ -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);
}

View File

@ -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"))

View File

@ -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()

View File

@ -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;
@ -27,7 +28,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Predicate;
import java.util.logging.Logger;
import java.util.stream.Collectors;
@ -60,7 +60,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;
}

View File

@ -18,10 +18,11 @@ 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.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;
import java.util.function.Predicate;
import java.util.logging.Level;
@ -54,7 +55,7 @@ public class SpawnsData implements IXmlReader
{
protected static final Logger LOGGER = Logger.getLogger(SpawnsData.class.getName());
private final List<SpawnTemplate> _spawns = new CopyOnWriteArrayList<>();
private final Collection<SpawnTemplate> _spawns = ConcurrentHashMap.newKeySet();
protected SpawnsData()
{
@ -98,7 +99,7 @@ public class SpawnsData implements IXmlReader
if (Config.THREADS_FOR_LOADING)
{
final List<ScheduledFuture<?>> jobs = new CopyOnWriteArrayList<>();
final Collection<ScheduledFuture<?>> jobs = ConcurrentHashMap.newKeySet();
for (SpawnTemplate template : _spawns)
{
if (template.isSpawningByDefault())
@ -146,7 +147,7 @@ public class SpawnsData implements IXmlReader
LOGGER.info(getClass().getSimpleName() + ": All spawns has been removed!");
}
public List<SpawnTemplate> getSpawns()
public Collection<SpawnTemplate> getSpawns()
{
return _spawns;
}
@ -166,7 +167,7 @@ public class SpawnsData implements IXmlReader
return _spawns.stream().flatMap(template -> template.getGroups().stream()).flatMap(group -> group.getSpawns().stream()).filter(condition).collect(Collectors.toList());
}
public void parseSpawn(Node spawnsNode, File file, List<SpawnTemplate> spawns)
public void parseSpawn(Node spawnsNode, File file, Collection<SpawnTemplate> spawns)
{
final SpawnTemplate spawnTemplate = new SpawnTemplate(new StatsSet(parseAttributes(spawnsNode)), file);
SpawnGroup defaultGroup = null;

View File

@ -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
{

View File

@ -18,8 +18,9 @@ package org.l2jmobius.gameserver.engines;
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 java.util.logging.Logger;
@ -66,13 +67,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(() ->

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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 org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
@ -45,7 +45,7 @@ public class RaceManagerInstance extends Npc
public static final int LANES = 8;
public static final int WINDOW_START = 0;
private static List<RaceManagerInstance> _managers;
private static Collection<RaceManagerInstance> _managers;
protected static int _raceNumber = 4;
// Time Constants
@ -104,7 +104,7 @@ public class RaceManagerInstance extends Npc
{
_notInitialized = false;
_managers = new CopyOnWriteArrayList<>();
_managers = ConcurrentHashMap.newKeySet();
ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.TICKETS_ARE_NOW_AVAILABLE_FOR_MONSTER_RACE_S1), 0, 10 * MINUTE);
ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.NOW_SELLING_TICKETS_FOR_MONSTER_RACE_S1), 30 * SECOND, 10 * MINUTE);

View File

@ -19,10 +19,12 @@ package org.l2jmobius.gameserver.model.actor.instance;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Future;
import java.util.logging.Level;
@ -304,7 +306,7 @@ public class ServitorInstance extends Summon implements Runnable
int buff_index = 0;
final List<Long> storedSkills = new CopyOnWriteArrayList<>();
final Collection<Long> storedSkills = ConcurrentHashMap.newKeySet();
// Store all effect data along with calculated remaining
if (storeEffects)

View File

@ -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;
@ -62,7 +62,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)
{
@ -205,7 +205,7 @@ public class TamedBeastInstance extends FeedableBeastInstance
{
if (_beastSkills == null)
{
_beastSkills = new CopyOnWriteArrayList<>();
_beastSkills = ConcurrentHashMap.newKeySet();
}
_beastSkills.add(skill);
}

View File

@ -49,7 +49,7 @@ public interface Siegable
SiegeClan getDefenderClan(Clan clan);
List<SiegeClan> getDefenderClans();
Collection<SiegeClan> getDefenderClans();
boolean checkIsDefender(Clan clan);

View File

@ -21,12 +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.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -221,9 +222,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<>();
@ -1582,7 +1583,7 @@ public class Siege implements Siegable
}
@Override
public List<SiegeClan> getAttackerClans()
public Collection<SiegeClan> getAttackerClans()
{
if (_isNormalSide)
{
@ -1625,7 +1626,7 @@ public class Siege implements Siegable
}
@Override
public List<SiegeClan> getDefenderClans()
public Collection<SiegeClan> getDefenderClans()
{
if (_isNormalSide)
{
@ -1655,7 +1656,7 @@ public class Siege implements Siegable
return null;
}
public List<SiegeClan> getDefenderWaitingClans()
public Collection<SiegeClan> getDefenderWaitingClans()
{
return _defenderWaitingClans;
}

View File

@ -16,8 +16,9 @@
*/
package org.l2jmobius.gameserver.model.holders;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.gameserver.enums.Movie;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
@ -29,7 +30,7 @@ public class MovieHolder
{
private final Movie _movie;
private final List<PlayerInstance> _players;
private final List<PlayerInstance> _votedPlayers = new CopyOnWriteArrayList<>();
private final Collection<PlayerInstance> _votedPlayers = ConcurrentHashMap.newKeySet();
public MovieHolder(List<PlayerInstance> players, Movie movie)
{
@ -64,7 +65,7 @@ public class MovieHolder
return _players;
}
public List<PlayerInstance> getVotedPlayers()
public Collection<PlayerInstance> getVotedPlayers()
{
return _votedPlayers;
}

View File

@ -127,7 +127,7 @@ public class CommandChannelMatchingRoom extends MatchingRoom
if (leaderParty != null)
{
final CommandChannel cc = leaderParty.getCommandChannel();
if ((leaderParty == playerParty) || ((cc != null) && cc.getPartys().contains(playerParty)))
if ((leaderParty == playerParty) || ((cc != null) && cc.getParties().contains(playerParty)))
{
return MatchingMemberType.COMMAND_CHANNEL_PARTY_MEMBER;
}

View File

@ -45,8 +45,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());

View File

@ -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;
@ -50,7 +49,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 =
{

View File

@ -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
{

View File

@ -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;

View File

@ -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;
@ -49,7 +49,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));
@ -78,7 +78,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()
{

View File

@ -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()
{

View File

@ -17,8 +17,9 @@
package custom.events.Rabbits;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.CommonUtil;
@ -49,7 +50,7 @@ public class Rabbits extends Event
private static final int EVENT_TIME = 10;
private static final int TOTAL_CHEST_COUNT = 75;
private static final int TRANSFORMATION_ID = 105;
private final List<Npc> _npcs = new CopyOnWriteArrayList<>();
private final Collection<Npc> _npcs = ConcurrentHashMap.newKeySet();
private final List<PlayerInstance> _players = new ArrayList<>();
private boolean _isActive = false;
@ -253,7 +254,7 @@ public class Rabbits extends Event
}
}
private void recordSpawn(List<Npc> npcs, int npcId, int x, int y, int z, int heading, boolean randomOffSet, long despawnDelay)
private void recordSpawn(Collection<Npc> npcs, int npcId, int x, int y, int z, int heading, boolean randomOffSet, long despawnDelay)
{
final Npc npc = addSpawn(npcId, x, y, z, heading, randomOffSet, despawnDelay);
if (npc.getId() == CHEST)

View File

@ -17,8 +17,9 @@
package custom.events.Race;
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.l2jmobius.Config;
@ -45,7 +46,7 @@ public class Race extends Event
// Npc
private Npc _npc;
// Player list
private List<PlayerInstance> _players;
private Collection<PlayerInstance> _players;
// Event Task
ScheduledFuture<?> _eventTask = null;
// Event state
@ -127,7 +128,7 @@ public class Race extends Event
}
// Initialize list
_npclist = new ArrayList<>();
_players = new CopyOnWriteArrayList<>();
_players = ConcurrentHashMap.newKeySet();
// Set Event active
_isactive = true;
// Spawn Manager

View File

@ -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)
{

View File

@ -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;

View File

@ -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);
}

View File

@ -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"))

View File

@ -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()

View File

@ -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;
@ -27,7 +28,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Predicate;
import java.util.logging.Logger;
import java.util.stream.Collectors;
@ -60,7 +60,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;
}

View File

@ -18,10 +18,11 @@ 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.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;
import java.util.function.Predicate;
import java.util.logging.Level;
@ -54,7 +55,7 @@ public class SpawnsData implements IXmlReader
{
protected static final Logger LOGGER = Logger.getLogger(SpawnsData.class.getName());
private final List<SpawnTemplate> _spawns = new CopyOnWriteArrayList<>();
private final Collection<SpawnTemplate> _spawns = ConcurrentHashMap.newKeySet();
protected SpawnsData()
{
@ -98,7 +99,7 @@ public class SpawnsData implements IXmlReader
if (Config.THREADS_FOR_LOADING)
{
final List<ScheduledFuture<?>> jobs = new CopyOnWriteArrayList<>();
final Collection<ScheduledFuture<?>> jobs = ConcurrentHashMap.newKeySet();
for (SpawnTemplate template : _spawns)
{
if (template.isSpawningByDefault())
@ -146,7 +147,7 @@ public class SpawnsData implements IXmlReader
LOGGER.info(getClass().getSimpleName() + ": All spawns has been removed!");
}
public List<SpawnTemplate> getSpawns()
public Collection<SpawnTemplate> getSpawns()
{
return _spawns;
}
@ -166,7 +167,7 @@ public class SpawnsData implements IXmlReader
return _spawns.stream().flatMap(template -> template.getGroups().stream()).flatMap(group -> group.getSpawns().stream()).filter(condition).collect(Collectors.toList());
}
public void parseSpawn(Node spawnsNode, File file, List<SpawnTemplate> spawns)
public void parseSpawn(Node spawnsNode, File file, Collection<SpawnTemplate> spawns)
{
final SpawnTemplate spawnTemplate = new SpawnTemplate(new StatsSet(parseAttributes(spawnsNode)), file);
SpawnGroup defaultGroup = null;

View File

@ -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
{

View File

@ -18,8 +18,9 @@ package org.l2jmobius.gameserver.engines;
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 java.util.logging.Logger;
@ -66,13 +67,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(() ->

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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 org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
@ -45,7 +45,7 @@ public class RaceManagerInstance extends Npc
public static final int LANES = 8;
public static final int WINDOW_START = 0;
private static List<RaceManagerInstance> _managers;
private static Collection<RaceManagerInstance> _managers;
protected static int _raceNumber = 4;
// Time Constants
@ -104,7 +104,7 @@ public class RaceManagerInstance extends Npc
{
_notInitialized = false;
_managers = new CopyOnWriteArrayList<>();
_managers = ConcurrentHashMap.newKeySet();
ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.TICKETS_ARE_NOW_AVAILABLE_FOR_MONSTER_RACE_S1), 0, 10 * MINUTE);
ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.NOW_SELLING_TICKETS_FOR_MONSTER_RACE_S1), 30 * SECOND, 10 * MINUTE);

View File

@ -19,10 +19,12 @@ package org.l2jmobius.gameserver.model.actor.instance;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Future;
import java.util.logging.Level;
@ -304,7 +306,7 @@ public class ServitorInstance extends Summon implements Runnable
int buff_index = 0;
final List<Long> storedSkills = new CopyOnWriteArrayList<>();
final Collection<Long> storedSkills = ConcurrentHashMap.newKeySet();
// Store all effect data along with calculated remaining
if (storeEffects)

View File

@ -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;
@ -62,7 +62,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)
{
@ -205,7 +205,7 @@ public class TamedBeastInstance extends FeedableBeastInstance
{
if (_beastSkills == null)
{
_beastSkills = new CopyOnWriteArrayList<>();
_beastSkills = ConcurrentHashMap.newKeySet();
}
_beastSkills.add(skill);
}

View File

@ -49,7 +49,7 @@ public interface Siegable
SiegeClan getDefenderClan(Clan clan);
List<SiegeClan> getDefenderClans();
Collection<SiegeClan> getDefenderClans();
boolean checkIsDefender(Clan clan);

View File

@ -21,12 +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.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -221,9 +222,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<>();
@ -1582,7 +1583,7 @@ public class Siege implements Siegable
}
@Override
public List<SiegeClan> getAttackerClans()
public Collection<SiegeClan> getAttackerClans()
{
if (_isNormalSide)
{
@ -1625,7 +1626,7 @@ public class Siege implements Siegable
}
@Override
public List<SiegeClan> getDefenderClans()
public Collection<SiegeClan> getDefenderClans()
{
if (_isNormalSide)
{
@ -1655,7 +1656,7 @@ public class Siege implements Siegable
return null;
}
public List<SiegeClan> getDefenderWaitingClans()
public Collection<SiegeClan> getDefenderWaitingClans()
{
return _defenderWaitingClans;
}

View File

@ -16,8 +16,9 @@
*/
package org.l2jmobius.gameserver.model.holders;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.gameserver.enums.Movie;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
@ -29,7 +30,7 @@ public class MovieHolder
{
private final Movie _movie;
private final List<PlayerInstance> _players;
private final List<PlayerInstance> _votedPlayers = new CopyOnWriteArrayList<>();
private final Collection<PlayerInstance> _votedPlayers = ConcurrentHashMap.newKeySet();
public MovieHolder(List<PlayerInstance> players, Movie movie)
{
@ -64,7 +65,7 @@ public class MovieHolder
return _players;
}
public List<PlayerInstance> getVotedPlayers()
public Collection<PlayerInstance> getVotedPlayers()
{
return _votedPlayers;
}

View File

@ -127,7 +127,7 @@ public class CommandChannelMatchingRoom extends MatchingRoom
if (leaderParty != null)
{
final CommandChannel cc = leaderParty.getCommandChannel();
if ((leaderParty == playerParty) || ((cc != null) && cc.getPartys().contains(playerParty)))
if ((leaderParty == playerParty) || ((cc != null) && cc.getParties().contains(playerParty)))
{
return MatchingMemberType.COMMAND_CHANNEL_PARTY_MEMBER;
}

View File

@ -45,8 +45,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());

View File

@ -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;
@ -50,7 +49,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 =
{

View File

@ -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
{

View File

@ -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;

View File

@ -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;
@ -49,7 +49,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));
@ -78,7 +78,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()
{

View File

@ -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()
{

View File

@ -17,8 +17,9 @@
package custom.events.Rabbits;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.CommonUtil;
@ -49,7 +50,7 @@ public class Rabbits extends Event
private static final int EVENT_TIME = 10;
private static final int TOTAL_CHEST_COUNT = 75;
private static final int TRANSFORMATION_ID = 105;
private final List<Npc> _npcs = new CopyOnWriteArrayList<>();
private final Collection<Npc> _npcs = ConcurrentHashMap.newKeySet();
private final List<PlayerInstance> _players = new ArrayList<>();
private boolean _isActive = false;
@ -253,7 +254,7 @@ public class Rabbits extends Event
}
}
private void recordSpawn(List<Npc> npcs, int npcId, int x, int y, int z, int heading, boolean randomOffSet, long despawnDelay)
private void recordSpawn(Collection<Npc> npcs, int npcId, int x, int y, int z, int heading, boolean randomOffSet, long despawnDelay)
{
final Npc npc = addSpawn(npcId, x, y, z, heading, randomOffSet, despawnDelay);
if (npc.getId() == CHEST)

View File

@ -17,8 +17,9 @@
package custom.events.Race;
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.l2jmobius.Config;
@ -45,7 +46,7 @@ public class Race extends Event
// Npc
private Npc _npc;
// Player list
private List<PlayerInstance> _players;
private Collection<PlayerInstance> _players;
// Event Task
ScheduledFuture<?> _eventTask = null;
// Event state
@ -127,7 +128,7 @@ public class Race extends Event
}
// Initialize list
_npclist = new ArrayList<>();
_players = new CopyOnWriteArrayList<>();
_players = ConcurrentHashMap.newKeySet();
// Set Event active
_isactive = true;
// Spawn Manager

View File

@ -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)
{

View File

@ -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;

View File

@ -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);
}

View File

@ -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"))

View File

@ -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()

View File

@ -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;
@ -27,7 +28,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Predicate;
import java.util.logging.Logger;
import java.util.stream.Collectors;
@ -60,7 +60,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;
}

View File

@ -18,10 +18,11 @@ 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.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;
import java.util.function.Predicate;
import java.util.logging.Level;
@ -54,7 +55,7 @@ public class SpawnsData implements IXmlReader
{
protected static final Logger LOGGER = Logger.getLogger(SpawnsData.class.getName());
private final List<SpawnTemplate> _spawns = new CopyOnWriteArrayList<>();
private final Collection<SpawnTemplate> _spawns = ConcurrentHashMap.newKeySet();
protected SpawnsData()
{
@ -98,7 +99,7 @@ public class SpawnsData implements IXmlReader
if (Config.THREADS_FOR_LOADING)
{
final List<ScheduledFuture<?>> jobs = new CopyOnWriteArrayList<>();
final Collection<ScheduledFuture<?>> jobs = ConcurrentHashMap.newKeySet();
for (SpawnTemplate template : _spawns)
{
if (template.isSpawningByDefault())
@ -146,7 +147,7 @@ public class SpawnsData implements IXmlReader
LOGGER.info(getClass().getSimpleName() + ": All spawns has been removed!");
}
public List<SpawnTemplate> getSpawns()
public Collection<SpawnTemplate> getSpawns()
{
return _spawns;
}
@ -166,7 +167,7 @@ public class SpawnsData implements IXmlReader
return _spawns.stream().flatMap(template -> template.getGroups().stream()).flatMap(group -> group.getSpawns().stream()).filter(condition).collect(Collectors.toList());
}
public void parseSpawn(Node spawnsNode, File file, List<SpawnTemplate> spawns)
public void parseSpawn(Node spawnsNode, File file, Collection<SpawnTemplate> spawns)
{
final SpawnTemplate spawnTemplate = new SpawnTemplate(new StatsSet(parseAttributes(spawnsNode)), file);
SpawnGroup defaultGroup = null;

View File

@ -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
{

View File

@ -18,8 +18,9 @@ package org.l2jmobius.gameserver.engines;
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 java.util.logging.Logger;
@ -66,13 +67,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(() ->

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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 org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
@ -45,7 +45,7 @@ public class RaceManagerInstance extends Npc
public static final int LANES = 8;
public static final int WINDOW_START = 0;
private static List<RaceManagerInstance> _managers;
private static Collection<RaceManagerInstance> _managers;
protected static int _raceNumber = 4;
// Time Constants
@ -104,7 +104,7 @@ public class RaceManagerInstance extends Npc
{
_notInitialized = false;
_managers = new CopyOnWriteArrayList<>();
_managers = ConcurrentHashMap.newKeySet();
ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.TICKETS_ARE_NOW_AVAILABLE_FOR_MONSTER_RACE_S1), 0, 10 * MINUTE);
ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.NOW_SELLING_TICKETS_FOR_MONSTER_RACE_S1), 30 * SECOND, 10 * MINUTE);

View File

@ -19,10 +19,12 @@ package org.l2jmobius.gameserver.model.actor.instance;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Future;
import java.util.logging.Level;
@ -304,7 +306,7 @@ public class ServitorInstance extends Summon implements Runnable
int buff_index = 0;
final List<Long> storedSkills = new CopyOnWriteArrayList<>();
final Collection<Long> storedSkills = ConcurrentHashMap.newKeySet();
// Store all effect data along with calculated remaining
if (storeEffects)

View File

@ -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;
@ -62,7 +62,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)
{
@ -205,7 +205,7 @@ public class TamedBeastInstance extends FeedableBeastInstance
{
if (_beastSkills == null)
{
_beastSkills = new CopyOnWriteArrayList<>();
_beastSkills = ConcurrentHashMap.newKeySet();
}
_beastSkills.add(skill);
}

View File

@ -49,7 +49,7 @@ public interface Siegable
SiegeClan getDefenderClan(Clan clan);
List<SiegeClan> getDefenderClans();
Collection<SiegeClan> getDefenderClans();
boolean checkIsDefender(Clan clan);

View File

@ -21,12 +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.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -221,9 +222,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<>();
@ -1582,7 +1583,7 @@ public class Siege implements Siegable
}
@Override
public List<SiegeClan> getAttackerClans()
public Collection<SiegeClan> getAttackerClans()
{
if (_isNormalSide)
{
@ -1625,7 +1626,7 @@ public class Siege implements Siegable
}
@Override
public List<SiegeClan> getDefenderClans()
public Collection<SiegeClan> getDefenderClans()
{
if (_isNormalSide)
{
@ -1655,7 +1656,7 @@ public class Siege implements Siegable
return null;
}
public List<SiegeClan> getDefenderWaitingClans()
public Collection<SiegeClan> getDefenderWaitingClans()
{
return _defenderWaitingClans;
}

View File

@ -16,8 +16,9 @@
*/
package org.l2jmobius.gameserver.model.holders;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.gameserver.enums.Movie;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
@ -29,7 +30,7 @@ public class MovieHolder
{
private final Movie _movie;
private final List<PlayerInstance> _players;
private final List<PlayerInstance> _votedPlayers = new CopyOnWriteArrayList<>();
private final Collection<PlayerInstance> _votedPlayers = ConcurrentHashMap.newKeySet();
public MovieHolder(List<PlayerInstance> players, Movie movie)
{
@ -64,7 +65,7 @@ public class MovieHolder
return _players;
}
public List<PlayerInstance> getVotedPlayers()
public Collection<PlayerInstance> getVotedPlayers()
{
return _votedPlayers;
}

View File

@ -127,7 +127,7 @@ public class CommandChannelMatchingRoom extends MatchingRoom
if (leaderParty != null)
{
final CommandChannel cc = leaderParty.getCommandChannel();
if ((leaderParty == playerParty) || ((cc != null) && cc.getPartys().contains(playerParty)))
if ((leaderParty == playerParty) || ((cc != null) && cc.getParties().contains(playerParty)))
{
return MatchingMemberType.COMMAND_CHANNEL_PARTY_MEMBER;
}

View File

@ -45,8 +45,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());

View File

@ -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;
@ -50,7 +49,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 =
{

View File

@ -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
{

View File

@ -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;

View File

@ -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;
@ -49,7 +49,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));
@ -78,7 +78,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()
{

View File

@ -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()
{

View File

@ -17,8 +17,9 @@
package custom.events.Rabbits;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.Config;
import org.l2jmobius.commons.util.CommonUtil;
@ -49,7 +50,7 @@ public class Rabbits extends Event
private static final int EVENT_TIME = 10;
private static final int TOTAL_CHEST_COUNT = 75;
private static final int TRANSFORMATION_ID = 105;
private final List<Npc> _npcs = new CopyOnWriteArrayList<>();
private final Collection<Npc> _npcs = ConcurrentHashMap.newKeySet();
private final List<PlayerInstance> _players = new ArrayList<>();
private boolean _isActive = false;
@ -253,7 +254,7 @@ public class Rabbits extends Event
}
}
private void recordSpawn(List<Npc> npcs, int npcId, int x, int y, int z, int heading, boolean randomOffSet, long despawnDelay)
private void recordSpawn(Collection<Npc> npcs, int npcId, int x, int y, int z, int heading, boolean randomOffSet, long despawnDelay)
{
final Npc npc = addSpawn(npcId, x, y, z, heading, randomOffSet, despawnDelay);
if (npc.getId() == CHEST)

View File

@ -17,8 +17,9 @@
package custom.events.Race;
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.l2jmobius.Config;
@ -45,7 +46,7 @@ public class Race extends Event
// Npc
private Npc _npc;
// Player list
private List<PlayerInstance> _players;
private Collection<PlayerInstance> _players;
// Event Task
ScheduledFuture<?> _eventTask = null;
// Event state
@ -127,7 +128,7 @@ public class Race extends Event
}
// Initialize list
_npclist = new ArrayList<>();
_players = new CopyOnWriteArrayList<>();
_players = ConcurrentHashMap.newKeySet();
// Set Event active
_isactive = true;
// Spawn Manager

View File

@ -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)
{

View File

@ -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;

View File

@ -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);
}

View File

@ -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"))

View File

@ -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()

View File

@ -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;
@ -27,7 +28,6 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Predicate;
import java.util.logging.Logger;
import java.util.stream.Collectors;
@ -60,7 +60,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;
}

View File

@ -18,10 +18,11 @@ 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.List;
import java.util.Map;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;
import java.util.function.Predicate;
import java.util.logging.Level;
@ -54,7 +55,7 @@ public class SpawnsData implements IXmlReader
{
protected static final Logger LOGGER = Logger.getLogger(SpawnsData.class.getName());
private final List<SpawnTemplate> _spawns = new CopyOnWriteArrayList<>();
private final Collection<SpawnTemplate> _spawns = ConcurrentHashMap.newKeySet();
protected SpawnsData()
{
@ -98,7 +99,7 @@ public class SpawnsData implements IXmlReader
if (Config.THREADS_FOR_LOADING)
{
final List<ScheduledFuture<?>> jobs = new CopyOnWriteArrayList<>();
final Collection<ScheduledFuture<?>> jobs = ConcurrentHashMap.newKeySet();
for (SpawnTemplate template : _spawns)
{
if (template.isSpawningByDefault())
@ -146,7 +147,7 @@ public class SpawnsData implements IXmlReader
LOGGER.info(getClass().getSimpleName() + ": All spawns has been removed!");
}
public List<SpawnTemplate> getSpawns()
public Collection<SpawnTemplate> getSpawns()
{
return _spawns;
}
@ -166,7 +167,7 @@ public class SpawnsData implements IXmlReader
return _spawns.stream().flatMap(template -> template.getGroups().stream()).flatMap(group -> group.getSpawns().stream()).filter(condition).collect(Collectors.toList());
}
public void parseSpawn(Node spawnsNode, File file, List<SpawnTemplate> spawns)
public void parseSpawn(Node spawnsNode, File file, Collection<SpawnTemplate> spawns)
{
final SpawnTemplate spawnTemplate = new SpawnTemplate(new StatsSet(parseAttributes(spawnsNode)), file);
SpawnGroup defaultGroup = null;

View File

@ -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
{

View File

@ -18,8 +18,9 @@ package org.l2jmobius.gameserver.engines;
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 java.util.logging.Logger;
@ -66,13 +67,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(() ->

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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 org.l2jmobius.Config;
import org.l2jmobius.commons.concurrent.ThreadPool;
@ -45,7 +45,7 @@ public class RaceManagerInstance extends Npc
public static final int LANES = 8;
public static final int WINDOW_START = 0;
private static List<RaceManagerInstance> _managers;
private static Collection<RaceManagerInstance> _managers;
protected static int _raceNumber = 4;
// Time Constants
@ -104,7 +104,7 @@ public class RaceManagerInstance extends Npc
{
_notInitialized = false;
_managers = new CopyOnWriteArrayList<>();
_managers = ConcurrentHashMap.newKeySet();
ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.TICKETS_ARE_NOW_AVAILABLE_FOR_MONSTER_RACE_S1), 0, 10 * MINUTE);
ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.NOW_SELLING_TICKETS_FOR_MONSTER_RACE_S1), 30 * SECOND, 10 * MINUTE);

View File

@ -19,10 +19,12 @@ package org.l2jmobius.gameserver.model.actor.instance;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.Future;
import java.util.logging.Level;
@ -304,7 +306,7 @@ public class ServitorInstance extends Summon implements Runnable
int buff_index = 0;
final List<Long> storedSkills = new CopyOnWriteArrayList<>();
final Collection<Long> storedSkills = ConcurrentHashMap.newKeySet();
// Store all effect data along with calculated remaining
if (storeEffects)

View File

@ -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;
@ -62,7 +62,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)
{
@ -205,7 +205,7 @@ public class TamedBeastInstance extends FeedableBeastInstance
{
if (_beastSkills == null)
{
_beastSkills = new CopyOnWriteArrayList<>();
_beastSkills = ConcurrentHashMap.newKeySet();
}
_beastSkills.add(skill);
}

View File

@ -49,7 +49,7 @@ public interface Siegable
SiegeClan getDefenderClan(Clan clan);
List<SiegeClan> getDefenderClans();
Collection<SiegeClan> getDefenderClans();
boolean checkIsDefender(Clan clan);

View File

@ -21,12 +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.Collections;
import java.util.Iterator;
import java.util.List;
import java.util.Objects;
import java.util.Set;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -221,9 +222,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<>();
@ -1582,7 +1583,7 @@ public class Siege implements Siegable
}
@Override
public List<SiegeClan> getAttackerClans()
public Collection<SiegeClan> getAttackerClans()
{
if (_isNormalSide)
{
@ -1625,7 +1626,7 @@ public class Siege implements Siegable
}
@Override
public List<SiegeClan> getDefenderClans()
public Collection<SiegeClan> getDefenderClans()
{
if (_isNormalSide)
{
@ -1655,7 +1656,7 @@ public class Siege implements Siegable
return null;
}
public List<SiegeClan> getDefenderWaitingClans()
public Collection<SiegeClan> getDefenderWaitingClans()
{
return _defenderWaitingClans;
}

View File

@ -16,8 +16,9 @@
*/
package org.l2jmobius.gameserver.model.holders;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ConcurrentHashMap;
import org.l2jmobius.gameserver.enums.Movie;
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
@ -29,7 +30,7 @@ public class MovieHolder
{
private final Movie _movie;
private final List<PlayerInstance> _players;
private final List<PlayerInstance> _votedPlayers = new CopyOnWriteArrayList<>();
private final Collection<PlayerInstance> _votedPlayers = ConcurrentHashMap.newKeySet();
public MovieHolder(List<PlayerInstance> players, Movie movie)
{
@ -64,7 +65,7 @@ public class MovieHolder
return _players;
}
public List<PlayerInstance> getVotedPlayers()
public Collection<PlayerInstance> getVotedPlayers()
{
return _votedPlayers;
}

Some files were not shown because too many files have changed in this diff Show More