*/
if (command.getFailMessage() != null) {
logger.info("Banned/Inactive account for player " + info.username + ": " + command.getFailMessage());
/* Send player the Login NACK message */
MessageS2CLoginMessageNACK msgLoginMessageNACK = new MessageS2CLoginMessageNACK(command.getChannel(), command.getFailMessage());
msgLoginMessageNACK.setProtocolVersion(command.getProtocolVersion());
netMan.sendMessage(msgLoginMessageNACK);
/*
* Disconnect player of server.
*/
netMan.disconnectClient(command.getChannel());
return;
}
/* Now we count the number of connections from this ip-address */
int count = info.countConnectionsFromSameIPAddress(playerContainer);
Configuration conf = Configuration.getConfiguration();
int limit = conf.getInt("parallel_connection_limit", TimeoutConf.PARALLEL_CONNECTION_LIMIT);
if (count > limit) {
String whiteList = "," + conf.get("ip_whitelist", "127.0.0.1") + ",";
if (whiteList.indexOf("," + info.address + ",") < 0) {
logger.info("to many parallel connections from " + info.address + " rejecting login of " + info.username);
/* Send player the Login NACK message */
MessageS2CLoginMessageNACK msgLoginMessageNACK = new MessageS2CLoginMessageNACK(command.getChannel(),
"There are too many connections from your ip-address.\nPlease contact /support, if you are at a conference or something similar.");
msgLoginMessageNACK.setProtocolVersion(command.getProtocolVersion());
netMan.sendMessage(msgLoginMessageNACK);
// Disconnect player of server.
netMan.disconnectClient(command.getChannel());
return;