Addition of KickMissingHWID configuration.
This commit is contained in:
@@ -162,11 +162,15 @@ RestartOnDeadlock = False
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
# Check if hardware information is sent upon login.
|
||||
# Players without hardware information are kicked from the game.
|
||||
# WARNING: To receive hardware information from client, l2.ini NetSendHardWare must be set to true.
|
||||
# Default: False
|
||||
EnableHardwareInfo = False
|
||||
|
||||
# Players without hardware information are kicked from the game.
|
||||
# Automatically set to True when MaxPlayersPerHWID > 0.
|
||||
# Default: False
|
||||
KickMissingHWID = False
|
||||
|
||||
# Maximum number of players per HWID allowed to enter game.
|
||||
# Default: 0 (unlimited)
|
||||
MaxPlayersPerHWID = 0
|
||||
|
@@ -760,6 +760,7 @@ public class Config
|
||||
public static int BACKUP_DAYS;
|
||||
public static int MAXIMUM_ONLINE_USERS;
|
||||
public static boolean HARDWARE_INFO_ENABLED;
|
||||
public static boolean KICK_MISSING_HWID;
|
||||
public static int MAX_PLAYERS_PER_HWID;
|
||||
public static Pattern CHARNAME_TEMPLATE_PATTERN;
|
||||
public static String PET_NAME_TEMPLATE;
|
||||
@@ -1355,7 +1356,12 @@ public class Config
|
||||
MAX_CHARACTERS_NUMBER_PER_ACCOUNT = serverSettings.getInt("CharMaxNumber", 7);
|
||||
MAXIMUM_ONLINE_USERS = serverSettings.getInt("MaximumOnlineUsers", 100);
|
||||
HARDWARE_INFO_ENABLED = serverSettings.getBoolean("EnableHardwareInfo", false);
|
||||
KICK_MISSING_HWID = serverSettings.getBoolean("KickMissingHWID", false);
|
||||
MAX_PLAYERS_PER_HWID = serverSettings.getInt("MaxPlayersPerHWID", 0);
|
||||
if (MAX_PLAYERS_PER_HWID > 0)
|
||||
{
|
||||
KICK_MISSING_HWID = true;
|
||||
}
|
||||
final String[] protocols = serverSettings.getString("AllowedProtocolRevisions", "603;606;607").split(";");
|
||||
PROTOCOL_LIST = new ArrayList<>(protocols.length);
|
||||
for (String protocol : protocols)
|
||||
|
@@ -696,27 +696,24 @@ public class EnterWorld implements IClientIncomingPacket
|
||||
}
|
||||
|
||||
// Check max players.
|
||||
if (Config.MAX_PLAYERS_PER_HWID > 0)
|
||||
if (Config.KICK_MISSING_HWID && (hwInfo == null))
|
||||
{
|
||||
if (hwInfo == null)
|
||||
Disconnection.of(client).defaultSequence(false);
|
||||
}
|
||||
else if (Config.MAX_PLAYERS_PER_HWID > 0)
|
||||
{
|
||||
int count = 0;
|
||||
for (PlayerInstance plr : World.getInstance().getPlayers())
|
||||
{
|
||||
if ((plr.isOnlineInt() == 1) && (plr.getClient().getHardwareInfo().equals(hwInfo)))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count >= Config.MAX_PLAYERS_PER_HWID)
|
||||
{
|
||||
Disconnection.of(client).defaultSequence(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
int count = 0;
|
||||
for (PlayerInstance plr : World.getInstance().getPlayers())
|
||||
{
|
||||
if ((plr.isOnlineInt() == 1) && (plr.getClient().getHardwareInfo().equals(hwInfo)))
|
||||
{
|
||||
count++;
|
||||
}
|
||||
}
|
||||
if (count >= Config.MAX_PLAYERS_PER_HWID)
|
||||
{
|
||||
Disconnection.of(client).defaultSequence(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}, 5000);
|
||||
}
|
||||
|
Reference in New Issue
Block a user