client.getTrace()
Forum rules
READ NOW: L2j Forums Rules of Conduct
READ NOW: L2j Forums Rules of Conduct
-
- Posts: 34
- Joined: Fri Nov 13, 2009 5:56 pm
client.getTrace()
Hello
I have a problem and i need some help about:
IpPack pack = new IpPack(client.getAdress(), client.getTrace());
Is a part of code from MultiBoxProtection.java (Sorry i cant post there since i dont have 20 posts)
So i have problem on eclipse with this one: client.getTrace());
Any idea ?
I have a problem and i need some help about:
IpPack pack = new IpPack(client.getAdress(), client.getTrace());
Is a part of code from MultiBoxProtection.java (Sorry i cant post there since i dont have 20 posts)
So i have problem on eclipse with this one: client.getTrace());
Any idea ?
- Tavo22
- Posts: 258
- Joined: Mon Mar 22, 2010 8:14 pm
Re: client.getTrace()
With the last rev the patch works fine.
But suddenly i get this error
But suddenly i get this error
and the server crash.Exception in thread "SelectorThread-216" java.lang.NullPointerException
at com.l2jserver.gameserver.network.MultiBoxProtection$IpPack.hashCode(MultiBoxProtection.java:122)
at javolution.util.FastMap.getEntry(FastMap.java:418)
at javolution.util.FastMap.get(FastMap.java:406)
at com.l2jserver.gameserver.network.MultiBoxProtection.removeConnection(MultiBoxProtection.java:83)
at com.l2jserver.gameserver.network.L2GameClient.onForcedDisconnection(L2GameClient.java:575)
at org.mmocore.network.SelectorThread.readPacket(SelectorThread.java:321)
at org.mmocore.network.SelectorThread.run(SelectorThread.java:176)
-
- Posts: 3
- Joined: Thu Nov 06, 2008 4:03 am
Re: client.getTrace()
Same problem here, what is your L2J, L2JDP version?Tavo22 wrote:With the last rev the patch works fine.
But suddenly i get this errorand the server crash.Exception in thread "SelectorThread-216" java.lang.NullPointerException
at com.l2jserver.gameserver.network.MultiBoxProtection$IpPack.hashCode(MultiBoxProtection.java:122)
at javolution.util.FastMap.getEntry(FastMap.java:418)
at javolution.util.FastMap.get(FastMap.java:406)
at com.l2jserver.gameserver.network.MultiBoxProtection.removeConnection(MultiBoxProtection.java:83)
at com.l2jserver.gameserver.network.L2GameClient.onForcedDisconnection(L2GameClient.java:575)
at org.mmocore.network.SelectorThread.readPacket(SelectorThread.java:321)
at org.mmocore.network.SelectorThread.run(SelectorThread.java:176)
- Tavo22
- Posts: 258
- Joined: Mon Mar 22, 2010 8:14 pm
Re: client.getTrace()
L2J Revision Number: 4411
L2JDP Revision Number: 7664
The problem is here, but i really dont know how this method works...
L2JDP Revision Number: 7664
The problem is here, but i really dont know how this method works...
Code: Select all
@Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((ip == null) ? 0 : ip.hashCode()); for (int[] array: tracert) result = prime * result + Arrays.hashCode(array); return result; }
-
- Posts: 3
- Joined: Thu Nov 06, 2008 4:03 am
Re: client.getTrace()
What the H*** is this?
for (int[] array: tracert)
for (int[] array: tracert)
-
- Posts: 915
- Joined: Thu Sep 03, 2009 6:36 pm
- Location: Israel
- Contact:
Re: client.getTrace()
it's an iteration over every array inside tracert
- JIV
- L2j Veteran
- Posts: 1882
- Joined: Sun Jan 06, 2008 8:17 pm
- Location: Slovakia
- Contact:
Re: client.getTrace()
it just compute hashcode for multidimensional array, afaik it was generated by eclipse.
reason why you get npe is tracert is null because it wasnt set yet, called disconnection before enterworld.
reason why you get npe is tracert is null because it wasnt set yet, called disconnection before enterworld.
- Tavo22
- Posts: 258
- Joined: Mon Mar 22, 2010 8:14 pm
Re: client.getTrace()
Thanks Jiv! now is working =)
-
- Posts: 125
- Joined: Mon Jul 07, 2008 4:01 pm
Re: client.getTrace()
can some one explain better...
coz i didnt get what mean jiv..
what exactly is the fix...
coz i didnt get what mean jiv..

