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

@ -60,7 +60,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.enums.ChatType;
import com.l2jserver.gameserver.enums.IllegalActionPunishmentType;
import com.l2jserver.gameserver.model.L2World;
@ -71,6 +70,7 @@ import com.l2jserver.gameserver.util.FloodProtectorConfig;
import com.l2jserver.gameserver.util.Util;
import com.l2jserver.util.PropertiesParser;
import com.l2jserver.util.StringUtil;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* This class loads all the game server related configurations from files.<br>

View File

@ -18,8 +18,8 @@
*/
package com.l2jserver.gameserver;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.l2jserver.Config;
import com.l2jserver.gameserver.enums.ItemLocation;
@ -29,7 +29,7 @@ import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
public final class ItemsAutoDestroy
{
private final List<L2ItemInstance> _items = new CopyOnWriteArrayList<>();
private final Map<Integer, L2ItemInstance> _items = new ConcurrentHashMap<>();
protected ItemsAutoDestroy()
{
@ -44,22 +44,22 @@ public final class ItemsAutoDestroy
public synchronized void addItem(L2ItemInstance item)
{
item.setDropTime(System.currentTimeMillis());
_items.add(item);
_items.put(item.getObjectId(), item);
}
public synchronized void removeItems()
{
if (_items.isEmpty())
final long curtime = System.currentTimeMillis();
for (L2ItemInstance item : _items.values())
{
return;
}
long curtime = System.currentTimeMillis();
for (L2ItemInstance item : _items)
{
if ((item == null) || (item.getDropTime() == 0) || (item.getItemLocation() != ItemLocation.VOID))
if (item == null)
{
_items.remove(item);
continue;
}
if ((item.getDropTime() == 0) || (item.getItemLocation() != ItemLocation.VOID))
{
_items.remove(item.getObjectId());
}
else
{
@ -69,7 +69,7 @@ public final class ItemsAutoDestroy
{
L2World.getInstance().removeVisibleObject(item, item.getWorldRegion());
L2World.getInstance().removeObject(item);
_items.remove(item);
_items.remove(item.getObjectId());
if (Config.SAVE_DROPPED_ITEM)
{
ItemsOnGroundManager.getInstance().removeObject(item);
@ -82,7 +82,7 @@ public final class ItemsAutoDestroy
{
L2World.getInstance().removeVisibleObject(item, item.getWorldRegion());
L2World.getInstance().removeObject(item);
_items.remove(item);
_items.remove(item.getObjectId());
if (Config.SAVE_DROPPED_ITEM)
{
ItemsOnGroundManager.getInstance().removeObject(item);
@ -97,7 +97,7 @@ public final class ItemsAutoDestroy
{
L2World.getInstance().removeVisibleObject(item, item.getWorldRegion());
L2World.getInstance().removeObject(item);
_items.remove(item);
_items.remove(item.getObjectId());
if (Config.SAVE_DROPPED_ITEM)
{
ItemsOnGroundManager.getInstance().removeObject(item);

View File

@ -39,6 +39,7 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level;
import java.util.logging.LogRecord;
import java.util.logging.Logger;
@ -134,7 +135,7 @@ public class LoginServerThread extends Thread
_reserveHost = Config.RESERVE_HOST_ON_LOGIN;
_subnets = Config.GAME_SERVER_SUBNETS;
_hosts = Config.GAME_SERVER_HOSTS;
_waitingClients = new ArrayList<>();
_waitingClients = new CopyOnWriteArrayList<>();
_maxPlayer = Config.MAXIMUM_ONLINE_USERS;
}

View File

@ -61,6 +61,7 @@ public class RecipeController
protected RecipeController()
{
// Prevent external initialization.
}
public void requestBookOpen(L2PcInstance player, boolean isDwarvenCraft)

View File

@ -451,16 +451,9 @@ public final class L2ControllableMobAI extends L2AttackableAI
double dy, dx;
double dblAggroRange = aggroRange * aggroRange;
List<L2Character> potentialTarget = new ArrayList<>();
Collection<L2Object> objs = npc.getKnownList().getKnownObjects().values();
for (L2Object obj : objs)
final List<L2Character> potentialTarget = new ArrayList<>();
for (L2Character obj : npc.getKnownList().getKnownCharacters())
{
if (!(obj instanceof L2Character))
{
continue;
}
npcX = npc.getX();
npcY = npc.getY();
targetX = obj.getX();
@ -474,8 +467,7 @@ public final class L2ControllableMobAI extends L2AttackableAI
continue;
}
L2Character target = (L2Character) obj;
L2Character target = obj;
if (checkAutoAttackCondition(target))
{
potentialTarget.add(target);

View File

@ -22,9 +22,9 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -48,8 +48,8 @@ public class Forum
public static final int CLANMEMBERONLY = 2;
public static final int OWNERONLY = 3;
private final List<Forum> _children;
private final Map<Integer, Topic> _topic;
private final List<Forum> _children = new ArrayList<>();
private final Map<Integer, Topic> _topic = new ConcurrentHashMap<>();
private final int _forumId;
private String _forumName;
private int _forumType;
@ -68,8 +68,6 @@ public class Forum
{
_forumId = Forumid;
_fParent = FParent;
_children = new ArrayList<>();
_topic = new HashMap<>();
}
/**
@ -88,8 +86,6 @@ public class Forum
_forumPerm = perm;
_fParent = parent;
_ownerID = OwnerID;
_children = new ArrayList<>();
_topic = new HashMap<>();
parent._children.add(this);
ForumsBBSManager.getInstance().addForum(this);
_loaded = true;
@ -151,7 +147,7 @@ public class Forum
{
while (rs.next())
{
Forum f = new Forum(rs.getInt("forum_id"), this);
final Forum f = new Forum(rs.getInt("forum_id"), this);
_children.add(f);
ForumsBBSManager.getInstance().addForum(f);
}
@ -208,14 +204,7 @@ public class Forum
public Forum getChildByName(String name)
{
vload();
for (Forum f : _children)
{
if (f.getName().equals(name))
{
return f;
}
}
return null;
return _children.stream().filter(f -> f.getName().equals(name)).findFirst().orElse(null);
}
/**

View File

@ -47,7 +47,7 @@ public class Post
public String postTxt;
}
private final List<CPost> _post;
private final List<CPost> _post = new ArrayList<>();
/**
* @param _PostOwner
@ -59,8 +59,7 @@ public class Post
*/
public Post(String _PostOwner, int _PostOwnerID, long date, int tid, int _PostForumID, String txt)
{
_post = new ArrayList<>();
CPost cp = new CPost();
final CPost cp = new CPost();
cp.postId = 0;
cp.postOwner = _PostOwner;
cp.postOwnerId = _PostOwnerID;
@ -73,6 +72,11 @@ public class Post
}
public Post(Topic t)
{
load(t);
}
public void insertindb(CPost cp)
{
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
@ -93,23 +97,9 @@ public class Post
}
}
public Post(Topic t)
{
_post = new ArrayList<>();
load(t);
}
public CPost getCPost(int id)
{
int i = 0;
for (CPost cp : _post)
{
if (i++ == id)
{
return cp;
}
}
return null;
return _post.get(id);
}
public void deleteme(Topic t)
@ -142,7 +132,7 @@ public class Post
{
while (rs.next())
{
CPost cp = new CPost();
final CPost cp = new CPost();
cp.postId = rs.getInt("post_id");
cp.postOwner = rs.getString("post_owner_name");
cp.postOwnerId = rs.getInt("post_ownerid");

View File

@ -63,10 +63,7 @@ public class ForumsBBSManager extends BaseBBSManager
*/
public void initRoot()
{
for (Forum f : _table)
{
f.vload();
}
_table.forEach(f -> f.vload());
_log.info("Loaded " + _table.size() + " forums. Last forum id used: " + _lastid);
}
@ -101,14 +98,7 @@ public class ForumsBBSManager extends BaseBBSManager
*/
public Forum getForumByName(String name)
{
for (Forum f : _table)
{
if (f.getName().equals(name))
{
return f;
}
}
return null;
return _table.stream().filter(f -> f.getName().equals(name)).findFirst().orElse(null);
}
/**
@ -143,14 +133,7 @@ public class ForumsBBSManager extends BaseBBSManager
*/
public Forum getForumByID(int idf)
{
for (Forum f : _table)
{
if (f.getID() == idf)
{
return f;
}
}
return null;
return _table.stream().filter(f -> f.getID() == idf).findFirst().orElse(null);
}
@Override

View File

@ -20,10 +20,10 @@ package com.l2jserver.gameserver.communitybbs.Manager;
import java.text.DateFormat;
import java.util.Date;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.concurrent.ConcurrentHashMap;
import com.l2jserver.gameserver.communitybbs.BB.Forum;
import com.l2jserver.gameserver.communitybbs.BB.Post;
@ -35,7 +35,7 @@ import com.l2jserver.util.StringUtil;
public class PostBBSManager extends BaseBBSManager
{
private final Map<Topic, Post> _postByTopic = new HashMap<>();
private final Map<Topic, Post> _postByTopic = new ConcurrentHashMap<>();
public Post getGPosttByTopic(Topic t)
{

View File

@ -19,13 +19,13 @@
package com.l2jserver.gameserver.communitybbs.Manager;
import java.text.DateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.StringTokenizer;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import com.l2jserver.gameserver.communitybbs.BB.Forum;
import com.l2jserver.gameserver.communitybbs.BB.Post;
@ -37,13 +37,12 @@ import com.l2jserver.util.StringUtil;
public class TopicBBSManager extends BaseBBSManager
{
private final List<Topic> _table;
private final Map<Forum, Integer> _maxId;
private final List<Topic> _table = new CopyOnWriteArrayList<>();
private final Map<Forum, Integer> _maxId = new HashMap<>();
protected TopicBBSManager()
{
_table = new ArrayList<>();
_maxId = new ConcurrentHashMap<>();
// Prevent external initialization.
}
public void addTopic(Topic tt)

View File

@ -378,8 +378,8 @@ public class ClanTable
public void storeclanswars(int clanId1, int clanId2)
{
final L2Clan clan1 = ClanTable.getInstance().getClan(clanId1);
final L2Clan clan2 = ClanTable.getInstance().getClan(clanId2);
final L2Clan clan1 = getClan(clanId1);
final L2Clan clan2 = getClan(clanId2);
EventDispatcher.getInstance().notifyEventAsync(new OnClanWarStart(clan1, clan2));
@ -419,8 +419,8 @@ public class ClanTable
public void deleteclanswars(int clanId1, int clanId2)
{
L2Clan clan1 = ClanTable.getInstance().getClan(clanId1);
L2Clan clan2 = ClanTable.getInstance().getClan(clanId2);
L2Clan clan1 = getClan(clanId1);
L2Clan clan2 = getClan(clanId2);
EventDispatcher.getInstance().notifyEventAsync(new OnClanWarFinish(clan1, clan2));

View File

@ -27,8 +27,8 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.holders.RangeAbilityPointsHolder;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* @author UnAfraid

View File

@ -30,7 +30,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.L2AccessLevel;
import com.l2jserver.gameserver.model.L2AdminCommandAccessRight;
import com.l2jserver.gameserver.model.StatsSet;
@ -38,6 +37,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* Loads administrator access levels and commands.

View File

@ -26,13 +26,13 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.datatables.ItemTable;
import com.l2jserver.gameserver.enums.Race;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.items.appearance.AppearanceStone;
import com.l2jserver.gameserver.model.items.appearance.AppearanceTargetType;
import com.l2jserver.gameserver.model.items.type.CrystalType;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* @author UnAfraid
@ -109,7 +109,7 @@ public class AppearanceItemData implements IXmlReader
}
case "bodyPart":
{
final int part = ItemTable._slots.get(c.getTextContent());
final int part = ItemTable.SLOTS.get(c.getTextContent());
stone.addBodyPart(part);
break;
}

View File

@ -25,10 +25,10 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.L2ArmorSet;
import com.l2jserver.gameserver.model.holders.ArmorsetSkillHolder;
import com.l2jserver.gameserver.model.holders.SkillHolder;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* Loads armor set bonuses.

View File

@ -25,12 +25,12 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.enums.Race;
import com.l2jserver.gameserver.enums.Sex;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.beautyshop.BeautyData;
import com.l2jserver.gameserver.model.beautyshop.BeautyItem;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* @author Sdw

View File

@ -33,11 +33,11 @@ import org.w3c.dom.Node;
import com.l2jserver.Config;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.datatables.ItemTable;
import com.l2jserver.gameserver.model.buylist.L2BuyList;
import com.l2jserver.gameserver.model.buylist.Product;
import com.l2jserver.gameserver.model.items.L2Item;
import com.l2jserver.util.data.xml.IXmlReader;
import com.l2jserver.util.file.filter.NumericNameFilter;
/**

View File

@ -29,9 +29,9 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.enums.CastleSide;
import com.l2jserver.gameserver.model.holders.CastleSpawnHolder;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* @author St3eT

View File

@ -29,8 +29,8 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.enums.CategoryType;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* Loads the category data with Class or NPC IDs.

View File

@ -25,9 +25,9 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.base.ClassId;
import com.l2jserver.gameserver.model.base.ClassInfo;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* Loads the the list of classes and it's info.

View File

@ -30,13 +30,13 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.instancemanager.InstanceManager;
import com.l2jserver.gameserver.instancemanager.MapRegionManager;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.instance.L2DoorInstance;
import com.l2jserver.gameserver.model.actor.templates.L2DoorTemplate;
import com.l2jserver.gameserver.pathfinding.AbstractNodeLoc;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* Loads doors.

View File

@ -26,11 +26,11 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.items.enchant.EnchantScroll;
import com.l2jserver.gameserver.model.items.enchant.EnchantSupportItem;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* Loads item enchant data.

View File

@ -26,7 +26,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.datatables.ItemTable;
import com.l2jserver.gameserver.model.holders.RangeChanceHolder;
import com.l2jserver.gameserver.model.items.L2Item;
@ -34,6 +33,7 @@ import com.l2jserver.gameserver.model.items.enchant.EnchantItemGroup;
import com.l2jserver.gameserver.model.items.enchant.EnchantRateItem;
import com.l2jserver.gameserver.model.items.enchant.EnchantScrollGroup;
import com.l2jserver.gameserver.util.Util;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* @author UnAfraid
@ -117,7 +117,7 @@ public final class EnchantItemGroupsData implements IXmlReader
final NamedNodeMap attrs = z.getAttributes();
if (attrs.getNamedItem("slot") != null)
{
rateGroup.addSlot(ItemTable._slots.get(parseString(attrs, "slot")));
rateGroup.addSlot(ItemTable.SLOTS.get(parseString(attrs, "slot")));
}
if (attrs.getNamedItem("magicWeapon") != null)
{

View File

@ -27,7 +27,6 @@ import java.util.Map;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.datatables.ItemTable;
import com.l2jserver.gameserver.enums.StatFunction;
import com.l2jserver.gameserver.model.items.L2Item;
@ -35,6 +34,7 @@ import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
import com.l2jserver.gameserver.model.items.type.CrystalType;
import com.l2jserver.gameserver.model.stats.Stats;
import com.l2jserver.gameserver.model.stats.functions.FuncTemplate;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* This class holds the Enchant HP Bonus Data.

View File

@ -25,10 +25,10 @@ import java.util.logging.Level;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
import com.l2jserver.gameserver.model.options.EnchantOptions;
import com.l2jserver.gameserver.util.Util;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* @author UnAfraid

View File

@ -27,13 +27,13 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.Config;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.L2EnchantSkillGroup;
import com.l2jserver.gameserver.model.L2EnchantSkillGroup.EnchantSkillHolder;
import com.l2jserver.gameserver.model.L2EnchantSkillLearn;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* This class holds the Enchant Groups information.

View File

@ -25,7 +25,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* This class holds the Experience points for each level for players and pets.

View File

@ -27,9 +27,9 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.fishing.L2Fish;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* This class holds the Fish information.

View File

@ -25,9 +25,9 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.fishing.L2FishingMonster;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* This class holds the Fishing Monsters information.

View File

@ -25,9 +25,9 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.fishing.L2FishingRod;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* This class holds the Fishing Rods information.

View File

@ -27,10 +27,10 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.base.ClassId;
import com.l2jserver.gameserver.model.items.L2Henna;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* This class holds the henna related information.<br>

View File

@ -24,8 +24,8 @@ import org.w3c.dom.Node;
import com.l2jserver.Config;
import com.l2jserver.gameserver.GameTimeController;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.actor.L2Character;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* This class load, holds and calculates the hit condition bonuses.

View File

@ -28,10 +28,10 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.Config;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.base.ClassId;
import com.l2jserver.gameserver.model.items.PcItemTemplate;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* This class holds the Initial Equipment information.<br>

View File

@ -27,7 +27,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.enums.MacroType;
import com.l2jserver.gameserver.enums.ShortcutType;
import com.l2jserver.gameserver.model.Macro;
@ -37,6 +36,7 @@ import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.base.ClassId;
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
import com.l2jserver.gameserver.network.serverpackets.ShortCutRegister;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* This class holds the Initial Shortcuts information.<br>

View File

@ -26,9 +26,9 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.CrystalizationData;
import com.l2jserver.gameserver.model.holders.ItemChanceHolder;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* @author UnAfraid

View File

@ -26,7 +26,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* @author UnAfraid

View File

@ -31,7 +31,6 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.Config;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.L2Npc;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
@ -45,6 +44,7 @@ import com.l2jserver.gameserver.network.serverpackets.MultiSellList;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.network.serverpackets.UserInfo;
import com.l2jserver.gameserver.util.Util;
import com.l2jserver.util.data.xml.IXmlReader;
import com.l2jserver.util.file.filter.NumericNameFilter;
public final class MultisellData implements IXmlReader

View File

@ -36,7 +36,6 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.Config;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.datatables.SkillData;
import com.l2jserver.gameserver.enums.AISkillScope;
import com.l2jserver.gameserver.model.StatsSet;
@ -51,6 +50,7 @@ import com.l2jserver.gameserver.model.holders.MinionHolder;
import com.l2jserver.gameserver.model.holders.SkillHolder;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.gameserver.util.Util;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* NPC data parser.

View File

@ -26,13 +26,13 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.holders.SkillHolder;
import com.l2jserver.gameserver.model.options.Options;
import com.l2jserver.gameserver.model.options.OptionsSkillHolder;
import com.l2jserver.gameserver.model.options.OptionsSkillType;
import com.l2jserver.gameserver.model.stats.Stats;
import com.l2jserver.gameserver.model.stats.functions.FuncTemplate;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* @author UnAfraid

View File

@ -25,11 +25,11 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.enums.MountType;
import com.l2jserver.gameserver.model.L2PetData;
import com.l2jserver.gameserver.model.L2PetLevelData;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* This class parse and hold all pet parameters.<br>

View File

@ -28,11 +28,11 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.templates.L2PcTemplate;
import com.l2jserver.gameserver.model.base.ClassId;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* Loads player's base stats.

View File

@ -24,7 +24,7 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* This class holds the Player Xp Percent Lost Data for each level for players.

View File

@ -27,7 +27,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.datatables.ItemTable;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
@ -35,6 +34,7 @@ import com.l2jserver.gameserver.model.items.L2Item;
import com.l2jserver.gameserver.model.primeshop.PrimeShopGroup;
import com.l2jserver.gameserver.model.primeshop.PrimeShopItem;
import com.l2jserver.gameserver.network.serverpackets.primeshop.ExBRProductInfo;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* @author Gnacik, UnAfraid

View File

@ -27,12 +27,12 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.L2RecipeInstance;
import com.l2jserver.gameserver.model.L2RecipeList;
import com.l2jserver.gameserver.model.L2RecipeStatInstance;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* The Class RecipeData.

View File

@ -26,7 +26,7 @@ import java.util.logging.Level;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* @author NosBit

View File

@ -28,7 +28,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.Location;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.VehiclePathPoint;
@ -37,6 +36,7 @@ import com.l2jserver.gameserver.model.actor.templates.L2CharTemplate;
import com.l2jserver.gameserver.model.shuttle.L2ShuttleData;
import com.l2jserver.gameserver.model.shuttle.L2ShuttleEngine;
import com.l2jserver.gameserver.model.shuttle.L2ShuttleStop;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* @author UnAfraid

View File

@ -27,10 +27,10 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.SiegeScheduleDate;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.util.Util;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* @author UnAfraid

View File

@ -26,8 +26,8 @@ import java.util.Map;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.base.ClassId;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* Holds all skill learn data for all npcs.

View File

@ -36,7 +36,6 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.Config;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.datatables.SkillData;
import com.l2jserver.gameserver.enums.CategoryType;
import com.l2jserver.gameserver.enums.Race;
@ -54,6 +53,7 @@ import com.l2jserver.gameserver.model.holders.SkillHolder;
import com.l2jserver.gameserver.model.interfaces.ISkillsHolder;
import com.l2jserver.gameserver.model.skills.CommonSkill;
import com.l2jserver.gameserver.model.skills.Skill;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* This class loads and manage the characters and pledges skills trees.<br>

View File

@ -26,10 +26,10 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.instance.L2StaticObjectInstance;
import com.l2jserver.gameserver.model.actor.templates.L2CharTemplate;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* This class loads and holds all static object data.

View File

@ -26,11 +26,11 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.teleporter.TeleportHolder;
import com.l2jserver.gameserver.model.teleporter.TeleportLocation;
import com.l2jserver.gameserver.model.teleporter.TeleportType;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* @author UnAfraid

View File

@ -26,7 +26,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.actor.transform.Transform;
@ -36,6 +35,7 @@ import com.l2jserver.gameserver.model.holders.AdditionalItemHolder;
import com.l2jserver.gameserver.model.holders.AdditionalSkillHolder;
import com.l2jserver.gameserver.model.holders.SkillHolder;
import com.l2jserver.gameserver.network.serverpackets.ExBasicActionList;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* @author UnAfraid

View File

@ -27,8 +27,8 @@ import java.util.logging.Logger;
import org.w3c.dom.Document;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.ActionKey;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* UI Data parser.

View File

@ -36,7 +36,7 @@ public class EventDroplist
/**
* The table containing all DataDrop object
*/
private static final List<DateDrop> _allNpcDateDrops = new ArrayList<>();
private static final List<DateDrop> ALL_NPC_DATE_DROPS = new ArrayList<>();
public static class DateDrop
{
@ -75,7 +75,7 @@ public class EventDroplist
*/
public void addGlobalDrop(int[] itemIdList, int[] count, int chance, DateRange dateRange)
{
_allNpcDateDrops.add(new DateDrop(dateRange, new EventDrop(itemIdList, count[0], count[1], chance)));
ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, new EventDrop(itemIdList, count[0], count[1], chance)));
}
/**
@ -87,7 +87,7 @@ public class EventDroplist
*/
public void addGlobalDrop(int itemId, long min, long max, int chance, DateRange dateRange)
{
_allNpcDateDrops.add(new DateDrop(dateRange, new EventDrop(itemId, min, max, chance)));
ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, new EventDrop(itemId, min, max, chance)));
}
/**
@ -97,7 +97,7 @@ public class EventDroplist
*/
public void addGlobalDrop(DateRange dateRange, EventDrop eventDrop)
{
_allNpcDateDrops.add(new DateDrop(dateRange, eventDrop));
ALL_NPC_DATE_DROPS.add(new DateDrop(dateRange, eventDrop));
}
/**
@ -107,7 +107,7 @@ public class EventDroplist
{
final List<DateDrop> list = new ArrayList<>();
final Date currentDate = new Date();
for (DateDrop drop : _allNpcDateDrops)
for (DateDrop drop : ALL_NPC_DATE_DROPS)
{
if (drop._dateRange.isWithinRange(currentDate))
{

View File

@ -60,53 +60,53 @@ public class ItemTable
private static Logger LOGGER = Logger.getLogger(ItemTable.class.getName());
private static Logger LOGGER_ITEMS = Logger.getLogger("item");
public static final Map<String, Integer> _slots = new HashMap<>();
public static final Map<String, Integer> SLOTS = new HashMap<>();
private L2Item[] _allTemplates;
private final Map<Integer, L2EtcItem> _etcItems;
private final Map<Integer, L2Armor> _armors;
private final Map<Integer, L2Weapon> _weapons;
private final Map<Integer, L2EtcItem> _etcItems = new HashMap<>();
private final Map<Integer, L2Armor> _armors = new HashMap<>();
private final Map<Integer, L2Weapon> _weapons = new HashMap<>();
static
{
_slots.put("shirt", L2Item.SLOT_UNDERWEAR);
_slots.put("lbracelet", L2Item.SLOT_L_BRACELET);
_slots.put("rbracelet", L2Item.SLOT_R_BRACELET);
_slots.put("talisman", L2Item.SLOT_DECO);
_slots.put("chest", L2Item.SLOT_CHEST);
_slots.put("fullarmor", L2Item.SLOT_FULL_ARMOR);
_slots.put("head", L2Item.SLOT_HEAD);
_slots.put("hair", L2Item.SLOT_HAIR);
_slots.put("hairall", L2Item.SLOT_HAIRALL);
_slots.put("underwear", L2Item.SLOT_UNDERWEAR);
_slots.put("back", L2Item.SLOT_BACK);
_slots.put("neck", L2Item.SLOT_NECK);
_slots.put("legs", L2Item.SLOT_LEGS);
_slots.put("feet", L2Item.SLOT_FEET);
_slots.put("gloves", L2Item.SLOT_GLOVES);
_slots.put("chest,legs", L2Item.SLOT_CHEST | L2Item.SLOT_LEGS);
_slots.put("belt", L2Item.SLOT_BELT);
_slots.put("rhand", L2Item.SLOT_R_HAND);
_slots.put("lhand", L2Item.SLOT_L_HAND);
_slots.put("lrhand", L2Item.SLOT_LR_HAND);
_slots.put("rear;lear", L2Item.SLOT_R_EAR | L2Item.SLOT_L_EAR);
_slots.put("rfinger;lfinger", L2Item.SLOT_R_FINGER | L2Item.SLOT_L_FINGER);
_slots.put("wolf", L2Item.SLOT_WOLF);
_slots.put("greatwolf", L2Item.SLOT_GREATWOLF);
_slots.put("hatchling", L2Item.SLOT_HATCHLING);
_slots.put("strider", L2Item.SLOT_STRIDER);
_slots.put("babypet", L2Item.SLOT_BABYPET);
_slots.put("brooch", L2Item.SLOT_BROOCH);
_slots.put("brooch_jewel", L2Item.SLOT_BROOCH_JEWEL);
_slots.put("none", L2Item.SLOT_NONE);
SLOTS.put("shirt", L2Item.SLOT_UNDERWEAR);
SLOTS.put("lbracelet", L2Item.SLOT_L_BRACELET);
SLOTS.put("rbracelet", L2Item.SLOT_R_BRACELET);
SLOTS.put("talisman", L2Item.SLOT_DECO);
SLOTS.put("chest", L2Item.SLOT_CHEST);
SLOTS.put("fullarmor", L2Item.SLOT_FULL_ARMOR);
SLOTS.put("head", L2Item.SLOT_HEAD);
SLOTS.put("hair", L2Item.SLOT_HAIR);
SLOTS.put("hairall", L2Item.SLOT_HAIRALL);
SLOTS.put("underwear", L2Item.SLOT_UNDERWEAR);
SLOTS.put("back", L2Item.SLOT_BACK);
SLOTS.put("neck", L2Item.SLOT_NECK);
SLOTS.put("legs", L2Item.SLOT_LEGS);
SLOTS.put("feet", L2Item.SLOT_FEET);
SLOTS.put("gloves", L2Item.SLOT_GLOVES);
SLOTS.put("chest,legs", L2Item.SLOT_CHEST | L2Item.SLOT_LEGS);
SLOTS.put("belt", L2Item.SLOT_BELT);
SLOTS.put("rhand", L2Item.SLOT_R_HAND);
SLOTS.put("lhand", L2Item.SLOT_L_HAND);
SLOTS.put("lrhand", L2Item.SLOT_LR_HAND);
SLOTS.put("rear;lear", L2Item.SLOT_R_EAR | L2Item.SLOT_L_EAR);
SLOTS.put("rfinger;lfinger", L2Item.SLOT_R_FINGER | L2Item.SLOT_L_FINGER);
SLOTS.put("wolf", L2Item.SLOT_WOLF);
SLOTS.put("greatwolf", L2Item.SLOT_GREATWOLF);
SLOTS.put("hatchling", L2Item.SLOT_HATCHLING);
SLOTS.put("strider", L2Item.SLOT_STRIDER);
SLOTS.put("babypet", L2Item.SLOT_BABYPET);
SLOTS.put("brooch", L2Item.SLOT_BROOCH);
SLOTS.put("brooch_jewel", L2Item.SLOT_BROOCH_JEWEL);
SLOTS.put("none", L2Item.SLOT_NONE);
// retail compatibility
_slots.put("onepiece", L2Item.SLOT_FULL_ARMOR);
_slots.put("hair2", L2Item.SLOT_HAIR2);
_slots.put("dhair", L2Item.SLOT_HAIRALL);
_slots.put("alldress", L2Item.SLOT_ALLDRESS);
_slots.put("deco1", L2Item.SLOT_DECO);
_slots.put("waist", L2Item.SLOT_BELT);
SLOTS.put("onepiece", L2Item.SLOT_FULL_ARMOR);
SLOTS.put("hair2", L2Item.SLOT_HAIR2);
SLOTS.put("dhair", L2Item.SLOT_HAIRALL);
SLOTS.put("alldress", L2Item.SLOT_ALLDRESS);
SLOTS.put("deco1", L2Item.SLOT_DECO);
SLOTS.put("waist", L2Item.SLOT_BELT);
}
/**
@ -119,9 +119,6 @@ public class ItemTable
protected ItemTable()
{
_etcItems = new HashMap<>();
_armors = new HashMap<>();
_weapons = new HashMap<>();
load();
}

View File

@ -37,13 +37,13 @@ import org.w3c.dom.Node;
import com.l2jserver.Config;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.data.xml.impl.NpcData;
import com.l2jserver.gameserver.instancemanager.DayNightSpawnManager;
import com.l2jserver.gameserver.instancemanager.ZoneManager;
import com.l2jserver.gameserver.model.L2Spawn;
import com.l2jserver.gameserver.model.StatsSet;
import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* Spawn data retriever.

View File

@ -148,12 +148,11 @@ public abstract class DocumentBase
protected final Logger _log = Logger.getLogger(getClass().getName());
private final File _file;
protected Map<String, String[]> _tables;
protected final Map<String, String[]> _tables = new HashMap<>();
protected DocumentBase(File pFile)
{
_file = pFile;
_tables = new HashMap<>();
}
public Document parse()
@ -184,7 +183,7 @@ public abstract class DocumentBase
protected void resetTable()
{
_tables = new HashMap<>();
_tables.clear();
}
protected void setTable(String name, String[] table)
@ -1189,9 +1188,9 @@ public abstract class DocumentBase
{
int old = mask;
String item = st.nextToken().trim();
if (ItemTable._slots.containsKey(item))
if (ItemTable.SLOTS.containsKey(item))
{
mask |= ItemTable._slots.get(item);
mask |= ItemTable.SLOTS.get(item);
}
if (old == mask)

View File

@ -176,9 +176,6 @@ public final class DocumentItem extends DocumentBase
}
}
/**
* @return
*/
public List<L2Item> getItemList()
{
return _itemsInFile;

View File

@ -18,8 +18,8 @@
*/
package com.l2jserver.gameserver.instancemanager;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.l2jserver.Config;
import com.l2jserver.gameserver.model.L2World;
@ -32,7 +32,7 @@ import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
public class BoatManager
{
private final Map<Integer, L2BoatInstance> _boats = new HashMap<>();
private final Map<Integer, L2BoatInstance> _boats = new ConcurrentHashMap<>();
private final boolean[] _docksBusy = new boolean[3];
public static final int TALKING_ISLAND = 1;
@ -103,11 +103,12 @@ public class BoatManager
npcDat.set("basePDef", 100);
npcDat.set("baseMDef", 100);
L2BoatInstance boat = new L2BoatInstance(new L2CharTemplate(npcDat));
_boats.put(boat.getObjectId(), boat);
final L2BoatInstance boat = new L2BoatInstance(new L2CharTemplate(npcDat));
boat.setHeading(heading);
boat.setXYZInvisible(x, y, z);
boat.spawnMe();
_boats.put(boat.getObjectId(), boat);
return boat;
}

View File

@ -45,7 +45,7 @@ public final class CHSiegeManager
private static final Logger _log = Logger.getLogger(CHSiegeManager.class.getName());
private static final String SQL_LOAD_HALLS = "SELECT * FROM siegable_clanhall";
private final HashMap<Integer, SiegableHall> _siegableHalls = new HashMap<>();
private final Map<Integer, SiegableHall> _siegableHalls = new HashMap<>();
protected CHSiegeManager()
{
@ -86,7 +86,7 @@ public final class CHSiegeManager
}
}
public HashMap<Integer, SiegableHall> getConquerableHalls()
public Map<Integer, SiegableHall> getConquerableHalls()
{
return _siegableHalls;
}

View File

@ -42,7 +42,7 @@ public final class CastleManager implements InstanceListManager
{
private static final Logger _log = Logger.getLogger(CastleManager.class.getName());
private List<Castle> _castles;
private final List<Castle> _castles = new ArrayList<>();
private final Map<Integer, Long> _castleSiegeDate = new ConcurrentHashMap<>();
@ -72,9 +72,9 @@ public final class CastleManager implements InstanceListManager
{
double distance;
Castle castle;
for (int i = 0; i < getCastles().size(); i++)
for (int i = 0; i < _castles.size(); i++)
{
castle = getCastles().get(i);
castle = _castles.get(i);
if (castle == null)
{
continue;
@ -92,7 +92,7 @@ public final class CastleManager implements InstanceListManager
public final Castle getCastleById(int castleId)
{
for (Castle temp : getCastles())
for (Castle temp : _castles)
{
if (temp.getResidenceId() == castleId)
{
@ -104,7 +104,7 @@ public final class CastleManager implements InstanceListManager
public final Castle getCastleByOwner(L2Clan clan)
{
for (Castle temp : getCastles())
for (Castle temp : _castles)
{
if (temp.getOwnerId() == clan.getId())
{
@ -116,7 +116,7 @@ public final class CastleManager implements InstanceListManager
public final Castle getCastle(String name)
{
for (Castle temp : getCastles())
for (Castle temp : _castles)
{
if (temp.getName().equalsIgnoreCase(name.trim()))
{
@ -128,7 +128,7 @@ public final class CastleManager implements InstanceListManager
public final Castle getCastle(int x, int y, int z)
{
for (Castle temp : getCastles())
for (Castle temp : _castles)
{
if (temp.checkIfInZone(x, y, z))
{
@ -146,9 +146,9 @@ public final class CastleManager implements InstanceListManager
public final int getCastleIndex(int castleId)
{
Castle castle;
for (int i = 0; i < getCastles().size(); i++)
for (int i = 0; i < _castles.size(); i++)
{
castle = getCastles().get(i);
castle = _castles.get(i);
if ((castle != null) && (castle.getResidenceId() == castleId))
{
return i;
@ -165,9 +165,9 @@ public final class CastleManager implements InstanceListManager
public final int getCastleIndex(int x, int y, int z)
{
Castle castle;
for (int i = 0; i < getCastles().size(); i++)
for (int i = 0; i < _castles.size(); i++)
{
castle = getCastles().get(i);
castle = _castles.get(i);
if ((castle != null) && castle.checkIfInZone(x, y, z))
{
return i;
@ -178,17 +178,13 @@ public final class CastleManager implements InstanceListManager
public final List<Castle> getCastles()
{
if (_castles == null)
{
_castles = new ArrayList<>();
}
return _castles;
}
public boolean hasOwnedCastle()
{
boolean hasOwnedCastle = false;
for (Castle castle : getCastles())
for (Castle castle : _castles)
{
if (castle.getOwnerId() > 0)
{
@ -279,9 +275,9 @@ public final class CastleManager implements InstanceListManager
{
while (rs.next())
{
getCastles().add(new Castle(rs.getInt("id")));
_castles.add(new Castle(rs.getInt("id")));
}
_log.info(getClass().getSimpleName() + ": Loaded: " + getCastles().size() + " castles");
_log.info(getClass().getSimpleName() + ": Loaded: " + _castles.size() + " castles");
}
catch (Exception e)
{

View File

@ -40,7 +40,6 @@ import org.w3c.dom.Node;
import com.l2jserver.Config;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.enums.ManorMode;
import com.l2jserver.gameserver.model.CropProcure;
import com.l2jserver.gameserver.model.L2Clan;
@ -53,6 +52,7 @@ import com.l2jserver.gameserver.model.interfaces.IStorable;
import com.l2jserver.gameserver.model.itemcontainer.ItemContainer;
import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.util.Rnd;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* Castle manor system.

View File

@ -23,6 +23,7 @@ import java.sql.ResultSet;
import java.sql.Statement;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -44,9 +45,9 @@ public final class ClanHallManager
{
protected static final Logger _log = Logger.getLogger(ClanHallManager.class.getName());
private final Map<Integer, AuctionableHall> _clanHall;
private final Map<Integer, AuctionableHall> _freeClanHall;
private final Map<Integer, AuctionableHall> _allAuctionableClanHalls;
private final Map<Integer, AuctionableHall> _clanHall = new ConcurrentHashMap<>();
private final Map<Integer, AuctionableHall> _freeClanHall = new ConcurrentHashMap<>();
private final Map<Integer, AuctionableHall> _allAuctionableClanHalls = new HashMap<>();
private static Map<Integer, ClanHall> _allClanHalls = new HashMap<>();
private boolean _loaded = false;
@ -57,9 +58,6 @@ public final class ClanHallManager
protected ClanHallManager()
{
_clanHall = new HashMap<>();
_freeClanHall = new HashMap<>();
_allAuctionableClanHalls = new HashMap<>();
load();
}
@ -216,7 +214,7 @@ public final class ClanHallManager
*/
public final ClanHall getClanHall(int x, int y, int z)
{
for (ClanHall temp : getAllClanHalls().values())
for (ClanHall temp : _allClanHalls.values())
{
if (temp.checkIfInZone(x, y, z))
{
@ -313,4 +311,4 @@ public final class ClanHallManager
{
protected static final ClanHallManager _instance = new ClanHallManager();
}
}
}

View File

@ -21,7 +21,8 @@ package com.l2jserver.gameserver.instancemanager;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -37,7 +38,7 @@ public final class CoupleManager
{
private static final Logger _log = Logger.getLogger(CoupleManager.class.getName());
private ArrayList<Couple> _couples;
private final List<Couple> _couples = new CopyOnWriteArrayList<>();
protected CoupleManager()
{
@ -46,7 +47,7 @@ public final class CoupleManager
public void reload()
{
getCouples().clear();
_couples.clear();
load();
}
@ -84,15 +85,15 @@ public final class CoupleManager
{
if ((player1.getPartnerId() == 0) && (player2.getPartnerId() == 0))
{
int _player1id = player1.getObjectId();
int _player2id = player2.getObjectId();
int player1id = player1.getObjectId();
int player2id = player2.getObjectId();
Couple _new = new Couple(player1, player2);
getCouples().add(_new);
player1.setPartnerId(_player2id);
player2.setPartnerId(_player1id);
player1.setCoupleId(_new.getId());
player2.setCoupleId(_new.getId());
Couple couple = new Couple(player1, player2);
getCouples().add(couple);
player1.setPartnerId(player2id);
player2.setPartnerId(player1id);
player1.setCoupleId(couple.getId());
player2.setCoupleId(couple.getId());
}
}
}
@ -138,12 +139,8 @@ public final class CoupleManager
return -1;
}
public final ArrayList<Couple> getCouples()
public final List<Couple> getCouples()
{
if (_couples == null)
{
_couples = new ArrayList<>();
}
return _couples;
}

View File

@ -19,9 +19,9 @@
package com.l2jserver.gameserver.instancemanager;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -38,9 +38,9 @@ public final class DayNightSpawnManager
private static Logger _log = Logger.getLogger(DayNightSpawnManager.class.getName());
private final List<L2Spawn> _dayCreatures;
private final List<L2Spawn> _nightCreatures;
private final Map<L2Spawn, L2RaidBossInstance> _bosses;
private final List<L2Spawn> _dayCreatures = new ArrayList<>();
private final List<L2Spawn> _nightCreatures = new ArrayList<>();
private final Map<L2Spawn, L2RaidBossInstance> _bosses = new ConcurrentHashMap<>();
// private static int _currentState; // 0 = Day, 1 = Night
@ -51,9 +51,7 @@ public final class DayNightSpawnManager
protected DayNightSpawnManager()
{
_dayCreatures = new ArrayList<>();
_nightCreatures = new ArrayList<>();
_bosses = new HashMap<>();
// Prevent external initialization.
}
public void addDayCreature(L2Spawn spawnDat)
@ -202,7 +200,6 @@ public final class DayNightSpawnManager
{
boss = (L2RaidBossInstance) spawn.doSpawn();
RaidBossSpawnManager.getInstance().notifySpawnNightBoss(boss);
_bosses.remove(spawn);
_bosses.put(spawn, boss);
continue;
}
@ -257,8 +254,6 @@ public final class DayNightSpawnManager
return raidboss;
}
_bosses.put(spawnDat, null);
return null;
}

View File

@ -36,7 +36,7 @@ public final class FortManager implements InstanceListManager
{
protected static final Logger _log = Logger.getLogger(FortManager.class.getName());
private List<Fort> _forts;
private final List<Fort> _forts = new ArrayList<>();
public final int findNearestFortIndex(L2Object obj)
{
@ -50,9 +50,9 @@ public final class FortManager implements InstanceListManager
{
double distance;
Fort fort;
for (int i = 0; i < getForts().size(); i++)
for (int i = 0; i < _forts.size(); i++)
{
fort = getForts().get(i);
fort = _forts.get(i);
if (fort == null)
{
continue;
@ -70,7 +70,7 @@ public final class FortManager implements InstanceListManager
public final Fort getFortById(int fortId)
{
for (Fort f : getForts())
for (Fort f : _forts)
{
if (f.getResidenceId() == fortId)
{
@ -82,7 +82,7 @@ public final class FortManager implements InstanceListManager
public final Fort getFortByOwner(L2Clan clan)
{
for (Fort f : getForts())
for (Fort f : _forts)
{
if (f.getOwnerClan() == clan)
{
@ -94,7 +94,7 @@ public final class FortManager implements InstanceListManager
public final Fort getFort(String name)
{
for (Fort f : getForts())
for (Fort f : _forts)
{
if (f.getName().equalsIgnoreCase(name.trim()))
{
@ -106,7 +106,7 @@ public final class FortManager implements InstanceListManager
public final Fort getFort(int x, int y, int z)
{
for (Fort f : getForts())
for (Fort f : _forts)
{
if (f.checkIfInZone(x, y, z))
{
@ -124,9 +124,9 @@ public final class FortManager implements InstanceListManager
public final int getFortIndex(int fortId)
{
Fort fort;
for (int i = 0; i < getForts().size(); i++)
for (int i = 0; i < _forts.size(); i++)
{
fort = getForts().get(i);
fort = _forts.get(i);
if ((fort != null) && (fort.getResidenceId() == fortId))
{
return i;
@ -143,9 +143,9 @@ public final class FortManager implements InstanceListManager
public final int getFortIndex(int x, int y, int z)
{
Fort fort;
for (int i = 0; i < getForts().size(); i++)
for (int i = 0; i < _forts.size(); i++)
{
fort = getForts().get(i);
fort = _forts.get(i);
if ((fort != null) && fort.checkIfInZone(x, y, z))
{
return i;
@ -156,10 +156,6 @@ public final class FortManager implements InstanceListManager
public final List<Fort> getForts()
{
if (_forts == null)
{
_forts = new ArrayList<>();
}
return _forts;
}
@ -172,11 +168,11 @@ public final class FortManager implements InstanceListManager
{
while (rs.next())
{
getForts().add(new Fort(rs.getInt("id")));
_forts.add(new Fort(rs.getInt("id")));
}
_log.info(getClass().getSimpleName() + ": Loaded: " + getForts().size() + " fortress");
for (Fort fort : getForts())
_log.info(getClass().getSimpleName() + ": Loaded: " + _forts.size() + " fortress");
for (Fort fort : _forts)
{
fort.getSiege().getSiegeGuardManager().loadSiegeGuard();
}

View File

@ -23,6 +23,8 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -35,7 +37,7 @@ public final class FortSiegeGuardManager
private static final Logger _log = Logger.getLogger(FortSiegeGuardManager.class.getName());
private final Fort _fort;
private final HashMap<Integer, ArrayList<L2Spawn>> _siegeGuards = new HashMap<>();
private final Map<Integer, List<L2Spawn>> _siegeGuards = new HashMap<>();
public FortSiegeGuardManager(Fort fort)
{
@ -49,7 +51,7 @@ public final class FortSiegeGuardManager
{
try
{
final ArrayList<L2Spawn> monsterList = getSiegeGuardSpawn().get(getFort().getResidenceId());
final List<L2Spawn> monsterList = _siegeGuards.get(getFort().getResidenceId());
if (monsterList != null)
{
for (L2Spawn spawnDat : monsterList)
@ -79,8 +81,7 @@ public final class FortSiegeGuardManager
{
try
{
final ArrayList<L2Spawn> monsterList = getSiegeGuardSpawn().get(getFort().getResidenceId());
final List<L2Spawn> monsterList = _siegeGuards.get(getFort().getResidenceId());
if (monsterList != null)
{
for (L2Spawn spawnDat : monsterList)
@ -112,7 +113,7 @@ public final class FortSiegeGuardManager
ps.setInt(1, fortId);
try (ResultSet rs = ps.executeQuery())
{
ArrayList<L2Spawn> siegeGuardSpawns = new ArrayList<>();
final List<L2Spawn> siegeGuardSpawns = new ArrayList<>();
while (rs.next())
{
final L2Spawn spawn = new L2Spawn(rs.getInt("npcId"));
@ -140,7 +141,7 @@ public final class FortSiegeGuardManager
return _fort;
}
public final HashMap<Integer, ArrayList<L2Spawn>> getSiegeGuardSpawn()
public final Map<Integer, List<L2Spawn>> getSiegeGuardSpawn()
{
return _siegeGuards;
}

View File

@ -25,10 +25,11 @@ import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.StringTokenizer;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -53,15 +54,15 @@ public final class FortSiegeManager
private int _attackerMaxClans = 500; // Max number of clans
// Fort Siege settings
private HashMap<Integer, ArrayList<FortSiegeSpawn>> _commanderSpawnList;
private HashMap<Integer, ArrayList<CombatFlag>> _flagList;
private Map<Integer, List<FortSiegeSpawn>> _commanderSpawnList;
private Map<Integer, List<CombatFlag>> _flagList;
private boolean _justToTerritory = true; // Changeable in fortsiege.properties
private int _flagMaxCount = 1; // Changeable in fortsiege.properties
private int _siegeClanMinLevel = 4; // Changeable in fortsiege.properties
private int _siegeLength = 60; // Time in minute. Changeable in fortsiege.properties
private int _countDownLength = 10; // Time in minute. Changeable in fortsiege.properties
private int _suspiciousMerchantRespawnDelay = 180; // Time in minute. Changeable in fortsiege.properties
private List<FortSiege> _sieges;
private final List<FortSiege> _sieges = new ArrayList<>();
protected FortSiegeManager()
{
@ -137,13 +138,13 @@ public final class FortSiegeManager
_suspiciousMerchantRespawnDelay = Integer.decode(siegeSettings.getProperty("SuspiciousMerchantRespawnDelay", "180"));
// Siege spawns settings
_commanderSpawnList = new HashMap<>();
_flagList = new HashMap<>();
_commanderSpawnList = new ConcurrentHashMap<>();
_flagList = new ConcurrentHashMap<>();
for (Fort fort : FortManager.getInstance().getForts())
{
ArrayList<FortSiegeSpawn> _commanderSpawns = new ArrayList<>();
ArrayList<CombatFlag> _flagSpawns = new ArrayList<>();
List<FortSiegeSpawn> commanderSpawns = new ArrayList<>();
List<CombatFlag> flagSpawns = new ArrayList<>();
for (int i = 1; i < 5; i++)
{
final String _spawnParams = siegeSettings.getProperty(fort.getName().replace(" ", "") + "Commander" + i, "");
@ -161,7 +162,7 @@ public final class FortSiegeManager
int heading = Integer.parseInt(st.nextToken());
int npc_id = Integer.parseInt(st.nextToken());
_commanderSpawns.add(new FortSiegeSpawn(fort.getResidenceId(), x, y, z, heading, npc_id, i));
commanderSpawns.add(new FortSiegeSpawn(fort.getResidenceId(), x, y, z, heading, npc_id, i));
}
catch (Exception e)
{
@ -169,7 +170,7 @@ public final class FortSiegeManager
}
}
_commanderSpawnList.put(fort.getResidenceId(), _commanderSpawns);
_commanderSpawnList.put(fort.getResidenceId(), commanderSpawns);
for (int i = 1; i < 4; i++)
{
@ -187,33 +188,25 @@ public final class FortSiegeManager
int z = Integer.parseInt(st.nextToken());
int flag_id = Integer.parseInt(st.nextToken());
_flagSpawns.add(new CombatFlag(fort.getResidenceId(), x, y, z, 0, flag_id));
flagSpawns.add(new CombatFlag(fort.getResidenceId(), x, y, z, 0, flag_id));
}
catch (Exception e)
{
_log.warning("Error while loading flag(s) for " + fort.getName() + " fort.");
}
}
_flagList.put(fort.getResidenceId(), _flagSpawns);
_flagList.put(fort.getResidenceId(), flagSpawns);
}
}
public final ArrayList<FortSiegeSpawn> getCommanderSpawnList(int _fortId)
public final List<FortSiegeSpawn> getCommanderSpawnList(int _fortId)
{
if (_commanderSpawnList.containsKey(_fortId))
{
return _commanderSpawnList.get(_fortId);
}
return null;
return _commanderSpawnList.get(_fortId);
}
public final ArrayList<CombatFlag> getFlagList(int _fortId)
public final List<CombatFlag> getFlagList(int _fortId)
{
if (_flagList.containsKey(_fortId))
{
return _flagList.get(_fortId);
}
return null;
return _flagList.get(_fortId);
}
public final int getAttackerMaxClans()
@ -270,19 +263,11 @@ public final class FortSiegeManager
public final List<FortSiege> getSieges()
{
if (_sieges == null)
{
_sieges = new ArrayList<>();
}
return _sieges;
}
public final void addSiege(FortSiege fortSiege)
{
if (_sieges == null)
{
_sieges = new ArrayList<>();
}
_sieges.add(fortSiege);
}
@ -300,7 +285,7 @@ public final class FortSiegeManager
final Fort fort = FortManager.getInstance().getFort(player);
final ArrayList<CombatFlag> fcf = _flagList.get(fort.getResidenceId());
final List<CombatFlag> fcf = _flagList.get(fort.getResidenceId());
for (CombatFlag cf : fcf)
{
if (cf.getCombatFlagInstance() == item)
@ -347,9 +332,7 @@ public final class FortSiegeManager
public void dropCombatFlag(L2PcInstance player, int fortId)
{
final Fort fort = FortManager.getInstance().getFortById(fortId);
final ArrayList<CombatFlag> fcf = _flagList.get(fort.getResidenceId());
final List<CombatFlag> fcf = _flagList.get(fort.getResidenceId());
for (CombatFlag cf : fcf)
{
if (cf.getPlayerObjectId() == player.getObjectId())

View File

@ -24,10 +24,12 @@ import java.sql.ResultSet;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ScheduledFuture;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -120,9 +122,9 @@ public final class FourSepulchersManager
};
// @formatter:on
protected Map<Integer, Boolean> _archonSpawned = new HashMap<>();
protected Map<Integer, Boolean> _hallInUse = new HashMap<>();
protected Map<Integer, L2PcInstance> _challengers = new HashMap<>();
protected Map<Integer, Boolean> _archonSpawned = new ConcurrentHashMap<>();
protected Map<Integer, Boolean> _hallInUse = new ConcurrentHashMap<>();
protected Map<Integer, L2PcInstance> _challengers = new ConcurrentHashMap<>();
protected Map<Integer, int[]> _startHallSpawns = new HashMap<>();
protected Map<Integer, Integer> _hallGateKeepers = new HashMap<>();
protected Map<Integer, Integer> _keyBoxNpc = new HashMap<>();
@ -143,7 +145,7 @@ public final class FourSepulchersManager
protected List<L2Spawn> _managers;
protected List<L2Spawn> _dukeFinalSpawns;
protected List<L2Spawn> _emperorsGraveSpawns;
protected List<L2Npc> _allMobs = new ArrayList<>();
protected List<L2Npc> _allMobs = new CopyOnWriteArrayList<>();
private long _attackTimeEnd = 0;
private long _coolDownTimeEnd = 0;
@ -260,19 +262,15 @@ public final class FourSepulchersManager
_hallInUse.put(31923, false);
_hallInUse.put(31924, false);
if (_archonSpawned.size() != 0)
for (int npcId : _archonSpawned.keySet())
{
Set<Integer> npcIdSet = _archonSpawned.keySet();
for (int npcId : npcIdSet)
{
_archonSpawned.put(npcId, false);
}
_archonSpawned.put(npcId, false);
}
}
protected void spawnManagers()
{
_managers = new ArrayList<>();
_managers = new CopyOnWriteArrayList<>();
for (int npcId = 31921; npcId <= 31924; npcId++)
{
@ -972,7 +970,7 @@ public final class FourSepulchersManager
if (Config.FS_PARTY_MEMBER_COUNT > 1)
{
List<L2PcInstance> members = new ArrayList<>();
final List<L2PcInstance> members = new LinkedList<>();
for (L2PcInstance mem : player.getParty().getMembers())
{
if (!mem.isDead() && Util.checkIfInRange(700, player, mem, true))
@ -1006,7 +1004,7 @@ public final class FourSepulchersManager
}
if ((Config.FS_PARTY_MEMBER_COUNT <= 1) && player.isInParty())
{
List<L2PcInstance> members = new ArrayList<>();
final List<L2PcInstance> members = new LinkedList<>();
for (L2PcInstance mem : player.getParty().getMembers())
{
if (!mem.isDead() && Util.checkIfInRange(700, player, mem, true))
@ -1084,9 +1082,8 @@ public final class FourSepulchersManager
return;
}
List<L2Spawn> monsterList;
List<L2SepulcherMonsterInstance> mobs = new ArrayList<>();
final List<L2SepulcherMonsterInstance> mobs = new CopyOnWriteArrayList<>();
final List<L2Spawn> monsterList;
if (Rnd.get(2) == 0)
{
monsterList = _physicalMonsters.get(npcId);
@ -1366,11 +1363,6 @@ public final class FourSepulchersManager
{
for (L2Npc mob : _allMobs)
{
if (mob == null)
{
continue;
}
try
{
if (mob.getSpawn() != null)

View File

@ -29,6 +29,8 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -59,13 +61,13 @@ public final class GrandBossManager implements IStorable
protected static Logger _log = Logger.getLogger(GrandBossManager.class.getName());
protected static Map<Integer, L2GrandBossInstance> _bosses = new HashMap<>();
protected static final Map<Integer, L2GrandBossInstance> BOSSES = new ConcurrentHashMap<>();
protected static Map<Integer, StatsSet> _storedInfo = new HashMap<>();
private final Map<Integer, Integer> _bossStatus = new HashMap<>();
private final List<L2BossZone> _zones = new ArrayList<>();
private final List<L2BossZone> _zones = new CopyOnWriteArrayList<>();
protected GrandBossManager()
{
@ -276,13 +278,13 @@ public final class GrandBossManager implements IStorable
{
if (boss != null)
{
_bosses.put(boss.getId(), boss);
BOSSES.put(boss.getId(), boss);
}
}
public L2GrandBossInstance getBoss(int bossId)
{
return _bosses.get(bossId);
return BOSSES.get(bossId);
}
public StatsSet getStatsSet(int bossId)
@ -329,7 +331,7 @@ public final class GrandBossManager implements IStorable
}
for (Entry<Integer, StatsSet> e : _storedInfo.entrySet())
{
final L2GrandBossInstance boss = _bosses.get(e.getKey());
final L2GrandBossInstance boss = BOSSES.get(e.getKey());
StatsSet info = e.getValue();
if ((boss == null) || (info == null))
{
@ -379,7 +381,7 @@ public final class GrandBossManager implements IStorable
{
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
{
L2GrandBossInstance boss = _bosses.get(bossId);
L2GrandBossInstance boss = BOSSES.get(bossId);
StatsSet info = _storedInfo.get(bossId);
if (statusOnly || (boss == null) || (info == null))
@ -428,7 +430,7 @@ public final class GrandBossManager implements IStorable
{
storeMe();
_bosses.clear();
BOSSES.clear();
_storedInfo.clear();
_bossStatus.clear();
_zones.clear();

View File

@ -24,28 +24,29 @@ import java.sql.ResultSet;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.model.entity.Instance;
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* @author evill33t, GodKratos
*/
public final class InstanceManager implements IXmlReader
{
private static final Map<Integer, Instance> _instanceList = new HashMap<>();
private final Map<Integer, InstanceWorld> _instanceWorlds = new HashMap<>();
private static final Map<Integer, Instance> INSTANCES = new ConcurrentHashMap<>();
private final Map<Integer, InstanceWorld> _instanceWorlds = new ConcurrentHashMap<>();
private int _dynamic = 300000;
// InstanceId Names
private static final Map<Integer, String> _instanceIdNames = new HashMap<>();
private final Map<Integer, Map<Integer, Long>> _playerInstanceTimes = new HashMap<>();
private final Map<Integer, Map<Integer, Long>> _playerInstanceTimes = new ConcurrentHashMap<>();
// SQL Queries
private static final String ADD_INSTANCE_TIME = "INSERT INTO character_instance_time (charId,instanceId,time) values (?,?,?) ON DUPLICATE KEY UPDATE time=?";
private static final String RESTORE_INSTANCE_TIMES = "SELECT instanceId,time FROM character_instance_time WHERE charId=?";
@ -54,10 +55,10 @@ public final class InstanceManager implements IXmlReader
protected InstanceManager()
{
// Creates the multiverse.
_instanceList.put(-1, new Instance(-1, "multiverse"));
INSTANCES.put(-1, new Instance(-1, "multiverse"));
LOGGER.info(getClass().getSimpleName() + ": Multiverse Instance created.");
// Creates the universe.
_instanceList.put(0, new Instance(0, "universe"));
INSTANCES.put(0, new Instance(0, "universe"));
LOGGER.info(getClass().getSimpleName() + ": Universe Instance created.");
load();
}
@ -166,7 +167,7 @@ public final class InstanceManager implements IXmlReader
{
return; // already restored
}
_playerInstanceTimes.put(playerObjId, new HashMap<Integer, Long>());
_playerInstanceTimes.put(playerObjId, new ConcurrentHashMap<>());
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(RESTORE_INSTANCE_TIMES))
{
@ -270,18 +271,15 @@ public final class InstanceManager implements IXmlReader
{
return;
}
final Instance temp = _instanceList.get(instanceid);
final Instance temp = INSTANCES.get(instanceid);
if (temp != null)
{
temp.removeNpcs();
temp.removePlayers();
temp.removeDoors();
temp.cancelTimer();
_instanceList.remove(instanceid);
if (_instanceWorlds.containsKey(instanceid))
{
_instanceWorlds.remove(instanceid);
}
INSTANCES.remove(instanceid);
_instanceWorlds.remove(instanceid);
}
}
@ -291,7 +289,7 @@ public final class InstanceManager implements IXmlReader
*/
public Instance getInstance(int instanceid)
{
return _instanceList.get(instanceid);
return INSTANCES.get(instanceid);
}
/**
@ -299,7 +297,7 @@ public final class InstanceManager implements IXmlReader
*/
public Map<Integer, Instance> getInstances()
{
return _instanceList;
return INSTANCES;
}
/**
@ -308,7 +306,7 @@ public final class InstanceManager implements IXmlReader
*/
public int getPlayerInstance(int objectId)
{
for (Instance temp : _instanceList.values())
for (Instance temp : INSTANCES.values())
{
if (temp == null)
{
@ -336,7 +334,7 @@ public final class InstanceManager implements IXmlReader
}
final Instance instance = new Instance(id);
_instanceList.put(id, instance);
INSTANCES.put(id, instance);
return true;
}
@ -353,7 +351,7 @@ public final class InstanceManager implements IXmlReader
}
final Instance instance = new Instance(id);
_instanceList.put(id, instance);
INSTANCES.put(id, instance);
instance.loadInstanceTemplate(template);
return true;
}
@ -375,7 +373,7 @@ public final class InstanceManager implements IXmlReader
}
}
final Instance instance = new Instance(_dynamic);
_instanceList.put(_dynamic, instance);
INSTANCES.put(_dynamic, instance);
if (template != null)
{
instance.loadInstanceTemplate(template);

View File

@ -23,8 +23,8 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -43,7 +43,7 @@ public final class ItemsOnGroundManager implements Runnable
{
private static final Logger _log = Logger.getLogger(ItemsOnGroundManager.class.getName());
private final List<L2ItemInstance> _items = new ArrayList<>();
private final List<L2ItemInstance> _items = new CopyOnWriteArrayList<>();
protected ItemsOnGroundManager()
{

View File

@ -27,7 +27,6 @@ import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.Config;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.L2MapRegion;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.Location;
@ -42,6 +41,7 @@ import com.l2jserver.gameserver.model.entity.Instance;
import com.l2jserver.gameserver.model.entity.clanhall.SiegableHall;
import com.l2jserver.gameserver.model.zone.type.L2ClanHallZone;
import com.l2jserver.gameserver.model.zone.type.L2RespawnZone;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* @author Nyaran

View File

@ -21,7 +21,6 @@ package com.l2jserver.gameserver.instancemanager;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level;
@ -49,7 +48,7 @@ public final class MercTicketManager
{
private static final Logger _log = Logger.getLogger(MercTicketManager.class.getName());
private static final List<L2ItemInstance> _droppedTickets = new CopyOnWriteArrayList<>();
private static final List<L2ItemInstance> DROPPED_TICKETS = new CopyOnWriteArrayList<>();
// TODO: move all these values into siege.properties
// max tickets per merc type = 10 + (castleid * 2)?
@ -139,7 +138,7 @@ public final class MercTicketManager
public void reload()
{
_droppedTickets.clear();
DROPPED_TICKETS.clear();
load();
}
@ -194,7 +193,7 @@ public final class MercTicketManager
dropticket.dropMe(null, x, y, z);
dropticket.setDropTime(0); // avoids it from being removed by the auto item destroyer
L2World.getInstance().storeObject(dropticket);
_droppedTickets.add(dropticket);
DROPPED_TICKETS.add(dropticket);
}
break;
}
@ -203,7 +202,7 @@ public final class MercTicketManager
rs.close();
s.close();
_log.info(getClass().getSimpleName() + ": Loaded: " + _droppedTickets.size() + " Mercenary Tickets");
_log.info(getClass().getSimpleName() + ": Loaded: " + DROPPED_TICKETS.size() + " Mercenary Tickets");
}
catch (Exception e)
{
@ -235,7 +234,7 @@ public final class MercTicketManager
}
int count = 0;
for (L2ItemInstance ticket : _droppedTickets)
for (L2ItemInstance ticket : DROPPED_TICKETS)
{
if ((ticket != null) && (ticket.getId() == itemId))
{
@ -268,7 +267,7 @@ public final class MercTicketManager
}
int count = 0;
for (L2ItemInstance ticket : _droppedTickets)
for (L2ItemInstance ticket : DROPPED_TICKETS)
{
if ((ticket != null) && (getTicketCastleId(ticket.getId()) == castleId))
{
@ -289,7 +288,7 @@ public final class MercTicketManager
public boolean isTooCloseToAnotherTicket(int x, int y, int z)
{
for (L2ItemInstance item : _droppedTickets)
for (L2ItemInstance item : DROPPED_TICKETS)
{
double dx = x - item.getX();
double dy = y - item.getY();
@ -339,7 +338,7 @@ public final class MercTicketManager
dropticket.setDropTime(0); // avoids it from beeing removed by the auto item destroyer
L2World.getInstance().storeObject(dropticket); // add to the world
// and keep track of this ticket in the list
_droppedTickets.add(dropticket);
DROPPED_TICKETS.add(dropticket);
return NPC_IDS[i];
}
@ -370,15 +369,13 @@ public final class MercTicketManager
*/
public void deleteTickets(int castleId)
{
Iterator<L2ItemInstance> it = _droppedTickets.iterator();
while (it.hasNext())
for (L2ItemInstance item : DROPPED_TICKETS)
{
L2ItemInstance item = it.next();
if ((item != null) && (getTicketCastleId(item.getId()) == castleId))
{
item.decayMe();
L2World.getInstance().removeObject(item);
it.remove();
DROPPED_TICKETS.remove(item);
}
}
}
@ -409,7 +406,7 @@ public final class MercTicketManager
(new SiegeGuardManager(castle)).removeMerc(npcId, item.getX(), item.getY(), item.getZ());
}
_droppedTickets.remove(item);
DROPPED_TICKETS.remove(item);
}
public int[] getItemIds()
@ -419,7 +416,7 @@ public final class MercTicketManager
public final List<L2ItemInstance> getDroppedTickets()
{
return _droppedTickets;
return DROPPED_TICKETS;
}
/**

View File

@ -26,8 +26,10 @@ import java.sql.Statement;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -42,7 +44,7 @@ public class RaidBossPointsManager
{
private static final Logger _log = Logger.getLogger(RaidBossPointsManager.class.getName());
private HashMap<Integer, Map<Integer, Integer>> _list;
private final Map<Integer, Map<Integer, Integer>> _list = new ConcurrentHashMap<>();
public RaidBossPointsManager()
{
@ -51,7 +53,6 @@ public class RaidBossPointsManager
private final void init()
{
_list = new HashMap<>();
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT `charId`,`boss_id`,`points` FROM `character_raid_points`"))
@ -101,8 +102,7 @@ public class RaidBossPointsManager
public final int getPointsByOwnerId(int ownerId)
{
Map<Integer, Integer> tmpPoint;
tmpPoint = _list.get(ownerId);
Map<Integer, Integer> tmpPoint = _list.get(ownerId);
int totalPoints = 0;
if ((tmpPoint == null) || tmpPoint.isEmpty())
@ -148,9 +148,7 @@ public class RaidBossPointsManager
public Map<Integer, Integer> getRankList()
{
Map<Integer, Integer> tmpRanking = new HashMap<>();
Map<Integer, Integer> tmpPoints = new HashMap<>();
final Map<Integer, Integer> tmpPoints = new HashMap<>();
for (int ownerId : _list.keySet())
{
int totalPoints = getPointsByOwnerId(ownerId);
@ -159,16 +157,15 @@ public class RaidBossPointsManager
tmpPoints.put(ownerId, totalPoints);
}
}
ArrayList<Entry<Integer, Integer>> list = new ArrayList<>(tmpPoints.entrySet());
final List<Entry<Integer, Integer>> list = new ArrayList<>(tmpPoints.entrySet());
list.sort(Comparator.comparing(Entry<Integer, Integer>::getValue).reversed());
int ranking = 1;
for (Map.Entry<Integer, Integer> entry : list)
final Map<Integer, Integer> tmpRanking = new HashMap<>();
for (Entry<Integer, Integer> entry : list)
{
tmpRanking.put(entry.getKey(), ranking++);
}
return tmpRanking;
}

View File

@ -23,8 +23,8 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledFuture;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -46,10 +46,10 @@ public class RaidBossSpawnManager
{
private static final Logger _log = Logger.getLogger(RaidBossSpawnManager.class.getName());
protected static final Map<Integer, L2RaidBossInstance> _bosses = new HashMap<>();
protected static final Map<Integer, L2Spawn> _spawns = new HashMap<>();
protected static final Map<Integer, StatsSet> _storedInfo = new HashMap<>();
protected static final Map<Integer, ScheduledFuture<?>> _schedules = new HashMap<>();
protected static final Map<Integer, L2RaidBossInstance> _bosses = new ConcurrentHashMap<>();
protected static final Map<Integer, L2Spawn> _spawns = new ConcurrentHashMap<>();
protected static final Map<Integer, StatsSet> _storedInfo = new ConcurrentHashMap<>();
protected static final Map<Integer, ScheduledFuture<?>> _schedules = new ConcurrentHashMap<>();
public static enum StatusEnum
{

View File

@ -148,7 +148,7 @@ public final class SiegeGuardManager
int hiredCount = 0, hiredMax = MercTicketManager.getInstance().getMaxAllowedMerc(_castle.getResidenceId());
boolean isHired = (getCastle().getOwnerId() > 0) ? true : false;
loadSiegeGuard();
for (L2Spawn spawn : getSiegeGuardSpawn())
for (L2Spawn spawn : _siegeGuardSpawn)
{
if (spawn != null)
{
@ -175,7 +175,7 @@ public final class SiegeGuardManager
*/
public void unspawnSiegeGuard()
{
for (L2Spawn spawn : getSiegeGuardSpawn())
for (L2Spawn spawn : _siegeGuardSpawn)
{
if ((spawn != null) && (spawn.getLastSpawn() != null))
{
@ -184,7 +184,7 @@ public final class SiegeGuardManager
}
}
getSiegeGuardSpawn().clear();
_siegeGuardSpawn.clear();
}
/**

View File

@ -268,7 +268,7 @@ public final class SiegeManager
public final List<Siege> getSieges()
{
ArrayList<Siege> sieges = new ArrayList<>();
List<Siege> sieges = new ArrayList<>();
for (Castle castle : CastleManager.getInstance().getCastles())
{
sieges.add(castle.getSiege());

View File

@ -29,7 +29,6 @@ import org.w3c.dom.Node;
import com.l2jserver.gameserver.ThreadPoolManager;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.enums.ChatType;
import com.l2jserver.gameserver.instancemanager.tasks.StartMovingTask;
import com.l2jserver.gameserver.model.L2NpcWalkerNode;
@ -45,6 +44,7 @@ import com.l2jserver.gameserver.model.holders.NpcRoutesHolder;
import com.l2jserver.gameserver.network.NpcStringId;
import com.l2jserver.gameserver.network.serverpackets.NpcSay;
import com.l2jserver.gameserver.util.Broadcast;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* This class manages walking monsters.

View File

@ -32,7 +32,6 @@ import org.w3c.dom.Document;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
import com.l2jserver.gameserver.data.xml.IXmlReader;
import com.l2jserver.gameserver.model.L2Object;
import com.l2jserver.gameserver.model.L2World;
import com.l2jserver.gameserver.model.L2WorldRegion;
@ -49,6 +48,7 @@ import com.l2jserver.gameserver.model.zone.type.L2ArenaZone;
import com.l2jserver.gameserver.model.zone.type.L2OlympiadStadiumZone;
import com.l2jserver.gameserver.model.zone.type.L2RespawnZone;
import com.l2jserver.gameserver.model.zone.type.NpcSpawnTerritory;
import com.l2jserver.util.data.xml.IXmlReader;
/**
* This class manages the zones

View File

@ -23,9 +23,11 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ScheduledFuture;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
@ -65,16 +67,13 @@ public class AutoSpawnHandler
private static final int DEFAULT_RESPAWN = 3600000; // 1 hour in millisecs
private static final int DEFAULT_DESPAWN = 3600000; // 1 hour in millisecs
protected Map<Integer, AutoSpawnInstance> _registeredSpawns;
protected Map<Integer, ScheduledFuture<?>> _runningSpawns;
protected Map<Integer, AutoSpawnInstance> _registeredSpawns = new ConcurrentHashMap<>();
protected Map<Integer, ScheduledFuture<?>> _runningSpawns = new ConcurrentHashMap<>();
protected boolean _activeState = true;
protected AutoSpawnHandler()
{
_registeredSpawns = new HashMap<>();
_runningSpawns = new HashMap<>();
restoreSpawnData();
}
@ -108,8 +107,8 @@ public class AutoSpawnHandler
}
// create clean list
_registeredSpawns = new HashMap<>();
_runningSpawns = new HashMap<>();
_registeredSpawns.clear();
_runningSpawns.clear();
// load
restoreSpawnData();
@ -367,19 +366,17 @@ public class AutoSpawnHandler
return null;
}
public Map<Integer, AutoSpawnInstance> getAutoSpawnInstances(int npcId)
public List<AutoSpawnInstance> getAutoSpawnInstances(int npcId)
{
Map<Integer, AutoSpawnInstance> spawnInstList = new HashMap<>();
final List<AutoSpawnInstance> result = new LinkedList<>();
for (AutoSpawnInstance spawnInst : _registeredSpawns.values())
{
if (spawnInst.getId() == npcId)
{
spawnInstList.put(spawnInst.getObjectId(), spawnInst);
result.add(spawnInst);
}
}
return spawnInstList;
return result;
}
/**
@ -595,9 +592,9 @@ public class AutoSpawnHandler
protected int _lastLocIndex = -1;
private final List<L2Npc> _npcList = new ArrayList<>();
private final List<L2Npc> _npcList = new CopyOnWriteArrayList<>();
private final List<Location> _locList = new ArrayList<>();
private final List<Location> _locList = new CopyOnWriteArrayList<>();
private boolean _spawnActive;
@ -680,16 +677,14 @@ public class AutoSpawnHandler
return ret;
}
public L2Spawn[] getSpawns()
public List<L2Spawn> getSpawns()
{
List<L2Spawn> npcSpawns = new ArrayList<>();
final List<L2Spawn> npcSpawns = new ArrayList<>();
for (L2Npc npcInst : _npcList)
{
npcSpawns.add(npcInst.getSpawn());
}
return npcSpawns.toArray(new L2Spawn[npcSpawns.size()]);
return npcSpawns;
}
public void setSpawnCount(int spawnCount)

View File

@ -35,14 +35,10 @@ import com.l2jserver.gameserver.network.SystemMessageId;
import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
import com.l2jserver.gameserver.network.serverpackets.friend.BlockListPacket;
/**
* This class ...
* @version $Revision: 1.2 $ $Date: 2004/06/27 08:12:59 $
*/
public class BlockList
{
private static Logger _log = Logger.getLogger(BlockList.class.getName());
private static Map<Integer, HashMap<Integer, String>> _offlineList = new HashMap<>();
private static Map<Integer, HashMap<Integer, String>> OFFLINE_LIST = new HashMap<>();
private final L2PcInstance _owner;
private HashMap<Integer, String> _blockList;
@ -51,7 +47,7 @@ public class BlockList
public BlockList(L2PcInstance owner)
{
_owner = owner;
_blockList = _offlineList.get(owner.getObjectId());
_blockList = OFFLINE_LIST.get(owner.getObjectId());
if (_blockList == null)
{
_blockList = loadList(_owner.getObjectId());
@ -108,7 +104,7 @@ public class BlockList
public void playerLogout()
{
_offlineList.put(_owner.getObjectId(), _blockList);
OFFLINE_LIST.put(_owner.getObjectId(), _blockList);
}
private static HashMap<Integer, String> loadList(int ObjId)
@ -303,10 +299,10 @@ public class BlockList
{
return BlockList.isBlocked(player, targetId);
}
if (!_offlineList.containsKey(ownerId))
if (!OFFLINE_LIST.containsKey(ownerId))
{
_offlineList.put(ownerId, loadList(ownerId));
OFFLINE_LIST.put(ownerId, loadList(ownerId));
}
return _offlineList.get(ownerId).containsKey(targetId);
return OFFLINE_LIST.get(ownerId).containsKey(targetId);
}
}

View File

@ -23,9 +23,10 @@ import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Queue;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArraySet;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;
import java.util.function.Function;
@ -62,18 +63,18 @@ import com.l2jserver.gameserver.network.serverpackets.ShortBuffStatusUpdate;
public final class CharEffectList
{
private static final Logger _log = Logger.getLogger(CharEffectList.class.getName());
/** Map containing all effects from buffs for this effect list. */
private volatile ConcurrentHashMap<Integer, BuffInfo> _buffs;
/** Map containing all triggered skills for this effect list. */
private volatile ConcurrentHashMap<Integer, BuffInfo> _triggered;
/** Map containing all dances/songs for this effect list. */
private volatile ConcurrentHashMap<Integer, BuffInfo> _dances;
/** Map containing all toggle for this effect list. */
private volatile ConcurrentHashMap<Integer, BuffInfo> _toggles;
/** Map containing all debuffs for this effect list. */
private volatile ConcurrentHashMap<Integer, BuffInfo> _debuffs;
/** They bypass most of the actions, they are not included in most operations. */
private volatile ConcurrentHashMap<Integer, BuffInfo> _passives;
/** Queue containing all effects from buffs for this effect list. */
private volatile Queue<BuffInfo> _buffs;
/** Queue containing all triggered skills for this effect list. */
private volatile Queue<BuffInfo> _triggered;
/** Queue containing all dances/songs for this effect list. */
private volatile Queue<BuffInfo> _dances;
/** Queue containing all toggle for this effect list. */
private volatile Queue<BuffInfo> _toggles;
/** Queue containing all debuffs for this effect list. */
private volatile Queue<BuffInfo> _debuffs;
/** Queue containing all passives for this effect list. They bypass most of the actions and they are not included in most operations. */
private volatile Queue<BuffInfo> _passives;
/** Map containing the all stacked effect in progress for each abnormal type. */
private volatile Map<AbnormalType, BuffInfo> _stackedEffects;
/** Set containing all abnormal types that shouldn't be added to this creature effect list. */
@ -108,7 +109,7 @@ public final class CharEffectList
* Gets buff skills.
* @return the buff skills
*/
public Map<Integer, BuffInfo> getBuffs()
public Queue<BuffInfo> getBuffs()
{
if (_buffs == null)
{
@ -116,7 +117,7 @@ public final class CharEffectList
{
if (_buffs == null)
{
_buffs = new ConcurrentHashMap<>();
_buffs = new ConcurrentLinkedQueue<>();
}
}
}
@ -127,7 +128,7 @@ public final class CharEffectList
* Gets triggered skill skills.
* @return the triggered skill skills
*/
public Map<Integer, BuffInfo> getTriggered()
public Queue<BuffInfo> getTriggered()
{
if (_triggered == null)
{
@ -135,7 +136,7 @@ public final class CharEffectList
{
if (_triggered == null)
{
_triggered = new ConcurrentHashMap<>();
_triggered = new ConcurrentLinkedQueue<>();
}
}
}
@ -146,7 +147,7 @@ public final class CharEffectList
* Gets dance/song skills.
* @return the dance/song skills
*/
public Map<Integer, BuffInfo> getDances()
public Queue<BuffInfo> getDances()
{
if (_dances == null)
{
@ -154,7 +155,7 @@ public final class CharEffectList
{
if (_dances == null)
{
_dances = new ConcurrentHashMap<>();
_dances = new ConcurrentLinkedQueue<>();
}
}
}
@ -165,7 +166,7 @@ public final class CharEffectList
* Gets toggle skills.
* @return the toggle skills
*/
public Map<Integer, BuffInfo> getToggles()
public Queue<BuffInfo> getToggles()
{
if (_toggles == null)
{
@ -173,7 +174,7 @@ public final class CharEffectList
{
if (_toggles == null)
{
_toggles = new ConcurrentHashMap<>();
_toggles = new ConcurrentLinkedQueue<>();
}
}
}
@ -184,7 +185,7 @@ public final class CharEffectList
* Gets debuff skills.
* @return the debuff skills
*/
public Map<Integer, BuffInfo> getDebuffs()
public Queue<BuffInfo> getDebuffs()
{
if (_debuffs == null)
{
@ -192,7 +193,7 @@ public final class CharEffectList
{
if (_debuffs == null)
{
_debuffs = new ConcurrentHashMap<>();
_debuffs = new ConcurrentLinkedQueue<>();
}
}
}
@ -203,7 +204,7 @@ public final class CharEffectList
* Gets passive skills.
* @return the passive skills
*/
public Map<Integer, BuffInfo> getPassives()
public Queue<BuffInfo> getPassives()
{
if (_passives == null)
{
@ -211,7 +212,7 @@ public final class CharEffectList
{
if (_passives == null)
{
_passives = new ConcurrentHashMap<>();
_passives = new ConcurrentLinkedQueue<>();
}
}
}
@ -232,27 +233,27 @@ public final class CharEffectList
final List<BuffInfo> buffs = new ArrayList<>();
if (hasBuffs())
{
buffs.addAll(getBuffs().values());
buffs.addAll(getBuffs());
}
if (hasTriggered())
{
buffs.addAll(getTriggered().values());
buffs.addAll(getTriggered());
}
if (hasDances())
{
buffs.addAll(getDances().values());
buffs.addAll(getDances());
}
if (hasToggles())
{
buffs.addAll(getToggles().values());
buffs.addAll(getToggles());
}
if (hasDebuffs())
{
buffs.addAll(getDebuffs().values());
buffs.addAll(getDebuffs());
}
return buffs;
}
@ -262,14 +263,14 @@ public final class CharEffectList
* @param skill the skill
* @return the effect list
*/
private Map<Integer, BuffInfo> getEffectList(Skill skill)
private Queue<BuffInfo> getEffectList(Skill skill)
{
if (skill == null)
{
return null;
}
final Map<Integer, BuffInfo> effects;
final Queue<BuffInfo> effects;
if (skill.isPassive())
{
effects = getPassives();
@ -308,7 +309,7 @@ public final class CharEffectList
{
if (hasBuffs())
{
for (BuffInfo info : getBuffs().values())
for (BuffInfo info : getBuffs())
{
if (info != null)
{
@ -325,7 +326,7 @@ public final class CharEffectList
if (hasTriggered())
{
for (BuffInfo info : getTriggered().values())
for (BuffInfo info : getTriggered())
{
if (info != null)
{
@ -342,7 +343,7 @@ public final class CharEffectList
if (hasDances())
{
for (BuffInfo info : getDances().values())
for (BuffInfo info : getDances())
{
if (info != null)
{
@ -359,7 +360,7 @@ public final class CharEffectList
if (hasToggles())
{
for (BuffInfo info : getToggles().values())
for (BuffInfo info : getToggles())
{
if (info != null)
{
@ -376,7 +377,7 @@ public final class CharEffectList
if (hasDebuffs())
{
for (BuffInfo info : getDebuffs().values())
for (BuffInfo info : getDebuffs())
{
if (info != null)
{
@ -401,7 +402,7 @@ public final class CharEffectList
*/
public boolean isAffectedBySkill(int skillId)
{
return (hasBuffs() && getBuffs().containsKey(skillId)) || (hasDebuffs() && getDebuffs().containsKey(skillId)) || (hasTriggered() && getTriggered().containsKey(skillId)) || (hasDances() && getDances().containsKey(skillId)) || (hasToggles() && getToggles().containsKey(skillId)) || (hasPassives() && getPassives().containsKey(skillId));
return getBuffInfoBySkillId(skillId) != null;
}
/**
@ -413,29 +414,34 @@ public final class CharEffectList
public BuffInfo getBuffInfoBySkillId(int skillId)
{
BuffInfo info = null;
if (hasBuffs() && getBuffs().containsKey(skillId))
if (hasBuffs())
{
info = getBuffs().get(skillId);
info = getBuffs().stream().filter(b -> b.getSkill().getId() == skillId).findFirst().orElse(null);
}
else if (hasTriggered() && getTriggered().containsKey(skillId))
if (hasTriggered() && (info == null))
{
info = getTriggered().get(skillId);
info = getTriggered().stream().filter(b -> b.getSkill().getId() == skillId).findFirst().orElse(null);
}
else if (hasDances() && getDances().containsKey(skillId))
if (hasDances() && (info == null))
{
info = getDances().get(skillId);
info = getDances().stream().filter(b -> b.getSkill().getId() == skillId).findFirst().orElse(null);
}
else if (hasToggles() && getToggles().containsKey(skillId))
if (hasToggles() && (info == null))
{
info = getToggles().get(skillId);
info = getToggles().stream().filter(b -> b.getSkill().getId() == skillId).findFirst().orElse(null);
}
else if (hasDebuffs() && getDebuffs().containsKey(skillId))
if (hasDebuffs() && (info == null))
{
info = getDebuffs().get(skillId);
info = getDebuffs().stream().filter(b -> b.getSkill().getId() == skillId).findFirst().orElse(null);
}
else if (hasPassives() && getPassives().containsKey(skillId))
if (hasPassives() && (info == null))
{
info = getPassives().get(skillId);
info = getPassives().stream().filter(b -> b.getSkill().getId() == skillId).findFirst().orElse(null);
}
return info;
}
@ -463,7 +469,7 @@ public final class CharEffectList
{
if (_blockedBuffSlots == null)
{
_blockedBuffSlots = new CopyOnWriteArraySet<>();
_blockedBuffSlots = ConcurrentHashMap.newKeySet(blockedBuffSlots.size());
}
}
}
@ -535,13 +541,8 @@ public final class CharEffectList
return false;
}
final Map<Integer, BuffInfo> effects = getEffectList(skill);
if ((effects == null) || effects.isEmpty())
{
return false;
}
for (BuffInfo info : effects.values())
final Queue<BuffInfo> effects = getEffectList(skill);
for (BuffInfo info : effects)
{
if ((info != null) && (info.getSkill().getAbnormalType() == type))
{
@ -604,7 +605,7 @@ public final class CharEffectList
* @param info the buff info
* @param effects the effect list
*/
protected void stopAndRemove(BuffInfo info, Map<Integer, BuffInfo> effects)
protected void stopAndRemove(BuffInfo info, Queue<BuffInfo> effects)
{
stopAndRemove(true, info, effects);
}
@ -615,7 +616,7 @@ public final class CharEffectList
* @param info the buff info
* @param buffs the buff list
*/
private void stopAndRemove(boolean removed, BuffInfo info, Map<Integer, BuffInfo> buffs)
private void stopAndRemove(boolean removed, BuffInfo info, Queue<BuffInfo> buffs)
{
if (info == null)
{
@ -623,7 +624,7 @@ public final class CharEffectList
}
// Removes the buff from the given effect list.
buffs.remove(info.getSkill().getId());
buffs.remove(info);
// Stop the buff effects.
info.stopAllEffects(removed);
// If it's a hidden buff that ends, then decrease hidden buff count.
@ -640,7 +641,7 @@ public final class CharEffectList
// If it's an herb that ends, check if there are hidden buffs.
if (info.getSkill().isAbnormalInstant() && hasBuffs())
{
for (BuffInfo buff : getBuffs().values())
for (BuffInfo buff : getBuffs())
{
if ((buff != null) && (buff.getSkill().getAbnormalType() == info.getSkill().getAbnormalType()) && !buff.isInUse())
{
@ -698,31 +699,31 @@ public final class CharEffectList
boolean update = false;
if (hasBuffs())
{
getBuffs().values().stream().filter(info -> !info.getSkill().isStayAfterDeath()).forEach(info -> stopAndRemove(info, getBuffs()));
getBuffs().stream().filter(info -> !info.getSkill().isStayAfterDeath()).forEach(info -> stopAndRemove(info, getBuffs()));
update = true;
}
if (hasTriggered())
{
getTriggered().values().stream().filter(info -> !info.getSkill().isStayAfterDeath()).forEach(info -> stopAndRemove(info, getTriggered()));
getTriggered().stream().filter(info -> !info.getSkill().isStayAfterDeath()).forEach(info -> stopAndRemove(info, getTriggered()));
update = true;
}
if (hasDebuffs())
{
getDebuffs().values().stream().filter(info -> !info.getSkill().isStayAfterDeath()).forEach(info -> stopAndRemove(info, getDebuffs()));
getDebuffs().stream().filter(info -> !info.getSkill().isStayAfterDeath()).forEach(info -> stopAndRemove(info, getDebuffs()));
update = true;
}
if (hasDances())
{
getDances().values().stream().filter(info -> !info.getSkill().isStayAfterDeath()).forEach(info -> stopAndRemove(info, getDances()));
getDances().stream().filter(info -> !info.getSkill().isStayAfterDeath()).forEach(info -> stopAndRemove(info, getDances()));
update = true;
}
if (hasToggles())
{
getToggles().values().stream().filter(info -> !info.getSkill().isStayAfterDeath()).forEach(info -> stopAndRemove(info, getToggles()));
getToggles().stream().filter(info -> !info.getSkill().isStayAfterDeath()).forEach(info -> stopAndRemove(info, getToggles()));
update = true;
}
@ -738,31 +739,31 @@ public final class CharEffectList
boolean update = false;
if (hasBuffs())
{
getBuffs().values().stream().filter(info -> !info.getSkill().isStayOnSubclassChange()).forEach(info -> stopAndRemove(info, getBuffs()));
getBuffs().stream().filter(info -> !info.getSkill().isStayOnSubclassChange()).forEach(info -> stopAndRemove(info, getBuffs()));
update = true;
}
if (hasTriggered())
{
getTriggered().values().stream().filter(info -> !info.getSkill().isStayOnSubclassChange()).forEach(info -> stopAndRemove(info, getTriggered()));
getTriggered().stream().filter(info -> !info.getSkill().isStayOnSubclassChange()).forEach(info -> stopAndRemove(info, getTriggered()));
update = true;
}
if (hasDebuffs())
{
getDebuffs().values().stream().filter(info -> !info.getSkill().isStayOnSubclassChange()).forEach(info -> stopAndRemove(info, getDebuffs()));
getDebuffs().stream().filter(info -> !info.getSkill().isStayOnSubclassChange()).forEach(info -> stopAndRemove(info, getDebuffs()));
update = true;
}
if (hasDances())
{
getDances().values().stream().filter(info -> !info.getSkill().isStayOnSubclassChange()).forEach(info -> stopAndRemove(info, getDances()));
getDances().stream().filter(info -> !info.getSkill().isStayOnSubclassChange()).forEach(info -> stopAndRemove(info, getDances()));
update = true;
}
if (hasToggles())
{
getToggles().values().stream().filter(info -> !info.getSkill().isStayOnSubclassChange()).forEach(info -> stopAndRemove(info, getToggles()));
getToggles().stream().filter(info -> !info.getSkill().isStayOnSubclassChange()).forEach(info -> stopAndRemove(info, getToggles()));
update = true;
}
@ -779,12 +780,12 @@ public final class CharEffectList
{
if (hasBuffs())
{
getBuffs().forEach((k, info) -> stopAndRemove(info, getBuffs()));
getBuffs().forEach(b -> stopAndRemove(b, getBuffs()));
}
if (triggered && hasTriggered())
{
getTriggered().forEach((k, info) -> stopAndRemove(info, getTriggered()));
getTriggered().forEach(b -> stopAndRemove(b, getTriggered()));
}
// Update effect flags and icons.
@ -808,7 +809,7 @@ public final class CharEffectList
{
if (hasToggles())
{
getToggles().forEach((k, info) -> stopAndRemove(info, getToggles()));
getToggles().forEach(b -> stopAndRemove(b, getToggles()));
// Update effect flags and icons.
updateEffectList(update);
}
@ -822,7 +823,7 @@ public final class CharEffectList
{
if (hasDances())
{
getDances().forEach((k, info) -> stopAndRemove(info, getDances()));
getDances().forEach(b -> stopAndRemove(b, getDances()));
// Update effect flags and icons.
updateEffectList(update);
}
@ -836,7 +837,7 @@ public final class CharEffectList
{
if (hasDebuffs())
{
getDebuffs().forEach((k, info) -> stopAndRemove(info, getDebuffs()));
getDebuffs().forEach(b -> stopAndRemove(b, getDebuffs()));
// Update effect flags and icons.
updateEffectList(update);
}
@ -860,31 +861,31 @@ public final class CharEffectList
if (hasBuffs())
{
getBuffs().values().stream().filter(Objects::nonNull).forEach(action);
getBuffs().stream().filter(Objects::nonNull).forEach(action);
update = true;
}
if (hasTriggered())
{
getTriggered().values().stream().filter(Objects::nonNull).forEach(action);
getTriggered().stream().filter(Objects::nonNull).forEach(action);
update = true;
}
if (hasDances())
{
getDances().values().stream().filter(Objects::nonNull).forEach(action);
getDances().stream().filter(Objects::nonNull).forEach(action);
update = true;
}
if (hasToggles())
{
getToggles().values().stream().filter(Objects::nonNull).forEach(action);
getToggles().stream().filter(Objects::nonNull).forEach(action);
update = true;
}
if (hasDebuffs())
{
getDebuffs().values().stream().filter(Objects::nonNull).forEach(action);
getDebuffs().stream().filter(Objects::nonNull).forEach(action);
update = true;
}
@ -908,7 +909,7 @@ public final class CharEffectList
final BuffInfo info = getBuffInfoBySkillId(skillId);
if (info != null)
{
stopSkillEffects(removed, info.getSkill());
remove(removed, info);
}
}
@ -925,15 +926,9 @@ public final class CharEffectList
*/
public void stopSkillEffects(boolean removed, Skill skill)
{
if ((skill == null) || !isAffectedBySkill(skill.getId()))
if (skill != null)
{
return;
}
final Map<Integer, BuffInfo> effects = getEffectList(skill);
if (effects != null)
{
remove(removed, effects.get(skill.getId()));
stopSkillEffects(removed, skill.getId());
}
}
@ -972,31 +967,31 @@ public final class CharEffectList
boolean update = false;
if (hasBuffs())
{
getBuffs().values().stream().filter(info -> info.getSkill().isRemovedOnAnyActionExceptMove()).forEach(info -> stopAndRemove(info, getBuffs()));
getBuffs().stream().filter(info -> info.getSkill().isRemovedOnAnyActionExceptMove()).forEach(info -> stopAndRemove(info, getBuffs()));
update = true;
}
if (hasTriggered())
{
getTriggered().values().stream().filter(info -> info.getSkill().isRemovedOnAnyActionExceptMove()).forEach(info -> stopAndRemove(info, getTriggered()));
getTriggered().stream().filter(info -> info.getSkill().isRemovedOnAnyActionExceptMove()).forEach(info -> stopAndRemove(info, getTriggered()));
update = true;
}
if (hasDebuffs())
{
getDebuffs().values().stream().filter(info -> info.getSkill().isRemovedOnAnyActionExceptMove()).forEach(info -> stopAndRemove(info, getDebuffs()));
getDebuffs().stream().filter(info -> info.getSkill().isRemovedOnAnyActionExceptMove()).forEach(info -> stopAndRemove(info, getDebuffs()));
update = true;
}
if (hasDances())
{
getDances().values().stream().filter(info -> info.getSkill().isRemovedOnAnyActionExceptMove()).forEach(info -> stopAndRemove(info, getDances()));
getDances().stream().filter(info -> info.getSkill().isRemovedOnAnyActionExceptMove()).forEach(info -> stopAndRemove(info, getDances()));
update = true;
}
if (hasToggles())
{
getToggles().values().stream().filter(info -> info.getSkill().isRemovedOnAnyActionExceptMove()).forEach(info -> stopAndRemove(info, getToggles()));
getToggles().stream().filter(info -> info.getSkill().isRemovedOnAnyActionExceptMove()).forEach(info -> stopAndRemove(info, getToggles()));
update = true;
}
@ -1014,25 +1009,25 @@ public final class CharEffectList
{
if (hasBuffs())
{
getBuffs().values().stream().filter(Objects::nonNull).filter(info -> info.getSkill().isRemovedOnDamage()).forEach(info -> stopAndRemove(info, getBuffs()));
getBuffs().stream().filter(Objects::nonNull).filter(info -> info.getSkill().isRemovedOnDamage()).forEach(info -> stopAndRemove(info, getBuffs()));
update = true;
}
if (hasTriggered())
{
getTriggered().values().stream().filter(Objects::nonNull).filter(info -> info.getSkill().isRemovedOnDamage()).forEach(info -> stopAndRemove(info, getTriggered()));
getTriggered().stream().filter(Objects::nonNull).filter(info -> info.getSkill().isRemovedOnDamage()).forEach(info -> stopAndRemove(info, getTriggered()));
update = true;
}
if (hasDances())
{
getDances().values().stream().filter(Objects::nonNull).filter(info -> info.getSkill().isRemovedOnDamage()).forEach(info -> stopAndRemove(info, getDances()));
getDances().stream().filter(Objects::nonNull).filter(info -> info.getSkill().isRemovedOnDamage()).forEach(info -> stopAndRemove(info, getDances()));
update = true;
}
if (hasToggles())
{
getToggles().values().stream().filter(Objects::nonNull).filter(info -> info.getSkill().isRemovedOnDamage()).forEach(info -> stopAndRemove(info, getToggles()));
getToggles().stream().filter(Objects::nonNull).filter(info -> info.getSkill().isRemovedOnDamage()).forEach(info -> stopAndRemove(info, getToggles()));
update = true;
}
}
@ -1041,7 +1036,7 @@ public final class CharEffectList
{
if (hasDebuffs())
{
getDebuffs().values().stream().filter(Objects::nonNull).filter(info -> info.getSkill().isRemovedOnDamage()).forEach(info -> stopAndRemove(info, getDebuffs()));
getDebuffs().stream().filter(Objects::nonNull).filter(info -> info.getSkill().isRemovedOnDamage()).forEach(info -> stopAndRemove(info, getDebuffs()));
update = true;
}
}
@ -1144,7 +1139,7 @@ public final class CharEffectList
boolean update = false;
if (hasBuffs())
{
for (BuffInfo info : getBuffs().values())
for (BuffInfo info : getBuffs())
{
update |= function.apply(info);
}
@ -1152,7 +1147,7 @@ public final class CharEffectList
if (hasTriggered())
{
for (BuffInfo info : getTriggered().values())
for (BuffInfo info : getTriggered())
{
update |= function.apply(info);
}
@ -1160,7 +1155,7 @@ public final class CharEffectList
if (dances && hasDances())
{
for (BuffInfo info : getDances().values())
for (BuffInfo info : getDances())
{
update |= function.apply(info);
}
@ -1168,7 +1163,7 @@ public final class CharEffectList
if (hasToggles())
{
for (BuffInfo info : getToggles().values())
for (BuffInfo info : getToggles())
{
update |= function.apply(info);
}
@ -1176,7 +1171,7 @@ public final class CharEffectList
if (hasDebuffs())
{
for (BuffInfo info : getDebuffs().values())
for (BuffInfo info : getDebuffs())
{
update |= function.apply(info);
}
@ -1192,7 +1187,7 @@ public final class CharEffectList
*/
public void remove(boolean removed, BuffInfo info)
{
if ((info == null) || !isAffectedBySkill(info.getSkill().getId()))
if (info == null)
{
return;
}
@ -1237,13 +1232,15 @@ public final class CharEffectList
}
// Puts the effects in the list.
final BuffInfo infoToRemove = getPassives().put(skill.getId(), info);
if (infoToRemove != null)
getPassives().stream().filter(b -> b.getSkill().getId() == skill.getId()).forEach(b ->
{
// Removes the old stats from the creature if the skill was present.
infoToRemove.setInUse(false);
infoToRemove.removeStats();
}
b.setInUse(false);
b.removeStats();
getPassives().remove(b);
});
getPassives().add(info);
// Initialize effects.
info.initializeEffects();
@ -1323,7 +1320,7 @@ public final class CharEffectList
}
// Select the map that holds the effects related to this skill.
final Map<Integer, BuffInfo> effects = getEffectList(skill);
final Queue<BuffInfo> effects = getEffectList(skill);
// Remove first buff when buff list is full.
if (!skill.isDebuff() && !skill.isToggle() && !skill.is7Signs() && !doesStack(skill))
{
@ -1341,7 +1338,7 @@ public final class CharEffectList
buffsToRemove = getBuffCount() - _owner.getStat().getMaxBuffCount();
}
for (BuffInfo bi : effects.values())
for (BuffInfo bi : effects)
{
if (buffsToRemove < 0)
{
@ -1361,7 +1358,7 @@ public final class CharEffectList
// After removing old buff (same ID) or stacked buff (same abnormal type),
// Add the buff to the end of the effect list.
effects.put(skill.getId(), info);
effects.add(info);
// Initialize effects.
info.initializeEffects();
// Update effect flags and icons.
@ -1423,7 +1420,7 @@ public final class CharEffectList
// Buffs.
if (hasBuffs())
{
for (BuffInfo info : getBuffs().values())
for (BuffInfo info : getBuffs())
{
if (info.getSkill().isHealingPotionSkill())
{
@ -1439,7 +1436,7 @@ public final class CharEffectList
// Triggered buffs.
if (hasTriggered())
{
for (BuffInfo info : getTriggered().values())
for (BuffInfo info : getTriggered())
{
addIcon(info, asu, ps, psSummon, os, isSummon);
}
@ -1448,7 +1445,7 @@ public final class CharEffectList
// Songs and dances.
if (hasDances())
{
for (BuffInfo info : getDances().values())
for (BuffInfo info : getDances())
{
addIcon(info, asu, ps, psSummon, os, isSummon);
}
@ -1457,7 +1454,7 @@ public final class CharEffectList
// Songs and dances.
if (hasToggles())
{
for (BuffInfo info : getToggles().values())
for (BuffInfo info : getToggles())
{
addIcon(info, asu, ps, psSummon, os, isSummon);
}
@ -1466,7 +1463,7 @@ public final class CharEffectList
// Debuffs.
if (hasDebuffs())
{
for (BuffInfo info : getDebuffs().values())
for (BuffInfo info : getDebuffs())
{
addIcon(info, asu, ps, psSummon, os, isSummon);
}
@ -1583,7 +1580,7 @@ public final class CharEffectList
{
if (hasBuffs())
{
for (BuffInfo info : getBuffs().values())
for (BuffInfo info : getBuffs())
{
if (info == null)
{
@ -1604,7 +1601,7 @@ public final class CharEffectList
if (hasTriggered())
{
for (BuffInfo info : getTriggered().values())
for (BuffInfo info : getTriggered())
{
if (info == null)
{
@ -1625,7 +1622,7 @@ public final class CharEffectList
if (hasToggles())
{
for (BuffInfo info : getToggles().values())
for (BuffInfo info : getToggles())
{
if (info == null)
{
@ -1646,7 +1643,7 @@ public final class CharEffectList
if (hasDebuffs())
{
for (BuffInfo info : getDebuffs().values())
for (BuffInfo info : getDebuffs())
{
if ((info != null) && info.getSkill().isRemovedOnDamage())
{
@ -1665,7 +1662,7 @@ public final class CharEffectList
int flags = 0;
if (hasBuffs())
{
for (BuffInfo info : getBuffs().values())
for (BuffInfo info : getBuffs())
{
if (info != null)
{
@ -1679,7 +1676,7 @@ public final class CharEffectList
if (hasTriggered())
{
for (BuffInfo info : getTriggered().values())
for (BuffInfo info : getTriggered())
{
if (info != null)
{
@ -1693,7 +1690,7 @@ public final class CharEffectList
if (hasDebuffs())
{
for (BuffInfo info : getDebuffs().values())
for (BuffInfo info : getDebuffs())
{
if (info != null)
{
@ -1707,7 +1704,7 @@ public final class CharEffectList
if (hasDances())
{
for (BuffInfo info : getDances().values())
for (BuffInfo info : getDances())
{
if (info != null)
{
@ -1721,7 +1718,7 @@ public final class CharEffectList
if (hasToggles())
{
for (BuffInfo info : getToggles().values())
for (BuffInfo info : getToggles())
{
if (info != null)
{

View File

@ -25,8 +25,11 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -109,7 +112,7 @@ public class L2Clan implements IIdentifiable, INamable
private String _name;
private int _clanId;
private L2ClanMember _leader;
private final Map<Integer, L2ClanMember> _members = new HashMap<>();
private final Map<Integer, L2ClanMember> _members = new ConcurrentHashMap<>();
private String _allyName;
private int _allyId;
@ -130,16 +133,16 @@ public class L2Clan implements IIdentifiable, INamable
private int _bloodOathCount;
private final ItemContainer _warehouse = new ClanWarehouse(this);
private final List<Integer> _atWarWith = new ArrayList<>();
private final List<Integer> _atWarAttackers = new ArrayList<>();
private final List<Integer> _atWarWith = new CopyOnWriteArrayList<>();
private final List<Integer> _atWarAttackers = new CopyOnWriteArrayList<>();
private Forum _forum;
/** HashMap(Integer, L2Skill) containing all skills of the L2Clan */
private final Map<Integer, Skill> _skills = new HashMap<>();
private final Map<Integer, RankPrivs> _privs = new HashMap<>();
private final Map<Integer, SubPledge> _subPledges = new HashMap<>();
private final Map<Integer, Skill> _subPledgeSkills = new HashMap<>();
/** Map(Integer, L2Skill) containing all skills of the L2Clan */
private final Map<Integer, Skill> _skills = new ConcurrentHashMap<>();
private final Map<Integer, RankPrivs> _privs = new ConcurrentHashMap<>();
private final Map<Integer, SubPledge> _subPledges = new ConcurrentHashMap<>();
private final Map<Integer, Skill> _subPledgeSkills = new ConcurrentHashMap<>();
private int _reputationScore = 0;
private int _rank = 0;
@ -609,9 +612,9 @@ public class L2Clan implements IIdentifiable, INamable
* @param exclude the object Id to exclude from list.
* @return all online members excluding the one with object id {code exclude}.
*/
public ArrayList<L2PcInstance> getOnlineMembers(int exclude)
public List<L2PcInstance> getOnlineMembers(int exclude)
{
final ArrayList<L2PcInstance> onlineMembers = new ArrayList<>();
final List<L2PcInstance> onlineMembers = new ArrayList<>();
for (L2ClanMember temp : _members.values())
{
if ((temp != null) && temp.isOnline() && (temp.getObjectId() != exclude))
@ -1596,59 +1599,32 @@ public class L2Clan implements IIdentifiable, INamable
public boolean isAtWarWith(Integer id)
{
if (!_atWarWith.isEmpty())
{
if (_atWarWith.contains(id))
{
return true;
}
}
return false;
return _atWarWith.contains(id);
}
public boolean isAtWarWith(L2Clan clan)
{
if (clan == null)
{
return false;
}
if (!_atWarWith.isEmpty())
{
if (_atWarWith.contains(clan.getId()))
{
return true;
}
}
return false;
return _atWarWith.contains(clan.getId());
}
public boolean isAtWarAttacker(Integer id)
public boolean isAtWarAttacker(int id)
{
if ((_atWarAttackers != null) && !_atWarAttackers.isEmpty())
{
if (_atWarAttackers.contains(id))
{
return true;
}
}
return false;
return _atWarAttackers.contains(id);
}
public void setEnemyClan(L2Clan clan)
{
Integer id = clan.getId();
_atWarWith.add(id);
_atWarWith.add(clan.getId());
}
public void setEnemyClan(Integer clan)
public void setEnemyClan(int id)
{
_atWarWith.add(clan);
_atWarWith.add(id);
}
public void setAttackerClan(L2Clan clan)
{
Integer id = clan.getId();
_atWarAttackers.add(id);
_atWarAttackers.add(clan.getId());
}
public void setAttackerClan(Integer clan)
@ -1658,14 +1634,12 @@ public class L2Clan implements IIdentifiable, INamable
public void deleteEnemyClan(L2Clan clan)
{
Integer id = clan.getId();
_atWarWith.remove(id);
_atWarWith.remove(clan.getId());
}
public void deleteAttackerClan(L2Clan clan)
{
Integer id = clan.getId();
_atWarAttackers.remove(id);
_atWarAttackers.remove(clan.getId());
}
public int getHiredGuards()
@ -1680,11 +1654,7 @@ public class L2Clan implements IIdentifiable, INamable
public boolean isAtWar()
{
if ((_atWarWith != null) && !_atWarWith.isEmpty())
{
return true;
}
return false;
return (_atWarWith != null) && !_atWarWith.isEmpty();
}
public List<Integer> getWarList()
@ -1871,11 +1841,6 @@ public class L2Clan implements IIdentifiable, INamable
*/
public final SubPledge[] getAllSubPledges()
{
if (_subPledges == null)
{
return new SubPledge[0];
}
return _subPledges.values().toArray(new SubPledge[_subPledges.values().size()]);
}
@ -2036,11 +2001,9 @@ public class L2Clan implements IIdentifiable, INamable
public void initializePrivs()
{
RankPrivs privs;
for (int i = 1; i < 10; i++)
{
privs = new RankPrivs(i, 0, new EnumIntBitmask<>(ClanPrivilege.class, false));
_privs.put(i, privs);
_privs.put(i, new RankPrivs(i, 0, new EnumIntBitmask<>(ClanPrivilege.class, false)));
}
}
@ -2988,9 +2951,9 @@ public class L2Clan implements IIdentifiable, INamable
return false;
}
public SubPledgeSkill[] getAllSubSkills()
public List<SubPledgeSkill> getAllSubSkills()
{
final ArrayList<SubPledgeSkill> list = new ArrayList<>();
final List<SubPledgeSkill> list = new LinkedList<>();
for (Skill skill : _subPledgeSkills.values())
{
list.add(new SubPledgeSkill(0, skill.getId(), skill.getLevel()));
@ -3002,7 +2965,7 @@ public class L2Clan implements IIdentifiable, INamable
list.add(new SubPledgeSkill(subunit.getId(), skill.getId(), skill.getLevel()));
}
}
return list.toArray(new SubPledgeSkill[list.size()]);
return list;
}
public void setNewLeaderId(int objectId, boolean storeInDb)

View File

@ -18,6 +18,7 @@
*/
package com.l2jserver.gameserver.model;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.function.Function;
@ -37,8 +38,8 @@ import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
*/
public class L2CommandChannel extends AbstractPlayerGroup
{
private final List<L2Party> _parties;
private L2PcInstance _commandLeader = null;
private final List<L2Party> _parties = new CopyOnWriteArrayList<>();
private L2PcInstance _commandLeader;
private int _channelLvl;
/**
@ -49,7 +50,6 @@ public class L2CommandChannel extends AbstractPlayerGroup
{
_commandLeader = leader;
L2Party party = leader.getParty();
_parties = new CopyOnWriteArrayList<>();
_parties.add(party);
_channelLvl = party.getLevel();
party.setCommandChannel(this);
@ -163,7 +163,7 @@ public class L2CommandChannel extends AbstractPlayerGroup
@Override
public List<L2PcInstance> getMembers()
{
List<L2PcInstance> members = new CopyOnWriteArrayList<>();
final List<L2PcInstance> members = new LinkedList<>();
for (L2Party party : getPartys())
{
members.addAll(party.getMembers());

View File

@ -43,7 +43,7 @@ public class L2ContactList
{
private final Logger _log = Logger.getLogger(getClass().getName());
private final L2PcInstance activeChar;
private final List<String> _contacts;
private final List<String> _contacts = new CopyOnWriteArrayList<>();
private static final String QUERY_ADD = "INSERT INTO character_contacts (charId, contactId) VALUES (?, ?)";
private static final String QUERY_REMOVE = "DELETE FROM character_contacts WHERE charId = ? and contactId = ?";
@ -52,7 +52,6 @@ public class L2ContactList
public L2ContactList(L2PcInstance player)
{
activeChar = player;
_contacts = new CopyOnWriteArrayList<>();
restore();
}

View File

@ -525,7 +525,6 @@ public abstract class L2Object extends ListenersContainer implements IIdentifiab
{
if (_scripts == null)
{
// Double-checked locking
synchronized (this)
{
if (_scripts == null)

View File

@ -21,9 +21,9 @@ package com.l2jserver.gameserver.model;
import java.time.Duration;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.NoSuchElementException;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
@ -83,7 +83,7 @@ public class L2Party extends AbstractPlayerGroup
private static final Duration PARTY_POSITION_BROADCAST_INTERVAL = Duration.ofSeconds(12);
private static final Duration PARTY_DISTRIBUTION_TYPE_REQUEST_TIMEOUT = Duration.ofSeconds(15);
private final List<L2PcInstance> _members;
private final List<L2PcInstance> _members = new CopyOnWriteArrayList<>();
private boolean _pendingInvitation = false;
private long _pendingInviteTimeout;
private int _partyLvl = 0;
@ -116,7 +116,6 @@ public class L2Party extends AbstractPlayerGroup
*/
public L2Party(L2PcInstance leader, PartyDistributionType partyDistributionType)
{
_members = new CopyOnWriteArrayList<>();
_members.add(leader);
_partyLvl = leader.getLevel();
_distributionType = partyDistributionType;
@ -768,33 +767,26 @@ public class L2Party extends AbstractPlayerGroup
*/
public void distributeAdena(L2PcInstance player, long adena, L2Character target)
{
// Get all the party members
final List<L2PcInstance> membersList = getMembers();
// Check the number of party members that must be rewarded
// (The party member must be in range to receive its reward)
final List<L2PcInstance> ToReward = new ArrayList<>();
for (L2PcInstance member : membersList)
final List<L2PcInstance> toReward = new LinkedList<>();
for (L2PcInstance member : getMembers())
{
if (!Util.checkIfInRange(Config.ALT_PARTY_RANGE2, target, member, true))
if (Util.checkIfInRange(Config.ALT_PARTY_RANGE2, target, member, true))
{
continue;
toReward.add(member);
}
ToReward.add(member);
}
// Avoid null exceptions, if any
if (ToReward.isEmpty())
if (!toReward.isEmpty())
{
return;
}
// Now we can actually distribute the adena reward
// (Total adena splitted by the number of party members that are in range and must be rewarded)
final long count = adena / ToReward.size();
for (L2PcInstance member : ToReward)
{
member.addAdena("Party", count, player, true);
// Now we can actually distribute the adena reward
// (Total adena splitted by the number of party members that are in range and must be rewarded)
long count = adena / toReward.size();
for (L2PcInstance member : toReward)
{
member.addAdena("Party", count, player, true);
}
}
}
@ -1044,14 +1036,7 @@ public class L2Party extends AbstractPlayerGroup
@Override
public L2PcInstance getLeader()
{
try
{
return _members.get(0);
}
catch (NoSuchElementException e)
{
return null;
}
return _members.get(0);
}
public synchronized void requestLootChange(PartyDistributionType partyDistributionType)

View File

@ -18,7 +18,8 @@
*/
package com.l2jserver.gameserver.model;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.serverpackets.RadarControl;
@ -29,12 +30,11 @@ import com.l2jserver.gameserver.network.serverpackets.RadarControl;
public final class L2Radar
{
private final L2PcInstance _player;
private final ArrayList<RadarMarker> _markers;
private final List<RadarMarker> _markers = new CopyOnWriteArrayList<>();
public L2Radar(L2PcInstance player)
{
_player = player;
_markers = new ArrayList<>();
}
// Add a marker to player's radar

View File

@ -18,8 +18,8 @@
*/
package com.l2jserver.gameserver.model;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import com.l2jserver.gameserver.enums.SiegeClanType;
import com.l2jserver.gameserver.model.actor.L2Npc;
@ -27,8 +27,7 @@ import com.l2jserver.gameserver.model.actor.L2Npc;
public class L2SiegeClan
{
private int _clanId = 0;
private List<L2Npc> _flag = new ArrayList<>();
private int _numFlagsAdded = 0;
private final List<L2Npc> _flag = new CopyOnWriteArrayList<>();
private SiegeClanType _type;
public L2SiegeClan(int clanId, SiegeClanType type)
@ -39,43 +38,25 @@ public class L2SiegeClan
public int getNumFlags()
{
return _numFlagsAdded;
return _flag.size();
}
public void addFlag(L2Npc flag)
{
_numFlagsAdded++;
getFlag().add(flag);
_flag.add(flag);
}
public boolean removeFlag(L2Npc flag)
{
if (flag == null)
{
return false;
}
boolean ret = getFlag().remove(flag);
// check if null objects or duplicates remain in the list.
// for some reason, this might be happening sometimes...
// delete false duplicates: if this flag got deleted, delete its copies too.
if (ret)
{
while (getFlag().remove(flag))
{
//
}
}
boolean ret = _flag.remove(flag);
flag.deleteMe();
_numFlagsAdded--;
return ret;
}
public void removeFlags()
{
for (L2Npc flag : getFlag())
{
removeFlag(flag);
}
_flag.forEach(f -> f.decayMe());
_flag.clear();
}
public final int getClanId()
@ -85,10 +66,6 @@ public class L2SiegeClan
public final List<L2Npc> getFlag()
{
if (_flag == null)
{
_flag = new ArrayList<>();
}
return _flag;
}

View File

@ -19,10 +19,12 @@
package com.l2jserver.gameserver.model;
import java.lang.reflect.Constructor;
import java.util.ArrayList;
import java.util.Deque;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ConcurrentLinkedDeque;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;
@ -79,9 +81,8 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
private boolean _doRespawn;
/** If true then spawn is custom */
private boolean _customSpawn;
private static List<SpawnListener> _spawnListeners = new ArrayList<>();
private final ArrayList<L2Npc> _spawnedNpcs = new ArrayList<>();
private L2Npc _lastSpawn;
private static List<SpawnListener> _spawnListeners = new CopyOnWriteArrayList<>();
private final Deque<L2Npc> _spawnedNpcs = new ConcurrentLinkedDeque<>();
private Map<Integer, Location> _lastSpawnPoints;
private boolean _isNoRndWalk = false; // Is no random walk
@ -688,7 +689,6 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
notifyNpcSpawned(mob);
_spawnedNpcs.add(mob);
_lastSpawn = mob;
if (_lastSpawnPoints != null)
{
_lastSpawnPoints.put(mob.getObjectId(), new Location(newlocx, newlocy, newlocz));
@ -705,28 +705,19 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
public static void addSpawnListener(SpawnListener listener)
{
synchronized (_spawnListeners)
{
_spawnListeners.add(listener);
}
_spawnListeners.add(listener);
}
public static void removeSpawnListener(SpawnListener listener)
{
synchronized (_spawnListeners)
{
_spawnListeners.remove(listener);
}
_spawnListeners.remove(listener);
}
public static void notifyNpcSpawned(L2Npc npc)
{
synchronized (_spawnListeners)
for (SpawnListener listener : _spawnListeners)
{
for (SpawnListener listener : _spawnListeners)
{
listener.npcSpawned(npc);
}
listener.npcSpawned(npc);
}
}
@ -791,10 +782,10 @@ public class L2Spawn implements IPositionable, IIdentifiable, INamable
public L2Npc getLastSpawn()
{
return _lastSpawn;
return _spawnedNpcs.peekLast();
}
public final ArrayList<L2Npc> getSpawnedNpcs()
public final Deque<L2Npc> getSpawnedNpcs()
{
return _spawnedNpcs;
}

View File

@ -18,8 +18,8 @@
*/
package com.l2jserver.gameserver.model;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Logger;
import com.l2jserver.util.Rnd;
@ -46,7 +46,7 @@ public class L2Territory
}
}
private final List<Point> _points;
private final List<Point> _points = new CopyOnWriteArrayList<>();
private final int _terr;
private int _xMin;
private int _xMax;
@ -58,7 +58,6 @@ public class L2Territory
public L2Territory(int terr)
{
_points = new ArrayList<>();
_terr = terr;
_xMin = 999999;
_xMax = -999999;
@ -99,14 +98,6 @@ public class L2Territory
_procMax += proc;
}
public void print()
{
for (Point p : _points)
{
_log.info("(" + p._x + "," + p._y + ")");
}
}
public boolean isIntersect(int x, int y, Point p1, Point p2)
{
double dy1 = p1._y - y;

View File

@ -22,6 +22,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Comparator;
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@ -446,15 +447,12 @@ public final class L2World
return null;
}
// Create an ArrayList in order to contain all visible L2Object
List<L2Object> result = new ArrayList<>();
// Go through the ArrayList of region
// Create a list in order to contain all visible objects.
final List<L2Object> result = new LinkedList<>();
for (L2WorldRegion regi : reg.getSurroundingRegions())
{
// Go through visible objects of the selected region
Collection<L2Object> vObj = regi.getVisibleObjects().values();
for (L2Object _object : vObj)
for (L2Object _object : regi.getVisibleObjects().values())
{
if ((_object == null) || _object.equals(object))
{
@ -488,15 +486,12 @@ public final class L2World
final int sqRadius = radius * radius;
// Create an ArrayList in order to contain all visible L2Object
List<L2Object> result = new ArrayList<>();
// Go through the ArrayList of region
// Create a list in order to contain all visible objects.
final List<L2Object> result = new LinkedList<>();
for (L2WorldRegion regi : object.getWorldRegion().getSurroundingRegions())
{
// Go through visible objects of the selected region
Collection<L2Object> vObj = regi.getVisibleObjects().values();
for (L2Object _object : vObj)
for (L2Object _object : regi.getVisibleObjects().values())
{
if ((_object == null) || _object.equals(object))
{
@ -529,14 +524,11 @@ public final class L2World
final int sqRadius = radius * radius;
// Create an ArrayList in order to contain all visible L2Object
List<L2Object> result = new ArrayList<>();
// Go through visible object of the selected region
// Create a list in order to contain all visible objects.
final List<L2Object> result = new LinkedList<>();
for (L2WorldRegion regi : object.getWorldRegion().getSurroundingRegions())
{
Collection<L2Object> vObj = regi.getVisibleObjects().values();
for (L2Object _object : vObj)
for (L2Object _object : regi.getVisibleObjects().values())
{
if ((_object == null) || _object.equals(object))
{
@ -567,10 +559,8 @@ public final class L2World
return null;
}
// Create an ArrayList in order to contain all visible L2Object
List<L2Playable> result = new ArrayList<>();
// Go through the ArrayList of region
// Create a list in order to contain all visible objects.
final List<L2Playable> result = new LinkedList<>();
for (L2WorldRegion regi : reg.getSurroundingRegions())
{
// Create an Iterator to go through the visible L2Object of the L2WorldRegion

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

View File

@ -18,8 +18,9 @@
*/
package com.l2jserver.gameserver.model;
import java.util.ArrayList;
import java.util.LinkedList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import com.l2jserver.gameserver.ai.CtrlIntention;
import com.l2jserver.gameserver.ai.L2ControllableMobAI;
@ -67,7 +68,7 @@ public final class MobGroup
{
if (_mobs == null)
{
_mobs = new ArrayList<>();
_mobs = new CopyOnWriteArrayList<>();
}
return _mobs;
@ -369,8 +370,7 @@ public final class MobGroup
protected void removeDead()
{
List<L2ControllableMobInstance> deadMobs = new ArrayList<>();
List<L2ControllableMobInstance> deadMobs = new LinkedList<>();
for (L2ControllableMobInstance mobInst : getMobs())
{
if ((mobInst != null) && mobInst.isDead())

View File

@ -18,8 +18,8 @@
*/
package com.l2jserver.gameserver.model;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.l2jserver.gameserver.model.actor.instance.L2ControllableMobInstance;
@ -35,7 +35,7 @@ public class MobGroupTable
protected MobGroupTable()
{
_groupMap = new HashMap<>();
_groupMap = new ConcurrentHashMap<>();
}
public static MobGroupTable getInstance()

View File

@ -18,8 +18,8 @@
*/
package com.l2jserver.gameserver.model;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
import com.l2jserver.gameserver.network.SystemMessageId;
@ -35,7 +35,7 @@ public class PartyMatchRoomList
protected PartyMatchRoomList()
{
_rooms = new HashMap<>();
_rooms = new ConcurrentHashMap<>();
}
public synchronized void addPartyMatchRoom(int id, PartyMatchRoom room)
@ -122,4 +122,4 @@ public class PartyMatchRoomList
{
protected static final PartyMatchRoomList _instance = new PartyMatchRoomList();
}
}
}

View File

@ -18,8 +18,8 @@
*/
package com.l2jserver.gameserver.model;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
@ -32,7 +32,7 @@ public class PartyMatchWaitingList
protected PartyMatchWaitingList()
{
_members = new ArrayList<>();
_members = new CopyOnWriteArrayList<>();
}
public void addPlayer(L2PcInstance player)

View File

@ -18,8 +18,8 @@
*/
package com.l2jserver.gameserver.model;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import com.l2jserver.gameserver.enums.PetitionState;
import com.l2jserver.gameserver.enums.PetitionType;
@ -43,7 +43,7 @@ public final class Petition
private final PetitionType _type;
private PetitionState _state = PetitionState.PENDING;
private final String _content;
private final List<CreatureSay> _messageLog = new ArrayList<>();
private final List<CreatureSay> _messageLog = new CopyOnWriteArrayList<>();
private final L2PcInstance _petitioner;
private L2PcInstance _responder;

View File

@ -21,7 +21,7 @@ package com.l2jserver.gameserver.model;
import java.time.Duration;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
@ -47,7 +47,7 @@ public class StatsSet implements IParserAdvUtils
public StatsSet()
{
this(new HashMap<String, Object>());
this(new LinkedHashMap<>());
}
public StatsSet(Map<String, Object> map)

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