Page 1 of 1

prob with interlude count dualboxes

Posted: Thu May 27, 2010 8:37 am
by Darkfeiter
here the code and red marked are the errors.

Code: Select all

        if (Config.L2JMOD_COUNT_DUALBOX)        			{	        				int onlineboxes= 0;        				onlineboxes=[color=#FF0000]countIP[/color](activeChar);        				if (onlineboxes>Config.L2JMOD_COUNT_DUALBOX_MAX_PER_IP)        				{        					activeChar.sendPacket(new ExShowScreenMessage("Only " + Integer.toString(Config.L2JMOD_COUNT_DUALBOX_MAX_PER_IP)+ " boxes per IP allowed! Bye!", 15000));        					activeChar.sendMessage("Only " + Integer.toString(Config.L2JMOD_COUNT_DUALBOX_MAX_PER_IP)+ " boxes per IP allowed! Bye!");        					activeChar.getClient().[color=#FF0000]handleCheat[/color]("Too much boxes per IP");        				}        			}
so some more :S

Code: Select all

	    private int countIP(L2PcInstance activeChar)	    {	    int connections = 0;	    String IPadress ="";	    	try	    	{	    		IPadress = activeChar.getClient().getConnection().getSocketChannel().socket().getInetAddress().getHostAddress();	    	}	    	catch (Exception e)	    	{	    		return 0; //no adress (fake online)	    	}	    //_log.warning("PlayerIP: " + IPadress);    	    Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();		for (L2PcInstance player : pls)		{	    	try	    	{	    		if (IPadress.equalsIgnoreCase(player.getClient().getConnection().getSocketChannel().socket().getInetAddress().getHostAddress())) connections = connections +1 ;	    		//_log.warning("CheckIP: " + player.getClient().getConnection().getSocketChannel().socket().getInetAddress().getHostAddress());	    	}	    	catch (Exception e)	    	{	    		continue; //no adress or fake online	    	}  				}
Collection and values are error sry the furom will scroll up if wanna make and add red

thanks for help me :D

Re: prob with interlude count dualboxes

Posted: Thu May 27, 2010 8:39 am
by janiii
again - wrong section. custom server mods is for contribution of custom server mods, not for support. and for interlude support, use just the section for legacy server! next time you write for interlude support in other section, you will get a warning.

and again - what is the error? not what is red, but what is the error there - what does eclipse says there? or what the compilation says..

when you want support for a custom mod, you should give us the source of the whole mod, not only of a part.

or you should just get support from where you have the mod:
1. it is custom mod and not supported by l2j
2. legacy support
3. mod was not posted on l2j forum

Re: prob with interlude count dualboxes

Posted: Thu May 27, 2010 8:42 am
by Darkfeiter
its just marked red in eclipse so and this is maybe code from final or whatever but i need it :S

Re: prob with interlude count dualboxes

Posted: Thu May 27, 2010 8:43 am
by Darkfeiter
ok here complete code :

Code: Select all

Index: java/com/l2jserver/Config.java===================================================================--- java/com/l2jserver/Config.java	(revision 3968)+++ java/com/l2jserver/Config.java	(working copy)@@ -658,7 +658,17 @@ 	public static String ANNOUNCE_PK_MSG; 	public static String ANNOUNCE_PVP_MSG; 	public static boolean L2JMOD_CHAT_ADMIN;	public static int L2JMOD_GAK_KARMA;	public static int L2JMOD_GAK_ITEM_ID;	public static int L2JMOD_GAK_ITEM_COUNT;	public static int L2JMOD_GAK_TIME;	public static int L2JMOD_BOOM_X;	public static int L2JMOD_BOOM_Y;	public static int L2JMOD_BOOM_Z;+	public static boolean L2JMOD_COUNT_DUALBOX;+	public static int L2JMOD_COUNT_DUALBOX_MAX_PER_IP;+	 	//-------------------------------------------------- 	// NPC Settings 	//--------------------------------------------------@@ -2173,6 +2206,15 @@ 					ANNOUNCE_PVP_MSG = L2JModSettings.getProperty("AnnouncePvpMsg", "$killer has defeated $target");  					L2JMOD_CHAT_ADMIN = Boolean.parseBoolean(L2JModSettings.getProperty("ChatAdmin", "false"));					L2JMOD_GAK_KARMA = Integer.parseInt(L2JModSettings.getProperty("GAKKarmaAmout", "1000"));					L2JMOD_GAK_ITEM_ID = Integer.parseInt(L2JModSettings.getProperty("GAKItemId", "57"));					L2JMOD_GAK_ITEM_COUNT = Integer.parseInt(L2JModSettings.getProperty("GAKItemCount", "1"));					L2JMOD_GAK_TIME = Integer.parseInt(L2JModSettings.getProperty("GAKReuseTime", "12"));					L2JMOD_BOOM_X = Integer.parseInt(L2JModSettings.getProperty("BoomX", "1"));					L2JMOD_BOOM_Y = Integer.parseInt(L2JModSettings.getProperty("BoomY", "1"));					L2JMOD_BOOM_Z = Integer.parseInt(L2JModSettings.getProperty("BoomZ", "1"));+					L2JMOD_COUNT_DUALBOX = Boolean.parseBoolean(L2JModSettings.getProperty("CountDualBoxes", "False"));+					L2JMOD_COUNT_DUALBOX_MAX_PER_IP = Integer.parseInt(L2JModSettings.getProperty("MaxCountDualBoxesPerIP", "1")); 				} 				catch (Exception e) 				{Index: java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java===================================================================--- java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java	(revision 3968)+++ java/com/l2jserver/gameserver/network/clientpackets/EnterWorld.java	(working copy)@@ -384,7 +390,64 @@+        +		if (Config.L2JMOD_COUNT_DUALBOX)+		{	+			int onlineboxes= 0;+			onlineboxes=countIP(activeChar);+			if (onlineboxes>Config.L2JMOD_COUNT_DUALBOX_MAX_PER_IP)+			{+				activeChar.sendPacket(new ExShowScreenMessage("Only " + Integer.toString(Config.L2JMOD_COUNT_DUALBOX_MAX_PER_IP)+ " boxes per IP allowed! Bye!", 15000));+				activeChar.sendMessage("Only " + Integer.toString(Config.L2JMOD_COUNT_DUALBOX_MAX_PER_IP)+ " boxes per IP allowed! Bye!");+				activeChar.getClient().handleCheat("Too much boxes per IP");+			}+		}+		@@ -638,4 +701,91 @@+    +    private int countIP(L2PcInstance activeChar)+    {+    int connections = 0;+    String IPadress ="";+    	try+    	{+    		IPadress = activeChar.getClient().getConnection().getInetAddress().getHostAddress();+    	}+    	catch (Exception e)+    	{+    		return 0; //no adress (fake online)+    	}+    //_log.warning("PlayerIP: " + IPadress);    +    Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().values();+	for (L2PcInstance player : pls)+	{+    	try+    	{+    		if (IPadress.equalsIgnoreCase(player.getClient().getConnection().getInetAddress().getHostAddress())) connections = connections +1 ;+    		//_log.warning("CheckIP: " + player.getClient().getConnection().getInetAddress().getHostAddress());+    	}+    	catch (Exception e)+    	{+    		continue; //no adress or fake online+    	}  		+	}+	//_log.warning("count: " + Integer.toString(connections));+    return connections;+    } }Index: java/config/l2jmods.properties===================================================================--- java/config/l2jmods.properties	(revision 3968)+++ java/config/l2jmods.properties	(working copy)@@ -334,3 +334,23 @@ # Check access_levels.sql and admin_command_access_rights for details. # Default: False ChatAdmin = False++# ---------------------------------------------------------------------------+# Boxing controll+# ---------------------------------------------------------------------------+# This option controls dualboxes count. Default punish is given if count > than preset. Default: False,1+CountDualBoxes = False+MaxCountDualBoxesPerIP = 1
and the lines that i say is something wrong whatever and i need help and sorry about wrong section

Re: prob with interlude count dualboxes

Posted: Thu May 27, 2010 8:45 am
by janiii
it is not whatever error, you have to tell the error! check the red marks in eclipse or try to compile and paste here the errors!

Re: prob with interlude count dualboxes

Posted: Thu May 27, 2010 8:50 am
by Darkfeiter
the method handlecheat (String) is undifined for the type L2GameClient.

so thats first red thing

Collection cannot be resolved to a type

the method Values() is undifined for the type collection.

so that eclipse says to me :S

Re: prob with interlude count dualboxes

Posted: Thu May 27, 2010 8:53 am
by janiii
if eclipse says something cannot be resolved, that means it is not imported or cannot be found in classpath.
import Collection -> ctrl+shift+o in eclipse for organize imports (yeah, i already told you this last time..)

for the other, check L2GameClient class and if it has a similar method to handle cheat. or check other classes how they handle cheats and punishment and apply it instead of the handleCheat method.
this is what handleCheat method does:

Code: Select all

	public boolean handleCheat(String punishment)	{		if (_activeChar != null)		{			Util.handleIllegalPlayerAction(_activeChar, toString()+": "+punishment, Config.DEFAULT_PUNISH);			return true;		} 		Logger _logAudit = Logger.getLogger("audit");		_logAudit.log(Level.INFO, "AUDIT: Client "+toString()+" kicked for reason: "+punishment);		closeNow();		return false;	}

Re: prob with interlude count dualboxes

Posted: Thu May 27, 2010 8:55 am
by JIV
handleCheat() can be replaced with kick (eg com.l2jserver.gameserver.network.L2GameClient.closeNow())

others are easy, just think first.

Re: prob with interlude count dualboxes

Posted: Thu May 27, 2010 9:28 am
by Darkfeiter
so i have just 1 the Values .

Code: Select all

return 0; //no adress (fake online)	    	}	    //_log.warning("PlayerIP: " + IPadress);    	    Collection<L2PcInstance> pls = L2World.getInstance().getAllPlayers().[color=#FF0000]values[/color]();		for (L2PcInstance player : pls)		{	    	try
if i try with eclipse quick fix it dont work so what can i do with that ?sorry i am beginner with java and eclipse and sorry about my english

Re: prob with interlude count dualboxes

Posted: Thu May 27, 2010 9:29 am
by janiii
check what the method getAllPlayers() return. probably you can just delete the values() from there.

Re: prob with interlude count dualboxes

Posted: Thu May 27, 2010 9:37 am
by Darkfeiter
i deletet it and test it thx for your help :D

so tryed the client dont load up but console show error like this :

Image

also 1 i can use at 2 show the error so if i edit config i can use 2 and on 3 error so donno :S pls help me

Re: prob with interlude count dualboxes

Posted: Thu May 27, 2010 12:09 pm
by Darkfeiter
anyone can help ??

Re: prob with interlude count dualboxes

Posted: Thu May 27, 2010 12:15 pm
by janiii
be more specific what you did - how you "fixed" the errors in eclipse. how does your handleCheat method looks like?

Re: prob with interlude count dualboxes

Posted: Thu May 27, 2010 2:28 pm
by Darkfeiter
i used your handleCheat just go with mouse over it and see quick fix from eclipse side so donno if its right or not

just at Value that i delete from the code

Re: prob with interlude count dualboxes

Posted: Thu May 27, 2010 3:12 pm
by JIV
it was only as example, you shouldn't copy paste method but create similar one.