L2j Killer - Attacker Gracia Final

Find the proper support area, Saga-Version.
Forum rules
READ NOW: L2j Forums Rules of Conduct
JustLikeMe
Posts: 91
Joined: Fri Feb 05, 2010 8:12 pm

Re: L2j Killer - Attacker Gracia Final

Post by JustLikeMe »

I've installed java and eclipse with subeclipse made all things needed im in the step that i run as the build.xml and then compile it, but i only want the gameserver.java . How can i replace DrHouse files in eclipse and then do the compile?
User avatar
ThePhoenixBird
L2j Inner Circle
L2j Inner Circle
Posts: 1857
Joined: Fri May 27, 2005 5:11 pm

Re: L2j Killer - Attacker Gracia Final

Post by ThePhoenixBird »

You need to modify the code manually to add the DrHouse patches, or generate a patch from the trac and apply it to the sources using eclipse, anyways i would recommend to add it manually to the code using Eclipse, just find the modified files change the code lines modified by house and recompile the server, then you will get your gameserver.jar on the generated compiled folder of your sources.
User avatar
LasTravel
Posts: 888
Joined: Tue Jan 05, 2010 12:08 am
Location: Spain

Re: L2j Killer - Attacker Gracia Final

Post by LasTravel »

Here DrHouse Fix for Gracia final...

Code: Select all

Index: java/net/sf/l2j/gameserver/GameServer.java===================================================================--- java/net/sf/l2j/gameserver/GameServer.java	(revision 1475)+++ java/net/sf/l2j/gameserver/GameServer.java	(working copy)@@ -121,6 +121,7 @@ import net.sf.l2j.gameserver.util.DynamicExtension; import net.sf.l2j.status.Status; import net.sf.l2j.util.DeadLockDetector;+import net.sf.l2j.util.IPv4Filter;  import org.mmocore.network.SelectorConfig; import org.mmocore.network.SelectorThread;@@ -439,7 +440,7 @@ 		sc.SLEEP_TIME = Config.MMO_SELECTOR_SLEEP_TIME; 		sc.HELPER_BUFFER_COUNT = Config.MMO_HELPER_BUFFER_COUNT; 		final L2GamePacketHandler gph = new L2GamePacketHandler();-		_selectorThread = new SelectorThread<L2GameClient>(sc, gph, gph, gph, null);+		_selectorThread = new SelectorThread<L2GameClient>(sc, gph, gph, gph, new IPv4Filter());  		InetAddress bindAddress = null; 		if (!Config.GAMESERVER_HOSTNAME.equals("*"))Index: java/net/sf/l2j/util/IPv4Filter.java===================================================================--- java/net/sf/l2j/util/IPv4Filter.java	(revision 0)+++ java/net/sf/l2j/util/IPv4Filter.java	(revision 0)@@ -0,0 +1,151 @@+/*+ * This program is free software: you can redistribute it and/or modify it under+ * the terms of the GNU General Public License as published by the Free Software+ * Foundation, either version 3 of the License, or (at your option) any later+ * version.+ * + * This program is distributed in the hope that it will be useful, but WITHOUT+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more+ * details.+ * + * You should have received a copy of the GNU General Public License along with+ * this program. If not, see <http://www.gnu.org/licenses/>.+ */++package net.sf.l2j.util;++import java.net.InetAddress;+import java.nio.channels.SocketChannel;+import java.util.ArrayList;+import java.util.HashMap;+import java.util.Map.Entry;++import org.mmocore.network.IAcceptFilter;++/**+ * Formatted Forsaiken's IPv4 filter [DrHouse]+ * + * @author Forsaiken+ *+ */+public class IPv4Filter implements IAcceptFilter, Runnable+{+	private HashMap<Integer, Flood> _ipFloodMap;+	private static final long SLEEP_TIME = 5000;+	+	public IPv4Filter()+	{+		_ipFloodMap = new HashMap<Integer, Flood>();+		Thread t = new Thread(this);+		t.setDaemon(true);+		t.start();+	}+	/**+	 * +	 * @param ip+	 * @return+	 */+	private static final int hash(byte[] ip)+	{+		return ip[0] & 0xFF | ip[1] << 8 & 0xFF00 | ip[2] << 16 & 0xFF0000 | ip[3] << 24 & 0xFF000000;+	}+	+	protected static final class Flood+	{+		long lastAccess;+		int trys;+		+		Flood()+		{+			lastAccess = System.currentTimeMillis();+			trys = 0;+		}+	}+	+	@Override+	public boolean accept(SocketChannel sc)+	{+		InetAddress addr = sc.socket().getInetAddress();+		int h = hash(addr.getAddress());+		+		long current = System.currentTimeMillis();+		Flood f;+		synchronized (_ipFloodMap)+		{+			f = _ipFloodMap.get(h);+		}+		if (f != null)+		{+			if (f.trys == -1)+			{+				f.lastAccess = current;+				return false;+			}+			+			if (f.lastAccess + 1000 > current)+			{+				f.lastAccess = current;+				+				if (f.trys >= 3)+				{+					f.trys = -1;+					return false;+				}+				+				f.trys++;+			}+			else+			{+				f.lastAccess = current;+			}+		}+		else+		{+			synchronized (_ipFloodMap)+			{+				_ipFloodMap.put(h, new Flood());+			}+		}+		+		return true;+	}++	@Override+	public void run()+	{+		while (true)+		{+			long reference = System.currentTimeMillis() - (1000 * 300);+			ArrayList<Integer> toRemove = new ArrayList<Integer>(50);+			+			synchronized (_ipFloodMap)+			{+				for (Entry<Integer, Flood> e : _ipFloodMap.entrySet())+				{+					Flood f = e.getValue();+					if (f.lastAccess < reference)+						toRemove.add(e.getKey());+				}+			}+			+			synchronized (_ipFloodMap)+			{+				for (Integer i : toRemove)+				{+					_ipFloodMap.remove(i);+				}+			}+			+			try+			{+				Thread.sleep(SLEEP_TIME);+			}+			catch (InterruptedException e)+			{+				+			}+		}+	}+	+}\ No newline at end of fileIndex: java/net/sf/l2j/loginserver/SelectorHelper.java===================================================================--- java/net/sf/l2j/loginserver/SelectorHelper.java	(revision 1475)+++ java/net/sf/l2j/loginserver/SelectorHelper.java	(working copy)@@ -12,16 +12,13 @@  */ package net.sf.l2j.loginserver; -import java.net.InetAddress; import java.nio.channels.SocketChannel;-import java.util.ArrayList;-import java.util.HashMap;-import java.util.Map.Entry; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit;  import net.sf.l2j.loginserver.serverpackets.Init;+import net.sf.l2j.util.IPv4Filter;  import org.mmocore.network.IAcceptFilter; import org.mmocore.network.IClientFactory;@@ -33,18 +30,15 @@  *   * @author KenM  */-public class SelectorHelper extends Thread implements IMMOExecutor<L2LoginClient>,+public class SelectorHelper implements IMMOExecutor<L2LoginClient>,         IClientFactory<L2LoginClient>, IAcceptFilter {-	private HashMap<Integer, Flood> _ipFloodMap; 	private ThreadPoolExecutor _generalPacketsThreadPool;+	private IPv4Filter _ipv4filter;  	public SelectorHelper() 	{-		_generalPacketsThreadPool = new ThreadPoolExecutor(4, 6, 15L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());-		_ipFloodMap = new HashMap<Integer, Flood>();-		super.setDaemon(true);-		super.start();+		_ipv4filter = new IPv4Filter(); 	}  	/**@@ -73,110 +67,6 @@ 	 */ 	public boolean accept(SocketChannel sc) 	{-		InetAddress addr = sc.socket().getInetAddress();-		int h = hash(addr.getAddress());-		-		long current = System.currentTimeMillis();-		Flood f;-		synchronized (_ipFloodMap)-		{-			f = _ipFloodMap.get(h);-		}-		if (f != null)-		{-			if (f.trys == -1)-			{-				f.lastAccess = current;-				return false;-			}-			-			if (f.lastAccess + 1000 > current)-			{-				f.lastAccess = current;-				-				if (f.trys >= 3)-				{-					f.trys = -1;-					return false;-				}-				-				f.trys++;-			}-			else-			{-				f.lastAccess = current;-			}-		}-		else-		{-			synchronized (_ipFloodMap)-			{-				_ipFloodMap.put(h, new Flood());-			}-		}-		return !LoginController.getInstance().isBannedAddress(addr);+		return _ipv4filter.accept(sc) && !LoginController.getInstance().isBannedAddress(sc.socket().getInetAddress()); 	}-	-	/**-	 * -	 * @param ip-	 * @return-	 */-	private int hash(byte[] ip)-	{-		return ip[0] & 0xFF | ip[1] << 8 & 0xFF00 | ip[2] << 16 & 0xFF0000 | ip[3] << 24-		        & 0xFF000000;-	}-	-	private class Flood-	{-		long lastAccess;-		int trys;-		-		Flood()-		{-			lastAccess = System.currentTimeMillis();-			trys = 0;-		}-	}-	-	/**-	 * -	 * @see java.lang.Thread#run()-	 */-	@Override-	public void run()-	{-		while (true)-		{-			long reference = System.currentTimeMillis() - (1000 * 300);-			ArrayList<Integer> toRemove = new ArrayList<Integer>(50);-			synchronized (_ipFloodMap)-			{-				for (Entry<Integer, Flood> e : _ipFloodMap.entrySet())-				{-					Flood f = e.getValue();-					if (f.lastAccess < reference)-						toRemove.add(e.getKey());-				}-			}-			-			synchronized (_ipFloodMap)-			{-				for (Integer i : toRemove)-				{-					_ipFloodMap.remove(i);-				}-			}-			-			try-			{-				Thread.sleep(5000);-			}-			catch (InterruptedException e)-			{-				-			}-		}-	} } 
JustLikeMe
Posts: 91
Joined: Fri Feb 05, 2010 8:12 pm

