Quellcode durchsuchen

BETA: Replacing Trove4J with !Java/Javolution in some places:
* Replaced Trove from Config.
* Instead of returning !ArrayList or !FastList returning the superinterface List, this way we can change the underlying implementation without changing the whole code (same for Map and Set).
* Replaced Trove in Instance class, removed some synchronizations replaced with shared !FastList, require feedback.
* Added a new method to Quest class.
* public List<L2NpcTemplate> addKillId(Collection<Integer> killIds)
* Updated Trove to 3.0.3.
* Updated L2TIntObjectHashMap implementation to match the framework's implementation by [[Ahmed]].
* Using !DocumentParser for ipconfig.xml using a static class.

'''Note:''' Update your library folder properly!

Zoey76 vor 12 Jahren
Ursprung
Commit
4ca88c9ea0

+ 1 - 1
L2J_Server_BETA/.classpath

@@ -13,6 +13,6 @@
 	<classpathentry kind="lib" path="dist/libs/mmocore.jar" />
 	<classpathentry kind="lib" path="dist/libs/netcon-1.7.jar" />
 	<classpathentry kind="lib" path="dist/libs/smtp.jar" />
-	<classpathentry kind="lib" path="dist/libs/trove-3.0.2.jar" />
+	<classpathentry kind="lib" path="dist/libs/trove-3.0.3.jar" />
 	<classpathentry kind="output" path="bin" />
 </classpath>

BIN
L2J_Server_BETA/dist/libs/trove-3.0.2.jar → L2J_Server_BETA/dist/libs/trove-3.0.3.jar


+ 126 - 123
L2J_Server_BETA/java/com/l2jserver/Config.java

@@ -14,11 +14,6 @@
  */
 package com.l2jserver;
 
-import gnu.trove.list.array.TIntArrayList;
-import gnu.trove.map.hash.TIntFloatHashMap;
-import gnu.trove.map.hash.TIntIntHashMap;
-import gnu.trove.map.hash.TIntObjectHashMap;
-
 import java.io.BufferedReader;
 import java.io.File;
 import java.io.FileInputStream;
@@ -35,17 +30,17 @@ import java.net.InetAddress;
 import java.net.UnknownHostException;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 import java.util.StringTokenizer;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import javax.xml.parsers.DocumentBuilderFactory;
-
-import org.w3c.dom.Document;
 import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
 
+import com.l2jserver.gameserver.engines.DocumentParser;
 import com.l2jserver.gameserver.model.itemcontainer.PcInventory;
 import com.l2jserver.gameserver.util.FloodProtectorConfig;
 import com.l2jserver.util.L2Properties;
@@ -105,9 +100,9 @@ public final class Config
 	public static double RESPAWN_RESTORE_MP;
 	public static boolean ALT_GAME_TIREDNESS;
 	public static boolean ENABLE_MODIFY_SKILL_DURATION;
-	public static TIntIntHashMap SKILL_DURATION_LIST;
+	public static Map<Integer, Integer> SKILL_DURATION_LIST;
 	public static boolean ENABLE_MODIFY_SKILL_REUSE;
-	public static TIntIntHashMap SKILL_REUSE_LIST;
+	public static Map<Integer, Integer> SKILL_REUSE_LIST;
 	public static boolean AUTO_LEARN_SKILLS;
 	public static boolean AUTO_LEARN_FS_SKILLS;
 	public static boolean AUTO_LOOT_HERBS;
@@ -463,7 +458,7 @@ public final class Config
 	public static boolean ALLOW_DISCARDITEM;
 	public static int AUTODESTROY_ITEM_AFTER;
 	public static int HERB_AUTO_DESTROY_TIME;
-	public static TIntArrayList LIST_PROTECTED_ITEMS;
+	public static List<Integer> LIST_PROTECTED_ITEMS;
 	public static boolean DATABASE_CLEAN_UP;
 	public static long CONNECTION_CLOSE_TIME;
 	public static int CHAR_STORE_INTERVAL;
@@ -577,7 +572,7 @@ public final class Config
 	public static boolean ALT_OLY_LOG_FIGHTS;
 	public static boolean ALT_OLY_SHOW_MONTHLY_WINNERS;
 	public static boolean ALT_OLY_ANNOUNCE_GAMES;
-	public static TIntArrayList LIST_OLY_RESTRICTED_ITEMS;
+	public static List<Integer> LIST_OLY_RESTRICTED_ITEMS;
 	public static int ALT_OLY_ENCHANT_LIMIT;
 	public static int ALT_OLY_WAIT_TIME;
 	public static int ALT_MANOR_REFRESH_TIME;
@@ -710,8 +705,8 @@ public final class Config
 	public static byte TVT_EVENT_MIN_LVL;
 	public static byte TVT_EVENT_MAX_LVL;
 	public static int TVT_EVENT_EFFECTS_REMOVAL;
-	public static TIntIntHashMap TVT_EVENT_FIGHTER_BUFFS;
-	public static TIntIntHashMap TVT_EVENT_MAGE_BUFFS;
+	public static Map<Integer, Integer> TVT_EVENT_FIGHTER_BUFFS;
+	public static Map<Integer, Integer> TVT_EVENT_MAGE_BUFFS;
 	public static int TVT_EVENT_MAX_PARTICIPANTS_PER_IP;
 	public static boolean TVT_ALLOW_VOICED_COMMAND;
 	public static boolean L2JMOD_ALLOW_WEDDING;
