Replaced several CopyOnWriteArrayList occurrences with ConcurrentHashMap.newKeySet().
This commit is contained in:
@@ -17,7 +17,8 @@
|
|||||||
package ai.areas.FantasyIsle;
|
package ai.areas.FantasyIsle;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.Collection;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -120,7 +121,7 @@ public class Parade extends AbstractNpcAI
|
|||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|
||||||
int npcIndex;
|
int npcIndex;
|
||||||
CopyOnWriteArrayList<Npc> spawns = new CopyOnWriteArrayList<>();
|
Collection<Npc> spawns = ConcurrentHashMap.newKeySet();
|
||||||
ScheduledFuture<?> spawnTask;
|
ScheduledFuture<?> spawnTask;
|
||||||
ScheduledFuture<?> deleteTask;
|
ScheduledFuture<?> deleteTask;
|
||||||
ScheduledFuture<?> cleanTask;
|
ScheduledFuture<?> cleanTask;
|
||||||
|
@@ -16,11 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
package ai.bosses.Core;
|
package ai.bosses.Core;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.gameserver.enums.ChatType;
|
import org.l2jmobius.gameserver.enums.ChatType;
|
||||||
@@ -78,7 +78,7 @@ public class Core extends AbstractNpcAI
|
|||||||
|
|
||||||
private static boolean _firstAttacked;
|
private static boolean _firstAttacked;
|
||||||
|
|
||||||
private static final List<Attackable> _minions = new CopyOnWriteArrayList<>();
|
private static final Collection<Attackable> _minions = ConcurrentHashMap.newKeySet();
|
||||||
|
|
||||||
private Core()
|
private Core()
|
||||||
{
|
{
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package ai.others;
|
package ai.others;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
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
|
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
|
//@formatter:on
|
||||||
private static final List<Npc> SPAWNED_GUARDS = new CopyOnWriteArrayList<>();
|
private static final Collection<Npc> SPAWNED_GUARDS = ConcurrentHashMap.newKeySet();
|
||||||
|
|
||||||
public SiegeGuards()
|
public SiegeGuards()
|
||||||
{
|
{
|
||||||
|
@@ -17,8 +17,9 @@
|
|||||||
package custom.events.Rabbits;
|
package custom.events.Rabbits;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.util.CommonUtil;
|
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 EVENT_TIME = 10;
|
||||||
private static final int TOTAL_CHEST_COUNT = 75;
|
private static final int TOTAL_CHEST_COUNT = 75;
|
||||||
private static final int TRANSFORMATION_ID = 105;
|
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 final List<PlayerInstance> _players = new ArrayList<>();
|
||||||
private boolean _isActive = false;
|
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);
|
final Npc npc = addSpawn(npcId, x, y, z, heading, randomOffSet, despawnDelay);
|
||||||
if (npc.getId() == CHEST)
|
if (npc.getId() == CHEST)
|
||||||
|
@@ -17,8 +17,9 @@
|
|||||||
package custom.events.Race;
|
package custom.events.Race;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@@ -45,7 +46,7 @@ public class Race extends Event
|
|||||||
// Npc
|
// Npc
|
||||||
private Npc _npc;
|
private Npc _npc;
|
||||||
// Player list
|
// Player list
|
||||||
private List<PlayerInstance> _players;
|
private Collection<PlayerInstance> _players;
|
||||||
// Event Task
|
// Event Task
|
||||||
ScheduledFuture<?> _eventTask = null;
|
ScheduledFuture<?> _eventTask = null;
|
||||||
// Event state
|
// Event state
|
||||||
@@ -127,7 +128,7 @@ public class Race extends Event
|
|||||||
}
|
}
|
||||||
// Initialize list
|
// Initialize list
|
||||||
_npclist = new ArrayList<>();
|
_npclist = new ArrayList<>();
|
||||||
_players = new CopyOnWriteArrayList<>();
|
_players = ConcurrentHashMap.newKeySet();
|
||||||
// Set Event active
|
// Set Event active
|
||||||
_isactive = true;
|
_isactive = true;
|
||||||
// Spawn Manager
|
// Spawn Manager
|
||||||
|
@@ -19,11 +19,12 @@ package org.l2jmobius.commons.util;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileFilter;
|
import java.io.FileFilter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
@@ -167,7 +168,7 @@ public interface IXmlReader
|
|||||||
|
|
||||||
if (Config.THREADS_FOR_LOADING)
|
if (Config.THREADS_FOR_LOADING)
|
||||||
{
|
{
|
||||||
final List<ScheduledFuture<?>> jobs = new CopyOnWriteArrayList<>();
|
final Collection<ScheduledFuture<?>> jobs = ConcurrentHashMap.newKeySet();
|
||||||
final File[] listOfFiles = dir.listFiles();
|
final File[] listOfFiles = dir.listFiles();
|
||||||
for (File file : listOfFiles)
|
for (File file : listOfFiles)
|
||||||
{
|
{
|
||||||
|
@@ -19,10 +19,9 @@ package org.l2jmobius.gameserver.communitybbs.BB;
|
|||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -46,7 +45,7 @@ public class Forum
|
|||||||
public static final int CLANMEMBERONLY = 2;
|
public static final int CLANMEMBERONLY = 2;
|
||||||
public static final int OWNERONLY = 3;
|
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 Map<Integer, Topic> _topic = new ConcurrentHashMap<>();
|
||||||
private final int _forumId;
|
private final int _forumId;
|
||||||
private String _forumName;
|
private String _forumName;
|
||||||
@@ -66,7 +65,7 @@ public class Forum
|
|||||||
{
|
{
|
||||||
_forumId = Forumid;
|
_forumId = Forumid;
|
||||||
_fParent = FParent;
|
_fParent = FParent;
|
||||||
_children = new CopyOnWriteArrayList<>();
|
_children = ConcurrentHashMap.newKeySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,7 +84,7 @@ public class Forum
|
|||||||
_forumPerm = perm;
|
_forumPerm = perm;
|
||||||
_fParent = parent;
|
_fParent = parent;
|
||||||
_ownerID = OwnerID;
|
_ownerID = OwnerID;
|
||||||
_children = new CopyOnWriteArrayList<>();
|
_children = ConcurrentHashMap.newKeySet();
|
||||||
parent._children.add(this);
|
parent._children.add(this);
|
||||||
ForumsBBSManager.getInstance().addForum(this);
|
ForumsBBSManager.getInstance().addForum(this);
|
||||||
_loaded = true;
|
_loaded = true;
|
||||||
|
@@ -19,8 +19,8 @@ package org.l2jmobius.gameserver.communitybbs.BB;
|
|||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ public class Post
|
|||||||
public String postTxt;
|
public String postTxt;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final List<CPost> _post;
|
private final Collection<CPost> _post;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param _PostOwner
|
* @param _PostOwner
|
||||||
@@ -57,7 +57,7 @@ public class Post
|
|||||||
*/
|
*/
|
||||||
public Post(String _PostOwner, int _PostOwnerID, long date, int tid, int _PostForumID, String txt)
|
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();
|
final CPost cp = new CPost();
|
||||||
cp.postId = 0;
|
cp.postId = 0;
|
||||||
cp.postOwner = _PostOwner;
|
cp.postOwner = _PostOwner;
|
||||||
@@ -92,7 +92,7 @@ public class Post
|
|||||||
|
|
||||||
public Post(Topic t)
|
public Post(Topic t)
|
||||||
{
|
{
|
||||||
_post = new CopyOnWriteArrayList<>();
|
_post = ConcurrentHashMap.newKeySet();
|
||||||
load(t);
|
load(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,8 +19,8 @@ package org.l2jmobius.gameserver.communitybbs.Manager;
|
|||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
|||||||
public class ForumsBBSManager extends BaseBBSManager
|
public class ForumsBBSManager extends BaseBBSManager
|
||||||
{
|
{
|
||||||
private static Logger LOGGER = Logger.getLogger(ForumsBBSManager.class.getName());
|
private static Logger LOGGER = Logger.getLogger(ForumsBBSManager.class.getName());
|
||||||
private final List<Forum> _table;
|
private final Collection<Forum> _table;
|
||||||
private int _lastid = 1;
|
private int _lastid = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,7 +39,7 @@ public class ForumsBBSManager extends BaseBBSManager
|
|||||||
*/
|
*/
|
||||||
protected ForumsBBSManager()
|
protected ForumsBBSManager()
|
||||||
{
|
{
|
||||||
_table = new CopyOnWriteArrayList<>();
|
_table = ConcurrentHashMap.newKeySet();
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
Statement s = con.createStatement();
|
Statement s = con.createStatement();
|
||||||
ResultSet rs = s.executeQuery("SELECT forum_id FROM forums WHERE forum_type = 0"))
|
ResultSet rs = s.executeQuery("SELECT forum_id FROM forums WHERE forum_type = 0"))
|
||||||
|
@@ -18,12 +18,11 @@ package org.l2jmobius.gameserver.communitybbs.Manager;
|
|||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.communitybbs.BB.Forum;
|
import org.l2jmobius.gameserver.communitybbs.BB.Forum;
|
||||||
import org.l2jmobius.gameserver.communitybbs.BB.Post;
|
import org.l2jmobius.gameserver.communitybbs.BB.Post;
|
||||||
@@ -34,7 +33,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
|||||||
|
|
||||||
public class TopicBBSManager extends BaseBBSManager
|
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<>();
|
private final Map<Forum, Integer> _maxId = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected TopicBBSManager()
|
protected TopicBBSManager()
|
||||||
|
@@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.data.xml.impl;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -27,7 +28,6 @@ import java.util.Map;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.stream.Collectors;
|
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<Integer, NpcTemplate> _npcs = new ConcurrentHashMap<>();
|
||||||
private final Map<String, Integer> _clans = 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()
|
protected NpcData()
|
||||||
{
|
{
|
||||||
@@ -789,7 +789,7 @@ public class NpcData implements IXmlReader
|
|||||||
/**
|
/**
|
||||||
* @return the IDs of monsters that have minions.
|
* @return the IDs of monsters that have minions.
|
||||||
*/
|
*/
|
||||||
public static List<Integer> getMasterMonsterIDs()
|
public static Collection<Integer> getMasterMonsterIDs()
|
||||||
{
|
{
|
||||||
return _masterMonsterIDs;
|
return _masterMonsterIDs;
|
||||||
}
|
}
|
||||||
|
@@ -18,10 +18,11 @@ package org.l2jmobius.gameserver.data.xml.impl;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@@ -54,7 +55,7 @@ public class SpawnsData implements IXmlReader
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER = Logger.getLogger(SpawnsData.class.getName());
|
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()
|
protected SpawnsData()
|
||||||
{
|
{
|
||||||
@@ -98,7 +99,7 @@ public class SpawnsData implements IXmlReader
|
|||||||
|
|
||||||
if (Config.THREADS_FOR_LOADING)
|
if (Config.THREADS_FOR_LOADING)
|
||||||
{
|
{
|
||||||
final List<ScheduledFuture<?>> jobs = new CopyOnWriteArrayList<>();
|
final Collection<ScheduledFuture<?>> jobs = ConcurrentHashMap.newKeySet();
|
||||||
for (SpawnTemplate template : _spawns)
|
for (SpawnTemplate template : _spawns)
|
||||||
{
|
{
|
||||||
if (template.isSpawningByDefault())
|
if (template.isSpawningByDefault())
|
||||||
@@ -146,7 +147,7 @@ public class SpawnsData implements IXmlReader
|
|||||||
LOGGER.info(getClass().getSimpleName() + ": All spawns has been removed!");
|
LOGGER.info(getClass().getSimpleName() + ": All spawns has been removed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SpawnTemplate> getSpawns()
|
public Collection<SpawnTemplate> getSpawns()
|
||||||
{
|
{
|
||||||
return _spawns;
|
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());
|
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);
|
final SpawnTemplate spawnTemplate = new SpawnTemplate(new StatsSet(parseAttributes(spawnsNode)), file);
|
||||||
SpawnGroup defaultGroup = null;
|
SpawnGroup defaultGroup = null;
|
||||||
|
@@ -16,10 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.datatables;
|
package org.l2jmobius.gameserver.datatables;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
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.DateRange;
|
||||||
import org.l2jmobius.gameserver.script.EventDrop;
|
import org.l2jmobius.gameserver.script.EventDrop;
|
||||||
@@ -35,7 +36,7 @@ public class EventDroplist
|
|||||||
/**
|
/**
|
||||||
* The table containing all DataDrop object
|
* 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
|
public static class DateDrop
|
||||||
{
|
{
|
||||||
|
@@ -18,8 +18,9 @@ package org.l2jmobius.gameserver.engines;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -66,13 +67,13 @@ public class DocumentEngine
|
|||||||
* Return created items
|
* Return created items
|
||||||
* @return List of {@link Item}
|
* @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)
|
if (Config.THREADS_FOR_LOADING)
|
||||||
{
|
{
|
||||||
final List<ScheduledFuture<?>> jobs = new CopyOnWriteArrayList<>();
|
final Collection<ScheduledFuture<?>> jobs = ConcurrentHashMap.newKeySet();
|
||||||
for (File file : _itemFiles)
|
for (File file : _itemFiles)
|
||||||
{
|
{
|
||||||
jobs.add(ThreadPool.schedule(() ->
|
jobs.add(ThreadPool.schedule(() ->
|
||||||
|
@@ -16,9 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model;
|
package org.l2jmobius.gameserver.model;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@@ -36,7 +37,7 @@ import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
|||||||
*/
|
*/
|
||||||
public class CommandChannel extends AbstractPlayerGroup
|
public class CommandChannel extends AbstractPlayerGroup
|
||||||
{
|
{
|
||||||
private final List<Party> _parties = new CopyOnWriteArrayList<>();
|
private final Collection<Party> _parties = ConcurrentHashMap.newKeySet();
|
||||||
private PlayerInstance _commandLeader;
|
private PlayerInstance _commandLeader;
|
||||||
private int _channelLvl;
|
private int _channelLvl;
|
||||||
|
|
||||||
@@ -150,7 +151,7 @@ public class CommandChannel extends AbstractPlayerGroup
|
|||||||
/**
|
/**
|
||||||
* @return a list of all parties in this command channel
|
* @return a list of all parties in this command channel
|
||||||
*/
|
*/
|
||||||
public List<Party> getPartys()
|
public Collection<Party> getParties()
|
||||||
{
|
{
|
||||||
return _parties;
|
return _parties;
|
||||||
}
|
}
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model;
|
package org.l2jmobius.gameserver.model;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.PetitionState;
|
import org.l2jmobius.gameserver.enums.PetitionState;
|
||||||
import org.l2jmobius.gameserver.enums.PetitionType;
|
import org.l2jmobius.gameserver.enums.PetitionType;
|
||||||
@@ -41,7 +41,7 @@ public class Petition
|
|||||||
private final PetitionType _type;
|
private final PetitionType _type;
|
||||||
private PetitionState _state = PetitionState.PENDING;
|
private PetitionState _state = PetitionState.PENDING;
|
||||||
private final String _content;
|
private final String _content;
|
||||||
private final List<CreatureSay> _messageLog = new CopyOnWriteArrayList<>();
|
private final Collection<CreatureSay> _messageLog = ConcurrentHashMap.newKeySet();
|
||||||
private final PlayerInstance _petitioner;
|
private final PlayerInstance _petitioner;
|
||||||
private PlayerInstance _responder;
|
private PlayerInstance _responder;
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ public class Petition
|
|||||||
return _messageLog.add(cs);
|
return _messageLog.add(cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CreatureSay> getLogMessages()
|
public Collection<CreatureSay> getLogMessages()
|
||||||
{
|
{
|
||||||
return _messageLog;
|
return _messageLog;
|
||||||
}
|
}
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.actor.instance;
|
package org.l2jmobius.gameserver.model.actor.instance;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
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 LANES = 8;
|
||||||
public static final int WINDOW_START = 0;
|
public static final int WINDOW_START = 0;
|
||||||
|
|
||||||
private static List<RaceManagerInstance> _managers;
|
private static Collection<RaceManagerInstance> _managers;
|
||||||
protected static int _raceNumber = 4;
|
protected static int _raceNumber = 4;
|
||||||
|
|
||||||
// Time Constants
|
// Time Constants
|
||||||
@@ -104,7 +104,7 @@ public class RaceManagerInstance extends Npc
|
|||||||
{
|
{
|
||||||
_notInitialized = false;
|
_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.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);
|
ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.NOW_SELLING_TICKETS_FOR_MONSTER_RACE_S1), 30 * SECOND, 10 * MINUTE);
|
||||||
|
@@ -19,10 +19,12 @@ package org.l2jmobius.gameserver.model.actor.instance;
|
|||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@@ -304,7 +306,7 @@ public class ServitorInstance extends Summon implements Runnable
|
|||||||
|
|
||||||
int buff_index = 0;
|
int buff_index = 0;
|
||||||
|
|
||||||
final List<Long> storedSkills = new CopyOnWriteArrayList<>();
|
final Collection<Long> storedSkills = ConcurrentHashMap.newKeySet();
|
||||||
|
|
||||||
// Store all effect data along with calculated remaining
|
// Store all effect data along with calculated remaining
|
||||||
if (storeEffects)
|
if (storeEffects)
|
||||||
|
@@ -18,8 +18,8 @@ package org.l2jmobius.gameserver.model.actor.instance;
|
|||||||
|
|
||||||
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
|
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -62,7 +62,7 @@ public class TamedBeastInstance extends FeedableBeastInstance
|
|||||||
private Future<?> _buffTask = null;
|
private Future<?> _buffTask = null;
|
||||||
private Future<?> _durationCheckTask = null;
|
private Future<?> _durationCheckTask = null;
|
||||||
protected boolean _isFreyaBeast;
|
protected boolean _isFreyaBeast;
|
||||||
private List<Skill> _beastSkills = null;
|
private Collection<Skill> _beastSkills = null;
|
||||||
|
|
||||||
public TamedBeastInstance(int npcTemplateId)
|
public TamedBeastInstance(int npcTemplateId)
|
||||||
{
|
{
|
||||||
@@ -205,7 +205,7 @@ public class TamedBeastInstance extends FeedableBeastInstance
|
|||||||
{
|
{
|
||||||
if (_beastSkills == null)
|
if (_beastSkills == null)
|
||||||
{
|
{
|
||||||
_beastSkills = new CopyOnWriteArrayList<>();
|
_beastSkills = ConcurrentHashMap.newKeySet();
|
||||||
}
|
}
|
||||||
_beastSkills.add(skill);
|
_beastSkills.add(skill);
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,7 @@ public interface Siegable
|
|||||||
|
|
||||||
SiegeClan getDefenderClan(Clan clan);
|
SiegeClan getDefenderClan(Clan clan);
|
||||||
|
|
||||||
List<SiegeClan> getDefenderClans();
|
Collection<SiegeClan> getDefenderClans();
|
||||||
|
|
||||||
boolean checkIsDefender(Clan clan);
|
boolean checkIsDefender(Clan clan);
|
||||||
|
|
||||||
|
@@ -21,12 +21,13 @@ import java.sql.PreparedStatement;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@@ -221,9 +222,9 @@ public class Siege implements Siegable
|
|||||||
}
|
}
|
||||||
|
|
||||||
// must support Concurrent Modifications
|
// must support Concurrent Modifications
|
||||||
private final List<SiegeClan> _attackerClans = new CopyOnWriteArrayList<>();
|
private final Collection<SiegeClan> _attackerClans = ConcurrentHashMap.newKeySet();
|
||||||
private final List<SiegeClan> _defenderClans = new CopyOnWriteArrayList<>();
|
private final Collection<SiegeClan> _defenderClans = ConcurrentHashMap.newKeySet();
|
||||||
private final List<SiegeClan> _defenderWaitingClans = new CopyOnWriteArrayList<>();
|
private final Collection<SiegeClan> _defenderWaitingClans = ConcurrentHashMap.newKeySet();
|
||||||
|
|
||||||
// Castle setting
|
// Castle setting
|
||||||
private final List<ControlTowerInstance> _controlTowers = new ArrayList<>();
|
private final List<ControlTowerInstance> _controlTowers = new ArrayList<>();
|
||||||
@@ -1582,7 +1583,7 @@ public class Siege implements Siegable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SiegeClan> getAttackerClans()
|
public Collection<SiegeClan> getAttackerClans()
|
||||||
{
|
{
|
||||||
if (_isNormalSide)
|
if (_isNormalSide)
|
||||||
{
|
{
|
||||||
@@ -1625,7 +1626,7 @@ public class Siege implements Siegable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SiegeClan> getDefenderClans()
|
public Collection<SiegeClan> getDefenderClans()
|
||||||
{
|
{
|
||||||
if (_isNormalSide)
|
if (_isNormalSide)
|
||||||
{
|
{
|
||||||
@@ -1655,7 +1656,7 @@ public class Siege implements Siegable
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SiegeClan> getDefenderWaitingClans()
|
public Collection<SiegeClan> getDefenderWaitingClans()
|
||||||
{
|
{
|
||||||
return _defenderWaitingClans;
|
return _defenderWaitingClans;
|
||||||
}
|
}
|
||||||
|
@@ -16,8 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.holders;
|
package org.l2jmobius.gameserver.model.holders;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.Movie;
|
import org.l2jmobius.gameserver.enums.Movie;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
@@ -29,7 +30,7 @@ public class MovieHolder
|
|||||||
{
|
{
|
||||||
private final Movie _movie;
|
private final Movie _movie;
|
||||||
private final List<PlayerInstance> _players;
|
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)
|
public MovieHolder(List<PlayerInstance> players, Movie movie)
|
||||||
{
|
{
|
||||||
@@ -64,7 +65,7 @@ public class MovieHolder
|
|||||||
return _players;
|
return _players;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PlayerInstance> getVotedPlayers()
|
public Collection<PlayerInstance> getVotedPlayers()
|
||||||
{
|
{
|
||||||
return _votedPlayers;
|
return _votedPlayers;
|
||||||
}
|
}
|
||||||
|
@@ -127,7 +127,7 @@ public class CommandChannelMatchingRoom extends MatchingRoom
|
|||||||
if (leaderParty != null)
|
if (leaderParty != null)
|
||||||
{
|
{
|
||||||
final CommandChannel cc = leaderParty.getCommandChannel();
|
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;
|
return MatchingMemberType.COMMAND_CHANNEL_PARTY_MEMBER;
|
||||||
}
|
}
|
||||||
|
@@ -45,8 +45,8 @@ public class ExMultiPartyCommandChannelInfo implements IClientOutgoingPacket
|
|||||||
packet.writeD(0x00); // Channel loot 0 or 1
|
packet.writeD(0x00); // Channel loot 0 or 1
|
||||||
packet.writeD(_channel.getMemberCount());
|
packet.writeD(_channel.getMemberCount());
|
||||||
|
|
||||||
packet.writeD(_channel.getPartys().size());
|
packet.writeD(_channel.getParties().size());
|
||||||
for (Party p : _channel.getPartys())
|
for (Party p : _channel.getParties())
|
||||||
{
|
{
|
||||||
packet.writeS(p.getLeader().getName());
|
packet.writeS(p.getLeader().getName());
|
||||||
packet.writeD(p.getLeaderObjectId());
|
packet.writeD(p.getLeaderObjectId());
|
||||||
|
@@ -26,11 +26,10 @@ import java.sql.ResultSet;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@@ -50,7 +49,7 @@ public class TaskManager
|
|||||||
static final Logger LOGGER = Logger.getLogger(TaskManager.class.getName());
|
static final Logger LOGGER = Logger.getLogger(TaskManager.class.getName());
|
||||||
|
|
||||||
private final Map<Integer, Task> _tasks = new ConcurrentHashMap<>();
|
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 =
|
static final String[] SQL_STATEMENTS =
|
||||||
{
|
{
|
||||||
|
@@ -18,8 +18,8 @@ package org.l2jmobius.loginserver;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ import org.l2jmobius.Config;
|
|||||||
*/
|
*/
|
||||||
public class GameServerListener extends FloodProtectedListener
|
public class GameServerListener extends FloodProtectedListener
|
||||||
{
|
{
|
||||||
private static List<GameServerThread> _gameServers = new CopyOnWriteArrayList<>();
|
private static Collection<GameServerThread> _gameServers = ConcurrentHashMap.newKeySet();
|
||||||
|
|
||||||
public GameServerListener() throws IOException
|
public GameServerListener() throws IOException
|
||||||
{
|
{
|
||||||
|
@@ -17,7 +17,8 @@
|
|||||||
package ai.areas.FantasyIsle;
|
package ai.areas.FantasyIsle;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.Collection;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -120,7 +121,7 @@ public class Parade extends AbstractNpcAI
|
|||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|
||||||
int npcIndex;
|
int npcIndex;
|
||||||
CopyOnWriteArrayList<Npc> spawns = new CopyOnWriteArrayList<>();
|
Collection<Npc> spawns = ConcurrentHashMap.newKeySet();
|
||||||
ScheduledFuture<?> spawnTask;
|
ScheduledFuture<?> spawnTask;
|
||||||
ScheduledFuture<?> deleteTask;
|
ScheduledFuture<?> deleteTask;
|
||||||
ScheduledFuture<?> cleanTask;
|
ScheduledFuture<?> cleanTask;
|
||||||
|
@@ -16,11 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
package ai.bosses.Core;
|
package ai.bosses.Core;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.gameserver.enums.ChatType;
|
import org.l2jmobius.gameserver.enums.ChatType;
|
||||||
@@ -78,7 +78,7 @@ public class Core extends AbstractNpcAI
|
|||||||
|
|
||||||
private static boolean _firstAttacked;
|
private static boolean _firstAttacked;
|
||||||
|
|
||||||
private static final List<Attackable> _minions = new CopyOnWriteArrayList<>();
|
private static final Collection<Attackable> _minions = ConcurrentHashMap.newKeySet();
|
||||||
|
|
||||||
private Core()
|
private Core()
|
||||||
{
|
{
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package ai.others;
|
package ai.others;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
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
|
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
|
//@formatter:on
|
||||||
private static final List<Npc> SPAWNED_GUARDS = new CopyOnWriteArrayList<>();
|
private static final Collection<Npc> SPAWNED_GUARDS = ConcurrentHashMap.newKeySet();
|
||||||
|
|
||||||
public SiegeGuards()
|
public SiegeGuards()
|
||||||
{
|
{
|
||||||
|
@@ -17,8 +17,9 @@
|
|||||||
package custom.events.Rabbits;
|
package custom.events.Rabbits;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.util.CommonUtil;
|
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 EVENT_TIME = 10;
|
||||||
private static final int TOTAL_CHEST_COUNT = 75;
|
private static final int TOTAL_CHEST_COUNT = 75;
|
||||||
private static final int TRANSFORMATION_ID = 105;
|
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 final List<PlayerInstance> _players = new ArrayList<>();
|
||||||
private boolean _isActive = false;
|
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);
|
final Npc npc = addSpawn(npcId, x, y, z, heading, randomOffSet, despawnDelay);
|
||||||
if (npc.getId() == CHEST)
|
if (npc.getId() == CHEST)
|
||||||
|
@@ -17,8 +17,9 @@
|
|||||||
package custom.events.Race;
|
package custom.events.Race;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@@ -45,7 +46,7 @@ public class Race extends Event
|
|||||||
// Npc
|
// Npc
|
||||||
private Npc _npc;
|
private Npc _npc;
|
||||||
// Player list
|
// Player list
|
||||||
private List<PlayerInstance> _players;
|
private Collection<PlayerInstance> _players;
|
||||||
// Event Task
|
// Event Task
|
||||||
ScheduledFuture<?> _eventTask = null;
|
ScheduledFuture<?> _eventTask = null;
|
||||||
// Event state
|
// Event state
|
||||||
@@ -127,7 +128,7 @@ public class Race extends Event
|
|||||||
}
|
}
|
||||||
// Initialize list
|
// Initialize list
|
||||||
_npclist = new ArrayList<>();
|
_npclist = new ArrayList<>();
|
||||||
_players = new CopyOnWriteArrayList<>();
|
_players = ConcurrentHashMap.newKeySet();
|
||||||
// Set Event active
|
// Set Event active
|
||||||
_isactive = true;
|
_isactive = true;
|
||||||
// Spawn Manager
|
// Spawn Manager
|
||||||
|
@@ -19,11 +19,12 @@ package org.l2jmobius.commons.util;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileFilter;
|
import java.io.FileFilter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
@@ -167,7 +168,7 @@ public interface IXmlReader
|
|||||||
|
|
||||||
if (Config.THREADS_FOR_LOADING)
|
if (Config.THREADS_FOR_LOADING)
|
||||||
{
|
{
|
||||||
final List<ScheduledFuture<?>> jobs = new CopyOnWriteArrayList<>();
|
final Collection<ScheduledFuture<?>> jobs = ConcurrentHashMap.newKeySet();
|
||||||
final File[] listOfFiles = dir.listFiles();
|
final File[] listOfFiles = dir.listFiles();
|
||||||
for (File file : listOfFiles)
|
for (File file : listOfFiles)
|
||||||
{
|
{
|
||||||
|
@@ -19,10 +19,9 @@ package org.l2jmobius.gameserver.communitybbs.BB;
|
|||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -46,7 +45,7 @@ public class Forum
|
|||||||
public static final int CLANMEMBERONLY = 2;
|
public static final int CLANMEMBERONLY = 2;
|
||||||
public static final int OWNERONLY = 3;
|
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 Map<Integer, Topic> _topic = new ConcurrentHashMap<>();
|
||||||
private final int _forumId;
|
private final int _forumId;
|
||||||
private String _forumName;
|
private String _forumName;
|
||||||
@@ -66,7 +65,7 @@ public class Forum
|
|||||||
{
|
{
|
||||||
_forumId = Forumid;
|
_forumId = Forumid;
|
||||||
_fParent = FParent;
|
_fParent = FParent;
|
||||||
_children = new CopyOnWriteArrayList<>();
|
_children = ConcurrentHashMap.newKeySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,7 +84,7 @@ public class Forum
|
|||||||
_forumPerm = perm;
|
_forumPerm = perm;
|
||||||
_fParent = parent;
|
_fParent = parent;
|
||||||
_ownerID = OwnerID;
|
_ownerID = OwnerID;
|
||||||
_children = new CopyOnWriteArrayList<>();
|
_children = ConcurrentHashMap.newKeySet();
|
||||||
parent._children.add(this);
|
parent._children.add(this);
|
||||||
ForumsBBSManager.getInstance().addForum(this);
|
ForumsBBSManager.getInstance().addForum(this);
|
||||||
_loaded = true;
|
_loaded = true;
|
||||||
|
@@ -19,8 +19,8 @@ package org.l2jmobius.gameserver.communitybbs.BB;
|
|||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ public class Post
|
|||||||
public String postTxt;
|
public String postTxt;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final List<CPost> _post;
|
private final Collection<CPost> _post;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param _PostOwner
|
* @param _PostOwner
|
||||||
@@ -57,7 +57,7 @@ public class Post
|
|||||||
*/
|
*/
|
||||||
public Post(String _PostOwner, int _PostOwnerID, long date, int tid, int _PostForumID, String txt)
|
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();
|
final CPost cp = new CPost();
|
||||||
cp.postId = 0;
|
cp.postId = 0;
|
||||||
cp.postOwner = _PostOwner;
|
cp.postOwner = _PostOwner;
|
||||||
@@ -92,7 +92,7 @@ public class Post
|
|||||||
|
|
||||||
public Post(Topic t)
|
public Post(Topic t)
|
||||||
{
|
{
|
||||||
_post = new CopyOnWriteArrayList<>();
|
_post = ConcurrentHashMap.newKeySet();
|
||||||
load(t);
|
load(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,8 +19,8 @@ package org.l2jmobius.gameserver.communitybbs.Manager;
|
|||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
|||||||
public class ForumsBBSManager extends BaseBBSManager
|
public class ForumsBBSManager extends BaseBBSManager
|
||||||
{
|
{
|
||||||
private static Logger LOGGER = Logger.getLogger(ForumsBBSManager.class.getName());
|
private static Logger LOGGER = Logger.getLogger(ForumsBBSManager.class.getName());
|
||||||
private final List<Forum> _table;
|
private final Collection<Forum> _table;
|
||||||
private int _lastid = 1;
|
private int _lastid = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,7 +39,7 @@ public class ForumsBBSManager extends BaseBBSManager
|
|||||||
*/
|
*/
|
||||||
protected ForumsBBSManager()
|
protected ForumsBBSManager()
|
||||||
{
|
{
|
||||||
_table = new CopyOnWriteArrayList<>();
|
_table = ConcurrentHashMap.newKeySet();
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
Statement s = con.createStatement();
|
Statement s = con.createStatement();
|
||||||
ResultSet rs = s.executeQuery("SELECT forum_id FROM forums WHERE forum_type = 0"))
|
ResultSet rs = s.executeQuery("SELECT forum_id FROM forums WHERE forum_type = 0"))
|
||||||
|
@@ -18,12 +18,11 @@ package org.l2jmobius.gameserver.communitybbs.Manager;
|
|||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.communitybbs.BB.Forum;
|
import org.l2jmobius.gameserver.communitybbs.BB.Forum;
|
||||||
import org.l2jmobius.gameserver.communitybbs.BB.Post;
|
import org.l2jmobius.gameserver.communitybbs.BB.Post;
|
||||||
@@ -34,7 +33,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
|||||||
|
|
||||||
public class TopicBBSManager extends BaseBBSManager
|
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<>();
|
private final Map<Forum, Integer> _maxId = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected TopicBBSManager()
|
protected TopicBBSManager()
|
||||||
|
@@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.data.xml.impl;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -27,7 +28,6 @@ import java.util.Map;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.stream.Collectors;
|
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<Integer, NpcTemplate> _npcs = new ConcurrentHashMap<>();
|
||||||
private final Map<String, Integer> _clans = 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()
|
protected NpcData()
|
||||||
{
|
{
|
||||||
@@ -789,7 +789,7 @@ public class NpcData implements IXmlReader
|
|||||||
/**
|
/**
|
||||||
* @return the IDs of monsters that have minions.
|
* @return the IDs of monsters that have minions.
|
||||||
*/
|
*/
|
||||||
public static List<Integer> getMasterMonsterIDs()
|
public static Collection<Integer> getMasterMonsterIDs()
|
||||||
{
|
{
|
||||||
return _masterMonsterIDs;
|
return _masterMonsterIDs;
|
||||||
}
|
}
|
||||||
|
@@ -18,10 +18,11 @@ package org.l2jmobius.gameserver.data.xml.impl;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@@ -54,7 +55,7 @@ public class SpawnsData implements IXmlReader
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER = Logger.getLogger(SpawnsData.class.getName());
|
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()
|
protected SpawnsData()
|
||||||
{
|
{
|
||||||
@@ -98,7 +99,7 @@ public class SpawnsData implements IXmlReader
|
|||||||
|
|
||||||
if (Config.THREADS_FOR_LOADING)
|
if (Config.THREADS_FOR_LOADING)
|
||||||
{
|
{
|
||||||
final List<ScheduledFuture<?>> jobs = new CopyOnWriteArrayList<>();
|
final Collection<ScheduledFuture<?>> jobs = ConcurrentHashMap.newKeySet();
|
||||||
for (SpawnTemplate template : _spawns)
|
for (SpawnTemplate template : _spawns)
|
||||||
{
|
{
|
||||||
if (template.isSpawningByDefault())
|
if (template.isSpawningByDefault())
|
||||||
@@ -146,7 +147,7 @@ public class SpawnsData implements IXmlReader
|
|||||||
LOGGER.info(getClass().getSimpleName() + ": All spawns has been removed!");
|
LOGGER.info(getClass().getSimpleName() + ": All spawns has been removed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SpawnTemplate> getSpawns()
|
public Collection<SpawnTemplate> getSpawns()
|
||||||
{
|
{
|
||||||
return _spawns;
|
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());
|
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);
|
final SpawnTemplate spawnTemplate = new SpawnTemplate(new StatsSet(parseAttributes(spawnsNode)), file);
|
||||||
SpawnGroup defaultGroup = null;
|
SpawnGroup defaultGroup = null;
|
||||||
|
@@ -16,10 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.datatables;
|
package org.l2jmobius.gameserver.datatables;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
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.DateRange;
|
||||||
import org.l2jmobius.gameserver.script.EventDrop;
|
import org.l2jmobius.gameserver.script.EventDrop;
|
||||||
@@ -35,7 +36,7 @@ public class EventDroplist
|
|||||||
/**
|
/**
|
||||||
* The table containing all DataDrop object
|
* 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
|
public static class DateDrop
|
||||||
{
|
{
|
||||||
|
@@ -18,8 +18,9 @@ package org.l2jmobius.gameserver.engines;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -66,13 +67,13 @@ public class DocumentEngine
|
|||||||
* Return created items
|
* Return created items
|
||||||
* @return List of {@link Item}
|
* @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)
|
if (Config.THREADS_FOR_LOADING)
|
||||||
{
|
{
|
||||||
final List<ScheduledFuture<?>> jobs = new CopyOnWriteArrayList<>();
|
final Collection<ScheduledFuture<?>> jobs = ConcurrentHashMap.newKeySet();
|
||||||
for (File file : _itemFiles)
|
for (File file : _itemFiles)
|
||||||
{
|
{
|
||||||
jobs.add(ThreadPool.schedule(() ->
|
jobs.add(ThreadPool.schedule(() ->
|
||||||
|
@@ -16,9 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model;
|
package org.l2jmobius.gameserver.model;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@@ -36,7 +37,7 @@ import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
|||||||
*/
|
*/
|
||||||
public class CommandChannel extends AbstractPlayerGroup
|
public class CommandChannel extends AbstractPlayerGroup
|
||||||
{
|
{
|
||||||
private final List<Party> _parties = new CopyOnWriteArrayList<>();
|
private final Collection<Party> _parties = ConcurrentHashMap.newKeySet();
|
||||||
private PlayerInstance _commandLeader;
|
private PlayerInstance _commandLeader;
|
||||||
private int _channelLvl;
|
private int _channelLvl;
|
||||||
|
|
||||||
@@ -150,7 +151,7 @@ public class CommandChannel extends AbstractPlayerGroup
|
|||||||
/**
|
/**
|
||||||
* @return a list of all parties in this command channel
|
* @return a list of all parties in this command channel
|
||||||
*/
|
*/
|
||||||
public List<Party> getPartys()
|
public Collection<Party> getParties()
|
||||||
{
|
{
|
||||||
return _parties;
|
return _parties;
|
||||||
}
|
}
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model;
|
package org.l2jmobius.gameserver.model;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.PetitionState;
|
import org.l2jmobius.gameserver.enums.PetitionState;
|
||||||
import org.l2jmobius.gameserver.enums.PetitionType;
|
import org.l2jmobius.gameserver.enums.PetitionType;
|
||||||
@@ -41,7 +41,7 @@ public class Petition
|
|||||||
private final PetitionType _type;
|
private final PetitionType _type;
|
||||||
private PetitionState _state = PetitionState.PENDING;
|
private PetitionState _state = PetitionState.PENDING;
|
||||||
private final String _content;
|
private final String _content;
|
||||||
private final List<CreatureSay> _messageLog = new CopyOnWriteArrayList<>();
|
private final Collection<CreatureSay> _messageLog = ConcurrentHashMap.newKeySet();
|
||||||
private final PlayerInstance _petitioner;
|
private final PlayerInstance _petitioner;
|
||||||
private PlayerInstance _responder;
|
private PlayerInstance _responder;
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ public class Petition
|
|||||||
return _messageLog.add(cs);
|
return _messageLog.add(cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CreatureSay> getLogMessages()
|
public Collection<CreatureSay> getLogMessages()
|
||||||
{
|
{
|
||||||
return _messageLog;
|
return _messageLog;
|
||||||
}
|
}
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.actor.instance;
|
package org.l2jmobius.gameserver.model.actor.instance;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
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 LANES = 8;
|
||||||
public static final int WINDOW_START = 0;
|
public static final int WINDOW_START = 0;
|
||||||
|
|
||||||
private static List<RaceManagerInstance> _managers;
|
private static Collection<RaceManagerInstance> _managers;
|
||||||
protected static int _raceNumber = 4;
|
protected static int _raceNumber = 4;
|
||||||
|
|
||||||
// Time Constants
|
// Time Constants
|
||||||
@@ -104,7 +104,7 @@ public class RaceManagerInstance extends Npc
|
|||||||
{
|
{
|
||||||
_notInitialized = false;
|
_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.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);
|
ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.NOW_SELLING_TICKETS_FOR_MONSTER_RACE_S1), 30 * SECOND, 10 * MINUTE);
|
||||||
|
@@ -19,10 +19,12 @@ package org.l2jmobius.gameserver.model.actor.instance;
|
|||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@@ -304,7 +306,7 @@ public class ServitorInstance extends Summon implements Runnable
|
|||||||
|
|
||||||
int buff_index = 0;
|
int buff_index = 0;
|
||||||
|
|
||||||
final List<Long> storedSkills = new CopyOnWriteArrayList<>();
|
final Collection<Long> storedSkills = ConcurrentHashMap.newKeySet();
|
||||||
|
|
||||||
// Store all effect data along with calculated remaining
|
// Store all effect data along with calculated remaining
|
||||||
if (storeEffects)
|
if (storeEffects)
|
||||||
|
@@ -18,8 +18,8 @@ package org.l2jmobius.gameserver.model.actor.instance;
|
|||||||
|
|
||||||
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
|
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -62,7 +62,7 @@ public class TamedBeastInstance extends FeedableBeastInstance
|
|||||||
private Future<?> _buffTask = null;
|
private Future<?> _buffTask = null;
|
||||||
private Future<?> _durationCheckTask = null;
|
private Future<?> _durationCheckTask = null;
|
||||||
protected boolean _isFreyaBeast;
|
protected boolean _isFreyaBeast;
|
||||||
private List<Skill> _beastSkills = null;
|
private Collection<Skill> _beastSkills = null;
|
||||||
|
|
||||||
public TamedBeastInstance(int npcTemplateId)
|
public TamedBeastInstance(int npcTemplateId)
|
||||||
{
|
{
|
||||||
@@ -205,7 +205,7 @@ public class TamedBeastInstance extends FeedableBeastInstance
|
|||||||
{
|
{
|
||||||
if (_beastSkills == null)
|
if (_beastSkills == null)
|
||||||
{
|
{
|
||||||
_beastSkills = new CopyOnWriteArrayList<>();
|
_beastSkills = ConcurrentHashMap.newKeySet();
|
||||||
}
|
}
|
||||||
_beastSkills.add(skill);
|
_beastSkills.add(skill);
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,7 @@ public interface Siegable
|
|||||||
|
|
||||||
SiegeClan getDefenderClan(Clan clan);
|
SiegeClan getDefenderClan(Clan clan);
|
||||||
|
|
||||||
List<SiegeClan> getDefenderClans();
|
Collection<SiegeClan> getDefenderClans();
|
||||||
|
|
||||||
boolean checkIsDefender(Clan clan);
|
boolean checkIsDefender(Clan clan);
|
||||||
|
|
||||||
|
@@ -21,12 +21,13 @@ import java.sql.PreparedStatement;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@@ -221,9 +222,9 @@ public class Siege implements Siegable
|
|||||||
}
|
}
|
||||||
|
|
||||||
// must support Concurrent Modifications
|
// must support Concurrent Modifications
|
||||||
private final List<SiegeClan> _attackerClans = new CopyOnWriteArrayList<>();
|
private final Collection<SiegeClan> _attackerClans = ConcurrentHashMap.newKeySet();
|
||||||
private final List<SiegeClan> _defenderClans = new CopyOnWriteArrayList<>();
|
private final Collection<SiegeClan> _defenderClans = ConcurrentHashMap.newKeySet();
|
||||||
private final List<SiegeClan> _defenderWaitingClans = new CopyOnWriteArrayList<>();
|
private final Collection<SiegeClan> _defenderWaitingClans = ConcurrentHashMap.newKeySet();
|
||||||
|
|
||||||
// Castle setting
|
// Castle setting
|
||||||
private final List<ControlTowerInstance> _controlTowers = new ArrayList<>();
|
private final List<ControlTowerInstance> _controlTowers = new ArrayList<>();
|
||||||
@@ -1582,7 +1583,7 @@ public class Siege implements Siegable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SiegeClan> getAttackerClans()
|
public Collection<SiegeClan> getAttackerClans()
|
||||||
{
|
{
|
||||||
if (_isNormalSide)
|
if (_isNormalSide)
|
||||||
{
|
{
|
||||||
@@ -1625,7 +1626,7 @@ public class Siege implements Siegable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SiegeClan> getDefenderClans()
|
public Collection<SiegeClan> getDefenderClans()
|
||||||
{
|
{
|
||||||
if (_isNormalSide)
|
if (_isNormalSide)
|
||||||
{
|
{
|
||||||
@@ -1655,7 +1656,7 @@ public class Siege implements Siegable
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SiegeClan> getDefenderWaitingClans()
|
public Collection<SiegeClan> getDefenderWaitingClans()
|
||||||
{
|
{
|
||||||
return _defenderWaitingClans;
|
return _defenderWaitingClans;
|
||||||
}
|
}
|
||||||
|
@@ -16,8 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.holders;
|
package org.l2jmobius.gameserver.model.holders;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.Movie;
|
import org.l2jmobius.gameserver.enums.Movie;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
@@ -29,7 +30,7 @@ public class MovieHolder
|
|||||||
{
|
{
|
||||||
private final Movie _movie;
|
private final Movie _movie;
|
||||||
private final List<PlayerInstance> _players;
|
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)
|
public MovieHolder(List<PlayerInstance> players, Movie movie)
|
||||||
{
|
{
|
||||||
@@ -64,7 +65,7 @@ public class MovieHolder
|
|||||||
return _players;
|
return _players;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PlayerInstance> getVotedPlayers()
|
public Collection<PlayerInstance> getVotedPlayers()
|
||||||
{
|
{
|
||||||
return _votedPlayers;
|
return _votedPlayers;
|
||||||
}
|
}
|
||||||
|
@@ -127,7 +127,7 @@ public class CommandChannelMatchingRoom extends MatchingRoom
|
|||||||
if (leaderParty != null)
|
if (leaderParty != null)
|
||||||
{
|
{
|
||||||
final CommandChannel cc = leaderParty.getCommandChannel();
|
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;
|
return MatchingMemberType.COMMAND_CHANNEL_PARTY_MEMBER;
|
||||||
}
|
}
|
||||||
|
@@ -45,8 +45,8 @@ public class ExMultiPartyCommandChannelInfo implements IClientOutgoingPacket
|
|||||||
packet.writeD(0x00); // Channel loot 0 or 1
|
packet.writeD(0x00); // Channel loot 0 or 1
|
||||||
packet.writeD(_channel.getMemberCount());
|
packet.writeD(_channel.getMemberCount());
|
||||||
|
|
||||||
packet.writeD(_channel.getPartys().size());
|
packet.writeD(_channel.getParties().size());
|
||||||
for (Party p : _channel.getPartys())
|
for (Party p : _channel.getParties())
|
||||||
{
|
{
|
||||||
packet.writeS(p.getLeader().getName());
|
packet.writeS(p.getLeader().getName());
|
||||||
packet.writeD(p.getLeaderObjectId());
|
packet.writeD(p.getLeaderObjectId());
|
||||||
|
@@ -26,11 +26,10 @@ import java.sql.ResultSet;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@@ -50,7 +49,7 @@ public class TaskManager
|
|||||||
static final Logger LOGGER = Logger.getLogger(TaskManager.class.getName());
|
static final Logger LOGGER = Logger.getLogger(TaskManager.class.getName());
|
||||||
|
|
||||||
private final Map<Integer, Task> _tasks = new ConcurrentHashMap<>();
|
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 =
|
static final String[] SQL_STATEMENTS =
|
||||||
{
|
{
|
||||||
|
@@ -18,8 +18,8 @@ package org.l2jmobius.loginserver;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ import org.l2jmobius.Config;
|
|||||||
*/
|
*/
|
||||||
public class GameServerListener extends FloodProtectedListener
|
public class GameServerListener extends FloodProtectedListener
|
||||||
{
|
{
|
||||||
private static List<GameServerThread> _gameServers = new CopyOnWriteArrayList<>();
|
private static Collection<GameServerThread> _gameServers = ConcurrentHashMap.newKeySet();
|
||||||
|
|
||||||
public GameServerListener() throws IOException
|
public GameServerListener() throws IOException
|
||||||
{
|
{
|
||||||
|
@@ -17,7 +17,8 @@
|
|||||||
package ai.areas.FantasyIsle;
|
package ai.areas.FantasyIsle;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.Collection;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -120,7 +121,7 @@ public class Parade extends AbstractNpcAI
|
|||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|
||||||
int npcIndex;
|
int npcIndex;
|
||||||
CopyOnWriteArrayList<Npc> spawns = new CopyOnWriteArrayList<>();
|
Collection<Npc> spawns = ConcurrentHashMap.newKeySet();
|
||||||
ScheduledFuture<?> spawnTask;
|
ScheduledFuture<?> spawnTask;
|
||||||
ScheduledFuture<?> deleteTask;
|
ScheduledFuture<?> deleteTask;
|
||||||
ScheduledFuture<?> cleanTask;
|
ScheduledFuture<?> cleanTask;
|
||||||
|
@@ -16,11 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
package ai.bosses.Core;
|
package ai.bosses.Core;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.gameserver.enums.ChatType;
|
import org.l2jmobius.gameserver.enums.ChatType;
|
||||||
@@ -78,7 +78,7 @@ public class Core extends AbstractNpcAI
|
|||||||
|
|
||||||
private static boolean _firstAttacked;
|
private static boolean _firstAttacked;
|
||||||
|
|
||||||
private static final List<Attackable> _minions = new CopyOnWriteArrayList<>();
|
private static final Collection<Attackable> _minions = ConcurrentHashMap.newKeySet();
|
||||||
|
|
||||||
private Core()
|
private Core()
|
||||||
{
|
{
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package ai.others;
|
package ai.others;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
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
|
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
|
//@formatter:on
|
||||||
private static final List<Npc> SPAWNED_GUARDS = new CopyOnWriteArrayList<>();
|
private static final Collection<Npc> SPAWNED_GUARDS = ConcurrentHashMap.newKeySet();
|
||||||
|
|
||||||
public SiegeGuards()
|
public SiegeGuards()
|
||||||
{
|
{
|
||||||
|
@@ -17,8 +17,9 @@
|
|||||||
package custom.events.Rabbits;
|
package custom.events.Rabbits;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.util.CommonUtil;
|
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 EVENT_TIME = 10;
|
||||||
private static final int TOTAL_CHEST_COUNT = 75;
|
private static final int TOTAL_CHEST_COUNT = 75;
|
||||||
private static final int TRANSFORMATION_ID = 105;
|
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 final List<PlayerInstance> _players = new ArrayList<>();
|
||||||
private boolean _isActive = false;
|
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);
|
final Npc npc = addSpawn(npcId, x, y, z, heading, randomOffSet, despawnDelay);
|
||||||
if (npc.getId() == CHEST)
|
if (npc.getId() == CHEST)
|
||||||
|
@@ -17,8 +17,9 @@
|
|||||||
package custom.events.Race;
|
package custom.events.Race;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@@ -45,7 +46,7 @@ public class Race extends Event
|
|||||||
// Npc
|
// Npc
|
||||||
private Npc _npc;
|
private Npc _npc;
|
||||||
// Player list
|
// Player list
|
||||||
private List<PlayerInstance> _players;
|
private Collection<PlayerInstance> _players;
|
||||||
// Event Task
|
// Event Task
|
||||||
ScheduledFuture<?> _eventTask = null;
|
ScheduledFuture<?> _eventTask = null;
|
||||||
// Event state
|
// Event state
|
||||||
@@ -127,7 +128,7 @@ public class Race extends Event
|
|||||||
}
|
}
|
||||||
// Initialize list
|
// Initialize list
|
||||||
_npclist = new ArrayList<>();
|
_npclist = new ArrayList<>();
|
||||||
_players = new CopyOnWriteArrayList<>();
|
_players = ConcurrentHashMap.newKeySet();
|
||||||
// Set Event active
|
// Set Event active
|
||||||
_isactive = true;
|
_isactive = true;
|
||||||
// Spawn Manager
|
// Spawn Manager
|
||||||
|
@@ -19,11 +19,12 @@ package org.l2jmobius.commons.util;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileFilter;
|
import java.io.FileFilter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
@@ -167,7 +168,7 @@ public interface IXmlReader
|
|||||||
|
|
||||||
if (Config.THREADS_FOR_LOADING)
|
if (Config.THREADS_FOR_LOADING)
|
||||||
{
|
{
|
||||||
final List<ScheduledFuture<?>> jobs = new CopyOnWriteArrayList<>();
|
final Collection<ScheduledFuture<?>> jobs = ConcurrentHashMap.newKeySet();
|
||||||
final File[] listOfFiles = dir.listFiles();
|
final File[] listOfFiles = dir.listFiles();
|
||||||
for (File file : listOfFiles)
|
for (File file : listOfFiles)
|
||||||
{
|
{
|
||||||
|
@@ -19,10 +19,9 @@ package org.l2jmobius.gameserver.communitybbs.BB;
|
|||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -46,7 +45,7 @@ public class Forum
|
|||||||
public static final int CLANMEMBERONLY = 2;
|
public static final int CLANMEMBERONLY = 2;
|
||||||
public static final int OWNERONLY = 3;
|
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 Map<Integer, Topic> _topic = new ConcurrentHashMap<>();
|
||||||
private final int _forumId;
|
private final int _forumId;
|
||||||
private String _forumName;
|
private String _forumName;
|
||||||
@@ -66,7 +65,7 @@ public class Forum
|
|||||||
{
|
{
|
||||||
_forumId = Forumid;
|
_forumId = Forumid;
|
||||||
_fParent = FParent;
|
_fParent = FParent;
|
||||||
_children = new CopyOnWriteArrayList<>();
|
_children = ConcurrentHashMap.newKeySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,7 +84,7 @@ public class Forum
|
|||||||
_forumPerm = perm;
|
_forumPerm = perm;
|
||||||
_fParent = parent;
|
_fParent = parent;
|
||||||
_ownerID = OwnerID;
|
_ownerID = OwnerID;
|
||||||
_children = new CopyOnWriteArrayList<>();
|
_children = ConcurrentHashMap.newKeySet();
|
||||||
parent._children.add(this);
|
parent._children.add(this);
|
||||||
ForumsBBSManager.getInstance().addForum(this);
|
ForumsBBSManager.getInstance().addForum(this);
|
||||||
_loaded = true;
|
_loaded = true;
|
||||||
|
@@ -19,8 +19,8 @@ package org.l2jmobius.gameserver.communitybbs.BB;
|
|||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ public class Post
|
|||||||
public String postTxt;
|
public String postTxt;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final List<CPost> _post;
|
private final Collection<CPost> _post;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param _PostOwner
|
* @param _PostOwner
|
||||||
@@ -57,7 +57,7 @@ public class Post
|
|||||||
*/
|
*/
|
||||||
public Post(String _PostOwner, int _PostOwnerID, long date, int tid, int _PostForumID, String txt)
|
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();
|
final CPost cp = new CPost();
|
||||||
cp.postId = 0;
|
cp.postId = 0;
|
||||||
cp.postOwner = _PostOwner;
|
cp.postOwner = _PostOwner;
|
||||||
@@ -92,7 +92,7 @@ public class Post
|
|||||||
|
|
||||||
public Post(Topic t)
|
public Post(Topic t)
|
||||||
{
|
{
|
||||||
_post = new CopyOnWriteArrayList<>();
|
_post = ConcurrentHashMap.newKeySet();
|
||||||
load(t);
|
load(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,8 +19,8 @@ package org.l2jmobius.gameserver.communitybbs.Manager;
|
|||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
|||||||
public class ForumsBBSManager extends BaseBBSManager
|
public class ForumsBBSManager extends BaseBBSManager
|
||||||
{
|
{
|
||||||
private static Logger LOGGER = Logger.getLogger(ForumsBBSManager.class.getName());
|
private static Logger LOGGER = Logger.getLogger(ForumsBBSManager.class.getName());
|
||||||
private final List<Forum> _table;
|
private final Collection<Forum> _table;
|
||||||
private int _lastid = 1;
|
private int _lastid = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,7 +39,7 @@ public class ForumsBBSManager extends BaseBBSManager
|
|||||||
*/
|
*/
|
||||||
protected ForumsBBSManager()
|
protected ForumsBBSManager()
|
||||||
{
|
{
|
||||||
_table = new CopyOnWriteArrayList<>();
|
_table = ConcurrentHashMap.newKeySet();
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
Statement s = con.createStatement();
|
Statement s = con.createStatement();
|
||||||
ResultSet rs = s.executeQuery("SELECT forum_id FROM forums WHERE forum_type = 0"))
|
ResultSet rs = s.executeQuery("SELECT forum_id FROM forums WHERE forum_type = 0"))
|
||||||
|
@@ -18,12 +18,11 @@ package org.l2jmobius.gameserver.communitybbs.Manager;
|
|||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.communitybbs.BB.Forum;
|
import org.l2jmobius.gameserver.communitybbs.BB.Forum;
|
||||||
import org.l2jmobius.gameserver.communitybbs.BB.Post;
|
import org.l2jmobius.gameserver.communitybbs.BB.Post;
|
||||||
@@ -34,7 +33,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
|||||||
|
|
||||||
public class TopicBBSManager extends BaseBBSManager
|
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<>();
|
private final Map<Forum, Integer> _maxId = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected TopicBBSManager()
|
protected TopicBBSManager()
|
||||||
|
@@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.data.xml.impl;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -27,7 +28,6 @@ import java.util.Map;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.stream.Collectors;
|
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<Integer, NpcTemplate> _npcs = new ConcurrentHashMap<>();
|
||||||
private final Map<String, Integer> _clans = 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()
|
protected NpcData()
|
||||||
{
|
{
|
||||||
@@ -789,7 +789,7 @@ public class NpcData implements IXmlReader
|
|||||||
/**
|
/**
|
||||||
* @return the IDs of monsters that have minions.
|
* @return the IDs of monsters that have minions.
|
||||||
*/
|
*/
|
||||||
public static List<Integer> getMasterMonsterIDs()
|
public static Collection<Integer> getMasterMonsterIDs()
|
||||||
{
|
{
|
||||||
return _masterMonsterIDs;
|
return _masterMonsterIDs;
|
||||||
}
|
}
|
||||||
|
@@ -18,10 +18,11 @@ package org.l2jmobius.gameserver.data.xml.impl;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@@ -54,7 +55,7 @@ public class SpawnsData implements IXmlReader
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER = Logger.getLogger(SpawnsData.class.getName());
|
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()
|
protected SpawnsData()
|
||||||
{
|
{
|
||||||
@@ -98,7 +99,7 @@ public class SpawnsData implements IXmlReader
|
|||||||
|
|
||||||
if (Config.THREADS_FOR_LOADING)
|
if (Config.THREADS_FOR_LOADING)
|
||||||
{
|
{
|
||||||
final List<ScheduledFuture<?>> jobs = new CopyOnWriteArrayList<>();
|
final Collection<ScheduledFuture<?>> jobs = ConcurrentHashMap.newKeySet();
|
||||||
for (SpawnTemplate template : _spawns)
|
for (SpawnTemplate template : _spawns)
|
||||||
{
|
{
|
||||||
if (template.isSpawningByDefault())
|
if (template.isSpawningByDefault())
|
||||||
@@ -146,7 +147,7 @@ public class SpawnsData implements IXmlReader
|
|||||||
LOGGER.info(getClass().getSimpleName() + ": All spawns has been removed!");
|
LOGGER.info(getClass().getSimpleName() + ": All spawns has been removed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SpawnTemplate> getSpawns()
|
public Collection<SpawnTemplate> getSpawns()
|
||||||
{
|
{
|
||||||
return _spawns;
|
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());
|
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);
|
final SpawnTemplate spawnTemplate = new SpawnTemplate(new StatsSet(parseAttributes(spawnsNode)), file);
|
||||||
SpawnGroup defaultGroup = null;
|
SpawnGroup defaultGroup = null;
|
||||||
|
@@ -16,10 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.datatables;
|
package org.l2jmobius.gameserver.datatables;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
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.DateRange;
|
||||||
import org.l2jmobius.gameserver.script.EventDrop;
|
import org.l2jmobius.gameserver.script.EventDrop;
|
||||||
@@ -35,7 +36,7 @@ public class EventDroplist
|
|||||||
/**
|
/**
|
||||||
* The table containing all DataDrop object
|
* 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
|
public static class DateDrop
|
||||||
{
|
{
|
||||||
|
@@ -18,8 +18,9 @@ package org.l2jmobius.gameserver.engines;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -66,13 +67,13 @@ public class DocumentEngine
|
|||||||
* Return created items
|
* Return created items
|
||||||
* @return List of {@link Item}
|
* @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)
|
if (Config.THREADS_FOR_LOADING)
|
||||||
{
|
{
|
||||||
final List<ScheduledFuture<?>> jobs = new CopyOnWriteArrayList<>();
|
final Collection<ScheduledFuture<?>> jobs = ConcurrentHashMap.newKeySet();
|
||||||
for (File file : _itemFiles)
|
for (File file : _itemFiles)
|
||||||
{
|
{
|
||||||
jobs.add(ThreadPool.schedule(() ->
|
jobs.add(ThreadPool.schedule(() ->
|
||||||
|
@@ -16,9 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model;
|
package org.l2jmobius.gameserver.model;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@@ -36,7 +37,7 @@ import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
|||||||
*/
|
*/
|
||||||
public class CommandChannel extends AbstractPlayerGroup
|
public class CommandChannel extends AbstractPlayerGroup
|
||||||
{
|
{
|
||||||
private final List<Party> _parties = new CopyOnWriteArrayList<>();
|
private final Collection<Party> _parties = ConcurrentHashMap.newKeySet();
|
||||||
private PlayerInstance _commandLeader;
|
private PlayerInstance _commandLeader;
|
||||||
private int _channelLvl;
|
private int _channelLvl;
|
||||||
|
|
||||||
@@ -150,7 +151,7 @@ public class CommandChannel extends AbstractPlayerGroup
|
|||||||
/**
|
/**
|
||||||
* @return a list of all parties in this command channel
|
* @return a list of all parties in this command channel
|
||||||
*/
|
*/
|
||||||
public List<Party> getPartys()
|
public Collection<Party> getParties()
|
||||||
{
|
{
|
||||||
return _parties;
|
return _parties;
|
||||||
}
|
}
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model;
|
package org.l2jmobius.gameserver.model;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.PetitionState;
|
import org.l2jmobius.gameserver.enums.PetitionState;
|
||||||
import org.l2jmobius.gameserver.enums.PetitionType;
|
import org.l2jmobius.gameserver.enums.PetitionType;
|
||||||
@@ -41,7 +41,7 @@ public class Petition
|
|||||||
private final PetitionType _type;
|
private final PetitionType _type;
|
||||||
private PetitionState _state = PetitionState.PENDING;
|
private PetitionState _state = PetitionState.PENDING;
|
||||||
private final String _content;
|
private final String _content;
|
||||||
private final List<CreatureSay> _messageLog = new CopyOnWriteArrayList<>();
|
private final Collection<CreatureSay> _messageLog = ConcurrentHashMap.newKeySet();
|
||||||
private final PlayerInstance _petitioner;
|
private final PlayerInstance _petitioner;
|
||||||
private PlayerInstance _responder;
|
private PlayerInstance _responder;
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ public class Petition
|
|||||||
return _messageLog.add(cs);
|
return _messageLog.add(cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CreatureSay> getLogMessages()
|
public Collection<CreatureSay> getLogMessages()
|
||||||
{
|
{
|
||||||
return _messageLog;
|
return _messageLog;
|
||||||
}
|
}
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.actor.instance;
|
package org.l2jmobius.gameserver.model.actor.instance;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
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 LANES = 8;
|
||||||
public static final int WINDOW_START = 0;
|
public static final int WINDOW_START = 0;
|
||||||
|
|
||||||
private static List<RaceManagerInstance> _managers;
|
private static Collection<RaceManagerInstance> _managers;
|
||||||
protected static int _raceNumber = 4;
|
protected static int _raceNumber = 4;
|
||||||
|
|
||||||
// Time Constants
|
// Time Constants
|
||||||
@@ -104,7 +104,7 @@ public class RaceManagerInstance extends Npc
|
|||||||
{
|
{
|
||||||
_notInitialized = false;
|
_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.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);
|
ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.NOW_SELLING_TICKETS_FOR_MONSTER_RACE_S1), 30 * SECOND, 10 * MINUTE);
|
||||||
|
@@ -19,10 +19,12 @@ package org.l2jmobius.gameserver.model.actor.instance;
|
|||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@@ -304,7 +306,7 @@ public class ServitorInstance extends Summon implements Runnable
|
|||||||
|
|
||||||
int buff_index = 0;
|
int buff_index = 0;
|
||||||
|
|
||||||
final List<Long> storedSkills = new CopyOnWriteArrayList<>();
|
final Collection<Long> storedSkills = ConcurrentHashMap.newKeySet();
|
||||||
|
|
||||||
// Store all effect data along with calculated remaining
|
// Store all effect data along with calculated remaining
|
||||||
if (storeEffects)
|
if (storeEffects)
|
||||||
|
@@ -18,8 +18,8 @@ package org.l2jmobius.gameserver.model.actor.instance;
|
|||||||
|
|
||||||
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
|
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -62,7 +62,7 @@ public class TamedBeastInstance extends FeedableBeastInstance
|
|||||||
private Future<?> _buffTask = null;
|
private Future<?> _buffTask = null;
|
||||||
private Future<?> _durationCheckTask = null;
|
private Future<?> _durationCheckTask = null;
|
||||||
protected boolean _isFreyaBeast;
|
protected boolean _isFreyaBeast;
|
||||||
private List<Skill> _beastSkills = null;
|
private Collection<Skill> _beastSkills = null;
|
||||||
|
|
||||||
public TamedBeastInstance(int npcTemplateId)
|
public TamedBeastInstance(int npcTemplateId)
|
||||||
{
|
{
|
||||||
@@ -205,7 +205,7 @@ public class TamedBeastInstance extends FeedableBeastInstance
|
|||||||
{
|
{
|
||||||
if (_beastSkills == null)
|
if (_beastSkills == null)
|
||||||
{
|
{
|
||||||
_beastSkills = new CopyOnWriteArrayList<>();
|
_beastSkills = ConcurrentHashMap.newKeySet();
|
||||||
}
|
}
|
||||||
_beastSkills.add(skill);
|
_beastSkills.add(skill);
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,7 @@ public interface Siegable
|
|||||||
|
|
||||||
SiegeClan getDefenderClan(Clan clan);
|
SiegeClan getDefenderClan(Clan clan);
|
||||||
|
|
||||||
List<SiegeClan> getDefenderClans();
|
Collection<SiegeClan> getDefenderClans();
|
||||||
|
|
||||||
boolean checkIsDefender(Clan clan);
|
boolean checkIsDefender(Clan clan);
|
||||||
|
|
||||||
|
@@ -21,12 +21,13 @@ import java.sql.PreparedStatement;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@@ -221,9 +222,9 @@ public class Siege implements Siegable
|
|||||||
}
|
}
|
||||||
|
|
||||||
// must support Concurrent Modifications
|
// must support Concurrent Modifications
|
||||||
private final List<SiegeClan> _attackerClans = new CopyOnWriteArrayList<>();
|
private final Collection<SiegeClan> _attackerClans = ConcurrentHashMap.newKeySet();
|
||||||
private final List<SiegeClan> _defenderClans = new CopyOnWriteArrayList<>();
|
private final Collection<SiegeClan> _defenderClans = ConcurrentHashMap.newKeySet();
|
||||||
private final List<SiegeClan> _defenderWaitingClans = new CopyOnWriteArrayList<>();
|
private final Collection<SiegeClan> _defenderWaitingClans = ConcurrentHashMap.newKeySet();
|
||||||
|
|
||||||
// Castle setting
|
// Castle setting
|
||||||
private final List<ControlTowerInstance> _controlTowers = new ArrayList<>();
|
private final List<ControlTowerInstance> _controlTowers = new ArrayList<>();
|
||||||
@@ -1582,7 +1583,7 @@ public class Siege implements Siegable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SiegeClan> getAttackerClans()
|
public Collection<SiegeClan> getAttackerClans()
|
||||||
{
|
{
|
||||||
if (_isNormalSide)
|
if (_isNormalSide)
|
||||||
{
|
{
|
||||||
@@ -1625,7 +1626,7 @@ public class Siege implements Siegable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SiegeClan> getDefenderClans()
|
public Collection<SiegeClan> getDefenderClans()
|
||||||
{
|
{
|
||||||
if (_isNormalSide)
|
if (_isNormalSide)
|
||||||
{
|
{
|
||||||
@@ -1655,7 +1656,7 @@ public class Siege implements Siegable
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SiegeClan> getDefenderWaitingClans()
|
public Collection<SiegeClan> getDefenderWaitingClans()
|
||||||
{
|
{
|
||||||
return _defenderWaitingClans;
|
return _defenderWaitingClans;
|
||||||
}
|
}
|
||||||
|
@@ -16,8 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.holders;
|
package org.l2jmobius.gameserver.model.holders;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.Movie;
|
import org.l2jmobius.gameserver.enums.Movie;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
@@ -29,7 +30,7 @@ public class MovieHolder
|
|||||||
{
|
{
|
||||||
private final Movie _movie;
|
private final Movie _movie;
|
||||||
private final List<PlayerInstance> _players;
|
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)
|
public MovieHolder(List<PlayerInstance> players, Movie movie)
|
||||||
{
|
{
|
||||||
@@ -64,7 +65,7 @@ public class MovieHolder
|
|||||||
return _players;
|
return _players;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PlayerInstance> getVotedPlayers()
|
public Collection<PlayerInstance> getVotedPlayers()
|
||||||
{
|
{
|
||||||
return _votedPlayers;
|
return _votedPlayers;
|
||||||
}
|
}
|
||||||
|
@@ -127,7 +127,7 @@ public class CommandChannelMatchingRoom extends MatchingRoom
|
|||||||
if (leaderParty != null)
|
if (leaderParty != null)
|
||||||
{
|
{
|
||||||
final CommandChannel cc = leaderParty.getCommandChannel();
|
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;
|
return MatchingMemberType.COMMAND_CHANNEL_PARTY_MEMBER;
|
||||||
}
|
}
|
||||||
|
@@ -45,8 +45,8 @@ public class ExMultiPartyCommandChannelInfo implements IClientOutgoingPacket
|
|||||||
packet.writeD(0x00); // Channel loot 0 or 1
|
packet.writeD(0x00); // Channel loot 0 or 1
|
||||||
packet.writeD(_channel.getMemberCount());
|
packet.writeD(_channel.getMemberCount());
|
||||||
|
|
||||||
packet.writeD(_channel.getPartys().size());
|
packet.writeD(_channel.getParties().size());
|
||||||
for (Party p : _channel.getPartys())
|
for (Party p : _channel.getParties())
|
||||||
{
|
{
|
||||||
packet.writeS(p.getLeader().getName());
|
packet.writeS(p.getLeader().getName());
|
||||||
packet.writeD(p.getLeaderObjectId());
|
packet.writeD(p.getLeaderObjectId());
|
||||||
|
@@ -26,11 +26,10 @@ import java.sql.ResultSet;
|
|||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@@ -50,7 +49,7 @@ public class TaskManager
|
|||||||
static final Logger LOGGER = Logger.getLogger(TaskManager.class.getName());
|
static final Logger LOGGER = Logger.getLogger(TaskManager.class.getName());
|
||||||
|
|
||||||
private final Map<Integer, Task> _tasks = new ConcurrentHashMap<>();
|
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 =
|
static final String[] SQL_STATEMENTS =
|
||||||
{
|
{
|
||||||
|
@@ -18,8 +18,8 @@ package org.l2jmobius.loginserver;
|
|||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.net.Socket;
|
import java.net.Socket;
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
|
|
||||||
@@ -28,7 +28,7 @@ import org.l2jmobius.Config;
|
|||||||
*/
|
*/
|
||||||
public class GameServerListener extends FloodProtectedListener
|
public class GameServerListener extends FloodProtectedListener
|
||||||
{
|
{
|
||||||
private static List<GameServerThread> _gameServers = new CopyOnWriteArrayList<>();
|
private static Collection<GameServerThread> _gameServers = ConcurrentHashMap.newKeySet();
|
||||||
|
|
||||||
public GameServerListener() throws IOException
|
public GameServerListener() throws IOException
|
||||||
{
|
{
|
||||||
|
@@ -17,7 +17,8 @@
|
|||||||
package ai.areas.FantasyIsle;
|
package ai.areas.FantasyIsle;
|
||||||
|
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.Collection;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -120,7 +121,7 @@ public class Parade extends AbstractNpcAI
|
|||||||
// @formatter:on
|
// @formatter:on
|
||||||
|
|
||||||
int npcIndex;
|
int npcIndex;
|
||||||
CopyOnWriteArrayList<Npc> spawns = new CopyOnWriteArrayList<>();
|
Collection<Npc> spawns = ConcurrentHashMap.newKeySet();
|
||||||
ScheduledFuture<?> spawnTask;
|
ScheduledFuture<?> spawnTask;
|
||||||
ScheduledFuture<?> deleteTask;
|
ScheduledFuture<?> deleteTask;
|
||||||
ScheduledFuture<?> cleanTask;
|
ScheduledFuture<?> cleanTask;
|
||||||
|
@@ -16,11 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
package ai.bosses.Core;
|
package ai.bosses.Core;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.gameserver.enums.ChatType;
|
import org.l2jmobius.gameserver.enums.ChatType;
|
||||||
@@ -78,7 +78,7 @@ public class Core extends AbstractNpcAI
|
|||||||
|
|
||||||
private static boolean _firstAttacked;
|
private static boolean _firstAttacked;
|
||||||
|
|
||||||
private static final List<Attackable> _minions = new CopyOnWriteArrayList<>();
|
private static final Collection<Attackable> _minions = ConcurrentHashMap.newKeySet();
|
||||||
|
|
||||||
private Core()
|
private Core()
|
||||||
{
|
{
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package ai.others;
|
package ai.others;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
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
|
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
|
//@formatter:on
|
||||||
private static final List<Npc> SPAWNED_GUARDS = new CopyOnWriteArrayList<>();
|
private static final Collection<Npc> SPAWNED_GUARDS = ConcurrentHashMap.newKeySet();
|
||||||
|
|
||||||
public SiegeGuards()
|
public SiegeGuards()
|
||||||
{
|
{
|
||||||
|
@@ -17,8 +17,9 @@
|
|||||||
package custom.events.Rabbits;
|
package custom.events.Rabbits;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.util.CommonUtil;
|
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 EVENT_TIME = 10;
|
||||||
private static final int TOTAL_CHEST_COUNT = 75;
|
private static final int TOTAL_CHEST_COUNT = 75;
|
||||||
private static final int TRANSFORMATION_ID = 105;
|
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 final List<PlayerInstance> _players = new ArrayList<>();
|
||||||
private boolean _isActive = false;
|
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);
|
final Npc npc = addSpawn(npcId, x, y, z, heading, randomOffSet, despawnDelay);
|
||||||
if (npc.getId() == CHEST)
|
if (npc.getId() == CHEST)
|
||||||
|
@@ -17,8 +17,9 @@
|
|||||||
package custom.events.Race;
|
package custom.events.Race;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@@ -45,7 +46,7 @@ public class Race extends Event
|
|||||||
// Npc
|
// Npc
|
||||||
private Npc _npc;
|
private Npc _npc;
|
||||||
// Player list
|
// Player list
|
||||||
private List<PlayerInstance> _players;
|
private Collection<PlayerInstance> _players;
|
||||||
// Event Task
|
// Event Task
|
||||||
ScheduledFuture<?> _eventTask = null;
|
ScheduledFuture<?> _eventTask = null;
|
||||||
// Event state
|
// Event state
|
||||||
@@ -127,7 +128,7 @@ public class Race extends Event
|
|||||||
}
|
}
|
||||||
// Initialize list
|
// Initialize list
|
||||||
_npclist = new ArrayList<>();
|
_npclist = new ArrayList<>();
|
||||||
_players = new CopyOnWriteArrayList<>();
|
_players = ConcurrentHashMap.newKeySet();
|
||||||
// Set Event active
|
// Set Event active
|
||||||
_isactive = true;
|
_isactive = true;
|
||||||
// Spawn Manager
|
// Spawn Manager
|
||||||
|
@@ -19,11 +19,12 @@ package org.l2jmobius.commons.util;
|
|||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileFilter;
|
import java.io.FileFilter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
@@ -167,7 +168,7 @@ public interface IXmlReader
|
|||||||
|
|
||||||
if (Config.THREADS_FOR_LOADING)
|
if (Config.THREADS_FOR_LOADING)
|
||||||
{
|
{
|
||||||
final List<ScheduledFuture<?>> jobs = new CopyOnWriteArrayList<>();
|
final Collection<ScheduledFuture<?>> jobs = ConcurrentHashMap.newKeySet();
|
||||||
final File[] listOfFiles = dir.listFiles();
|
final File[] listOfFiles = dir.listFiles();
|
||||||
for (File file : listOfFiles)
|
for (File file : listOfFiles)
|
||||||
{
|
{
|
||||||
|
@@ -19,10 +19,9 @@ package org.l2jmobius.gameserver.communitybbs.BB;
|
|||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -46,7 +45,7 @@ public class Forum
|
|||||||
public static final int CLANMEMBERONLY = 2;
|
public static final int CLANMEMBERONLY = 2;
|
||||||
public static final int OWNERONLY = 3;
|
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 Map<Integer, Topic> _topic = new ConcurrentHashMap<>();
|
||||||
private final int _forumId;
|
private final int _forumId;
|
||||||
private String _forumName;
|
private String _forumName;
|
||||||
@@ -66,7 +65,7 @@ public class Forum
|
|||||||
{
|
{
|
||||||
_forumId = Forumid;
|
_forumId = Forumid;
|
||||||
_fParent = FParent;
|
_fParent = FParent;
|
||||||
_children = new CopyOnWriteArrayList<>();
|
_children = ConcurrentHashMap.newKeySet();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -85,7 +84,7 @@ public class Forum
|
|||||||
_forumPerm = perm;
|
_forumPerm = perm;
|
||||||
_fParent = parent;
|
_fParent = parent;
|
||||||
_ownerID = OwnerID;
|
_ownerID = OwnerID;
|
||||||
_children = new CopyOnWriteArrayList<>();
|
_children = ConcurrentHashMap.newKeySet();
|
||||||
parent._children.add(this);
|
parent._children.add(this);
|
||||||
ForumsBBSManager.getInstance().addForum(this);
|
ForumsBBSManager.getInstance().addForum(this);
|
||||||
_loaded = true;
|
_loaded = true;
|
||||||
|
@@ -19,8 +19,8 @@ package org.l2jmobius.gameserver.communitybbs.BB;
|
|||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -45,7 +45,7 @@ public class Post
|
|||||||
public String postTxt;
|
public String postTxt;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final List<CPost> _post;
|
private final Collection<CPost> _post;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param _PostOwner
|
* @param _PostOwner
|
||||||
@@ -57,7 +57,7 @@ public class Post
|
|||||||
*/
|
*/
|
||||||
public Post(String _PostOwner, int _PostOwnerID, long date, int tid, int _PostForumID, String txt)
|
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();
|
final CPost cp = new CPost();
|
||||||
cp.postId = 0;
|
cp.postId = 0;
|
||||||
cp.postOwner = _PostOwner;
|
cp.postOwner = _PostOwner;
|
||||||
@@ -92,7 +92,7 @@ public class Post
|
|||||||
|
|
||||||
public Post(Topic t)
|
public Post(Topic t)
|
||||||
{
|
{
|
||||||
_post = new CopyOnWriteArrayList<>();
|
_post = ConcurrentHashMap.newKeySet();
|
||||||
load(t);
|
load(t);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -19,8 +19,8 @@ package org.l2jmobius.gameserver.communitybbs.Manager;
|
|||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.sql.Statement;
|
import java.sql.Statement;
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
|||||||
public class ForumsBBSManager extends BaseBBSManager
|
public class ForumsBBSManager extends BaseBBSManager
|
||||||
{
|
{
|
||||||
private static Logger LOGGER = Logger.getLogger(ForumsBBSManager.class.getName());
|
private static Logger LOGGER = Logger.getLogger(ForumsBBSManager.class.getName());
|
||||||
private final List<Forum> _table;
|
private final Collection<Forum> _table;
|
||||||
private int _lastid = 1;
|
private int _lastid = 1;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,7 +39,7 @@ public class ForumsBBSManager extends BaseBBSManager
|
|||||||
*/
|
*/
|
||||||
protected ForumsBBSManager()
|
protected ForumsBBSManager()
|
||||||
{
|
{
|
||||||
_table = new CopyOnWriteArrayList<>();
|
_table = ConcurrentHashMap.newKeySet();
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
Statement s = con.createStatement();
|
Statement s = con.createStatement();
|
||||||
ResultSet rs = s.executeQuery("SELECT forum_id FROM forums WHERE forum_type = 0"))
|
ResultSet rs = s.executeQuery("SELECT forum_id FROM forums WHERE forum_type = 0"))
|
||||||
|
@@ -18,12 +18,11 @@ package org.l2jmobius.gameserver.communitybbs.Manager;
|
|||||||
|
|
||||||
import java.text.DateFormat;
|
import java.text.DateFormat;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.StringTokenizer;
|
import java.util.StringTokenizer;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.communitybbs.BB.Forum;
|
import org.l2jmobius.gameserver.communitybbs.BB.Forum;
|
||||||
import org.l2jmobius.gameserver.communitybbs.BB.Post;
|
import org.l2jmobius.gameserver.communitybbs.BB.Post;
|
||||||
@@ -34,7 +33,7 @@ import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
|||||||
|
|
||||||
public class TopicBBSManager extends BaseBBSManager
|
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<>();
|
private final Map<Forum, Integer> _maxId = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
protected TopicBBSManager()
|
protected TopicBBSManager()
|
||||||
|
@@ -18,6 +18,7 @@ package org.l2jmobius.gameserver.data.xml.impl;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.EnumMap;
|
import java.util.EnumMap;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
@@ -27,7 +28,6 @@ import java.util.Map;
|
|||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
import java.util.stream.Collectors;
|
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<Integer, NpcTemplate> _npcs = new ConcurrentHashMap<>();
|
||||||
private final Map<String, Integer> _clans = 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()
|
protected NpcData()
|
||||||
{
|
{
|
||||||
@@ -789,7 +789,7 @@ public class NpcData implements IXmlReader
|
|||||||
/**
|
/**
|
||||||
* @return the IDs of monsters that have minions.
|
* @return the IDs of monsters that have minions.
|
||||||
*/
|
*/
|
||||||
public static List<Integer> getMasterMonsterIDs()
|
public static Collection<Integer> getMasterMonsterIDs()
|
||||||
{
|
{
|
||||||
return _masterMonsterIDs;
|
return _masterMonsterIDs;
|
||||||
}
|
}
|
||||||
|
@@ -18,10 +18,11 @@ package org.l2jmobius.gameserver.data.xml.impl;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.function.Predicate;
|
import java.util.function.Predicate;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@@ -54,7 +55,7 @@ public class SpawnsData implements IXmlReader
|
|||||||
{
|
{
|
||||||
protected static final Logger LOGGER = Logger.getLogger(SpawnsData.class.getName());
|
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()
|
protected SpawnsData()
|
||||||
{
|
{
|
||||||
@@ -98,7 +99,7 @@ public class SpawnsData implements IXmlReader
|
|||||||
|
|
||||||
if (Config.THREADS_FOR_LOADING)
|
if (Config.THREADS_FOR_LOADING)
|
||||||
{
|
{
|
||||||
final List<ScheduledFuture<?>> jobs = new CopyOnWriteArrayList<>();
|
final Collection<ScheduledFuture<?>> jobs = ConcurrentHashMap.newKeySet();
|
||||||
for (SpawnTemplate template : _spawns)
|
for (SpawnTemplate template : _spawns)
|
||||||
{
|
{
|
||||||
if (template.isSpawningByDefault())
|
if (template.isSpawningByDefault())
|
||||||
@@ -146,7 +147,7 @@ public class SpawnsData implements IXmlReader
|
|||||||
LOGGER.info(getClass().getSimpleName() + ": All spawns has been removed!");
|
LOGGER.info(getClass().getSimpleName() + ": All spawns has been removed!");
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SpawnTemplate> getSpawns()
|
public Collection<SpawnTemplate> getSpawns()
|
||||||
{
|
{
|
||||||
return _spawns;
|
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());
|
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);
|
final SpawnTemplate spawnTemplate = new SpawnTemplate(new StatsSet(parseAttributes(spawnsNode)), file);
|
||||||
SpawnGroup defaultGroup = null;
|
SpawnGroup defaultGroup = null;
|
||||||
|
@@ -16,10 +16,11 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.datatables;
|
package org.l2jmobius.gameserver.datatables;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
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.DateRange;
|
||||||
import org.l2jmobius.gameserver.script.EventDrop;
|
import org.l2jmobius.gameserver.script.EventDrop;
|
||||||
@@ -35,7 +36,7 @@ public class EventDroplist
|
|||||||
/**
|
/**
|
||||||
* The table containing all DataDrop object
|
* 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
|
public static class DateDrop
|
||||||
{
|
{
|
||||||
|
@@ -18,8 +18,9 @@ package org.l2jmobius.gameserver.engines;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
@@ -66,13 +67,13 @@ public class DocumentEngine
|
|||||||
* Return created items
|
* Return created items
|
||||||
* @return List of {@link Item}
|
* @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)
|
if (Config.THREADS_FOR_LOADING)
|
||||||
{
|
{
|
||||||
final List<ScheduledFuture<?>> jobs = new CopyOnWriteArrayList<>();
|
final Collection<ScheduledFuture<?>> jobs = ConcurrentHashMap.newKeySet();
|
||||||
for (File file : _itemFiles)
|
for (File file : _itemFiles)
|
||||||
{
|
{
|
||||||
jobs.add(ThreadPool.schedule(() ->
|
jobs.add(ThreadPool.schedule(() ->
|
||||||
|
@@ -16,9 +16,10 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model;
|
package org.l2jmobius.gameserver.model;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.LinkedList;
|
import java.util.LinkedList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
@@ -36,7 +37,7 @@ import org.l2jmobius.gameserver.network.serverpackets.SystemMessage;
|
|||||||
*/
|
*/
|
||||||
public class CommandChannel extends AbstractPlayerGroup
|
public class CommandChannel extends AbstractPlayerGroup
|
||||||
{
|
{
|
||||||
private final List<Party> _parties = new CopyOnWriteArrayList<>();
|
private final Collection<Party> _parties = ConcurrentHashMap.newKeySet();
|
||||||
private PlayerInstance _commandLeader;
|
private PlayerInstance _commandLeader;
|
||||||
private int _channelLvl;
|
private int _channelLvl;
|
||||||
|
|
||||||
@@ -150,7 +151,7 @@ public class CommandChannel extends AbstractPlayerGroup
|
|||||||
/**
|
/**
|
||||||
* @return a list of all parties in this command channel
|
* @return a list of all parties in this command channel
|
||||||
*/
|
*/
|
||||||
public List<Party> getPartys()
|
public Collection<Party> getParties()
|
||||||
{
|
{
|
||||||
return _parties;
|
return _parties;
|
||||||
}
|
}
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model;
|
package org.l2jmobius.gameserver.model;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.PetitionState;
|
import org.l2jmobius.gameserver.enums.PetitionState;
|
||||||
import org.l2jmobius.gameserver.enums.PetitionType;
|
import org.l2jmobius.gameserver.enums.PetitionType;
|
||||||
@@ -41,7 +41,7 @@ public class Petition
|
|||||||
private final PetitionType _type;
|
private final PetitionType _type;
|
||||||
private PetitionState _state = PetitionState.PENDING;
|
private PetitionState _state = PetitionState.PENDING;
|
||||||
private final String _content;
|
private final String _content;
|
||||||
private final List<CreatureSay> _messageLog = new CopyOnWriteArrayList<>();
|
private final Collection<CreatureSay> _messageLog = ConcurrentHashMap.newKeySet();
|
||||||
private final PlayerInstance _petitioner;
|
private final PlayerInstance _petitioner;
|
||||||
private PlayerInstance _responder;
|
private PlayerInstance _responder;
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ public class Petition
|
|||||||
return _messageLog.add(cs);
|
return _messageLog.add(cs);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CreatureSay> getLogMessages()
|
public Collection<CreatureSay> getLogMessages()
|
||||||
{
|
{
|
||||||
return _messageLog;
|
return _messageLog;
|
||||||
}
|
}
|
||||||
|
@@ -16,8 +16,8 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.actor.instance;
|
package org.l2jmobius.gameserver.model.actor.instance;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.Config;
|
import org.l2jmobius.Config;
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
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 LANES = 8;
|
||||||
public static final int WINDOW_START = 0;
|
public static final int WINDOW_START = 0;
|
||||||
|
|
||||||
private static List<RaceManagerInstance> _managers;
|
private static Collection<RaceManagerInstance> _managers;
|
||||||
protected static int _raceNumber = 4;
|
protected static int _raceNumber = 4;
|
||||||
|
|
||||||
// Time Constants
|
// Time Constants
|
||||||
@@ -104,7 +104,7 @@ public class RaceManagerInstance extends Npc
|
|||||||
{
|
{
|
||||||
_notInitialized = false;
|
_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.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);
|
ThreadPool.scheduleAtFixedRate(new Announcement(SystemMessageId.NOW_SELLING_TICKETS_FOR_MONSTER_RACE_S1), 30 * SECOND, 10 * MINUTE);
|
||||||
|
@@ -19,10 +19,12 @@ package org.l2jmobius.gameserver.model.actor.instance;
|
|||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.CopyOnWriteArrayList;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
@@ -304,7 +306,7 @@ public class ServitorInstance extends Summon implements Runnable
|
|||||||
|
|
||||||
int buff_index = 0;
|
int buff_index = 0;
|
||||||
|
|
||||||
final List<Long> storedSkills = new CopyOnWriteArrayList<>();
|
final Collection<Long> storedSkills = ConcurrentHashMap.newKeySet();
|
||||||
|
|
||||||
// Store all effect data along with calculated remaining
|
// Store all effect data along with calculated remaining
|
||||||
if (storeEffects)
|
if (storeEffects)
|
||||||
|
@@ -18,8 +18,8 @@ package org.l2jmobius.gameserver.model.actor.instance;
|
|||||||
|
|
||||||
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
|
import static org.l2jmobius.gameserver.ai.CtrlIntention.AI_INTENTION_IDLE;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.Collection;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
|
|
||||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||||
@@ -62,7 +62,7 @@ public class TamedBeastInstance extends FeedableBeastInstance
|
|||||||
private Future<?> _buffTask = null;
|
private Future<?> _buffTask = null;
|
||||||
private Future<?> _durationCheckTask = null;
|
private Future<?> _durationCheckTask = null;
|
||||||
protected boolean _isFreyaBeast;
|
protected boolean _isFreyaBeast;
|
||||||
private List<Skill> _beastSkills = null;
|
private Collection<Skill> _beastSkills = null;
|
||||||
|
|
||||||
public TamedBeastInstance(int npcTemplateId)
|
public TamedBeastInstance(int npcTemplateId)
|
||||||
{
|
{
|
||||||
@@ -205,7 +205,7 @@ public class TamedBeastInstance extends FeedableBeastInstance
|
|||||||
{
|
{
|
||||||
if (_beastSkills == null)
|
if (_beastSkills == null)
|
||||||
{
|
{
|
||||||
_beastSkills = new CopyOnWriteArrayList<>();
|
_beastSkills = ConcurrentHashMap.newKeySet();
|
||||||
}
|
}
|
||||||
_beastSkills.add(skill);
|
_beastSkills.add(skill);
|
||||||
}
|
}
|
||||||
|
@@ -49,7 +49,7 @@ public interface Siegable
|
|||||||
|
|
||||||
SiegeClan getDefenderClan(Clan clan);
|
SiegeClan getDefenderClan(Clan clan);
|
||||||
|
|
||||||
List<SiegeClan> getDefenderClans();
|
Collection<SiegeClan> getDefenderClans();
|
||||||
|
|
||||||
boolean checkIsDefender(Clan clan);
|
boolean checkIsDefender(Clan clan);
|
||||||
|
|
||||||
|
@@ -21,12 +21,13 @@ import java.sql.PreparedStatement;
|
|||||||
import java.sql.ResultSet;
|
import java.sql.ResultSet;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Calendar;
|
import java.util.Calendar;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.ScheduledFuture;
|
import java.util.concurrent.ScheduledFuture;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
import java.util.logging.Logger;
|
import java.util.logging.Logger;
|
||||||
@@ -221,9 +222,9 @@ public class Siege implements Siegable
|
|||||||
}
|
}
|
||||||
|
|
||||||
// must support Concurrent Modifications
|
// must support Concurrent Modifications
|
||||||
private final List<SiegeClan> _attackerClans = new CopyOnWriteArrayList<>();
|
private final Collection<SiegeClan> _attackerClans = ConcurrentHashMap.newKeySet();
|
||||||
private final List<SiegeClan> _defenderClans = new CopyOnWriteArrayList<>();
|
private final Collection<SiegeClan> _defenderClans = ConcurrentHashMap.newKeySet();
|
||||||
private final List<SiegeClan> _defenderWaitingClans = new CopyOnWriteArrayList<>();
|
private final Collection<SiegeClan> _defenderWaitingClans = ConcurrentHashMap.newKeySet();
|
||||||
|
|
||||||
// Castle setting
|
// Castle setting
|
||||||
private final List<ControlTowerInstance> _controlTowers = new ArrayList<>();
|
private final List<ControlTowerInstance> _controlTowers = new ArrayList<>();
|
||||||
@@ -1582,7 +1583,7 @@ public class Siege implements Siegable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SiegeClan> getAttackerClans()
|
public Collection<SiegeClan> getAttackerClans()
|
||||||
{
|
{
|
||||||
if (_isNormalSide)
|
if (_isNormalSide)
|
||||||
{
|
{
|
||||||
@@ -1625,7 +1626,7 @@ public class Siege implements Siegable
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<SiegeClan> getDefenderClans()
|
public Collection<SiegeClan> getDefenderClans()
|
||||||
{
|
{
|
||||||
if (_isNormalSide)
|
if (_isNormalSide)
|
||||||
{
|
{
|
||||||
@@ -1655,7 +1656,7 @@ public class Siege implements Siegable
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<SiegeClan> getDefenderWaitingClans()
|
public Collection<SiegeClan> getDefenderWaitingClans()
|
||||||
{
|
{
|
||||||
return _defenderWaitingClans;
|
return _defenderWaitingClans;
|
||||||
}
|
}
|
||||||
|
@@ -16,8 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
package org.l2jmobius.gameserver.model.holders;
|
package org.l2jmobius.gameserver.model.holders;
|
||||||
|
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.concurrent.CopyOnWriteArrayList;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
|
|
||||||
import org.l2jmobius.gameserver.enums.Movie;
|
import org.l2jmobius.gameserver.enums.Movie;
|
||||||
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
import org.l2jmobius.gameserver.model.actor.instance.PlayerInstance;
|
||||||
@@ -29,7 +30,7 @@ public class MovieHolder
|
|||||||
{
|
{
|
||||||
private final Movie _movie;
|
private final Movie _movie;
|
||||||
private final List<PlayerInstance> _players;
|
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)
|
public MovieHolder(List<PlayerInstance> players, Movie movie)
|
||||||
{
|
{
|
||||||
@@ -64,7 +65,7 @@ public class MovieHolder
|
|||||||
return _players;
|
return _players;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<PlayerInstance> getVotedPlayers()
|
public Collection<PlayerInstance> getVotedPlayers()
|
||||||
{
|
{
|
||||||
return _votedPlayers;
|
return _votedPlayers;
|
||||||
}
|
}
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user