Re: L2j Killer - Attacker Gracia Final

Post by JustLikeMe »

LasTravel wrote:Here DrHouse Fix for Gracia final...

Code: Select all

Index: java/net/sf/l2j/gameserver/GameServer.java===================================================================--- java/net/sf/l2j/gameserver/GameServer.java	(revision 1475)+++ java/net/sf/l2j/gameserver/GameServer.java	(working copy)@@ -121,6 +121,7 @@ import net.sf.l2j.gameserver.util.DynamicExtension; import net.sf.l2j.status.Status; import net.sf.l2j.util.DeadLockDetector;+import net.sf.l2j.util.IPv4Filter;  import org.mmocore.network.SelectorConfig; import org.mmocore.network.SelectorThread;@@ -439,7 +440,7 @@ 		sc.SLEEP_TIME = Config.MMO_SELECTOR_SLEEP_TIME; 		sc.HELPER_BUFFER_COUNT = Config.MMO_HELPER_BUFFER_COUNT; 		final L2GamePacketHandler gph = new L2GamePacketHandler();-		_selectorThread = new SelectorThread<L2GameClient>(sc, gph, gph, gph, null);+		_selectorThread = new SelectorThread<L2GameClient>(sc, gph, gph, gph, new IPv4Filter());  		InetAddress bindAddress = null; 		if (!Config.GAMESERVER_HOSTNAME.equals("*"))Index: java/net/sf/l2j/util/IPv4Filter.java===================================================================--- java/net/sf/l2j/util/IPv4Filter.java	(revision 0)+++ java/net/sf/l2j/util/IPv4Filter.java	(revision 0)@@ -0,0 +1,151 @@+/*+ * This program is free software: you can redistribute it and/or modify it under+ * the terms of the GNU General Public License as published by the Free Software+ * Foundation, either version 3 of the License, or (at your option) any later+ * version.+ * + * This program is distributed in the hope that it will be useful, but WITHOUT+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more+ * details.+ * + * You should have received a copy of the GNU General Public License along with+ * this program. If not, see <http://www.gnu.org/licenses/>.+ */++package net.sf.l2j.util;++import java.net.InetAddress;+import java.nio.channels.SocketChannel;+import java.util.ArrayList;+import java.util.HashMap;+import java.util.Map.Entry;++import org.mmocore.network.IAcceptFilter;++/**+ * Formatted Forsaiken's IPv4 filter [DrHouse]+ * + * @author Forsaiken+ *+ */+public class IPv4Filter implements IAcceptFilter, Runnable+{+	private HashMap<Integer, Flood> _ipFloodMap;+	private static final long SLEEP_TIME = 5000;+	+	public IPv4Filter()+	{+		_ipFloodMap = new HashMap<Integer, Flood>();+		Thread t = new Thread(this);+		t.setDaemon(true);+		t.start();+	}+	/**+	 * +	 * @param ip+	 * @return+	 */+	private static final int hash(byte[] ip)+	{+		return ip[0] & 0xFF | ip[1] << 8 & 0xFF00 | ip[2] << 16 & 0xFF0000 | ip[3] << 24 & 0xFF000000;+	}+	+	protected static final class Flood+	{+		long lastAccess;+		int trys;+		+		Flood()+		{+			lastAccess = System.currentTimeMillis();+			trys = 0;+		}+	}+	+	@Override+	public boolean accept(SocketChannel sc)+	{+		InetAddress addr = sc.socket().getInetAddress();+		int h = hash(addr.getAddress());+		+		long current = System.currentTimeMillis();+		Flood f;+		synchronized (_ipFloodMap)+		{+			f = _ipFloodMap.get(h);+		}+		if (f != null)+		{+			if (f.trys == -1)+			{+				f.lastAccess = current;+				return false;+			}+			+			if (f.lastAccess + 1000 > current)+			{+				f.lastAccess = current;+				+				if (f.trys >= 3)+				{+					f.trys = -1;+					return false;+				}+				+				f.trys++;+			}+			else+			{+				f.lastAccess = current;+			}+		}+		else+		{+			synchronized (_ipFloodMap)+			{+				_ipFloodMap.put(h, new Flood());+			}+		}+		+		return true;+	}++	@Override+	public void run()+	{+		while (true)+		{+			long reference = System.currentTimeMillis() - (1000 * 300);+			ArrayList<Integer> toRemove = new ArrayList<Integer>(50);+			+			synchronized (_ipFloodMap)+			{+				for (Entry<Integer, Flood> e : _ipFloodMap.entrySet())+				{+					Flood f = e.getValue();+					if (f.lastAccess < reference)+						toRemove.add(e.getKey());+				}+			}+			+			synchronized (_ipFloodMap)+			{+				for (Integer i : toRemove)+				{+					_ipFloodMap.remove(i);+				}+			}+			+			try+			{+				Thread.sleep(SLEEP_TIME);+			}+			catch (InterruptedException e)+			{+				+			}+		}+	}+	+}\ No newline at end of fileIndex: java/net/sf/l2j/loginserver/SelectorHelper.java===================================================================--- java/net/sf/l2j/loginserver/SelectorHelper.java	(revision 1475)+++ java/net/sf/l2j/loginserver/SelectorHelper.java	(working copy)@@ -12,16 +12,13 @@  */ package net.sf.l2j.loginserver; -import java.net.InetAddress; import java.nio.channels.SocketChannel;-import java.util.ArrayList;-import java.util.HashMap;-import java.util.Map.Entry; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit;  import net.sf.l2j.loginserver.serverpackets.Init;+import net.sf.l2j.util.IPv4Filter;  import org.mmocore.network.IAcceptFilter; import org.mmocore.network.IClientFactory;@@ -33,18 +30,15 @@  *   * @author KenM  */-public class SelectorHelper extends Thread implements IMMOExecutor<L2LoginClient>,+public class SelectorHelper implements IMMOExecutor<L2LoginClient>,         IClientFactory<L2LoginClient>, IAcceptFilter {-	private HashMap<Integer, Flood> _ipFloodMap; 	private ThreadPoolExecutor _generalPacketsThreadPool;+	private IPv4Filter _ipv4filter;  	public SelectorHelper() 	{-		_generalPacketsThreadPool = new ThreadPoolExecutor(4, 6, 15L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());-		_ipFloodMap = new HashMap<Integer, Flood>();-		super.setDaemon(true);-		super.start();+		_ipv4filter = new IPv4Filter(); 	}  	/**@@ -73,110 +67,6 @@ 	 */ 	public boolean accept(SocketChannel sc) 	{-		InetAddress addr = sc.socket().getInetAddress();-		int h = hash(addr.getAddress());-		-		long current = System.currentTimeMillis();-		Flood f;-		synchronized (_ipFloodMap)-		{-			f = _ipFloodMap.get(h);-		}-		if (f != null)-		{-			if (f.trys == -1)-			{-				f.lastAccess = current;-				return false;-			}-			-			if (f.lastAccess + 1000 > current)-			{-				f.lastAccess = current;-				-				if (f.trys >= 3)-				{-					f.trys = -1;-					return false;-				}-				-				f.trys++;-			}-			else-			{-				f.lastAccess = current;-			}-		}-		else-		{-			synchronized (_ipFloodMap)-			{-				_ipFloodMap.put(h, new Flood());-			}-		}-		return !LoginController.getInstance().isBannedAddress(addr);+		return _ipv4filter.accept(sc) && !LoginController.getInstance().isBannedAddress(sc.socket().getInetAddress()); 	}-	-	/**-	 * -	 * @param ip-	 * @return-	 */-	private int hash(byte[] ip)-	{-		return ip[0] & 0xFF | ip[1] << 8 & 0xFF00 | ip[2] << 16 & 0xFF0000 | ip[3] << 24-		        & 0xFF000000;-	}-	-	private class Flood-	{-		long lastAccess;-		int trys;-		-		Flood()-		{-			lastAccess = System.currentTimeMillis();-			trys = 0;-		}-	}-	-	/**-	 * -	 * @see java.lang.Thread#run()-	 */-	@Override-	public void run()-	{-		while (true)-		{-			long reference = System.currentTimeMillis() - (1000 * 300);-			ArrayList<Integer> toRemove = new ArrayList<Integer>(50);-			synchronized (_ipFloodMap)-			{-				for (Entry<Integer, Flood> e : _ipFloodMap.entrySet())-				{-					Flood f = e.getValue();-					if (f.lastAccess < reference)-						toRemove.add(e.getKey());-				}-			}-			-			synchronized (_ipFloodMap)-			{-				for (Integer i : toRemove)-				{-					_ipFloodMap.remove(i);-				}-			}-			-			try-			{-				Thread.sleep(5000);-			}-			catch (InterruptedException e)-			{-				-			}-		}-	} } 
This is for interlude? look at java/net/sf/l2j/gameserver/GameServer.java for gracia its com/l2jserver/