@@ -766,7 +761,7 @@ public final class Config
 	public static int L2JMOD_DUALBOX_CHECK_MAX_PLAYERS_PER_IP;
 	public static int L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP;
 	public static int L2JMOD_DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP;
-	public static TIntIntHashMap L2JMOD_DUALBOX_CHECK_WHITELIST;
+	public static Map<Integer, Integer> L2JMOD_DUALBOX_CHECK_WHITELIST;
 	public static boolean L2JMOD_ALLOW_CHANGE_PASSWORD;
 	
 	// --------------------------------------------------
@@ -783,18 +778,18 @@ public final class Config
 	public static boolean SHOW_CREST_WITHOUT_QUEST;
 	public static boolean ENABLE_RANDOM_ENCHANT_EFFECT;
 	public static int MIN_NPC_LVL_DMG_PENALTY;
-	public static TIntFloatHashMap NPC_DMG_PENALTY;
-	public static TIntFloatHashMap NPC_CRIT_DMG_PENALTY;
-	public static TIntFloatHashMap NPC_SKILL_DMG_PENALTY;
+	public static Map<Integer, Float> NPC_DMG_PENALTY;
+	public static Map<Integer, Float> NPC_CRIT_DMG_PENALTY;
+	public static Map<Integer, Float> NPC_SKILL_DMG_PENALTY;
 	public static int MIN_NPC_LVL_MAGIC_PENALTY;
-	public static TIntFloatHashMap NPC_SKILL_CHANCE_PENALTY;
+	public static Map<Integer, Float> NPC_SKILL_CHANCE_PENALTY;
 	public static int DECAY_TIME_TASK;
 	public static int NPC_DECAY_TIME;
 	public static int RAID_BOSS_DECAY_TIME;
 	public static int SPOILED_DECAY_TIME;
 	public static boolean GUARD_ATTACK_AGGRO_MOB;
 	public static boolean ALLOW_WYVERN_UPGRADER;
-	public static TIntArrayList LIST_PET_RENT_NPC;
+	public static List<Integer> LIST_PET_RENT_NPC;
 	public static double RAID_HP_REGEN_MULTIPLIER;
 	public static double RAID_MP_REGEN_MULTIPLIER;
 	public static double RAID_PDEFENCE_MULTIPLIER;
@@ -802,7 +797,7 @@ public final class Config
 	public static double RAID_PATTACK_MULTIPLIER;
 	public static double RAID_MATTACK_MULTIPLIER;
 	public static double RAID_MINION_RESPAWN_TIMER;
-	public static TIntIntHashMap MINIONS_RESPAWN_TIME;
+	public static Map<Integer, Integer> MINIONS_RESPAWN_TIME;
 	public static float RAID_MIN_RESPAWN_MULTIPLIER;
 	public static float RAID_MAX_RESPAWN_MULTIPLIER;
 	public static boolean RAID_DISABLE_CURSE;
@@ -812,7 +807,7 @@ public final class Config
 	public static int INVENTORY_MAXIMUM_PET;
 	public static double PET_HP_REGEN_MULTIPLIER;
 	public static double PET_MP_REGEN_MULTIPLIER;
-	public static TIntArrayList NON_TALKING_NPCS;
+	public static List<Integer> NON_TALKING_NPCS;
 	
 	// --------------------------------------------------
 	// PvP Settings
@@ -854,7 +849,7 @@ public final class Config
 	public static float RATE_QUEST_REWARD_SCROLL;
 	public static float RATE_QUEST_REWARD_RECIPE;
 	public static float RATE_QUEST_REWARD_MATERIAL;
-	public static TIntFloatHashMap RATE_DROP_ITEMS_ID;
+	public static Map<Integer, Float> RATE_DROP_ITEMS_ID;
 	public static float RATE_KARMA_EXP_LOST;
 	public static float RATE_SIEGE_GUARDS_PRICE;
 	public static float RATE_DROP_COMMON_HERBS;
@@ -923,7 +918,7 @@ public final class Config
 	public static boolean ACCEPT_ALTERNATE_ID;
 	public static int REQUEST_ID;
 	public static boolean RESERVE_HOST_ON_LOGIN = false;
-	public static TIntArrayList PROTOCOL_LIST;
+	public static List<Integer> PROTOCOL_LIST;
 	public static boolean LOG_LOGIN_CONTROLLER;
 	public static boolean LOGIN_SERVER_SCHEDULE_RESTART;
 	public static long LOGIN_SERVER_SCHEDULE_RESTART_TIME;
@@ -970,8 +965,8 @@ public final class Config
 	public static boolean CHECK_KNOWN;
 	public static int GAME_SERVER_LOGIN_PORT;
 	public static String GAME_SERVER_LOGIN_HOST;
-	public static String[] GAME_SERVER_SUBNETS;
-	public static String[] GAME_SERVER_HOSTS;
+	public static List<String> GAME_SERVER_SUBNETS;
+	public static List<String> GAME_SERVER_HOSTS;
 	public static int NEW_NODE_ID;
 	public static int SELECTED_NODE_ID;
 	public static int LINKED_NODE_ID;
