|
@@ -22,8 +22,6 @@ import java.util.List;
|
|
import java.util.logging.Level;
|
|
import java.util.logging.Level;
|
|
import java.util.logging.Logger;
|
|
import java.util.logging.Logger;
|
|
|
|
|
|
-import javolution.util.FastList;
|
|
|
|
-
|
|
|
|
import com.l2jserver.Config;
|
|
import com.l2jserver.Config;
|
|
import com.l2jserver.L2DatabaseFactory;
|
|
import com.l2jserver.L2DatabaseFactory;
|
|
import com.l2jserver.gameserver.ItemsAutoDestroy;
|
|
import com.l2jserver.gameserver.ItemsAutoDestroy;
|
|
@@ -31,6 +29,7 @@ import com.l2jserver.gameserver.ThreadPoolManager;
|
|
import com.l2jserver.gameserver.model.L2World;
|
|
import com.l2jserver.gameserver.model.L2World;
|
|
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
|
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
|
import com.l2jserver.gameserver.model.items.type.L2EtcItemType;
|
|
import com.l2jserver.gameserver.model.items.type.L2EtcItemType;
|
|
|
|
+import com.l2jserver.util.L2FastList;
|
|
|
|
|
|
/**
|
|
/**
|
|
* This class manage all items on ground.
|
|
* This class manage all items on ground.
|
|
@@ -41,15 +40,11 @@ public class ItemsOnGroundManager
|
|
{
|
|
{
|
|
static final Logger _log = Logger.getLogger(ItemsOnGroundManager.class.getName());
|
|
static final Logger _log = Logger.getLogger(ItemsOnGroundManager.class.getName());
|
|
|
|
|
|
- protected List<L2ItemInstance> _items = null;
|
|
|
|
|
|
+ protected List<L2ItemInstance> _items = new L2FastList<>(true);
|
|
private final StoreInDb _task = new StoreInDb();
|
|
private final StoreInDb _task = new StoreInDb();
|
|
|
|
|
|
protected ItemsOnGroundManager()
|
|
protected ItemsOnGroundManager()
|
|
{
|
|
{
|
|
- if (Config.SAVE_DROPPED_ITEM)
|
|
|
|
- {
|
|
|
|
- _items = new FastList<>();
|
|
|
|
- }
|
|
|
|
if (Config.SAVE_DROPPED_ITEM_INTERVAL > 0)
|
|
if (Config.SAVE_DROPPED_ITEM_INTERVAL > 0)
|
|
{
|
|
{
|
|
ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(_task, Config.SAVE_DROPPED_ITEM_INTERVAL, Config.SAVE_DROPPED_ITEM_INTERVAL);
|
|
ThreadPoolManager.getInstance().scheduleGeneralAtFixedRate(_task, Config.SAVE_DROPPED_ITEM_INTERVAL, Config.SAVE_DROPPED_ITEM_INTERVAL);
|
|
@@ -57,11 +52,6 @@ public class ItemsOnGroundManager
|
|
load();
|
|
load();
|
|
}
|
|
}
|
|
|
|
|
|
- public static final ItemsOnGroundManager getInstance()
|
|
|
|
- {
|
|
|
|
- return SingletonHolder._instance;
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
private void load()
|
|
private void load()
|
|
{
|
|
{
|
|
// If SaveDroppedItem is false, may want to delete all items previously stored to avoid add old items on reactivate
|
|
// If SaveDroppedItem is false, may want to delete all items previously stored to avoid add old items on reactivate
|
|
@@ -173,7 +163,7 @@ public class ItemsOnGroundManager
|
|
|
|
|
|
public void removeObject(L2ItemInstance item)
|
|
public void removeObject(L2ItemInstance item)
|
|
{
|
|
{
|
|
- if (Config.SAVE_DROPPED_ITEM && (_items != null))
|
|
|
|
|
|
+ if (Config.SAVE_DROPPED_ITEM)
|
|
{
|
|
{
|
|
_items.remove(item);
|
|
_items.remove(item);
|
|
}
|
|
}
|
|
@@ -273,6 +263,11 @@ public class ItemsOnGroundManager
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ public static final ItemsOnGroundManager getInstance()
|
|
|
|
+ {
|
|
|
|
+ return SingletonHolder._instance;
|
|
|
|
+ }
|
|
|
|
+
|
|
private static class SingletonHolder
|
|
private static class SingletonHolder
|
|
{
|
|
{
|
|
protected static final ItemsOnGroundManager _instance = new ItemsOnGroundManager();
|
|
protected static final ItemsOnGroundManager _instance = new ItemsOnGroundManager();
|