Config for dualbox check not to count offline traders.
This commit is contained in:
@ -993,6 +993,7 @@ public final class Config
|
||||
public static int DUALBOX_CHECK_MAX_PLAYERS_PER_IP;
|
||||
public static int DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP;
|
||||
public static int DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP;
|
||||
public static boolean DUALBOX_COUNT_OFFLINE_TRADERS;
|
||||
public static Map<Integer, Integer> DUALBOX_CHECK_WHITELIST;
|
||||
public static boolean ALLOW_CHANGE_PASSWORD;
|
||||
public static boolean ALLOW_HUMAN;
|
||||
@ -2344,6 +2345,7 @@ public final class Config
|
||||
DUALBOX_CHECK_MAX_PLAYERS_PER_IP = DualboxCheck.getInt("DualboxCheckMaxPlayersPerIP", 0);
|
||||
DUALBOX_CHECK_MAX_OLYMPIAD_PARTICIPANTS_PER_IP = DualboxCheck.getInt("DualboxCheckMaxOlympiadParticipantsPerIP", 0);
|
||||
DUALBOX_CHECK_MAX_L2EVENT_PARTICIPANTS_PER_IP = DualboxCheck.getInt("DualboxCheckMaxL2EventParticipantsPerIP", 0);
|
||||
DUALBOX_COUNT_OFFLINE_TRADERS = DualboxCheck.getBoolean("DualboxCountOfflineTraders", false);
|
||||
final String[] dualboxCheckWhiteList = DualboxCheck.getString("DualboxCheckWhitelist", "127.0.0.1,0").split(";");
|
||||
DUALBOX_CHECK_WHITELIST = new HashMap<>(dualboxCheckWhiteList.length);
|
||||
for (String entry : dualboxCheckWhiteList)
|
||||
|
@ -21,6 +21,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.L2GameClient;
|
||||
@ -158,9 +159,20 @@ public final class AntiFeedManager
|
||||
}
|
||||
|
||||
final Integer addrHash = Integer.valueOf(client.getConnectionAddress().hashCode());
|
||||
|
||||
final AtomicInteger connectionCount = event.computeIfAbsent(addrHash, k -> new AtomicInteger());
|
||||
|
||||
if (!Config.DUALBOX_COUNT_OFFLINE_TRADERS)
|
||||
{
|
||||
final String address = client.getConnectionAddress().getHostAddress();
|
||||
for (L2PcInstance player : L2World.getInstance().getPlayers())
|
||||
{
|
||||
if (((player.getClient() == null) || player.getClient().isDetached()) && player.getIPAddress().equals(address))
|
||||
{
|
||||
connectionCount.decrementAndGet();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ((connectionCount.get() + 1) <= (max + Config.DUALBOX_CHECK_WHITELIST.getOrDefault(addrHash, 0)))
|
||||
{
|
||||
connectionCount.incrementAndGet();
|
||||
|
@ -405,6 +405,7 @@ public final class L2PcInstance extends L2Playable
|
||||
private int _pcCafePoints = 0;
|
||||
|
||||
private L2GameClient _client;
|
||||
private String _ip = "N/A";
|
||||
|
||||
private final String _accountName;
|
||||
private long _deleteTimer;
|
||||
@ -3916,16 +3917,15 @@ public final class L2PcInstance extends L2Playable
|
||||
public void setClient(L2GameClient client)
|
||||
{
|
||||
_client = client;
|
||||
if ((_client != null) && (_client.getConnectionAddress() != null))
|
||||
{
|
||||
_ip = _client.getConnectionAddress().getHostAddress();
|
||||
}
|
||||
}
|
||||
|
||||
public String getIPAddress()
|
||||
{
|
||||
String ip = "N/A";
|
||||
if ((_client != null) && (_client.getConnectionAddress() != null))
|
||||
{
|
||||
ip = _client.getConnectionAddress().getHostAddress();
|
||||
}
|
||||
return ip;
|
||||
return _ip;
|
||||
}
|
||||
|
||||
public Location getCurrentSkillWorldPosition()
|
||||
|
Reference in New Issue
Block a user