@@ -1170,7 +1165,7 @@ public final class Config
 			MAXIMUM_ONLINE_USERS = Integer.parseInt(serverSettings.getProperty("MaximumOnlineUsers", "100"));
 			
 			String[] protocols = serverSettings.getProperty("AllowedProtocolRevisions", "267;268;271;273").split(";");
-			PROTOCOL_LIST = new TIntArrayList(protocols.length);
+			PROTOCOL_LIST = new ArrayList<>(protocols.length);
 			for (String protocol : protocols)
 			{
 				try
@@ -1183,75 +1178,10 @@ public final class Config
 				}
 			}
 			
-			File file = new File(IP_CONFIG_FILE);
-			Document doc = null;
-			ArrayList<String> subnets = new ArrayList<>(5);
-			ArrayList<String> hosts = new ArrayList<>(5);
-			try
-			{
-				DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
-				factory.setValidating(false);
-				factory.setIgnoringComments(true);
-				doc = factory.newDocumentBuilder().parse(file);
-				for (Node n = doc.getFirstChild(); n != null; n = n.getNextSibling())
-				{
-					NamedNodeMap attrs;
-					Node att;
-					
-					if ("gameserver".equalsIgnoreCase(n.getNodeName()))
-					{
-						for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
-						{
-							if ("define".equalsIgnoreCase(d.getNodeName()))
-							{
-								attrs = d.getAttributes();
-								
-								att = attrs.getNamedItem("subnet");
-								if (att == null)
-								{
-									continue;
-								}
-								
-								subnets.add(att.getNodeValue());
-								
-								att = attrs.getNamedItem("address");
-								if (att == null)
-								{
-									continue;
-								}
-								
-								hosts.add(att.getNodeValue());
-								
-								if (hosts.size() != subnets.size())
-								{
-									_log.log(Level.WARNING, "Failed to Load " + IP_CONFIG_FILE + " File - subnets does not match server addresses.");
-								}
-							}
-						}
-						
-						attrs = n.getAttributes();
-						att = attrs.getNamedItem("address");
-						if (att == null)
-						{
-							_log.log(Level.WARNING, "Failed to load " + IP_CONFIG_FILE + " file - default server address is missing.");
-							hosts.add("127.0.0.1");
-						}
-						else
-						{
-							hosts.add(att.getNodeValue());
-						}
-						subnets.add("0.0.0.0/0");
-					}
-				}
-				GAME_SERVER_SUBNETS = subnets.toArray(new String[subnets.size()]);
-				GAME_SERVER_HOSTS = hosts.toArray(new String[hosts.size()]);
-			}
-			catch (Exception e)
-			{
-				_log.log(Level.SEVERE, "Failed to load " + IP_CONFIG_FILE + " file!", e);
-				GAME_SERVER_SUBNETS = new String[]{ "0.0.0.0/0" };
-				GAME_SERVER_HOSTS = new String[]{ "127.0.0.1" };
-			}
+			// Hosts and Subnets
+			IPConfigData ipcd = new IPConfigData();
+			GAME_SERVER_SUBNETS = ipcd.getSubnets();
+			GAME_SERVER_HOSTS = ipcd.getHosts();
 			
 			// Load Community Properties file (if exists)
 			L2Properties communityServerSettings = new L2Properties();
