i give you what you want in 3 lines of code but you paste all this non sense code... if all you wanna do is not having 2 players with same ip in a specific zone you should use what i pasted above. why are you using code that you don't have any clue what is doing ?
what is this line is supposed to do ?? i bet you are clueless you should start by understanding you're code , if you can't read code as machine how you expect to write it ?
final AtomicInteger connectionCount = event.computeIfAbsent(addrHash, k -> new AtomicInteger());
anyway if you really wanna use this system you should paste all zone lines not only exit and enter.
public boolean tryAddClient(, GameClient client, int max)
{
if (client == null)
return false; // unable to determine IP address
-->> i think you're problem is related to "event" probably this is antifeed for an automatic event engine .. and probably events are registered when they are starting , you might not have any active event at the this of this time check.. man just use the 3 lines i pasted above.
final Map<Integer, AtomicInteger> event = _eventIPs.get(eventId);
if (event == null)
return false; // no such event registered
final Integer addrHash = client.getConnection().getInetAddress().hashCode();
final AtomicInteger connectionCount = event.computeIfAbsent(addrHash, k -> new AtomicInteger());
int whiteListCount = Config.DUALBOX_CHECK_WHITELIST.getOrDefault(addrHash, Integer.valueOf(0)).intValue();
if (whiteListCount < 0 || connectionCount.get() + 1 <= max + whiteListCount)
{
connectionCount.incrementAndGet();
return true;
}
return false;
}