Sync with L2jServer HighFive Mar 25th 2015.

This commit is contained in:
MobiusDev
2015-03-25 06:48:51 +00:00
parent e0c66b1412
commit 82606870c0
194 changed files with 2619 additions and 2869 deletions

View File

@ -18,11 +18,12 @@
*/
package com.l2jserver.gameserver.model;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Queue;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ScheduledFuture;
import java.util.logging.Logger;
@ -43,29 +44,24 @@ public final class L2WorldRegion
private static final Logger _log = Logger.getLogger(L2WorldRegion.class.getName());
/** Map containing all playable characters in game in this world region. */
private final Map<Integer, L2Playable> _allPlayable;
private final Map<Integer, L2Playable> _allPlayable = new ConcurrentHashMap<>();
/** Map containing visible objects in this world region. */
private final Map<Integer, L2Object> _visibleObjects;
private final Map<Integer, L2Object> _visibleObjects = new ConcurrentHashMap<>();
private final List<L2WorldRegion> _surroundingRegions;
private final Queue<L2WorldRegion> _surroundingRegions = new ConcurrentLinkedQueue<>();
private final int _tileX, _tileY;
private boolean _active = false;
private ScheduledFuture<?> _neighborsTask = null;
private final List<L2ZoneType> _zones;
private final List<L2ZoneType> _zones = new CopyOnWriteArrayList<>();
public L2WorldRegion(int pTileX, int pTileY)
{
_allPlayable = new ConcurrentHashMap<>();
_visibleObjects = new ConcurrentHashMap<>();
_surroundingRegions = new ArrayList<>();
_tileX = pTileX;
_tileY = pTileY;
// default a newly initialized region to inactive, unless always on is specified
_active = Config.GRIDS_ALWAYS_ON;
_zones = new ArrayList<>();
}
public List<L2ZoneType> getZones()
@ -233,8 +229,7 @@ public final class L2WorldRegion
int c = 0;
if (!isOn)
{
Collection<L2Object> vObj = _visibleObjects.values();
for (L2Object o : vObj)
for (L2Object o : _visibleObjects.values())
{
if (o instanceof L2Attackable)
{
@ -272,9 +267,7 @@ public final class L2WorldRegion
}
else
{
Collection<L2Object> vObj = _visibleObjects.values();
for (L2Object o : vObj)
for (L2Object o : _visibleObjects.values())
{
if (o instanceof L2Attackable)
{
@ -454,9 +447,9 @@ public final class L2WorldRegion
}
/**
* @return the ArrayList _surroundingRegions containing all L2WorldRegion around the current L2WorldRegion
* @return the list containing all L2WorldRegion around the current world region
*/
public List<L2WorldRegion> getSurroundingRegions()
public Queue<L2WorldRegion> getSurroundingRegions()
{
return _surroundingRegions;
}
@ -482,8 +475,7 @@ public final class L2WorldRegion
public void deleteVisibleNpcSpawns()
{
_log.fine("Deleting all visible NPC's in Region: " + getName());
Collection<L2Object> vNPC = _visibleObjects.values();
for (L2Object obj : vNPC)
for (L2Object obj : _visibleObjects.values())
{
if (obj instanceof L2Npc)
{