Edit: DrHouse GameServer.java:

Code: Select all

/* * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any later * version. *  * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. *  * You should have received a copy of the GNU General Public License along with * this program. If not, see <http://www.gnu.org/licenses/>. */ package com.l2jserver.gameserver; import java.io.File;import java.io.FileInputStream;import java.io.IOException;import java.io.InputStream;import java.net.InetAddress;import java.net.UnknownHostException;import java.util.Calendar;import java.util.logging.Level;import java.util.logging.LogManager;import java.util.logging.Logger;  import org.mmocore.network.SelectorConfig;import org.mmocore.network.SelectorThread; import com.l2jserver.Config;import com.l2jserver.L2DatabaseFactory;import com.l2jserver.Server;import com.l2jserver.gameserver.cache.CrestCache;import com.l2jserver.gameserver.cache.HtmCache;import com.l2jserver.gameserver.communitybbs.Manager.ForumsBBSManager;import com.l2jserver.gameserver.datatables.AccessLevels;import com.l2jserver.gameserver.datatables.AdminCommandAccessRights;import com.l2jserver.gameserver.datatables.ArmorSetsTable;import com.l2jserver.gameserver.datatables.AugmentationData;import com.l2jserver.gameserver.datatables.CharNameTable;import com.l2jserver.gameserver.datatables.CharTemplateTable;import com.l2jserver.gameserver.datatables.ClanTable;import com.l2jserver.gameserver.datatables.DoorTable;import com.l2jserver.gameserver.datatables.EnchantHPBonusData;import com.l2jserver.gameserver.datatables.EventDroplist;import com.l2jserver.gameserver.datatables.ExtractableItemsData;import com.l2jserver.gameserver.datatables.ExtractableSkillsData;import com.l2jserver.gameserver.datatables.FishTable;import com.l2jserver.gameserver.datatables.HelperBuffTable;import com.l2jserver.gameserver.datatables.HennaTable;import com.l2jserver.gameserver.datatables.HennaTreeTable;import com.l2jserver.gameserver.datatables.HeroSkillTable;import com.l2jserver.gameserver.datatables.ItemTable;import com.l2jserver.gameserver.datatables.PetDataTable;import com.l2jserver.gameserver.datatables.LevelUpData;import com.l2jserver.gameserver.datatables.MapRegionTable;import com.l2jserver.gameserver.datatables.MerchantPriceConfigTable;import com.l2jserver.gameserver.datatables.NobleSkillTable;import com.l2jserver.gameserver.datatables.NpcBufferTable;import com.l2jserver.gameserver.datatables.NpcTable;import com.l2jserver.gameserver.datatables.NpcWalkerRoutesTable;import com.l2jserver.gameserver.datatables.PetSkillsTable;import com.l2jserver.gameserver.datatables.ResidentialSkillTable;import com.l2jserver.gameserver.datatables.SkillSpellbookTable;import com.l2jserver.gameserver.datatables.SkillTable;import com.l2jserver.gameserver.datatables.SkillTreeTable;import com.l2jserver.gameserver.datatables.SpawnTable;import com.l2jserver.gameserver.datatables.StaticObjects;import com.l2jserver.gameserver.datatables.SummonItemsData;import com.l2jserver.gameserver.datatables.TeleportLocationTable;import com.l2jserver.gameserver.geoeditorcon.GeoEditorListener;import com.l2jserver.gameserver.handler.AdminCommandHandler;import com.l2jserver.gameserver.handler.ChatHandler;import com.l2jserver.gameserver.handler.ItemHandler;import com.l2jserver.gameserver.handler.SkillHandler;import com.l2jserver.gameserver.handler.UserCommandHandler;import com.l2jserver.gameserver.handler.VoicedCommandHandler;import com.l2jserver.gameserver.idfactory.IdFactory;import com.l2jserver.gameserver.instancemanager.AirShipManager;import com.l2jserver.gameserver.instancemanager.AuctionManager;import com.l2jserver.gameserver.instancemanager.BoatManager;import com.l2jserver.gameserver.instancemanager.CastleManager;import com.l2jserver.gameserver.instancemanager.CastleManorManager;import com.l2jserver.gameserver.instancemanager.ClanHallManager;import com.l2jserver.gameserver.instancemanager.CoupleManager;import com.l2jserver.gameserver.instancemanager.CursedWeaponsManager;import com.l2jserver.gameserver.instancemanager.DayNightSpawnManager;import com.l2jserver.gameserver.instancemanager.DimensionalRiftManager;import com.l2jserver.gameserver.instancemanager.FortManager;import com.l2jserver.gameserver.instancemanager.FortSiegeManager;import com.l2jserver.gameserver.instancemanager.FourSepulchersManager;import com.l2jserver.gameserver.instancemanager.GrandBossManager;import com.l2jserver.gameserver.instancemanager.InstanceManager;import com.l2jserver.gameserver.instancemanager.ItemsOnGroundManager;import com.l2jserver.gameserver.instancemanager.MailManager;import com.l2jserver.gameserver.instancemanager.MercTicketManager;import com.l2jserver.gameserver.instancemanager.PetitionManager;import com.l2jserver.gameserver.instancemanager.QuestManager;import com.l2jserver.gameserver.instancemanager.RaidBossPointsManager;import com.l2jserver.gameserver.instancemanager.RaidBossSpawnManager;import com.l2jserver.gameserver.instancemanager.SiegeManager;import com.l2jserver.gameserver.instancemanager.TransformationManager;import com.l2jserver.gameserver.instancemanager.ZoneManager;import com.l2jserver.gameserver.model.AutoChatHandler;import com.l2jserver.gameserver.model.AutoSpawnHandler;import com.l2jserver.gameserver.model.L2Manor;import com.l2jserver.gameserver.model.L2Multisell;import com.l2jserver.gameserver.model.L2World;import com.l2jserver.gameserver.model.entity.Hero;import com.l2jserver.gameserver.model.entity.TvTManager;import com.l2jserver.gameserver.model.olympiad.Olympiad;import com.l2jserver.gameserver.network.L2GameClient;import com.l2jserver.gameserver.network.L2GamePacketHandler;import com.l2jserver.gameserver.network.communityserver.CommunityServerThread;import com.l2jserver.gameserver.pathfinding.PathFinding;import com.l2jserver.gameserver.script.faenor.FaenorScriptEngine;import com.l2jserver.gameserver.scripting.CompiledScriptCache;import com.l2jserver.gameserver.scripting.L2ScriptEngineManager;import com.l2jserver.gameserver.taskmanager.AutoAnnounceTaskManager;import com.l2jserver.gameserver.taskmanager.KnownListUpdateTaskManager;import com.l2jserver.gameserver.taskmanager.TaskManager;import com.l2jserver.gameserver.util.DynamicExtension;import com.l2jserver.status.Status;import com.l2jserver.util.DeadLockDetector;import com.l2jserver.util.IPv4Filter; /** * This class ... *  * @version $Revision: 1.29.2.15.2.19 $ $Date: 2005/04/05 19:41:23 $ */public class GameServer{	private static final Logger _log = Logger.getLogger(GameServer.class.getName()); 	private final SelectorThread<L2GameClient> _selectorThread;	private final DeadLockDetector _deadDetectThread;	private final IdFactory _idFactory;	public static GameServer gameServer;	private LoginServerThread _loginThread;	private static Status _statusServer;	public static final Calendar dateTimeServerStarted = Calendar.getInstance(); 	public long getUsedMemoryMB()	{		return (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1048576; // ;	} 	public SelectorThread<L2GameClient> getSelectorThread()	{		return _selectorThread;	} 	public DeadLockDetector getDeadLockDetectorThread()	{		return _deadDetectThread;	} 	public GameServer() throws Exception	{		long serverLoadStart = System.currentTimeMillis(); 		gameServer = this;		_log.finest("used mem:" + getUsedMemoryMB() + "MB"); 		if (Config.SERVER_VERSION != null)		{			_log.info("L2J Server Version:    " + Config.SERVER_VERSION);		}		if (Config.DATAPACK_VERSION != null)		{			_log.info("L2J Datapack Version:  " + Config.DATAPACK_VERSION);		} 		_idFactory = IdFactory.getInstance(); 		if (!_idFactory.isInitialized())		{			_log.severe("Could not read object IDs from DB. Please Check Your Data.");			throw new Exception("Could not initialize the ID factory");		} 		ThreadPoolManager.getInstance(); 		new File(Config.DATAPACK_ROOT, "data/crests").mkdirs();		new File("log/game").mkdirs(); 		// load script engines		L2ScriptEngineManager.getInstance(); 		// start game time control early		GameTimeController.getInstance(); 		// keep the references of Singletons to prevent garbage collection		CharNameTable.getInstance();		SkillTable.getInstance(); 		ItemTable.getInstance();		if (!ItemTable.getInstance().isInitialized())		{			_log.severe("Could not find the extraced files. Please Check Your Data.");			throw new Exception("Could not initialize the item table");		} 		// Load clan hall data before zone data and doors table		ClanHallManager.getInstance(); 		ExtractableItemsData.getInstance();		ExtractableSkillsData.getInstance();		SummonItemsData.getInstance();		ZoneManager.getInstance();		MerchantPriceConfigTable.getInstance().loadInstances();		EnchantHPBonusData.getInstance();		TradeController.getInstance();		L2Multisell.getInstance();		InstanceManager.getInstance(); 		if (Config.ALLOW_NPC_WALKERS)		{			NpcWalkerRoutesTable.getInstance().load();		} 		NpcBufferTable.getInstance(); 		RecipeController.getInstance(); 		SkillTreeTable.getInstance();		PetSkillsTable.getInstance();		ArmorSetsTable.getInstance();		FishTable.getInstance();		SkillSpellbookTable.getInstance();		CharTemplateTable.getInstance();		NobleSkillTable.getInstance();		HeroSkillTable.getInstance();		ResidentialSkillTable.getInstance(); 		// Call to load caches		HtmCache.getInstance();		CrestCache.getInstance(); 		// forums has to be loaded before clan data, because of last forum id used should have also memo included		if (Config.COMMUNITY_TYPE > 0)			ForumsBBSManager.getInstance().initRoot(); 		ClanTable.getInstance(); 		NpcTable.getInstance();		if (!NpcTable.getInstance().[color=#FF0000]isInitialized[/color]())		{			_log.severe("Could not find the extraced files. Please Check Your Data.");			throw new Exception("Could not initialize the npc table");		} 		HennaTable.getInstance();		HennaTreeTable.getInstance();		HelperBuffTable.getInstance(); 		GeoData.getInstance();		if (Config.GEODATA == 2)			PathFinding.getInstance(); 		CastleManager.getInstance().loadInstances();		SiegeManager.getInstance().getSieges();		FortManager.getInstance().loadInstances();		FortSiegeManager.getInstance(); 		TeleportLocationTable.getInstance();		LevelUpData.getInstance();		L2World.getInstance();		SpawnTable.getInstance();		RaidBossSpawnManager.getInstance();		DayNightSpawnManager.getInstance().notifyChangeMode();		GrandBossManager.getInstance().initZones();		RaidBossPointsManager.init();		FourSepulchersManager.getInstance().init();		DimensionalRiftManager.getInstance();		Announcements.getInstance();		MapRegionTable.getInstance();		EventDroplist.getInstance(); 		DoorTable.getInstance();		StaticObjects.getInstance(); 		/** Load Manor data */		L2Manor.getInstance(); 		/** Load Manager */		AuctionManager.getInstance();		BoatManager.getInstance();		CastleManorManager.getInstance();		MercTicketManager.getInstance();		// PartyCommandManager.getInstance();		PetitionManager.getInstance();		QuestManager.getInstance();		TransformationManager.getInstance();		AirShipManager.getInstance(); 		try		{			_log.info("Loading Server Scripts");			File scripts = new File(Config.DATAPACK_ROOT + "/data/scripts.cfg");			if (!Config.ALT_DEV_NO_QUESTS)				L2ScriptEngineManager.getInstance().executeScriptList(scripts);		}		catch (IOException ioe)		{			_log.severe("Failed loading scripts.cfg, no script going to be loaded");		}		try		{			CompiledScriptCache compiledScriptCache = L2ScriptEngineManager.getInstance().getCompiledScriptCache();			if (compiledScriptCache == null)			{				_log.info("Compiled Scripts Cache is disabled.");			}			else			{				compiledScriptCache.purge(); 				if (compiledScriptCache.isModified())				{					compiledScriptCache.save();					_log.info("Compiled Scripts Cache was saved.");				}				else				{					_log.info("Compiled Scripts Cache is up-to-date.");				}			} 		}		catch (IOException e)		{			_log.log(Level.SEVERE, "Failed to store Compiled Scripts Cache.", e);		}		QuestManager.getInstance().report();		TransformationManager.getInstance().report(); 		AugmentationData.getInstance();		if (Config.SAVE_DROPPED_ITEM)			ItemsOnGroundManager.getInstance(); 		if (Config.AUTODESTROY_ITEM_AFTER > 0 || Config.HERB_AUTO_DESTROY_TIME > 0)			ItemsAutoDestroy.getInstance(); 		MonsterRace.getInstance(); 		SevenSigns.getInstance().spawnSevenSignsNPC();		SevenSignsFestival.getInstance();		AutoSpawnHandler.getInstance();		AutoChatHandler.getInstance(); 		Olympiad.getInstance();		Hero.getInstance();		FaenorScriptEngine.getInstance();		// Init of a cursed weapon manager		CursedWeaponsManager.getInstance(); 		_log.log(Level.CONFIG, "AutoChatHandler: Loaded " + AutoChatHandler.getInstance().size() + " handlers in total.");		_log.log(Level.CONFIG, "AutoSpawnHandler: Loaded " + AutoSpawnHandler.getInstance().size() + " handlers in total."); 		AdminCommandHandler.getInstance();		ChatHandler.getInstance();		ItemHandler.getInstance();		SkillHandler.getInstance();		UserCommandHandler.getInstance();		VoicedCommandHandler.getInstance(); 		AccessLevels.getInstance();		AdminCommandAccessRights.getInstance(); 		if (Config.L2JMOD_ALLOW_WEDDING)			CoupleManager.getInstance(); 		TaskManager.getInstance(); 		GmListTable.getInstance(); 		// read pet stats from db		PetDataTable.getInstance().loadPetsData(); 		MerchantPriceConfigTable.getInstance().updateReferences();		CastleManager.getInstance().activateInstances();		FortManager.getInstance().activateInstances(); 		if (Config.ALLOW_MAIL)			MailManager.getInstance(); 		Universe.getInstance(); 		if (Config.ACCEPT_GEOEDITOR_CONN)			GeoEditorListener.getInstance(); 		Runtime.getRuntime().addShutdownHook(Shutdown.getInstance()); 		_log.config("IdFactory: Free ObjectID's remaining: " + IdFactory.getInstance().size()); 		// initialize the dynamic extension loader		try		{			DynamicExtension.getInstance();		}		catch (Exception ex)		{			_log.log(Level.WARNING, "DynamicExtension could not be loaded and initialized", ex);		} 		TvTManager.getInstance();		KnownListUpdateTaskManager.getInstance();		if (Config.DEADLOCK_DETECTOR)		{			_deadDetectThread = new DeadLockDetector();			_deadDetectThread.setDaemon(true);			_deadDetectThread.start();		}		else			_deadDetectThread = null;		System.gc();		// maxMemory is the upper limit the jvm can use, totalMemory the size of		// the current allocation pool, freeMemory the unused memory in the		// allocation pool		long freeMem = (Runtime.getRuntime().maxMemory() - Runtime.getRuntime().totalMemory() + Runtime.getRuntime().freeMemory()) / 1048576;		long totalMem = Runtime.getRuntime().maxMemory() / 1048576;		_log.info("GameServer Started, free memory " + freeMem + " Mb of " + totalMem + " Mb"); 		_loginThread = LoginServerThread.getInstance();		_loginThread.start(); 		CommunityServerThread.initialize(); 		final SelectorConfig sc = new SelectorConfig();		sc.MAX_READ_PER_PASS = Config.MMO_MAX_READ_PER_PASS;		sc.MAX_SEND_PER_PASS = Config.MMO_MAX_SEND_PER_PASS;		sc.SLEEP_TIME = Config.MMO_SELECTOR_SLEEP_TIME;		sc.HELPER_BUFFER_COUNT = Config.MMO_HELPER_BUFFER_COUNT; 		final L2GamePacketHandler gph = new L2GamePacketHandler();		_selectorThread = new SelectorThread<L2GameClient>(sc, gph, gph, gph, new IPv4Filter()); 		InetAddress bindAddress = null;		if (!Config.GAMESERVER_HOSTNAME.equals("*"))		{			try			{				bindAddress = InetAddress.getByName(Config.GAMESERVER_HOSTNAME);			}			catch (UnknownHostException e1)			{				_log.severe("WARNING: The GameServer bind address is invalid, using all avaliable IPs. Reason: " + e1.getMessage()); 				if (Config.DEVELOPER)				{					e1.printStackTrace();				}			}		} 		try		{			_selectorThread.openServerSocket(bindAddress, Config.PORT_GAME);		}		catch (IOException e)		{			_log.severe("FATAL: Failed to open server socket. Reason: " + e.getMessage());			if (Config.DEVELOPER)			{				e.printStackTrace();			}			System.exit(1);		}		_selectorThread.start();		_log.config("Maximum Numbers of Connected Players: " + Config.MAXIMUM_ONLINE_USERS);		long serverLoadEnd = System.currentTimeMillis();		_log.info("Server Loaded in " + ((serverLoadEnd - serverLoadStart) / 1000) + " seconds"); 		AutoAnnounceTaskManager.getInstance();	} 	public static void main(String[] args) throws Exception	{		Server.serverMode = Server.MODE_GAMESERVER;		// Local Constants		final String LOG_FOLDER = "log"; // Name of folder for log file		final String LOG_NAME = "./log.cfg"; // Name of log file 		/*** Main ***/		// Create log folder		File logFolder = new File(Config.DATAPACK_ROOT, LOG_FOLDER);		logFolder.mkdir(); 		// Create input stream for log file -- or store file data into memory		InputStream is = new FileInputStream(new File(LOG_NAME));		LogManager.getLogManager().readConfiguration(is);		is.close(); 		// Initialize config		Config.load();		L2DatabaseFactory.getInstance();		gameServer = new GameServer(); 		if (Config.IS_TELNET_ENABLED)		{			_statusServer = new Status(Server.serverMode);			_statusServer.start();		}		else		{			_log.info("Telnet server is currently disabled.");		}	}} 
Eclipse found error

Code: Select all

NpcTable.getInstance();		if (!NpcTable.getInstance().[color=#FF0000]isInitialized[/color]())		{
Code with red color is the error. Eclipse quick fix:
1.Create method 'isInitialized()' in type 'NpcTable'
2.Add cast to method receiver
User avatar
LasTravel
Posts: 888
Joined: Tue Jan 05, 2010 12:08 am
Location: Spain

Re: L2j Killer - Attacker Gracia Final

Post by LasTravel »

Gracia final its java/net/sf/l2j/gameserver/, and gracia EPILOGUE its com/l2jserver/
User avatar
badboy29
Posts: 417
Joined: Fri Apr 24, 2009 5:34 am
Location: Brazil

Re: L2j Killer - Attacker Gracia Final

Post by badboy29 »

With Gracia Final this patch dont work, when i try log i get this error:
Loading LoginController...
Cached 10 KeyPairs for RSA communication
Stored 20 keys for Blowfish communication
Loaded 127 server names
Loaded 1 registered Game Servers
Cached 10 RSA keys for Game Server communication.
Loaded 9 IP Bans.
Listening for GameServers on 127.0.0.1:9014
Telnet server is currently disabled.
Login Server ready on 127.0.0.1:2106
Exception in thread "SelectorThread-15" java.lang.NullPointerException
at net.sf.l2j.loginserver.SelectorHelper.execute(SelectorHelper.java:50)

at org.mmocore.network.SelectorThread.parseClientPacket(SelectorThread.j
ava:428)
at org.mmocore.network.SelectorThread.tryReadPacket(SelectorThread.java:
360)
at org.mmocore.network.SelectorThread.readPacket(SelectorThread.java:294
)
at org.mmocore.network.SelectorThread.run(SelectorThread.java:176)
Tested in Test Server. Need mmocore update or what ?
Aka UnHoly
JustLikeMe
Posts: 91
Joined: Fri Feb 05, 2010 8:12 pm

Re: L2j Killer - Attacker Gracia Final

Post by JustLikeMe »

LasTravel wrote:Gracia final its java/net/sf/l2j/gameserver/, and gracia EPILOGUE its com/l2jserver/
Dunno what you sayin, but the packages are com.l2jserver.
Uphillyout
Posts: 255
Joined: Wed Jan 20, 2010 9:06 pm

Re: L2j Killer - Attacker Gracia Final

Post by Uphillyout »

what is it l2jKiller ? what it does?
JustLikeMe
Posts: 91
Joined: Fri Feb 05, 2010 8:12 pm

Re: L2j Killer - Attacker Gracia Final

Post by JustLikeMe »

It sends many many packets per second to ur ip and the server cant handle it. So the server crashes and u need to restart it.
User avatar
badboy29
Posts: 417
Joined: Fri Apr 24, 2009 5:34 am
Location: Brazil

Re: L2j Killer - Attacker Gracia Final

Post by badboy29 »

JustLikeMe wrote:Dunno what you sayin, but the packages are com.l2jserver.
In Gracia Final is java/net/sf/l2j/gameserver/
Only in Epilogue is java/com/l2jserver/gameserver

Understand now ?
Aka UnHoly
Uphillyout
Posts: 255
Joined: Wed Jan 20, 2010 9:06 pm

Re: L2j Killer - Attacker Gracia Final

Post by Uphillyout »

is this defense from "ddos" ?
User avatar
qwerty13
Posts: 640
Joined: Mon Feb 02, 2009 9:57 am
Location: Europe
Contact:

Re: L2j Killer - Attacker Gracia Final

Post by qwerty13 »

This defense for packet flooders like l2jkiller. If you dont use latest (epilogue) build, i think you can easy protect from l2jkiller with iptables, or just use latest build or apply DrHouse patch manually. :)
Uphillyout
Posts: 255
Joined: Wed Jan 20, 2010 9:06 pm

Re: L2j Killer - Attacker Gracia Final

Post by Uphillyout »

yeap thx, i will apply this
viewtopic.php?f=82&t=15687&p=79925#p79317
User avatar
badboy29
Posts: 417
Joined: Fri Apr 24, 2009 5:34 am
Location: Brazil

Re: L2j Killer - Attacker Gracia Final

Post by badboy29 »

Uphillyout wrote:yeap thx, i will apply this
viewtopic.php?f=82&t=15687&p=79925#p79317
Uphillyout after applying this patch, you got to log in normally ?
Aka UnHoly
JustLikeMe
Posts: 91
Joined: Fri Feb 05, 2010 8:12 pm

Re: L2j Killer - Attacker Gracia Final

Post by JustLikeMe »

JustLikeMe wrote:
LasTravel wrote:Here DrHouse Fix for Gracia final...

Code: Select all

Index: java/net/sf/l2j/gameserver/GameServer.java===================================================================--- java/net/sf/l2j/gameserver/GameServer.java	(revision 1475)+++ java/net/sf/l2j/gameserver/GameServer.java	(working copy)@@ -121,6 +121,7 @@ import net.sf.l2j.gameserver.util.DynamicExtension; import net.sf.l2j.status.Status; import net.sf.l2j.util.DeadLockDetector;+import net.sf.l2j.util.IPv4Filter;  import org.mmocore.network.SelectorConfig; import org.mmocore.network.SelectorThread;@@ -439,7 +440,7 @@ 		sc.SLEEP_TIME = Config.MMO_SELECTOR_SLEEP_TIME; 		sc.HELPER_BUFFER_COUNT = Config.MMO_HELPER_BUFFER_COUNT; 		final L2GamePacketHandler gph = new L2GamePacketHandler();-		_selectorThread = new SelectorThread<L2GameClient>(sc, gph, gph, gph, null);+		_selectorThread = new SelectorThread<L2GameClient>(sc, gph, gph, gph, new IPv4Filter());  		InetAddress bindAddress = null; 		if (!Config.GAMESERVER_HOSTNAME.equals("*"))Index: java/net/sf/l2j/util/IPv4Filter.java===================================================================--- java/net/sf/l2j/util/IPv4Filter.java	(revision 0)+++ java/net/sf/l2j/util/IPv4Filter.java	(revision 0)@@ -0,0 +1,151 @@+/*+ * This program is free software: you can redistribute it and/or modify it under+ * the terms of the GNU General Public License as published by the Free Software+ * Foundation, either version 3 of the License, or (at your option) any later+ * version.+ * + * This program is distributed in the hope that it will be useful, but WITHOUT+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS+ * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more+ * details.+ * + * You should have received a copy of the GNU General Public License along with+ * this program. If not, see <http://www.gnu.org/licenses/>.+ */++package net.sf.l2j.util;++import java.net.InetAddress;+import java.nio.channels.SocketChannel;+import java.util.ArrayList;+import java.util.HashMap;+import java.util.Map.Entry;++import org.mmocore.network.IAcceptFilter;++/**+ * Formatted Forsaiken's IPv4 filter [DrHouse]+ * + * @author Forsaiken+ *+ */+public class IPv4Filter implements IAcceptFilter, Runnable+{+	private HashMap<Integer, Flood> _ipFloodMap;+	private static final long SLEEP_TIME = 5000;+	+	public IPv4Filter()+	{+		_ipFloodMap = new HashMap<Integer, Flood>();+		Thread t = new Thread(this);+		t.setDaemon(true);+		t.start();+	}+	/**+	 * +	 * @param ip+	 * @return+	 */+	private static final int hash(byte[] ip)+	{+		return ip[0] & 0xFF | ip[1] << 8 & 0xFF00 | ip[2] << 16 & 0xFF0000 | ip[3] << 24 & 0xFF000000;+	}+	+	protected static final class Flood+	{+		long lastAccess;+		int trys;+		+		Flood()+		{+			lastAccess = System.currentTimeMillis();+			trys = 0;+		}+	}+	+	@Override+	public boolean accept(SocketChannel sc)+	{+		InetAddress addr = sc.socket().getInetAddress();+		int h = hash(addr.getAddress());+		+		long current = System.currentTimeMillis();+		Flood f;+		synchronized (_ipFloodMap)+		{+			f = _ipFloodMap.get(h);+		}+		if (f != null)+		{+			if (f.trys == -1)+			{+				f.lastAccess = current;+				return false;+			}+			+			if (f.lastAccess + 1000 > current)+			{+				f.lastAccess = current;+				+				if (f.trys >= 3)+				{+					f.trys = -1;+					return false;+				}+				+				f.trys++;+			}+			else+			{+				f.lastAccess = current;+			}+		}+		else+		{+			synchronized (_ipFloodMap)+			{+				_ipFloodMap.put(h, new Flood());+			}+		}+		+		return true;+	}++	@Override+	public void run()+	{+		while (true)+		{+			long reference = System.currentTimeMillis() - (1000 * 300);+			ArrayList<Integer> toRemove = new ArrayList<Integer>(50);+			+			synchronized (_ipFloodMap)+			{+				for (Entry<Integer, Flood> e : _ipFloodMap.entrySet())+				{+					Flood f = e.getValue();+					if (f.lastAccess < reference)+						toRemove.add(e.getKey());+				}+			}+			+			synchronized (_ipFloodMap)+			{+				for (Integer i : toRemove)+				{+					_ipFloodMap.remove(i);+				}+			}+			+			try+			{+				Thread.sleep(SLEEP_TIME);+			}+			catch (InterruptedException e)+			{+				+			}+		}+	}+	+}\ No newline at end of fileIndex: java/net/sf/l2j/loginserver/SelectorHelper.java===================================================================--- java/net/sf/l2j/loginserver/SelectorHelper.java	(revision 1475)+++ java/net/sf/l2j/loginserver/SelectorHelper.java	(working copy)@@ -12,16 +12,13 @@  */ package net.sf.l2j.loginserver; -import java.net.InetAddress; import java.nio.channels.SocketChannel;-import java.util.ArrayList;-import java.util.HashMap;-import java.util.Map.Entry; import java.util.concurrent.LinkedBlockingQueue; import java.util.concurrent.ThreadPoolExecutor; import java.util.concurrent.TimeUnit;  import net.sf.l2j.loginserver.serverpackets.Init;+import net.sf.l2j.util.IPv4Filter;  import org.mmocore.network.IAcceptFilter; import org.mmocore.network.IClientFactory;@@ -33,18 +30,15 @@  *   * @author KenM  */-public class SelectorHelper extends Thread implements IMMOExecutor<L2LoginClient>,+public class SelectorHelper implements IMMOExecutor<L2LoginClient>,         IClientFactory<L2LoginClient>, IAcceptFilter {-	private HashMap<Integer, Flood> _ipFloodMap; 	private ThreadPoolExecutor _generalPacketsThreadPool;+	private IPv4Filter _ipv4filter;  	public SelectorHelper() 	{-		_generalPacketsThreadPool = new ThreadPoolExecutor(4, 6, 15L, TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());-		_ipFloodMap = new HashMap<Integer, Flood>();-		super.setDaemon(true);-		super.start();+		_ipv4filter = new IPv4Filter(); 	}  	/**@@ -73,110 +67,6 @@ 	 */ 	public boolean accept(SocketChannel sc) 	{-		InetAddress addr = sc.socket().getInetAddress();-		int h = hash(addr.getAddress());-		-		long current = System.currentTimeMillis();-		Flood f;-		synchronized (_ipFloodMap)-		{-			f = _ipFloodMap.get(h);-		}-		if (f != null)-		{-			if (f.trys == -1)-			{-				f.lastAccess = current;-				return false;-			}-			-			if (f.lastAccess + 1000 > current)-			{-				f.lastAccess = current;-				-				if (f.trys >= 3)-				{-					f.trys = -1;-					return false;-				}-				-				f.trys++;-			}-			else-			{-				f.lastAccess = current;-			}-		}-		else-		{-			synchronized (_ipFloodMap)-			{-				_ipFloodMap.put(h, new Flood());-			}-		}-		return !LoginController.getInstance().isBannedAddress(addr);+		return _ipv4filter.accept(sc) && !LoginController.getInstance().isBannedAddress(sc.socket().getInetAddress()); 	}-	-	/**-	 * -	 * @param ip-	 * @return-	 */-	private int hash(byte[] ip)-	{-		return ip[0] & 0xFF | ip[1] << 8 & 0xFF00 | ip[2] << 16 & 0xFF0000 | ip[3] << 24-		        & 0xFF000000;-	}-	-	private class Flood-	{-		long lastAccess;-		int trys;-		-		Flood()-		{-			lastAccess = System.currentTimeMillis();-			trys = 0;-		}-	}-	-	/**-	 * -	 * @see java.lang.Thread#run()-	 */-	@Override-	public void run()-	{-		while (true)-		{-			long reference = System.currentTimeMillis() - (1000 * 300);-			ArrayList<Integer> toRemove = new ArrayList<Integer>(50);-			synchronized (_ipFloodMap)-			{-				for (Entry<Integer, Flood> e : _ipFloodMap.entrySet())-				{-					Flood f = e.getValue();-					if (f.lastAccess < reference)-						toRemove.add(e.getKey());-				}-			}-			-			synchronized (_ipFloodMap)-			{-				for (Integer i : toRemove)-				{-					_ipFloodMap.remove(i);-				}-			}-			-			try-			{-				Thread.sleep(5000);-			}-			catch (InterruptedException e)-			{-				-			}-		}-	} } 
This is for interlude? look at java/net/sf/l2j/gameserver/GameServer.java for gracia its com/l2jserver/

Edit: DrHouse GameServer.java:

Code: Select all

/* * This program is free software: you can redistribute it and/or modify it under * the terms of the GNU General Public License as published by the Free Software * Foundation, either version 3 of the License, or (at your option) any later * version. *  * This program is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more * details. *  * You should have received a copy of the GNU General Public License along with * this program. If not, see <http://www.gnu.org/licenses/>. */ package com.l2jserver.gameserver; import java.io.File;import java.io.FileInputStream;import java.io.IOException;import java.io.InputStream;import java.net.InetAddress;import java.net.UnknownHostException;import java.util.Calendar;import java.util.logging.Level;import java.util.logging.LogManager;import java.util.logging.Logger;  import org.mmocore.network.SelectorConfig;import org.mmocore.network.SelectorThread; import com.l2jserver.Config;import com.l2jserver.L2DatabaseFactory;import com.l2jserver.Server;import com.l2jserver.gameserver.cache.CrestCache;import com.l2jserver.gameserver.cache.HtmCache;import com.l2jserver.gameserver.communitybbs.Manager.ForumsBBSManager;import com.l2jserver.gameserver.datatables.AccessLevels;import com.l2jserver.gameserver.datatables.AdminCommandAccessRights;import com.l2jserver.gameserver.datatables.ArmorSetsTable;import com.l2jserver.gameserver.datatables.AugmentationData;import com.l2jserver.gameserver.datatables.CharNameTable;import com.l2jserver.gameserver.datatables.CharTemplateTable;import com.l2jserver.gameserver.datatables.ClanTable;import com.l2jserver.gameserver.datatables.DoorTable;import com.l2jserver.gameserver.datatables.EnchantHPBonusData;import com.l2jserver.gameserver.datatables.EventDroplist;import com.l2jserver.gameserver.datatables.ExtractableItemsData;import com.l2jserver.gameserver.datatables.ExtractableSkillsData;import com.l2jserver.gameserver.datatables.FishTable;import com.l2jserver.gameserver.datatables.HelperBuffTable;import com.l2jserver.gameserver.datatables.HennaTable;import com.l2jserver.gameserver.datatables.HennaTreeTable;import com.l2jserver.gameserver.datatables.HeroSkillTable;import com.l2jserver.gameserver.datatables.ItemTable;import com.l2jserver.gameserver.datatables.PetDataTable;import com.l2jserver.gameserver.datatables.LevelUpData;import com.l2jserver.gameserver.datatables.MapRegionTable;import com.l2jserver.gameserver.datatables.MerchantPriceConfigTable;import com.l2jserver.gameserver.datatables.NobleSkillTable;import com.l2jserver.gameserver.datatables.NpcBufferTable;import com.l2jserver.gameserver.datatables.NpcTable;import com.l2jserver.gameserver.datatables.NpcWalkerRoutesTable;import com.l2jserver.gameserver.datatables.PetSkillsTable;import com.l2jserver.gameserver.datatables.ResidentialSkillTable;import com.l2jserver.gameserver.datatables.SkillSpellbookTable;import com.l2jserver.gameserver.datatables.SkillTable;import com.l2jserver.gameserver.datatables.SkillTreeTable;import com.l2jserver.gameserver.datatables.SpawnTable;import com.l2jserver.gameserver.datatables.StaticObjects;import com.l2jserver.gameserver.datatables.SummonItemsData;import com.l2jserver.gameserver.datatables.TeleportLocationTable;import com.l2jserver.gameserver.geoeditorcon.GeoEditorListener;import com.l2jserver.gameserver.handler.AdminCommandHandler;import com.l2jserver.gameserver.handler.ChatHandler;import com.l2jserver.gameserver.handler.ItemHandler;import com.l2jserver.gameserver.handler.SkillHandler;import com.l2jserver.gameserver.handler.UserCommandHandler;import com.l2jserver.gameserver.handler.VoicedCommandHandler;import com.l2jserver.gameserver.idfactory.IdFactory;import com.l2jserver.gameserver.instancemanager.AirShipManager;import com.l2jserver.gameserver.instancemanager.AuctionManager;import com.l2jserver.gameserver.instancemanager.BoatManager;import com.l2jserver.gameserver.instancemanager.CastleManager;import com.l2jserver.gameserver.instancemanager.CastleManorManager;import com.l2jserver.gameserver.instancemanager.ClanHallManager;import com.l2jserver.gameserver.instancemanager.CoupleManager;import com.l2jserver.gameserver.instancemanager.CursedWeaponsManager;import com.l2jserver.gameserver.instancemanager.DayNightSpawnManager;import com.l2jserver.gameserver.instancemanager.DimensionalRiftManager;import com.l2jserver.gameserver.instancemanager.FortManager;import com.l2jserver.gameserver.instancemanager.FortSiegeManager;import com.l2jserver.gameserver.instancemanager.FourSepulchersManager;import com.l2jserver.gameserver.instancemanager.GrandBossManager;import com.l2jserver.gameserver.instancemanager.InstanceManager;import com.l2jserver.gameserver.instancemanager.ItemsOnGroundManager;import com.l2jserver.gameserver.instancemanager.MailManager;import com.l2jserver.gameserver.instancemanager.MercTicketManager;import com.l2jserver.gameserver.instancemanager.PetitionManager;import com.l2jserver.gameserver.instancemanager.QuestManager;import com.l2jserver.gameserver.instancemanager.RaidBossPointsManager;import com.l2jserver.gameserver.instancemanager.RaidBossSpawnManager;import com.l2jserver.gameserver.instancemanager.SiegeManager;import com.l2jserver.gameserver.instancemanager.TransformationManager;import com.l2jserver.gameserver.instancemanager.ZoneManager;import com.l2jserver.gameserver.model.AutoChatHandler;import com.l2jserver.gameserver.model.AutoSpawnHandler;import com.l2jserver.gameserver.model.L2Manor;import com.l2jserver.gameserver.model.L2Multisell;import com.l2jserver.gameserver.model.L2World;import com.l2jserver.gameserver.model.entity.Hero;import com.l2jserver.gameserver.model.entity.TvTManager;import com.l2jserver.gameserver.model.olympiad.Olympiad;import com.l2jserver.gameserver.network.L2GameClient;import com.l2jserver.gameserver.network.L2GamePacketHandler;import com.l2jserver.gameserver.network.communityserver.CommunityServerThread;import com.l2jserver.gameserver.pathfinding.PathFinding;import com.l2jserver.gameserver.script.faenor.FaenorScriptEngine;import com.l2jserver.gameserver.scripting.CompiledScriptCache;import com.l2jserver.gameserver.scripting.L2ScriptEngineManager;import com.l2jserver.gameserver.taskmanager.AutoAnnounceTaskManager;import com.l2jserver.gameserver.taskmanager.KnownListUpdateTaskManager;import com.l2jserver.gameserver.taskmanager.TaskManager;import com.l2jserver.gameserver.util.DynamicExtension;import com.l2jserver.status.Status;import com.l2jserver.util.DeadLockDetector;import com.l2jserver.util.IPv4Filter; /** * This class ... *  * @version $Revision: 1.29.2.15.2.19 $ $Date: 2005/04/05 19:41:23 $ */public class GameServer{	private static final Logger _log = Logger.getLogger(GameServer.class.getName()); 	private final SelectorThread<L2GameClient> _selectorThread;	private final DeadLockDetector _deadDetectThread;	private final IdFactory _idFactory;	public static GameServer gameServer;	private LoginServerThread _loginThread;	private static Status _statusServer;	public static final Calendar dateTimeServerStarted = Calendar.getInstance(); 	public long getUsedMemoryMB()	{		return (Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory()) / 1048576; // ;	} 	public SelectorThread<L2GameClient> getSelectorThread()	{		return _selectorThread;	} 	public DeadLockDetector getDeadLockDetectorThread()	{		return _deadDetectThread;	} 	public GameServer() throws Exception	{		long serverLoadStart = System.currentTimeMillis(); 		gameServer = this;		_log.finest("used mem:" + getUsedMemoryMB() + "MB"); 		if (Config.SERVER_VERSION != null)		{			_log.info("L2J Server Version:    " + Config.SERVER_VERSION);		}		if (Config.DATAPACK_VERSION != null)		{			_log.info("L2J Datapack Version:  " + Config.DATAPACK_VERSION);		} 		_idFactory = IdFactory.getInstance(); 		if (!_idFactory.isInitialized())		{			_log.severe("Could not read object IDs from DB. Please Check Your Data.");			throw new Exception("Could not initialize the ID factory");		} 		ThreadPoolManager.getInstance(); 		new File(Config.DATAPACK_ROOT, "data/crests").mkdirs();		new File("log/game").mkdirs(); 		// load script engines		L2ScriptEngineManager.getInstance(); 		// start game time control early		GameTimeController.getInstance(); 		// keep the references of Singletons to prevent garbage collection		CharNameTable.getInstance();		SkillTable.getInstance(); 		ItemTable.getInstance();		if (!ItemTable.getInstance().isInitialized())		{			_log.severe("Could not find the extraced files. Please Check Your Data.");			throw new Exception("Could not initialize the item table");		} 		// Load clan hall data before zone data and doors table		ClanHallManager.getInstance(); 		ExtractableItemsData.getInstance();		ExtractableSkillsData.getInstance();		SummonItemsData.getInstance();		ZoneManager.getInstance();		MerchantPriceConfigTable.getInstance().loadInstances();		EnchantHPBonusData.getInstance();		TradeController.getInstance();		L2Multisell.getInstance();		InstanceManager.getInstance(); 		if (Config.ALLOW_NPC_WALKERS)		{			NpcWalkerRoutesTable.getInstance().load();		} 		NpcBufferTable.getInstance(); 		RecipeController.getInstance(); 		SkillTreeTable.getInstance();		PetSkillsTable.getInstance();		ArmorSetsTable.getInstance();		FishTable.getInstance();		SkillSpellbookTable.getInstance();		CharTemplateTable.getInstance();		NobleSkillTable.getInstance();		HeroSkillTable.getInstance();		ResidentialSkillTable.getInstance(); 		// Call to load caches		HtmCache.getInstance();		CrestCache.getInstance(); 		// forums has to be loaded before clan data, because of last forum id used should have also memo included		if (Config.COMMUNITY_TYPE > 0)			ForumsBBSManager.getInstance().initRoot(); 		ClanTable.getInstance(); 		NpcTable.getInstance();		if (!NpcTable.getInstance().[color=#FF0000]isInitialized[/color]())		{			_log.severe("Could not find the extraced files. Please Check Your Data.");			throw new Exception("Could not initialize the npc table");		} 		HennaTable.getInstance();		HennaTreeTable.getInstance();		HelperBuffTable.getInstance(); 		GeoData.getInstance();		if (Config.GEODATA == 2)			PathFinding.getInstance(); 		CastleManager.getInstance().loadInstances();		SiegeManager.getInstance().getSieges();		FortManager.getInstance().loadInstances();		FortSiegeManager.getInstance(); 		TeleportLocationTable.getInstance();		LevelUpData.getInstance();		L2World.getInstance();		SpawnTable.getInstance();		RaidBossSpawnManager.getInstance();		DayNightSpawnManager.getInstance().notifyChangeMode();		GrandBossManager.getInstance().initZones();		RaidBossPointsManager.init();		FourSepulchersManager.getInstance().init();		DimensionalRiftManager.getInstance();		Announcements.getInstance();		MapRegionTable.getInstance();		EventDroplist.getInstance(); 		DoorTable.getInstance();		StaticObjects.getInstance(); 		/** Load Manor data */		L2Manor.getInstance(); 		/** Load Manager */		AuctionManager.getInstance();		BoatManager.getInstance();		CastleManorManager.getInstance();		MercTicketManager.getInstance();		// PartyCommandManager.getInstance();		PetitionManager.getInstance();		QuestManager.getInstance();		TransformationManager.getInstance();		AirShipManager.getInstance(); 		try		{			_log.info("Loading Server Scripts");			File scripts = new File(Config.DATAPACK_ROOT + "/data/scripts.cfg");			if (!Config.ALT_DEV_NO_QUESTS)				L2ScriptEngineManager.getInstance().executeScriptList(scripts);		}		catch (IOException ioe)		{			_log.severe("Failed loading scripts.cfg, no script going to be loaded");		}		try		{			CompiledScriptCache compiledScriptCache = L2ScriptEngineManager.getInstance().getCompiledScriptCache();			if (compiledScriptCache == null)			{				_log.info("Compiled Scripts Cache is disabled.");			}			else			{				compiledScriptCache.purge(); 				if (compiledScriptCache.isModified())				{					compiledScriptCache.save();					_log.info("Compiled Scripts Cache was saved.");				}				else				{					_log.info("Compiled Scripts Cache is up-to-date.");				}			} 		}		catch (IOException e)		{			_log.log(Level.SEVERE, "Failed to store Compiled Scripts Cache.", e);		}		QuestManager.getInstance().report();		TransformationManager.getInstance().report(); 		AugmentationData.getInstance();		if (Config.SAVE_DROPPED_ITEM)			ItemsOnGroundManager.getInstance(); 		if (Config.AUTODESTROY_ITEM_AFTER > 0 || Config.HERB_AUTO_DESTROY_TIME > 0)			ItemsAutoDestroy.getInstance(); 		MonsterRace.getInstance(); 		SevenSigns.getInstance().spawnSevenSignsNPC();		SevenSignsFestival.getInstance();		AutoSpawnHandler.getInstance();		AutoChatHandler.getInstance(); 		Olympiad.getInstance();		Hero.getInstance();		FaenorScriptEngine.getInstance();		// Init of a cursed weapon manager		CursedWeaponsManager.getInstance(); 		_log.log(Level.CONFIG, "AutoChatHandler: Loaded " + AutoChatHandler.getInstance().size() + " handlers in total.");		_log.log(Level.CONFIG, "AutoSpawnHandler: Loaded " + AutoSpawnHandler.getInstance().size() + " handlers in total."); 		AdminCommandHandler.getInstance();		ChatHandler.getInstance();		ItemHandler.getInstance();		SkillHandler.getInstance();		UserCommandHandler.getInstance();		VoicedCommandHandler.getInstance(); 		AccessLevels.getInstance();		AdminCommandAccessRights.getInstance(); 		if (Config.L2JMOD_ALLOW_WEDDING)			CoupleManager.getInstance(); 		TaskManager.getInstance(); 		GmListTable.getInstance(); 		// read pet stats from db		PetDataTable.getInstance().loadPetsData(); 		MerchantPriceConfigTable.getInstance().updateReferences();		CastleManager.getInstance().activateInstances();		FortManager.getInstance().activateInstances(); 		if (Config.ALLOW_MAIL)			MailManager.getInstance(); 		Universe.getInstance(); 		if (Config.ACCEPT_GEOEDITOR_CONN)			GeoEditorListener.getInstance(); 		Runtime.getRuntime().addShutdownHook(Shutdown.getInstance()); 		_log.config("IdFactory: Free ObjectID's remaining: " + IdFactory.getInstance().size()); 		// initialize the dynamic extension loader		try		{			DynamicExtension.getInstance();		}		catch (Exception ex)		{			_log.log(Level.WARNING, "DynamicExtension could not be loaded and initialized", ex);		} 		TvTManager.getInstance();		KnownListUpdateTaskManager.getInstance();		if (Config.DEADLOCK_DETECTOR)		{			_deadDetectThread = new DeadLockDetector();			_deadDetectThread.setDaemon(true);			_deadDetectThread.start();		}		else			_deadDetectThread = null;		System.gc();		// maxMemory is the upper limit the jvm can use, totalMemory the size of		// the current allocation pool, freeMemory the unused memory in the		// allocation pool		long freeMem = (Runtime.getRuntime().maxMemory() - Runtime.getRuntime().totalMemory() + Runtime.getRuntime().freeMemory()) / 1048576;		long totalMem = Runtime.getRuntime().maxMemory() / 1048576;		_log.info("GameServer Started, free memory " + freeMem + " Mb of " + totalMem + " Mb"); 		_loginThread = LoginServerThread.getInstance();		_loginThread.start(); 		CommunityServerThread.initialize(); 		final SelectorConfig sc = new SelectorConfig();		sc.MAX_READ_PER_PASS = Config.MMO_MAX_READ_PER_PASS;		sc.MAX_SEND_PER_PASS = Config.MMO_MAX_SEND_PER_PASS;		sc.SLEEP_TIME = Config.MMO_SELECTOR_SLEEP_TIME;		sc.HELPER_BUFFER_COUNT = Config.MMO_HELPER_BUFFER_COUNT; 		final L2GamePacketHandler gph = new L2GamePacketHandler();		_selectorThread = new SelectorThread<L2GameClient>(sc, gph, gph, gph, new IPv4Filter()); 		InetAddress bindAddress = null;		if (!Config.GAMESERVER_HOSTNAME.equals("*"))		{			try			{				bindAddress = InetAddress.getByName(Config.GAMESERVER_HOSTNAME);			}			catch (UnknownHostException e1)			{				_log.severe("WARNING: The GameServer bind address is invalid, using all avaliable IPs. Reason: " + e1.getMessage()); 				if (Config.DEVELOPER)				{					e1.printStackTrace();				}			}		} 		try		{			_selectorThread.openServerSocket(bindAddress, Config.PORT_GAME);		}		catch (IOException e)		{			_log.severe("FATAL: Failed to open server socket. Reason: " + e.getMessage());			if (Config.DEVELOPER)			{				e.printStackTrace();			}			System.exit(1);		}		_selectorThread.start();		_log.config("Maximum Numbers of Connected Players: " + Config.MAXIMUM_ONLINE_USERS);		long serverLoadEnd = System.currentTimeMillis();		_log.info("Server Loaded in " + ((serverLoadEnd - serverLoadStart) / 1000) + " seconds"); 		AutoAnnounceTaskManager.getInstance();	} 	public static void main(String[] args) throws Exception	{		Server.serverMode = Server.MODE_GAMESERVER;		// Local Constants		final String LOG_FOLDER = "log"; // Name of folder for log file		final String LOG_NAME = "./log.cfg"; // Name of log file 		/*** Main ***/		// Create log folder		File logFolder = new File(Config.DATAPACK_ROOT, LOG_FOLDER);		logFolder.mkdir(); 		// Create input stream for log file -- or store file data into memory		InputStream is = new FileInputStream(new File(LOG_NAME));		LogManager.getLogManager().readConfiguration(is);		is.close(); 		// Initialize config		Config.load();		L2DatabaseFactory.getInstance();		gameServer = new GameServer(); 		if (Config.IS_TELNET_ENABLED)		{			_statusServer = new Status(Server.serverMode);			_statusServer.start();		}		else		{			_log.info("Telnet server is currently disabled.");		}	}} 
Eclipse found error

Code: Select all

NpcTable.getInstance();		if (!NpcTable.getInstance().[color=#FF0000]isInitialized[/color]())		{
Code with red color is the error. Eclipse quick fix:
1.Create method 'isInitialized()' in type 'NpcTable'
2.Add cast to method receiver
Any help?
badboy29 wrote:
JustLikeMe wrote:Dunno what you sayin, but the packages are com.l2jserver.
In Gracia Final is java/net/sf/l2j/gameserver/
Only in Epilogue is java/com/l2jserver/gameserver

Understand now ?
Look i have scripts with packets com.l2jserver.gameserver . . . and they work in GRACIA FINAL so dont tell me crap.
Post Reply