@@ -1526,7 +1456,7 @@ public final class Config
 			if (ENABLE_MODIFY_SKILL_DURATION)
 			{
 				String[] propertySplit = Character.getProperty("SkillDurationList", "").split(";");
-				SKILL_DURATION_LIST = new TIntIntHashMap(propertySplit.length);
+				SKILL_DURATION_LIST = new HashMap<>(propertySplit.length);
 				for (String skill : propertySplit)
 				{
 					String[] skillSplit = skill.split(",");
@@ -1555,7 +1485,7 @@ public final class Config
 			if (ENABLE_MODIFY_SKILL_REUSE)
 			{
 				String[] propertySplit = Character.getProperty("SkillReuseList", "").split(";");
-				SKILL_REUSE_LIST = new TIntIntHashMap(propertySplit.length);
+				SKILL_REUSE_LIST = new HashMap<>(propertySplit.length);
 				for (String skill : propertySplit)
 				{
 					String[] skillSplit = skill.split(",");
@@ -1943,7 +1873,7 @@ public final class Config
 			AUTODESTROY_ITEM_AFTER = Integer.parseInt(General.getProperty("AutoDestroyDroppedItemAfter", "600"));
 			HERB_AUTO_DESTROY_TIME = Integer.parseInt(General.getProperty("AutoDestroyHerbTime", "60")) * 1000;
 			String[] split = General.getProperty("ListOfProtectedItems", "0").split(",");
-			LIST_PROTECTED_ITEMS = new TIntArrayList(split.length);
+			LIST_PROTECTED_ITEMS = new ArrayList<>(split.length);
 			for (String id : split)
 			{
 				LIST_PROTECTED_ITEMS.add(Integer.parseInt(id));
@@ -2197,10 +2127,10 @@ public final class Config
 			GUARD_ATTACK_AGGRO_MOB = Boolean.parseBoolean(NPC.getProperty("GuardAttackAggroMob", "False"));
 			ALLOW_WYVERN_UPGRADER = Boolean.parseBoolean(NPC.getProperty("AllowWyvernUpgrader", "False"));
 			String[] listPetRentNpc = NPC.getProperty("ListPetRentNpc", "30827").split(",");
-			LIST_PET_RENT_NPC = new TIntArrayList(listPetRentNpc.length);
+			LIST_PET_RENT_NPC = new ArrayList<>(listPetRentNpc.length);
 			for (String id : listPetRentNpc)
 			{
-				LIST_PET_RENT_NPC.add(Integer.parseInt(id));
+				LIST_PET_RENT_NPC.add(Integer.valueOf(id));
 			}
 			RAID_HP_REGEN_MULTIPLIER = Double.parseDouble(NPC.getProperty("RaidHpRegenMultiplier", "100")) / 100;
 			RAID_MP_REGEN_MULTIPLIER = Double.parseDouble(NPC.getProperty("RaidMpRegenMultiplier", "100")) / 100;
@@ -2212,7 +2142,7 @@ public final class Config
 			RAID_MAX_RESPAWN_MULTIPLIER = Float.parseFloat(NPC.getProperty("RaidMaxRespawnMultiplier", "1.0"));
 			RAID_MINION_RESPAWN_TIMER = Integer.parseInt(NPC.getProperty("RaidMinionRespawnTime", "300000"));
 			final String[] propertySplit = NPC.getProperty("CustomMinionsRespawnTime", "").split(";");
-			MINIONS_RESPAWN_TIME = new TIntIntHashMap(propertySplit.length);
+			MINIONS_RESPAWN_TIME = new HashMap<>(propertySplit.length);
 			for (String prop : propertySplit)
 			{
 				String[] propSplit = prop.split(",");
@@ -2223,7 +2153,7 @@ public final class Config
 				
 				try
 				{
-					MINIONS_RESPAWN_TIME.put(Integer.parseInt(propSplit[0]), Integer.parseInt(propSplit[1]));
+					MINIONS_RESPAWN_TIME.put(Integer.valueOf(propSplit[0]), Integer.valueOf(propSplit[1]));
 				}
 				catch (NumberFormatException nfe)
 				{
@@ -2242,7 +2172,7 @@ public final class Config
 			PET_HP_REGEN_MULTIPLIER = Double.parseDouble(NPC.getProperty("PetHpRegenMultiplier", "100")) / 100;
 			PET_MP_REGEN_MULTIPLIER = Double.parseDouble(NPC.getProperty("PetMpRegenMultiplier", "100")) / 100;
 			split = NPC.getProperty("NonTalkingNpcs", "18684,18685,18686,18687,18688,18689,18690,19691,18692,31557,31606,31671,31672,31673,31674,32026,32030,32031,32032,32306,32619,32620,32621").split(",");
-			NON_TALKING_NPCS = new TIntArrayList(split.length);
+			NON_TALKING_NPCS = new ArrayList<>(split.length);
 			for (String npcId : split)
 			{
 				try
@@ -2361,7 +2291,7 @@ public final class Config
 			}
 			
 			String[] rateDropItemsById = RatesSettings.getProperty("RateDropItemsById", "").split(";");
-			RATE_DROP_ITEMS_ID = new TIntFloatHashMap(rateDropItemsById.length);
+			RATE_DROP_ITEMS_ID = new HashMap<>(rateDropItemsById.length);
 			if (!rateDropItemsById[0].isEmpty())
 			{
 				for (String item : rateDropItemsById)
@@ -2375,7 +2305,7 @@ public final class Config
 					{
 						try
 						{
-							RATE_DROP_ITEMS_ID.put(Integer.parseInt(itemSplit[0]), Float.parseFloat(itemSplit[1]));
+							RATE_DROP_ITEMS_ID.put(Integer.valueOf(itemSplit[0]), Float.valueOf(itemSplit[1]));
 						}
 						catch (NumberFormatException nfe)
 						{
@@ -2586,7 +2516,7 @@ public final class Config
 							tvtNpcCoords = L2JModSettings.getProperty("TvTEventFighterBuffs", "").split(";");
 							if (!tvtNpcCoords[0].isEmpty())
 							{
-								TVT_EVENT_FIGHTER_BUFFS = new TIntIntHashMap(tvtNpcCoords.length);
+								TVT_EVENT_FIGHTER_BUFFS = new HashMap<>(tvtNpcCoords.length);
 								for (String skill : tvtNpcCoords)
 								{
 									String[] skillSplit = skill.split(",");
@@ -2614,7 +2544,7 @@ public final class Config
 							tvtNpcCoords = L2JModSettings.getProperty("TvTEventMageBuffs", "").split(";");
 							if (!tvtNpcCoords[0].isEmpty())
 							{
-								TVT_EVENT_MAGE_BUFFS = new TIntIntHashMap(tvtNpcCoords.length);
+								TVT_EVENT_MAGE_BUFFS = new HashMap<>(tvtNpcCoords.length);
 								for (String skill : tvtNpcCoords)
 								{
 									String[] skillSplit = skill.split(",");
@@ -2719,7 +2649,7 @@ public final class Config
 			L2JMOD_DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP = Integer.parseInt(L2JModSettings.getProperty("DualboxCheckMaxOlympiadParticipantsPerIP", "0"));
 			L2JMOD_DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP = Integer.parseInt(L2JModSettings.getProperty("DualboxCheckMaxL2EventParticipantsPerIP", "0"));
 			String[] dualboxCheckWhiteList = L2JModSettings.getProperty("DualboxCheckWhitelist", "127.0.0.1,0").split(";");
-			L2JMOD_DUALBOX_CHECK_WHITELIST = new TIntIntHashMap(dualboxCheckWhiteList.length);
+			L2JMOD_DUALBOX_CHECK_WHITELIST = new HashMap<>(dualboxCheckWhiteList.length);
 			for (String entry : dualboxCheckWhiteList)
 			{
 				String[] entrySplit = entry.split(",");
@@ -2839,7 +2769,7 @@ public final class Config
 			ALT_OLY_SHOW_MONTHLY_WINNERS = Boolean.parseBoolean(Olympiad.getProperty("AltOlyShowMonthlyWinners", "true"));
 			ALT_OLY_ANNOUNCE_GAMES = Boolean.parseBoolean(Olympiad.getProperty("AltOlyAnnounceGames", "true"));
 			String[] olyRestrictedItems = Olympiad.getProperty("AltOlyRestrictedItems", "6611,6612,6613,6614,6615,6616,6617,6618,6619,6620,6621,9388,9389,9390,17049,17050,17051,17052,17053,17054,17055,17056,17057,17058,17059,17060,17061,20759,20775,20776,20777,20778,14774").split(",");
-			LIST_OLY_RESTRICTED_ITEMS = new TIntArrayList(olyRestrictedItems.length);
+			LIST_OLY_RESTRICTED_ITEMS = new ArrayList<>(olyRestrictedItems.length);
 			for (String id : olyRestrictedItems)
 			{
 				LIST_OLY_RESTRICTED_ITEMS.add(Integer.parseInt(id));
@@ -4205,15 +4135,15 @@ public final class Config
 	
 	public static class ClassMasterSettings
 	{
-		private final TIntObjectHashMap<TIntIntHashMap> _claimItems;
-		private final TIntObjectHashMap<TIntIntHashMap> _rewardItems;
-		private final TIntObjectHashMap<Boolean> _allowedClassChange;
+		private final Map<Integer, Map<Integer, Integer>> _claimItems;
+		private final Map<Integer, Map<Integer, Integer>> _rewardItems;
+		private final Map<Integer, Boolean> _allowedClassChange;
 		
 		public ClassMasterSettings(String _configLine)
 		{
-			_claimItems = new TIntObjectHashMap<>(3);
-			_rewardItems = new TIntObjectHashMap<>(3);
-			_allowedClassChange = new TIntObjectHashMap<>(3);
+			_claimItems = new HashMap<>(3);
+			_rewardItems = new HashMap<>(3);
+			_allowedClassChange = new HashMap<>(3);
 			if (_configLine != null)
 			{
 				parseConfigLine(_configLine.trim());
@@ -4231,7 +4161,7 @@ public final class Config
 				
 				_allowedClassChange.put(job, true);
 				
-				TIntIntHashMap _items = new TIntIntHashMap();
+				Map<Integer, Integer> _items = new HashMap<>();
 				// parse items needed for class change
 				if (st.hasMoreTokens())
 				{
@@ -4248,7 +4178,7 @@ public final class Config
 				
 				_claimItems.put(job, _items);
 				
-				_items = new TIntIntHashMap();
+				_items = new HashMap<>();
 				// parse gifts after class change
 				if (st.hasMoreTokens())
 				{
@@ -4281,7 +4211,7 @@ public final class Config
 			return false;
 		}
 		
-		public TIntIntHashMap getRewardItems(int job)
+		public Map<Integer, Integer> getRewardItems(int job)
 		{
 			if (_rewardItems.containsKey(job))
 			{
@@ -4291,7 +4221,7 @@ public final class Config
 			return null;
 		}
 		
-		public TIntIntHashMap getRequireItems(int job)
+		public Map<Integer, Integer> getRequireItems(int job)
 		{
 			if (_claimItems.containsKey(job))
 			{
@@ -4306,11 +4236,11 @@ public final class Config
 	 * @param line the string line to parse
 	 * @return a parsed float map
 	 */
-	private static TIntFloatHashMap parseConfigLine(String line)
+	private static Map<Integer, Float> parseConfigLine(String line)
 	{
 		String[] propertySplit = line.split(",");
-		TIntFloatHashMap ret = new TIntFloatHashMap(propertySplit.length);
-		int i = 1;
+		Map<Integer, Float> ret = new HashMap<>(propertySplit.length);
+		int i = 0;
 		for (String value : propertySplit)
 		{
 			ret.put(i++, Float.parseFloat(value));
@@ -4369,4 +4299,77 @@ public final class Config
 		}
 		return result;
 	}
+	
+	private static class IPConfigData extends DocumentParser
+	{
+		private static final List<String> subnets = new ArrayList<>(5);
+		private static final List<String> hosts = new ArrayList<>(5);
+		
+		public IPConfigData()
+		{
+			load();
+		}
+		
+		@Override
+		public void load()
+		{
+			parseFile(new File(IP_CONFIG_FILE));
+		}
+		
+		@Override
+		protected void parseDocument()
+		{
+			NamedNodeMap attrs;
+			for (Node n = getCurrentDocument().getFirstChild(); n != null; n = n.getNextSibling())
+			{
+				if ("gameserver".equalsIgnoreCase(n.getNodeName()))
+				{
+					for (Node d = n.getFirstChild(); d != null; d = d.getNextSibling())
+					{
+						if ("define".equalsIgnoreCase(d.getNodeName()))
+						{
+							attrs = d.getAttributes();
+							subnets.add(attrs.getNamedItem("subnet").getNodeValue());
+							hosts.add(attrs.getNamedItem("address").getNodeValue());
+							
+							if (hosts.size() != subnets.size())
+							{
+								_log.log(Level.WARNING, "Failed to Load " + IP_CONFIG_FILE + " File - subnets does not match server addresses.");
+							}
+						}
+					}
+					
+					Node att = n.getAttributes().getNamedItem("address");
+					if (att == null)
+					{
+						_log.log(Level.WARNING, "Failed to load " + IP_CONFIG_FILE + " file - default server address is missing.");
+						hosts.add("127.0.0.1");
+					}
+					else
+					{
+						hosts.add(att.getNodeValue());
+					}
+					subnets.add("0.0.0.0/0");
+				}
+			}
+		}
+		
+		protected List<String> getSubnets()
+		{
+			if (subnets.isEmpty())
+			{
+				return Arrays.asList("0.0.0.0/0");
+			}
+			return subnets;
+		}
+		
+		protected List<String> getHosts()
+		{
+			if (hosts.isEmpty())
+			{
+				return Arrays.asList("127.0.0.1");
+			}
+			return hosts;
+		}
+	}
 }

+ 2 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/LoginServerThread.java

@@ -111,8 +111,8 @@ public class LoginServerThread extends Thread
 	private final FastMap<String, L2GameClient> _accountsInGameServer = new FastMap<>();
 	private int _status;
 	private String _serverName;
-	private final String[] _subnets;
-	private final String[] _hosts;
+	private final List<String> _subnets;
+	private final List<String> _hosts;
 	
 	/**
 	 * Instantiates a new login server thread.

+ 2 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/datatables/DoorTable.java

@@ -18,6 +18,7 @@ import gnu.trove.map.hash.TIntObjectHashMap;
 
 import java.util.ArrayList;
 import java.util.HashSet;
+import java.util.List;
 import java.util.Set;
 import java.util.logging.Logger;
 
@@ -197,7 +198,7 @@ public class DoorTable extends DocumentParser
 	 */
 	public boolean checkIfDoorsBetween(int x, int y, int z, int tx, int ty, int tz, int instanceId, boolean doubleFaceCheck)
 	{
-		ArrayList<L2DoorInstance> allDoors;
+		List<L2DoorInstance> allDoors;
 		if (instanceId > 0 && InstanceManager.getInstance().getInstance(instanceId) != null)
 			allDoors = InstanceManager.getInstance().getInstance(instanceId).getDoors();
 		else

+ 4 - 4
L2J_Server_BETA/java/com/l2jserver/gameserver/model/actor/instance/L2ClassMasterInstance.java

@@ -328,7 +328,7 @@ public final class L2ClassMasterInstance extends L2MerchantInstance
 		}
 		
 		// check if player have all required items for class transfer
-		for (int _itemId : Config.CLASS_MASTER_SETTINGS.getRequireItems(newJobLevel).keys())
+		for (int _itemId : Config.CLASS_MASTER_SETTINGS.getRequireItems(newJobLevel).keySet())
 		{
 			int _count = Config.CLASS_MASTER_SETTINGS.getRequireItems(newJobLevel).get(_itemId);
 			if (player.getInventory().getInventoryItemCount(_itemId, -1) < _count)
@@ -339,7 +339,7 @@ public final class L2ClassMasterInstance extends L2MerchantInstance
 		}
 		
 		// get all required items for class transfer
-		for (int _itemId : Config.CLASS_MASTER_SETTINGS.getRequireItems(newJobLevel).keys())
+		for (int _itemId : Config.CLASS_MASTER_SETTINGS.getRequireItems(newJobLevel).keySet())
 		{
 			int _count = Config.CLASS_MASTER_SETTINGS.getRequireItems(newJobLevel).get(_itemId);
 			if (!player.destroyItemByItemId("ClassMaster", _itemId, _count, player, true))
@@ -347,7 +347,7 @@ public final class L2ClassMasterInstance extends L2MerchantInstance
 		}
 		
 		// reward player with items
-		for (int _itemId : Config.CLASS_MASTER_SETTINGS.getRewardItems(newJobLevel).keys())
+		for (int _itemId : Config.CLASS_MASTER_SETTINGS.getRewardItems(newJobLevel).keySet())
 		{
 			int _count = Config.CLASS_MASTER_SETTINGS.getRewardItems(newJobLevel).get(_itemId);
 			player.addItem("ClassMaster", _itemId, _count, player, true);
@@ -432,7 +432,7 @@ public final class L2ClassMasterInstance extends L2MerchantInstance
 		if (Config.CLASS_MASTER_SETTINGS.getRequireItems(level) == null || Config.CLASS_MASTER_SETTINGS.getRequireItems(level).isEmpty())
 			return "<tr><td>none</td></tr>";
 		StringBuilder sb = new StringBuilder();
-		for (int _itemId : Config.CLASS_MASTER_SETTINGS.getRequireItems(level).keys())
+		for (int _itemId : Config.CLASS_MASTER_SETTINGS.getRequireItems(level).keySet())
 		{
 			int _count = Config.CLASS_MASTER_SETTINGS.getRequireItems(level).get(_itemId);
 			sb.append("<tr><td><font color=\"LEVEL\">" + _count + "</font></td><td>" + ItemTable.getInstance().getTemplate(_itemId).getName() + "</td></tr>");

+ 30 - 69
L2J_Server_BETA/java/com/l2jserver/gameserver/model/entity/Instance.java

@@ -1,11 +1,9 @@
 package com.l2jserver.gameserver.model.entity;
 
-import gnu.trove.procedure.TIntProcedure;
-import gnu.trove.set.hash.TIntHashSet;
-
 import java.io.File;
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.List;
 import java.util.concurrent.ScheduledFuture;
 import java.util.logging.Level;
 import java.util.logging.Logger;
@@ -39,7 +37,6 @@ import com.l2jserver.gameserver.model.actor.templates.L2NpcTemplate;
 import com.l2jserver.gameserver.network.SystemMessageId;
 import com.l2jserver.gameserver.network.clientpackets.Say2;
 import com.l2jserver.gameserver.network.serverpackets.CreatureSay;
-import com.l2jserver.gameserver.network.serverpackets.L2GameServerPacket;
 import com.l2jserver.gameserver.network.serverpackets.SystemMessage;
 
 /**
@@ -52,12 +49,10 @@ public class Instance
 	private int _id;
 	private String _name;
 	
-	private TIntHashSet _players = new TIntHashSet();
-	private final EjectPlayerProcedure _ejectProc;
-	
-	private FastList<L2Npc> _npcs = new FastList<L2Npc>().shared();
-	private ArrayList<L2DoorInstance> _doors = null;
-	private int[] _spawnLoc = new int[3];
+	private List<Integer> _players = new FastList<Integer>().shared();
+	private List<L2Npc> _npcs = new FastList<L2Npc>().shared();
+	private List<L2DoorInstance> _doors = null;
+	private int[] _spawnLoc = new int[3]; // TODO: Zoey76: Replace with Location object.
 	private boolean _allowSummon = true;
 	private long _emptyDestroyTime = -1;
 	private long _lastLeft = -1;
@@ -73,7 +68,6 @@ public class Instance
 	public Instance(int id)
 	{
 		_id = id;
-		_ejectProc = new EjectPlayerProcedure();
 		_instanceStartTime = System.currentTimeMillis();
 	}
 	
@@ -115,16 +109,18 @@ public class Instance
 		_allowSummon = b;
 	}
 	
-	/*
+	/**
 	 * Returns true if entire instance is PvP zone
+	 * @return 
 	 */
 	public boolean isPvPInstance()
 	{
 		return _isPvPInstance;
 	}
 	
-	/*
+	/**
 	 * Sets PvP zone status of the instance
+	 * @param b 
 	 */
 	public void setPvPInstance(boolean b)
 	{
@@ -169,10 +165,7 @@ public class Instance
 	 */
 	public void addPlayer(int objectId)
 	{
-		synchronized(_players)
-		{
-			_players.add(objectId);
-		}
+		_players.add(objectId);
 	}
 	
 	/**
@@ -181,10 +174,7 @@ public class Instance
 	 */
 	public void removePlayer(int objectId)
 	{
-		synchronized(_players)
-		{
-			_players.remove(objectId);
-		}
+		_players.remove(objectId);
 		
 		if (_players.isEmpty() && _emptyDestroyTime >= 0)
 		{
@@ -251,24 +241,24 @@ public class Instance
 		_doors.add(newdoor);
 	}
 	
-	public TIntHashSet getPlayers()
+	public List<Integer> getPlayers()
 	{
 		return _players;
 	}
 	
-	public FastList<L2Npc> getNpcs()
+	public List<L2Npc> getNpcs()
 	{
 		return _npcs;
 	}
 	
-	public ArrayList<L2DoorInstance> getDoors()
+	public List<L2DoorInstance> getDoors()
 	{
 		return _doors;
 	}
 	
 	public L2DoorInstance getDoor(int id)
 	{
-		for (L2DoorInstance temp: getDoors())
+		for (L2DoorInstance temp : _doors)
 		{
 			if (temp.getDoorId() == id)
 				return temp;
@@ -323,12 +313,12 @@ public class Instance
 	
 	public void removePlayers()
 	{
-		_players.forEach(_ejectProc);
-		
-		synchronized (_players)
+		// TODO: Zoey76: Implement IL2Procedure?
+		for (int objId : _players)
 		{
-			_players.clear();
+			ejectPlayer(objId);
 		}
+		_players.clear();
 	}
 	
 	public void removeNpcs()
@@ -615,8 +605,17 @@ public class Instance
 			remaining = remaining - 10000;
 		}
 		if (cs != null)
-			_players.forEach(new SendPacketToPlayerProcedure(cs));
-		
+		{
+			// TODO: Zoey76: Implement IL2Procedure?
+			for (int objId : _players)
+			{
+				L2PcInstance player = L2World.getInstance().getPlayer(objId);
+				if (player.getInstanceId() == getId())
+				{
+					player.sendPacket(cs);
+				}
+			}
+		}
 		cancelTimer();
 		if (remaining >= 10000)
 			_CheckTimeUpTask = ThreadPoolManager.getInstance().scheduleGeneral(new CheckTimeUp(remaining), interval);
@@ -654,42 +653,4 @@ public class Instance
 			InstanceManager.getInstance().destroyInstance(getId());
 		}
 	}
-	
-	
-	private final class EjectPlayerProcedure implements TIntProcedure
-	{
-		EjectPlayerProcedure()
-		{
-			
-		}
-		
-		@Override
-		public final boolean execute(final int objId)
-		{
-			ejectPlayer(objId);
-			return true;
-		}
-	}
-	
-	private final class SendPacketToPlayerProcedure implements TIntProcedure
-	{
-		private final L2GameServerPacket _packet;
-		
-		SendPacketToPlayerProcedure(final L2GameServerPacket packet)
-		{
-			_packet = packet;
-		}
-		
-		@Override
-		public final boolean execute(final int objId)
-		{
-			L2PcInstance player = L2World.getInstance().getPlayer(objId);
-			
-			if (player.getInstanceId() == getId())
-			{
-				player.sendPacket(_packet);
-			}
-			return true;
-		}
-	}
 }

+ 2 - 2
L2J_Server_BETA/java/com/l2jserver/gameserver/model/entity/TvTEvent.java

@@ -923,7 +923,7 @@ public class TvTEvent
 		{
 			if (Config.TVT_EVENT_MAGE_BUFFS != null && !Config.TVT_EVENT_MAGE_BUFFS.isEmpty())
 			{
-				for (int i : Config.TVT_EVENT_MAGE_BUFFS.keys())
+				for (int i : Config.TVT_EVENT_MAGE_BUFFS.keySet())
 				{
 					L2Skill skill = SkillTable.getInstance().getInfo(i, Config.TVT_EVENT_MAGE_BUFFS.get(i));
 					if (skill != null)
@@ -935,7 +935,7 @@ public class TvTEvent
 		{
 			if (Config.TVT_EVENT_FIGHTER_BUFFS != null && !Config.TVT_EVENT_FIGHTER_BUFFS.isEmpty())
 			{
-				for (int i : Config.TVT_EVENT_FIGHTER_BUFFS.keys())
+				for (int i : Config.TVT_EVENT_FIGHTER_BUFFS.keySet())
 				{
 					L2Skill skill = SkillTable.getInstance().getInfo(i, Config.TVT_EVENT_FIGHTER_BUFFS.get(i));
 					if (skill != null)

+ 15 - 0
L2J_Server_BETA/java/com/l2jserver/gameserver/model/quest/Quest.java

@@ -1866,6 +1866,21 @@ public class Quest extends ManagedScript
 		return value;
 	}
 	
+	/**
+	 * Add this quest event to the collection of NPC Ids that will respond to for on kill events.
+	 * @param killIds the collection of NPC Ids
+	 * @return the list of NPC templates that has been associated with this event
+	 */
+	public List<L2NpcTemplate> addKillId(Collection<Integer> killIds)
+	{
+		final List<L2NpcTemplate> list = new ArrayList<>(killIds.size());
+		for (int killId : killIds)
+		{
+			list.add(addEventId(killId, QuestEventType.ON_KILL));
+		}
+		return list;
+	}
+	
 	/**
 	 * @param npcId
 	 * @return

+ 9 - 7
L2J_Server_BETA/java/com/l2jserver/gameserver/network/gameserverpackets/AuthRequest.java

@@ -14,6 +14,8 @@
  */
 package com.l2jserver.gameserver.network.gameserverpackets;
 
+import java.util.List;
+
 import com.l2jserver.util.network.BaseSendablePacket;
 
 public class AuthRequest extends BaseSendablePacket
@@ -35,10 +37,10 @@ public class AuthRequest extends BaseSendablePacket
 	 * @param port 
 	 * @param reserveHost
 	 * @param maxplayer
-	 * @param subnets 
-	 * @param hosts 
+	 * @param subnets the subnets lists
+	 * @param hosts the hosts list
 	 */
-	public AuthRequest(int id, boolean acceptAlternate, byte[] hexid, int port, boolean reserveHost, int maxplayer, String[] subnets, String[] hosts)
+	public AuthRequest(int id, boolean acceptAlternate, byte[] hexid, int port, boolean reserveHost, int maxplayer, List<String> subnets, List<String> hosts)
 	{
 		writeC(0x01);
 		writeC(id);
@@ -48,11 +50,11 @@ public class AuthRequest extends BaseSendablePacket
 		writeD(maxplayer);
 		writeD(hexid.length);
 		writeB(hexid);
-		writeD(subnets.length);
-		for (int i = 0; i < subnets.length; i++)
+		writeD(subnets.size());
+		for (int i = 0; i < subnets.size(); i++)
 		{
-			writeS(subnets[i]);
-			writeS(hosts[i]);
+			writeS(subnets.get(i));
+			writeS(hosts.get(i));
 		}
 	}
 	

+ 1 - 1
L2J_Server_BETA/java/com/l2jserver/gameserver/util/L2TIntObjectHashMap.java

@@ -165,7 +165,7 @@ public class L2TIntObjectHashMap<V extends Object> extends TIntObjectHashMap<V>
 	}
 	
 	@Override
-	public V[] values()
+	public Object[] values()
 	{
 		if (!_tempLocksDisable)
 		{