what exactly is the fix...
- Tavo22
- Posts: 258
- Joined: Mon Mar 22, 2010 8:14 pm
Re: client.getTrace()
You are calling the removeConnection before EnterWorld, so you don't have tracert.
@Override
public int hashCode()
{
final int prime = 31;
int result = 1;
result = prime * result + ((ip == null) ? 0 : ip.hashCode());
if(tracert == null)
return result;
for (int[] array: tracert)
result = prime * result + Arrays.hashCode(array);
return result;
}
-
- Posts: 34
- Joined: Fri Nov 13, 2009 5:56 pm
Re: client.getTrace()
Sorry but i cant really understand. I have error on eclipse and the error say: they cant find it on L2GameClient.java.
So i think is at least my error is not somthing about pre or post enter world.
I'm wrong about that ?
That is what i got from error on my eclipse.
Sorry for my english and let me know where i'm wrong please!
PS: client.getTrace() exactly here is the problem on my eclipse.
So i think is at least my error is not somthing about pre or post enter world.
I'm wrong about that ?
That is what i got from error on my eclipse.
Sorry for my english and let me know where i'm wrong please!
PS: client.getTrace() exactly here is the problem on my eclipse.
-
- Posts: 183
- Joined: Thu Jul 15, 2010 12:26 am
Re: client.getTrace()
I'm having some errors.
MultiBoxProtection.java
Can anyone help me?
Code: Select all
[javac] C:\L2jServer\GameServer\java\com\l2jserver\gameserver\network\MultiBoxProtection.java:49: cannot find symbol [javac] symbol : method getAdress() [javac] location: class com.l2jserver.gameserver.network.L2GameClient [javac] IpPack pack = new IpPack(client.getAdress(), client.getTrace()); [javac] ^ [javac] C:\L2jServer\GameServer\java\com\l2jserver\gameserver\network\MultiBoxProtection.java:56: cannot find symbol [javac] symbol : method getAdress() [javac] location: class com.l2jserver.gameserver.network.L2GameClient [javac] _log.info("MultiBoxProtection.registerNewConnection(): Set Count for: "+ client.getActiveChar().getName() +" (" + client.getAdress() + ") to " + count); [javac] ^ [javac] C:\L2jServer\GameServer\java\com\l2jserver\gameserver\network\MultiBoxProtection.java:64: cannot find symbol [javac] symbol : method getAdress() [javac] location: class com.l2jserver.gameserver.network.L2GameClient [javac] _log.info("MultiBoxProtection.registerNewConnection(): Increase Count for: "+ client.getActiveChar().getName() +" (" + client.getAdress() + ") to " + count); [javac] ^ [javac] C:\L2jServer\GameServer\java\com\l2jserver\gameserver\network\MultiBoxProtection.java:72: cannot find symbol [javac] symbol : method getAdress() [javac] location: class com.l2jserver.gameserver.network.L2GameClient [javac] _log.info("MultiBoxProtection.registerNewConnection(): Count for: "+ client.getActiveChar().getName() +" (" + client.getAdress() + ") is " + count); [javac] ^ [javac] C:\L2jServer\GameServer\java\com\l2jserver\gameserver\network\MultiBoxProtection.java:82: cannot find symbol [javac] symbol : method getAdress() [javac] location: class com.l2jserver.gameserver.network.L2GameClient [javac] IpPack pack = new IpPack(client.getAdress(), client.getTrace()); [javac] ^ [javac] C:\L2jServer\GameServer\java\com\l2jserver\gameserver\network\MultiBoxProtection.java:89: cannot find symbol [javac] symbol : method getAdress() [javac] location: class com.l2jserver.gameserver.network.L2GameClient [javac] _log.info("MultiBoxProtection.removeConnection(): Decrease Count for: "+ client.getActiveChar().getName() +" (" + client.getAdress() + ") to " + count); [javac] ^ [javac] C:\L2jServer\GameServer\java\com\l2jserver\gameserver\network\MultiBoxProtection.java:95: cannot find symbol [javac] symbol : method getAdress() [javac] location: class com.l2jserver.gameserver.network.L2GameClient [javac] _log.info("MultiBoxProtection.removeConnection(): Remove Count for: "+ client.getActiveChar().getName() +" (" + client.getAdress() + ")"); [javac] ^ [javac] 7 errors
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.network; import java.util.Arrays;import java.util.Map;import java.util.logging.Logger; import com.l2jserver.Config; import javolution.util.FastMap; /** * @author JIV * */public class MultiBoxProtection{ protected static final Logger _log = Logger.getLogger(MultiBoxProtection.class.getName()); private Map<IpPack, Integer> map; public static MultiBoxProtection getInstance() { return SingletonHolder._instance; } public MultiBoxProtection() { map = new FastMap<MultiBoxProtection.IpPack, Integer>(); } public synchronized boolean registerNewConnection(L2GameClient client) { IpPack pack = new IpPack(client.getAdress(), client.getTrace()); Integer count = map.get(pack); if (count == null) { count = 1; map.put(pack, count); if (Config.DEVELOPER) _log.info("MultiBoxProtection.registerNewConnection(): Set Count for: "+ client.getActiveChar().getName() +" (" + client.getAdress() + ") to " + count); return true; } else if (count < Config.MAX_PLAYERS_FROM_ONE_PC) { count++; map.put(pack, count); if (Config.DEVELOPER) _log.info("MultiBoxProtection.registerNewConnection(): Increase Count for: "+ client.getActiveChar().getName() +" (" + client.getAdress() + ") to " + count); return true; } else { count++; map.put(pack, count); if (Config.DEVELOPER) _log.info("MultiBoxProtection.registerNewConnection(): Count for: "+ client.getActiveChar().getName() +" (" + client.getAdress() + ") is " + count); return false; } } public synchronized void removeConnection(L2GameClient client) { if (client == null) return; IpPack pack = new IpPack(client.getAdress(), client.getTrace()); Integer count = map.get(pack); if (count != null && count > 1) { count--; map.put(pack, count); if (Config.DEVELOPER) _log.info("MultiBoxProtection.removeConnection(): Decrease Count for: "+ client.getActiveChar().getName() +" (" + client.getAdress() + ") to " + count); } else { map.remove(pack); if (Config.DEVELOPER) _log.info("MultiBoxProtection.removeConnection(): Remove Count for: "+ client.getActiveChar().getName() +" (" + client.getAdress() + ")"); } } @SuppressWarnings("synthetic-access") private static class SingletonHolder { protected static final MultiBoxProtection _instance = new MultiBoxProtection(); } public final static class IpPack { String ip; int[][] tracert; public IpPack(String ip, int[][] tracert) { this.ip = ip; this.tracert = tracert; } @Override public int hashCode() { final int prime = 31; int result = 1; result = prime * result + ((ip == null) ? 0 : ip.hashCode()); for (int[] array: tracert) result = prime * result + Arrays.hashCode(array); return result; } @Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (getClass() != obj.getClass()) return false; IpPack other = (IpPack) obj; if (ip == null) { if (other.ip != null) return false; } else if (!ip.equals(other.ip)) return false; for (int i = 0 ; i < tracert.length; i++) for (int o = 0; o < tracert[0].length; o++) if (tracert[i][o] != other.tracert[i][o]) return false; return true; } }}
-
- Posts: 34
- Joined: Tue May 13, 2008 4:32 am
Re: client.getTrace()
put at the int array : the int tracertcharly911 wrote:What the H*** is this?
for (int[] array: tracert)