Replaced several CopyOnWriteArrayList occurrences with ConcurrentHashMap.newKeySet().
This commit is contained in:
@@ -17,7 +17,8 @@
|
||||
package ai.areas.FantasyIsle;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import org.l2jmobius.commons.concurrent.ThreadPool;
|
||||
@@ -120,7 +121,7 @@ public class Parade extends AbstractNpcAI
|
||||
// @formatter:on
|
||||
|
||||
int npcIndex;
|
||||
CopyOnWriteArrayList<Npc> spawns = new CopyOnWriteArrayList<>();
|
||||
Collection<Npc> spawns = ConcurrentHashMap.newKeySet();
|
||||
ScheduledFuture<?> spawnTask;
|
||||
ScheduledFuture<?> deleteTask;
|
||||
ScheduledFuture<?> cleanTask;
|
||||
|
@@ -16,11 +16,11 @@
|
||||
*/
|
||||
package ai.bosses.Core;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.gameserver.enums.ChatType;
|
||||
@@ -49,7 +49,7 @@ public class Core extends AbstractNpcAI
|
||||
private static final int DOOM_WRAITH = 29008;
|
||||
private static final int SUSCEPTOR = 29011;
|
||||
// Spawns
|
||||
private static final Map<Integer, Location> MINNION_SPAWNS = new HashMap<>();
|
||||
private static final Map<Integer, Location> MINNION_SPAWNS = new HashMap<>();
|
||||
static
|
||||
{
|
||||
MINNION_SPAWNS.put(DEATH_KNIGHT, new Location(17191, 109298, -6488));
|
||||
@@ -78,7 +78,7 @@ public class Core extends AbstractNpcAI
|
||||
|
||||
private static boolean _firstAttacked;
|
||||
|
||||
private static final List<Attackable> _minions = new CopyOnWriteArrayList<>();
|
||||
private static final Collection<Attackable> _minions = ConcurrentHashMap.newKeySet();
|
||||
|
||||
private Core()
|
||||
{
|
||||
|
@@ -16,8 +16,8 @@
|
||||
*/
|
||||
package ai.others;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import org.l2jmobius.gameserver.geoengine.GeoEngine;
|
||||
@@ -87,7 +87,7 @@ public class SiegeGuards extends AbstractNpcAI
|
||||
35134, 35135, 35136, 35176, 35177, 35178, 35218, 35219, 35220, 35261, 35262, 35263, 35264, 35265, 35308, 35309, 35310, 35352, 35353, 35354, 35497, 35498, 35499, 35500, 35501, 35544, 35545, 35546
|
||||
};
|
||||
//@formatter:on
|
||||
private static final List<Npc> SPAWNED_GUARDS = new CopyOnWriteArrayList<>();
|
||||
private static final Collection<Npc> SPAWNED_GUARDS = ConcurrentHashMap.newKeySet();
|
||||
|
||||
public SiegeGuards()
|
||||
{
|
||||
|
@@ -17,8 +17,9 @@
|
||||
package custom.events.Rabbits;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
import org.l2jmobius.commons.util.CommonUtil;
|
||||
@@ -49,7 +50,7 @@ public class Rabbits extends Event
|
||||
private static final int EVENT_TIME = 10;
|
||||
private static final int TOTAL_CHEST_COUNT = 75;
|
||||
private static final int TRANSFORMATION_ID = 105;
|
||||
private final List<Npc> _npcs = new CopyOnWriteArrayList<>();
|
||||
private final Collection<Npc> _npcs = ConcurrentHashMap.newKeySet();
|
||||
private final List<PlayerInstance> _players = new ArrayList<>();
|
||||
private boolean _isActive = false;
|
||||
|
||||
@@ -253,7 +254,7 @@ public class Rabbits extends Event
|
||||
}
|
||||
}
|
||||
|
||||
private void recordSpawn(List<Npc> npcs, int npcId, int x, int y, int z, int heading, boolean randomOffSet, long despawnDelay)
|
||||
private void recordSpawn(Collection<Npc> npcs, int npcId, int x, int y, int z, int heading, boolean randomOffSet, long despawnDelay)
|
||||
{
|
||||
final Npc npc = addSpawn(npcId, x, y, z, heading, randomOffSet, despawnDelay);
|
||||
if (npc.getId() == CHEST)
|
||||
|
@@ -17,8 +17,9 @@
|
||||
package custom.events.Race;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
|
||||
import org.l2jmobius.Config;
|
||||
@@ -45,7 +46,7 @@ public class Race extends Event
|
||||
// Npc
|
||||
private Npc _npc;
|
||||
// Player list
|
||||
private List<PlayerInstance> _players;
|
||||
private Collection<PlayerInstance> _players;
|
||||
// Event Task
|
||||
ScheduledFuture<?> _eventTask = null;
|
||||
// Event state
|
||||
@@ -127,7 +128,7 @@ public class Race extends Event
|
||||
}
|
||||
// Initialize list
|
||||
_npclist = new ArrayList<>();
|
||||
_players = new CopyOnWriteArrayList<>();
|
||||
_players = ConcurrentHashMap.newKeySet();
|
||||
// Set Event active
|
||||
_isactive = true;
|
||||
// Spawn Manager
|
||||
|
Reference in New Issue
Block a user