Addition of KickMissingHWID configuration.
This commit is contained in:
@ -761,6 +761,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;
|
||||
@ -1406,7 +1407,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)
|
||||
|
@ -713,27 +713,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