Removed L2 prefix from LoginServer class name.

This commit is contained in:
MobiusDev 2018-04-26 22:42:05 +00:00
parent fee32f388d
commit dad8a4b8c9
53 changed files with 746 additions and 746 deletions

View File

@ -83,7 +83,7 @@
<attribute name="Built-Date" value="${time.stamp}" />
<attribute name="Implementation-URL" value="http://www.l2jmobius.com/" />
<attribute name="Class-Path" value="${manifest.libs}" />
<attribute name="Main-Class" value="com.l2jmobius.loginserver.L2LoginServer" />
<attribute name="Main-Class" value="com.l2jmobius.loginserver.LoginServer" />
</manifest>
</jar>
<jar destfile="${build.dist.game}/GameServer.jar" level="9">

View File

@ -79,7 +79,7 @@ public class LoginServerThread extends Thread
protected static final Logger LOGGER = Logger.getLogger(LoginServerThread.class.getName());
protected static final Logger ACCOUNTING_LOGGER = Logger.getLogger("accounting");
/** @see com.l2jmobius.loginserver.L2LoginServer#PROTOCOL_REV */
/** @see com.l2jmobius.loginserver.LoginServer#PROTOCOL_REV */
private static final int REVISION = 0x0106;
private final String _hostname;
private final int _port;

View File

@ -139,8 +139,8 @@ public class GameServerThread extends Thread
_gsi.setDown();
LOGGER.info("Server [" + getServerId() + "] " + GameServerTable.getInstance().getServerNameById(getServerId()) + " is now set as disconnected");
}
L2LoginServer.getInstance().getGameServerListener().removeGameServer(this);
L2LoginServer.getInstance().getGameServerListener().removeFloodProtection(_connectionIp);
LoginServer.getInstance().getGameServerListener().removeGameServer(this);
LoginServer.getInstance().getGameServerListener().removeFloodProtection(_connectionIp);
}
}

View File

@ -36,26 +36,26 @@ import com.l2jmobius.loginserver.network.ClientNetworkManager;
/**
* @author KenM
*/
public final class L2LoginServer
public final class LoginServer
{
private final Logger LOGGER = Logger.getLogger(L2LoginServer.class.getName());
private final Logger LOGGER = Logger.getLogger(LoginServer.class.getName());
public static final int PROTOCOL_REV = 0x0106;
private static L2LoginServer _instance;
private static LoginServer _instance;
private GameServerListener _gameServerListener;
private Thread _restartLoginServer;
public static void main(String[] args) throws Exception
{
new L2LoginServer();
new LoginServer();
}
public static L2LoginServer getInstance()
public static LoginServer getInstance()
{
return _instance;
}
private L2LoginServer() throws Exception
private LoginServer() throws Exception
{
_instance = this;
Server.serverMode = Server.MODE_LOGINSERVER;

View File

@ -17,7 +17,7 @@
package com.l2jmobius.loginserver.network.loginserverpackets;
import com.l2jmobius.commons.network.BaseSendablePacket;
import com.l2jmobius.loginserver.L2LoginServer;
import com.l2jmobius.loginserver.LoginServer;
/**
* @author -Wooden-
@ -33,7 +33,7 @@ public class InitLS extends BaseSendablePacket
public InitLS(byte[] publickey)
{
writeC(0x00);
writeD(L2LoginServer.PROTOCOL_REV);
writeD(LoginServer.PROTOCOL_REV);
writeD(publickey.length);
writeB(publickey);
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/L2LoginServer.java"/>
<listEntry value="/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/LoginServer.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
@ -13,7 +13,7 @@
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.debug.ui.INCLUDE_EXTERNAL_JARS" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.l2jmobius.loginserver.L2LoginServer"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.l2jmobius.loginserver.LoginServer"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="L2J_Mobius_1.0_Ertheia"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:L2J_Mobius_1.0_Ertheia}/dist/login/"/>
</launchConfiguration>

View File

@ -83,7 +83,7 @@
<attribute name="Built-Date" value="${time.stamp}" />
<attribute name="Implementation-URL" value="http://www.l2jmobius.com/" />
<attribute name="Class-Path" value="${manifest.libs}" />
<attribute name="Main-Class" value="com.l2jmobius.loginserver.L2LoginServer" />
<attribute name="Main-Class" value="com.l2jmobius.loginserver.LoginServer" />
</manifest>
</jar>
<jar destfile="${build.dist.game}/GameServer.jar" level="9">

View File

@ -79,7 +79,7 @@ public class LoginServerThread extends Thread
protected static final Logger LOGGER = Logger.getLogger(LoginServerThread.class.getName());
protected static final Logger ACCOUNTING_LOGGER = Logger.getLogger("accounting");
/** @see com.l2jmobius.loginserver.L2LoginServer#PROTOCOL_REV */
/** @see com.l2jmobius.loginserver.LoginServer#PROTOCOL_REV */
private static final int REVISION = 0x0106;
private final String _hostname;
private final int _port;

View File

@ -139,8 +139,8 @@ public class GameServerThread extends Thread
_gsi.setDown();
LOGGER.info("Server [" + getServerId() + "] " + GameServerTable.getInstance().getServerNameById(getServerId()) + " is now set as disconnected");
}
L2LoginServer.getInstance().getGameServerListener().removeGameServer(this);
L2LoginServer.getInstance().getGameServerListener().removeFloodProtection(_connectionIp);
LoginServer.getInstance().getGameServerListener().removeGameServer(this);
LoginServer.getInstance().getGameServerListener().removeFloodProtection(_connectionIp);
}
}

View File

@ -36,26 +36,26 @@ import com.l2jmobius.loginserver.network.ClientNetworkManager;
/**
* @author KenM
*/
public final class L2LoginServer
public final class LoginServer
{
private final Logger LOGGER = Logger.getLogger(L2LoginServer.class.getName());
private final Logger LOGGER = Logger.getLogger(LoginServer.class.getName());
public static final int PROTOCOL_REV = 0x0106;
private static L2LoginServer _instance;
private static LoginServer _instance;
private GameServerListener _gameServerListener;
private Thread _restartLoginServer;
public static void main(String[] args) throws Exception
{
new L2LoginServer();
new LoginServer();
}
public static L2LoginServer getInstance()
public static LoginServer getInstance()
{
return _instance;
}
private L2LoginServer() throws Exception
private LoginServer() throws Exception
{
_instance = this;
Server.serverMode = Server.MODE_LOGINSERVER;

View File

@ -17,7 +17,7 @@
package com.l2jmobius.loginserver.network.loginserverpackets;
import com.l2jmobius.commons.network.BaseSendablePacket;
import com.l2jmobius.loginserver.L2LoginServer;
import com.l2jmobius.loginserver.LoginServer;
/**
* @author -Wooden-
@ -33,7 +33,7 @@ public class InitLS extends BaseSendablePacket
public InitLS(byte[] publickey)
{
writeC(0x00);
writeD(L2LoginServer.PROTOCOL_REV);
writeD(LoginServer.PROTOCOL_REV);
writeD(publickey.length);
writeB(publickey);
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/L2LoginServer.java"/>
<listEntry value="/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/LoginServer.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
@ -13,7 +13,7 @@
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.debug.ui.INCLUDE_EXTERNAL_JARS" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.l2jmobius.loginserver.L2LoginServer"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.l2jmobius.loginserver.LoginServer"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="L2J_Mobius_2.5_Underground"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:L2J_Mobius_2.5_Underground}/dist/login/"/>
</launchConfiguration>

View File

@ -83,7 +83,7 @@
<attribute name="Built-Date" value="${time.stamp}" />
<attribute name="Implementation-URL" value="http://www.l2jmobius.com/" />
<attribute name="Class-Path" value="${manifest.libs}" />
<attribute name="Main-Class" value="com.l2jmobius.loginserver.L2LoginServer" />
<attribute name="Main-Class" value="com.l2jmobius.loginserver.LoginServer" />
</manifest>
</jar>
<jar destfile="${build.dist.game}/GameServer.jar" level="9">

View File

@ -80,7 +80,7 @@ public class LoginServerThread extends Thread
protected static final Logger ACCOUNTING_LOGGER = Logger.getLogger("accounting");
/**
* @see com.l2jmobius.loginserver.L2LoginServer#PROTOCOL_REV
* @see com.l2jmobius.loginserver.LoginServer#PROTOCOL_REV
*/
private static final int REVISION = 0x0106;
private final String _hostname;

View File

@ -139,8 +139,8 @@ public class GameServerThread extends Thread
_gsi.setDown();
LOGGER.info("Server [" + getServerId() + "] " + GameServerTable.getInstance().getServerNameById(getServerId()) + " is now set as disconnected");
}
L2LoginServer.getInstance().getGameServerListener().removeGameServer(this);
L2LoginServer.getInstance().getGameServerListener().removeFloodProtection(_connectionIp);
LoginServer.getInstance().getGameServerListener().removeGameServer(this);
LoginServer.getInstance().getGameServerListener().removeFloodProtection(_connectionIp);
}
}

View File

@ -36,26 +36,26 @@ import com.l2jmobius.loginserver.network.ClientNetworkManager;
/**
* @author KenM
*/
public final class L2LoginServer
public final class LoginServer
{
private final Logger LOGGER = Logger.getLogger(L2LoginServer.class.getName());
private final Logger LOGGER = Logger.getLogger(LoginServer.class.getName());
public static final int PROTOCOL_REV = 0x0106;
private static L2LoginServer _instance;
private static LoginServer _instance;
private GameServerListener _gameServerListener;
private Thread _restartLoginServer;
public static void main(String[] args) throws Exception
{
new L2LoginServer();
new LoginServer();
}
public static L2LoginServer getInstance()
public static LoginServer getInstance()
{
return _instance;
}
private L2LoginServer() throws Exception
private LoginServer() throws Exception
{
_instance = this;
Server.serverMode = Server.MODE_LOGINSERVER;

View File

@ -17,7 +17,7 @@
package com.l2jmobius.loginserver.network.loginserverpackets;
import com.l2jmobius.commons.network.BaseSendablePacket;
import com.l2jmobius.loginserver.L2LoginServer;
import com.l2jmobius.loginserver.LoginServer;
/**
* @author -Wooden-
@ -33,7 +33,7 @@ public class InitLS extends BaseSendablePacket
public InitLS(byte[] publickey)
{
writeC(0x00);
writeD(L2LoginServer.PROTOCOL_REV);
writeD(LoginServer.PROTOCOL_REV);
writeD(publickey.length);
writeB(publickey);
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/L2LoginServer.java"/>
<listEntry value="/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/LoginServer.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
@ -13,7 +13,7 @@
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.debug.ui.INCLUDE_EXTERNAL_JARS" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.l2jmobius.loginserver.L2LoginServer"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.l2jmobius.loginserver.LoginServer"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="L2J_Mobius_3.0_Helios"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:L2J_Mobius_3.0_Helios}/dist/login/"/>
</launchConfiguration>

View File

@ -83,7 +83,7 @@
<attribute name="Built-Date" value="${time.stamp}" />
<attribute name="Implementation-URL" value="http://www.l2jmobius.com/" />
<attribute name="Class-Path" value="${manifest.libs}" />
<attribute name="Main-Class" value="com.l2jmobius.loginserver.L2LoginServer" />
<attribute name="Main-Class" value="com.l2jmobius.loginserver.LoginServer" />
</manifest>
</jar>
<jar destfile="${build.dist.game}/GameServer.jar" level="9">

View File

@ -80,7 +80,7 @@ public class LoginServerThread extends Thread
protected static final Logger ACCOUNTING_LOGGER = Logger.getLogger("accounting");
/**
* @see com.l2jmobius.loginserver.L2LoginServer#PROTOCOL_REV
* @see com.l2jmobius.loginserver.LoginServer#PROTOCOL_REV
*/
private static final int REVISION = 0x0106;
private final String _hostname;

View File

@ -139,8 +139,8 @@ public class GameServerThread extends Thread
_gsi.setDown();
LOGGER.info("Server [" + getServerId() + "] " + GameServerTable.getInstance().getServerNameById(getServerId()) + " is now set as disconnected");
}
L2LoginServer.getInstance().getGameServerListener().removeGameServer(this);
L2LoginServer.getInstance().getGameServerListener().removeFloodProtection(_connectionIp);
LoginServer.getInstance().getGameServerListener().removeGameServer(this);
LoginServer.getInstance().getGameServerListener().removeFloodProtection(_connectionIp);
}
}

View File

@ -36,26 +36,26 @@ import com.l2jmobius.loginserver.network.ClientNetworkManager;
/**
* @author KenM
*/
public final class L2LoginServer
public final class LoginServer
{
private final Logger LOGGER = Logger.getLogger(L2LoginServer.class.getName());
private final Logger LOGGER = Logger.getLogger(LoginServer.class.getName());
public static final int PROTOCOL_REV = 0x0106;
private static L2LoginServer _instance;
private static LoginServer _instance;
private GameServerListener _gameServerListener;
private Thread _restartLoginServer;
public static void main(String[] args) throws Exception
{
new L2LoginServer();
new LoginServer();
}
public static L2LoginServer getInstance()
public static LoginServer getInstance()
{
return _instance;
}
private L2LoginServer() throws Exception
private LoginServer() throws Exception
{
_instance = this;
Server.serverMode = Server.MODE_LOGINSERVER;

View File

@ -17,7 +17,7 @@
package com.l2jmobius.loginserver.network.loginserverpackets;
import com.l2jmobius.commons.network.BaseSendablePacket;
import com.l2jmobius.loginserver.L2LoginServer;
import com.l2jmobius.loginserver.LoginServer;
/**
* @author -Wooden-
@ -33,7 +33,7 @@ public class InitLS extends BaseSendablePacket
public InitLS(byte[] publickey)
{
writeC(0x00);
writeD(L2LoginServer.PROTOCOL_REV);
writeD(LoginServer.PROTOCOL_REV);
writeD(publickey.length);
writeB(publickey);
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/loginserver/L2LoginServer.java"/>
<listEntry value="/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/loginserver/LoginServer.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
@ -13,7 +13,7 @@
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.debug.ui.INCLUDE_EXTERNAL_JARS" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.l2jmobius.loginserver.L2LoginServer"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.l2jmobius.loginserver.LoginServer"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="L2J_Mobius_4.0_GrandCrusade"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:L2J_Mobius_4.0_GrandCrusade}/dist/login/"/>
</launchConfiguration>

View File

@ -80,7 +80,7 @@
<attribute name="Built-Date" value="${time.stamp}" />
<attribute name="Implementation-URL" value="http://www.l2jmobius.com/" />
<attribute name="Class-Path" value="${manifest.libs}" />
<attribute name="Main-Class" value="com.l2jmobius.loginserver.L2LoginServer" />
<attribute name="Main-Class" value="com.l2jmobius.loginserver.LoginServer" />
</manifest>
</jar>
<jar destfile="${build.dist.game}/GameServer.jar" level="9">

View File

@ -3,7 +3,7 @@
err=1
until [ $err == 0 ];
do
java -Dfile.encoding=UTF-8 -Djava.util.logging.config.file=config/others/log.cfg -Xms128m -Xmx128m -cp lib/*:LoginServer.jar com.l2jmobius.loginserver.L2LoginServer > log/stdout.log 2>&1
java -Dfile.encoding=UTF-8 -Djava.util.logging.config.file=config/others/log.cfg -Xms128m -Xmx128m -cp lib/*:LoginServer.jar com.l2jmobius.loginserver.LoginServer > log/stdout.log 2>&1
err=$?
# /etc/init.d/mysql restart
sleep 10;

View File

@ -5,7 +5,7 @@ title L2J Mobius - Login Server Console
echo Starting Login Server.
echo.
java -version:1.8 -server -Dfile.encoding=UTF-8 -Djava.util.logging.config.file=config/others/log.cfg -Xms128m -Xmx256m -cp ./lib/*;LoginServer.jar com.l2jmobius.loginserver.L2LoginServer
java -version:1.8 -server -Dfile.encoding=UTF-8 -Djava.util.logging.config.file=config/others/log.cfg -Xms128m -Xmx256m -cp ./lib/*;LoginServer.jar com.l2jmobius.loginserver.LoginServer
if ERRORLEVEL 2 goto restart
if ERRORLEVEL 1 goto error

View File

@ -219,8 +219,8 @@ public class GameServerThread extends Thread
LOGGER.info("Server [" + getServerId() + "] " + GameServerTable.getInstance().getServerNameById(getServerId()) + " is now set as disconnected");
}
L2LoginServer.getInstance().getGameServerListener().removeGameServer(this);
L2LoginServer.getInstance().getGameServerListener().removeFloodProtection(_connectionIp);
LoginServer.getInstance().getGameServerListener().removeGameServer(this);
LoginServer.getInstance().getGameServerListener().removeFloodProtection(_connectionIp);
}
}

View File

@ -35,13 +35,13 @@ import com.l2jmobius.commons.mmocore.SelectorThread;
import com.l2jmobius.commons.util.Util;
import com.l2jmobius.status.Status;
public class L2LoginServer
public class LoginServer
{
private final Logger LOGGER = Logger.getLogger(L2LoginServer.class.getName());
private final Logger LOGGER = Logger.getLogger(LoginServer.class.getName());
public static final int PROTOCOL_REV = 0x0102;
private static L2LoginServer _instance;
private static LoginServer _instance;
private GameServerListener _gameServerListener;
private SelectorThread<L2LoginClient> _selectorThread;
@ -49,15 +49,15 @@ public class L2LoginServer
public static void main(String[] args)
{
_instance = new L2LoginServer();
_instance = new LoginServer();
}
public static L2LoginServer getInstance()
public static LoginServer getInstance()
{
return _instance;
}
public L2LoginServer()
public LoginServer()
{
_instance = this;
Server.serverMode = Server.MODE_LOGINSERVER;

View File

@ -16,7 +16,7 @@
*/
package com.l2jmobius.loginserver.network.loginserverpackets;
import com.l2jmobius.loginserver.L2LoginServer;
import com.l2jmobius.loginserver.LoginServer;
import com.l2jmobius.loginserver.network.serverpackets.ServerBasePacket;
/**
@ -33,7 +33,7 @@ public class InitLS extends ServerBasePacket
public InitLS(byte[] publickey)
{
writeC(0x00);
writeD(L2LoginServer.PROTOCOL_REV);
writeD(LoginServer.PROTOCOL_REV);
writeD(publickey.length);
writeB(publickey);
}

View File

@ -30,7 +30,7 @@ import java.util.logging.Logger;
import com.l2jmobius.Config;
import com.l2jmobius.loginserver.GameServerTable;
import com.l2jmobius.loginserver.L2LoginServer;
import com.l2jmobius.loginserver.LoginServer;
import com.l2jmobius.loginserver.LoginController;
public class LoginStatusThread extends Thread
@ -243,14 +243,14 @@ public class LoginStatusThread extends Thread
}
else if (_usrCommand.startsWith("shutdown"))
{
L2LoginServer.getInstance().shutdown(false);
LoginServer.getInstance().shutdown(false);
_print.println("Bye Bye!");
_print.flush();
_cSocket.close();
}
else if (_usrCommand.startsWith("restart"))
{
L2LoginServer.getInstance().shutdown(true);
LoginServer.getInstance().shutdown(true);
_print.println("Bye Bye!");
_print.flush();
_cSocket.close();

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/L2J_Mobius_C6_Interlude/java/com/l2jmobius/loginserver/L2LoginServer.java"/>
<listEntry value="/L2J_Mobius_C6_Interlude/java/com/l2jmobius/loginserver/LoginServer.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
@ -13,7 +13,7 @@
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.debug.ui.INCLUDE_EXTERNAL_JARS" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.l2jmobius.loginserver.L2LoginServer"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.l2jmobius.loginserver.LoginServer"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="L2J_Mobius_C6_Interlude"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:L2J_Mobius_C6_Interlude}/dist/login/"/>
</launchConfiguration>

View File

@ -83,7 +83,7 @@
<attribute name="Built-Date" value="${time.stamp}" />
<attribute name="Implementation-URL" value="http://www.l2jmobius.com/" />
<attribute name="Class-Path" value="${manifest.libs}" />
<attribute name="Main-Class" value="com.l2jmobius.loginserver.L2LoginServer" />
<attribute name="Main-Class" value="com.l2jmobius.loginserver.LoginServer" />
</manifest>
</jar>
<jar destfile="${build.dist.game}/GameServer.jar" level="9">

View File

@ -79,7 +79,7 @@ public class LoginServerThread extends Thread
protected static final Logger LOGGER = Logger.getLogger(LoginServerThread.class.getName());
protected static final Logger ACCOUNTING_LOGGER = Logger.getLogger("accounting");
/** @see com.l2jmobius.loginserver.L2LoginServer#PROTOCOL_REV */
/** @see com.l2jmobius.loginserver.LoginServer#PROTOCOL_REV */
private static final int REVISION = 0x0106;
private final String _hostname;
private final int _port;

View File

@ -139,8 +139,8 @@ public class GameServerThread extends Thread
_gsi.setDown();
LOGGER.info("Server [" + getServerId() + "] " + GameServerTable.getInstance().getServerNameById(getServerId()) + " is now set as disconnected");
}
L2LoginServer.getInstance().getGameServerListener().removeGameServer(this);
L2LoginServer.getInstance().getGameServerListener().removeFloodProtection(_connectionIp);
LoginServer.getInstance().getGameServerListener().removeGameServer(this);
LoginServer.getInstance().getGameServerListener().removeFloodProtection(_connectionIp);
}
}

View File

@ -1,216 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.loginserver;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.net.UnknownHostException;
import java.security.GeneralSecurityException;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;
import com.l2jmobius.Config;
import com.l2jmobius.Server;
import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.loginserver.network.ClientNetworkManager;
/**
* @author KenM
*/
public final class L2LoginServer
{
private final Logger LOGGER = Logger.getLogger(L2LoginServer.class.getName());
public static final int PROTOCOL_REV = 0x0106;
private static L2LoginServer _instance;
private GameServerListener _gameServerListener;
private Thread _restartLoginServer;
public static void main(String[] args) throws Exception
{
new L2LoginServer();
}
public static L2LoginServer getInstance()
{
return _instance;
}
private L2LoginServer() throws Exception
{
_instance = this;
Server.serverMode = Server.MODE_LOGINSERVER;
// Local Constants
final String LOG_FOLDER = "log"; // Name of folder for log file
final String LOG_NAME = "./log.cfg"; // Name of log file
/*** Main ***/
// Create log folder
final File logFolder = new File(".", LOG_FOLDER);
logFolder.mkdir();
// Create input stream for log file -- or store file data into memory
try (InputStream is = new FileInputStream(new File(LOG_NAME)))
{
LogManager.getLogManager().readConfiguration(is);
}
catch (IOException e)
{
LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage());
}
// Load Config
Config.load();
// Prepare Database
DatabaseFactory.getInstance();
try
{
LoginController.load();
}
catch (GeneralSecurityException e)
{
LOGGER.log(Level.SEVERE, "FATAL: Failed initializing LoginController. Reason: " + e.getMessage(), e);
System.exit(1);
}
GameServerTable.getInstance();
loadBanFile();
try
{
_gameServerListener = new GameServerListener();
_gameServerListener.start();
LOGGER.info("Listening for GameServers on " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT);
}
catch (IOException e)
{
LOGGER.log(Level.SEVERE, "FATAL: Failed to start the Game Server Listener. Reason: " + e.getMessage(), e);
System.exit(1);
}
ClientNetworkManager.getInstance().start();
}
public GameServerListener getGameServerListener()
{
return _gameServerListener;
}
private void loadBanFile()
{
final File bannedFile = new File("./banned_ip.cfg");
if (bannedFile.exists() && bannedFile.isFile())
{
try (FileInputStream fis = new FileInputStream(bannedFile);
InputStreamReader is = new InputStreamReader(fis);
LineNumberReader lnr = new LineNumberReader(is))
{
//@formatter:off
lnr.lines()
.map(String::trim)
.filter(l -> !l.isEmpty() && (l.charAt(0) != '#'))
.forEach(line -> {
String[] parts = line.split("#", 2); // address[ duration][ # comments]
line = parts[0];
parts = line.split("\\s+"); // durations might be aligned via multiple spaces
final String address = parts[0];
long duration = 0;
if (parts.length > 1)
{
try
{
duration = Long.parseLong(parts[1]);
}
catch (NumberFormatException nfe)
{
LOGGER.warning("Skipped: Incorrect ban duration (" + parts[1] + ") on (" + bannedFile.getName() + "). Line: " + lnr.getLineNumber());
return;
}
}
try
{
LoginController.getInstance().addBanForAddress(address, duration);
}
catch (UnknownHostException e)
{
LOGGER.warning("Skipped: Invalid address (" + address + ") on (" + bannedFile.getName() + "). Line: " + lnr.getLineNumber());
}
});
//@formatter:on
}
catch (IOException e)
{
LOGGER.log(Level.WARNING, "Error while reading the bans file (" + bannedFile.getName() + "). Details: " + e.getMessage(), e);
}
LOGGER.info("Loaded " + LoginController.getInstance().getBannedIps().size() + " IP Bans.");
}
else
{
LOGGER.warning("IP Bans file (" + bannedFile.getName() + ") is missing or is a directory, skipped.");
}
if (Config.LOGIN_SERVER_SCHEDULE_RESTART)
{
LOGGER.info("Scheduled LS restart after " + Config.LOGIN_SERVER_SCHEDULE_RESTART_TIME + " hours");
_restartLoginServer = new LoginServerRestart();
_restartLoginServer.setDaemon(true);
_restartLoginServer.start();
}
}
class LoginServerRestart extends Thread
{
public LoginServerRestart()
{
setName("LoginServerRestart");
}
@Override
public void run()
{
while (!isInterrupted())
{
try
{
Thread.sleep(Config.LOGIN_SERVER_SCHEDULE_RESTART_TIME * 3600000);
}
catch (InterruptedException e)
{
return;
}
shutdown(true);
}
}
}
public void shutdown(boolean restart)
{
Runtime.getRuntime().exit(restart ? 2 : 0);
}
}

View File

@ -0,0 +1,216 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.loginserver;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.net.UnknownHostException;
import java.security.GeneralSecurityException;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;
import com.l2jmobius.Config;
import com.l2jmobius.Server;
import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.loginserver.network.ClientNetworkManager;
/**
* @author KenM
*/
public final class LoginServer
{
private final Logger LOGGER = Logger.getLogger(LoginServer.class.getName());
public static final int PROTOCOL_REV = 0x0106;
private static LoginServer _instance;
private GameServerListener _gameServerListener;
private Thread _restartLoginServer;
public static void main(String[] args) throws Exception
{
new LoginServer();
}
public static LoginServer getInstance()
{
return _instance;
}
private LoginServer() throws Exception
{
_instance = this;
Server.serverMode = Server.MODE_LOGINSERVER;
// Local Constants
final String LOG_FOLDER = "log"; // Name of folder for log file
final String LOG_NAME = "./log.cfg"; // Name of log file
/*** Main ***/
// Create log folder
final File logFolder = new File(".", LOG_FOLDER);
logFolder.mkdir();
// Create input stream for log file -- or store file data into memory
try (InputStream is = new FileInputStream(new File(LOG_NAME)))
{
LogManager.getLogManager().readConfiguration(is);
}
catch (IOException e)
{
LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage());
}
// Load Config
Config.load();
// Prepare Database
DatabaseFactory.getInstance();
try
{
LoginController.load();
}
catch (GeneralSecurityException e)
{
LOGGER.log(Level.SEVERE, "FATAL: Failed initializing LoginController. Reason: " + e.getMessage(), e);
System.exit(1);
}
GameServerTable.getInstance();
loadBanFile();
try
{
_gameServerListener = new GameServerListener();
_gameServerListener.start();
LOGGER.info("Listening for GameServers on " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT);
}
catch (IOException e)
{
LOGGER.log(Level.SEVERE, "FATAL: Failed to start the Game Server Listener. Reason: " + e.getMessage(), e);
System.exit(1);
}
ClientNetworkManager.getInstance().start();
}
public GameServerListener getGameServerListener()
{
return _gameServerListener;
}
private void loadBanFile()
{
final File bannedFile = new File("./banned_ip.cfg");
if (bannedFile.exists() && bannedFile.isFile())
{
try (FileInputStream fis = new FileInputStream(bannedFile);
InputStreamReader is = new InputStreamReader(fis);
LineNumberReader lnr = new LineNumberReader(is))
{
//@formatter:off
lnr.lines()
.map(String::trim)
.filter(l -> !l.isEmpty() && (l.charAt(0) != '#'))
.forEach(line -> {
String[] parts = line.split("#", 2); // address[ duration][ # comments]
line = parts[0];
parts = line.split("\\s+"); // durations might be aligned via multiple spaces
final String address = parts[0];
long duration = 0;
if (parts.length > 1)
{
try
{
duration = Long.parseLong(parts[1]);
}
catch (NumberFormatException nfe)
{
LOGGER.warning("Skipped: Incorrect ban duration (" + parts[1] + ") on (" + bannedFile.getName() + "). Line: " + lnr.getLineNumber());
return;
}
}
try
{
LoginController.getInstance().addBanForAddress(address, duration);
}
catch (UnknownHostException e)
{
LOGGER.warning("Skipped: Invalid address (" + address + ") on (" + bannedFile.getName() + "). Line: " + lnr.getLineNumber());
}
});
//@formatter:on
}
catch (IOException e)
{
LOGGER.log(Level.WARNING, "Error while reading the bans file (" + bannedFile.getName() + "). Details: " + e.getMessage(), e);
}
LOGGER.info("Loaded " + LoginController.getInstance().getBannedIps().size() + " IP Bans.");
}
else
{
LOGGER.warning("IP Bans file (" + bannedFile.getName() + ") is missing or is a directory, skipped.");
}
if (Config.LOGIN_SERVER_SCHEDULE_RESTART)
{
LOGGER.info("Scheduled LS restart after " + Config.LOGIN_SERVER_SCHEDULE_RESTART_TIME + " hours");
_restartLoginServer = new LoginServerRestart();
_restartLoginServer.setDaemon(true);
_restartLoginServer.start();
}
}
class LoginServerRestart extends Thread
{
public LoginServerRestart()
{
setName("LoginServerRestart");
}
@Override
public void run()
{
while (!isInterrupted())
{
try
{
Thread.sleep(Config.LOGIN_SERVER_SCHEDULE_RESTART_TIME * 3600000);
}
catch (InterruptedException e)
{
return;
}
shutdown(true);
}
}
}
public void shutdown(boolean restart)
{
Runtime.getRuntime().exit(restart ? 2 : 0);
}
}

View File

@ -17,7 +17,7 @@
package com.l2jmobius.loginserver.network.loginserverpackets;
import com.l2jmobius.commons.network.BaseSendablePacket;
import com.l2jmobius.loginserver.L2LoginServer;
import com.l2jmobius.loginserver.LoginServer;
/**
* @author -Wooden-
@ -33,7 +33,7 @@ public class InitLS extends BaseSendablePacket
public InitLS(byte[] publickey)
{
writeC(0x00);
writeD(L2LoginServer.PROTOCOL_REV);
writeD(LoginServer.PROTOCOL_REV);
writeD(publickey.length);
writeB(publickey);
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/L2LoginServer.java"/>
<listEntry value="/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/LoginServer.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
@ -13,7 +13,7 @@
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.debug.ui.INCLUDE_EXTERNAL_JARS" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.l2jmobius.loginserver.L2LoginServer"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.l2jmobius.loginserver.LoginServer"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="L2J_Mobius_CT_2.6_HighFive"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:L2J_Mobius_CT_2.6_HighFive}/dist/login/"/>
</launchConfiguration>

View File

@ -83,7 +83,7 @@
<attribute name="Built-Date" value="${time.stamp}" />
<attribute name="Implementation-URL" value="http://www.l2jmobius.com/" />
<attribute name="Class-Path" value="${manifest.libs}" />
<attribute name="Main-Class" value="com.l2jmobius.loginserver.L2LoginServer" />
<attribute name="Main-Class" value="com.l2jmobius.loginserver.LoginServer" />
</manifest>
</jar>
<jar destfile="${build.dist.game}/GameServer.jar" level="9">

View File

@ -80,7 +80,7 @@ public class LoginServerThread extends Thread
protected static final Logger ACCOUNTING_LOGGER = Logger.getLogger("accounting");
/**
* @see com.l2jmobius.loginserver.L2LoginServer#PROTOCOL_REV
* @see com.l2jmobius.loginserver.LoginServer#PROTOCOL_REV
*/
private static final int REVISION = 0x0106;
private final String _hostname;

View File

@ -139,8 +139,8 @@ public class GameServerThread extends Thread
_gsi.setDown();
LOGGER.info("Server [" + getServerId() + "] " + GameServerTable.getInstance().getServerNameById(getServerId()) + " is now set as disconnected");
}
L2LoginServer.getInstance().getGameServerListener().removeGameServer(this);
L2LoginServer.getInstance().getGameServerListener().removeFloodProtection(_connectionIp);
LoginServer.getInstance().getGameServerListener().removeGameServer(this);
LoginServer.getInstance().getGameServerListener().removeFloodProtection(_connectionIp);
}
}

View File

@ -1,216 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.loginserver;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.net.UnknownHostException;
import java.security.GeneralSecurityException;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;
import com.l2jmobius.Config;
import com.l2jmobius.Server;
import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.loginserver.network.ClientNetworkManager;
/**
* @author KenM
*/
public final class L2LoginServer
{
private final Logger LOGGER = Logger.getLogger(L2LoginServer.class.getName());
public static final int PROTOCOL_REV = 0x0106;
private static L2LoginServer _instance;
private GameServerListener _gameServerListener;
private Thread _restartLoginServer;
public static void main(String[] args) throws Exception
{
new L2LoginServer();
}
public static L2LoginServer getInstance()
{
return _instance;
}
private L2LoginServer() throws Exception
{
_instance = this;
Server.serverMode = Server.MODE_LOGINSERVER;
// Local Constants
final String LOG_FOLDER = "log"; // Name of folder for log file
final String LOG_NAME = "./log.cfg"; // Name of log file
/*** Main ***/
// Create log folder
final File logFolder = new File(".", LOG_FOLDER);
logFolder.mkdir();
// Create input stream for log file -- or store file data into memory
try (InputStream is = new FileInputStream(new File(LOG_NAME)))
{
LogManager.getLogManager().readConfiguration(is);
}
catch (IOException e)
{
LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage());
}
// Load Config
Config.load();
// Prepare Database
DatabaseFactory.getInstance();
try
{
LoginController.load();
}
catch (GeneralSecurityException e)
{
LOGGER.log(Level.SEVERE, "FATAL: Failed initializing LoginController. Reason: " + e.getMessage(), e);
System.exit(1);
}
GameServerTable.getInstance();
loadBanFile();
try
{
_gameServerListener = new GameServerListener();
_gameServerListener.start();
LOGGER.info("Listening for GameServers on " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT);
}
catch (IOException e)
{
LOGGER.log(Level.SEVERE, "FATAL: Failed to start the Game Server Listener. Reason: " + e.getMessage(), e);
System.exit(1);
}
ClientNetworkManager.getInstance().start();
}
public GameServerListener getGameServerListener()
{
return _gameServerListener;
}
private void loadBanFile()
{
final File bannedFile = new File("./banned_ip.cfg");
if (bannedFile.exists() && bannedFile.isFile())
{
try (FileInputStream fis = new FileInputStream(bannedFile);
InputStreamReader is = new InputStreamReader(fis);
LineNumberReader lnr = new LineNumberReader(is))
{
//@formatter:off
lnr.lines()
.map(String::trim)
.filter(l -> !l.isEmpty() && (l.charAt(0) != '#'))
.forEach(line -> {
String[] parts = line.split("#", 2); // address[ duration][ # comments]
line = parts[0];
parts = line.split("\\s+"); // durations might be aligned via multiple spaces
final String address = parts[0];
long duration = 0;
if (parts.length > 1)
{
try
{
duration = Long.parseLong(parts[1]);
}
catch (NumberFormatException nfe)
{
LOGGER.warning("Skipped: Incorrect ban duration (" + parts[1] + ") on (" + bannedFile.getName() + "). Line: " + lnr.getLineNumber());
return;
}
}
try
{
LoginController.getInstance().addBanForAddress(address, duration);
}
catch (UnknownHostException e)
{
LOGGER.warning("Skipped: Invalid address (" + address + ") on (" + bannedFile.getName() + "). Line: " + lnr.getLineNumber());
}
});
//@formatter:on
}
catch (IOException e)
{
LOGGER.log(Level.WARNING, "Error while reading the bans file (" + bannedFile.getName() + "). Details: " + e.getMessage(), e);
}
LOGGER.info("Loaded " + LoginController.getInstance().getBannedIps().size() + " IP Bans.");
}
else
{
LOGGER.warning("IP Bans file (" + bannedFile.getName() + ") is missing or is a directory, skipped.");
}
if (Config.LOGIN_SERVER_SCHEDULE_RESTART)
{
LOGGER.info("Scheduled LS restart after " + Config.LOGIN_SERVER_SCHEDULE_RESTART_TIME + " hours");
_restartLoginServer = new LoginServerRestart();
_restartLoginServer.setDaemon(true);
_restartLoginServer.start();
}
}
class LoginServerRestart extends Thread
{
public LoginServerRestart()
{
setName("LoginServerRestart");
}
@Override
public void run()
{
while (!isInterrupted())
{
try
{
Thread.sleep(Config.LOGIN_SERVER_SCHEDULE_RESTART_TIME * 3600000);
}
catch (InterruptedException e)
{
return;
}
shutdown(true);
}
}
}
public void shutdown(boolean restart)
{
Runtime.getRuntime().exit(restart ? 2 : 0);
}
}

View File

@ -0,0 +1,216 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.loginserver;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.net.UnknownHostException;
import java.security.GeneralSecurityException;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;
import com.l2jmobius.Config;
import com.l2jmobius.Server;
import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.loginserver.network.ClientNetworkManager;
/**
* @author KenM
*/
public final class LoginServer
{
private final Logger LOGGER = Logger.getLogger(LoginServer.class.getName());
public static final int PROTOCOL_REV = 0x0106;
private static LoginServer _instance;
private GameServerListener _gameServerListener;
private Thread _restartLoginServer;
public static void main(String[] args) throws Exception
{
new LoginServer();
}
public static LoginServer getInstance()
{
return _instance;
}
private LoginServer() throws Exception
{
_instance = this;
Server.serverMode = Server.MODE_LOGINSERVER;
// Local Constants
final String LOG_FOLDER = "log"; // Name of folder for log file
final String LOG_NAME = "./log.cfg"; // Name of log file
/*** Main ***/
// Create log folder
final File logFolder = new File(".", LOG_FOLDER);
logFolder.mkdir();
// Create input stream for log file -- or store file data into memory
try (InputStream is = new FileInputStream(new File(LOG_NAME)))
{
LogManager.getLogManager().readConfiguration(is);
}
catch (IOException e)
{
LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage());
}
// Load Config
Config.load();
// Prepare Database
DatabaseFactory.getInstance();
try
{
LoginController.load();
}
catch (GeneralSecurityException e)
{
LOGGER.log(Level.SEVERE, "FATAL: Failed initializing LoginController. Reason: " + e.getMessage(), e);
System.exit(1);
}
GameServerTable.getInstance();
loadBanFile();
try
{
_gameServerListener = new GameServerListener();
_gameServerListener.start();
LOGGER.info("Listening for GameServers on " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT);
}
catch (IOException e)
{
LOGGER.log(Level.SEVERE, "FATAL: Failed to start the Game Server Listener. Reason: " + e.getMessage(), e);
System.exit(1);
}
ClientNetworkManager.getInstance().start();
}
public GameServerListener getGameServerListener()
{
return _gameServerListener;
}
private void loadBanFile()
{
final File bannedFile = new File("./banned_ip.cfg");
if (bannedFile.exists() && bannedFile.isFile())
{
try (FileInputStream fis = new FileInputStream(bannedFile);
InputStreamReader is = new InputStreamReader(fis);
LineNumberReader lnr = new LineNumberReader(is))
{
//@formatter:off
lnr.lines()
.map(String::trim)
.filter(l -> !l.isEmpty() && (l.charAt(0) != '#'))
.forEach(line -> {
String[] parts = line.split("#", 2); // address[ duration][ # comments]
line = parts[0];
parts = line.split("\\s+"); // durations might be aligned via multiple spaces
final String address = parts[0];
long duration = 0;
if (parts.length > 1)
{
try
{
duration = Long.parseLong(parts[1]);
}
catch (NumberFormatException nfe)
{
LOGGER.warning("Skipped: Incorrect ban duration (" + parts[1] + ") on (" + bannedFile.getName() + "). Line: " + lnr.getLineNumber());
return;
}
}
try
{
LoginController.getInstance().addBanForAddress(address, duration);
}
catch (UnknownHostException e)
{
LOGGER.warning("Skipped: Invalid address (" + address + ") on (" + bannedFile.getName() + "). Line: " + lnr.getLineNumber());
}
});
//@formatter:on
}
catch (IOException e)
{
LOGGER.log(Level.WARNING, "Error while reading the bans file (" + bannedFile.getName() + "). Details: " + e.getMessage(), e);
}
LOGGER.info("Loaded " + LoginController.getInstance().getBannedIps().size() + " IP Bans.");
}
else
{
LOGGER.warning("IP Bans file (" + bannedFile.getName() + ") is missing or is a directory, skipped.");
}
if (Config.LOGIN_SERVER_SCHEDULE_RESTART)
{
LOGGER.info("Scheduled LS restart after " + Config.LOGIN_SERVER_SCHEDULE_RESTART_TIME + " hours");
_restartLoginServer = new LoginServerRestart();
_restartLoginServer.setDaemon(true);
_restartLoginServer.start();
}
}
class LoginServerRestart extends Thread
{
public LoginServerRestart()
{
setName("LoginServerRestart");
}
@Override
public void run()
{
while (!isInterrupted())
{
try
{
Thread.sleep(Config.LOGIN_SERVER_SCHEDULE_RESTART_TIME * 3600000);
}
catch (InterruptedException e)
{
return;
}
shutdown(true);
}
}
}
public void shutdown(boolean restart)
{
Runtime.getRuntime().exit(restart ? 2 : 0);
}
}

View File

@ -17,7 +17,7 @@
package com.l2jmobius.loginserver.network.loginserverpackets;
import com.l2jmobius.commons.network.BaseSendablePacket;
import com.l2jmobius.loginserver.L2LoginServer;
import com.l2jmobius.loginserver.LoginServer;
/**
* @author -Wooden-
@ -33,7 +33,7 @@ public class InitLS extends BaseSendablePacket
public InitLS(byte[] publickey)
{
writeC(0x00);
writeD(L2LoginServer.PROTOCOL_REV);
writeD(LoginServer.PROTOCOL_REV);
writeD(publickey.length);
writeB(publickey);
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/L2LoginServer.java"/>
<listEntry value="/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/LoginServer.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
@ -13,7 +13,7 @@
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.debug.ui.INCLUDE_EXTERNAL_JARS" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.l2jmobius.loginserver.L2LoginServer"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.l2jmobius.loginserver.LoginServer"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="L2J_Mobius_Classic_2.0_Saviors"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:L2J_Mobius_Classic_2.0_Saviors}/dist/login/"/>
</launchConfiguration>

View File

@ -83,7 +83,7 @@
<attribute name="Built-Date" value="${time.stamp}" />
<attribute name="Implementation-URL" value="http://www.l2jmobius.com/" />
<attribute name="Class-Path" value="${manifest.libs}" />
<attribute name="Main-Class" value="com.l2jmobius.loginserver.L2LoginServer" />
<attribute name="Main-Class" value="com.l2jmobius.loginserver.LoginServer" />
</manifest>
</jar>
<jar destfile="${build.dist.game}/GameServer.jar" level="9">

View File

@ -80,7 +80,7 @@ public class LoginServerThread extends Thread
protected static final Logger ACCOUNTING_LOGGER = Logger.getLogger("accounting");
/**
* @see com.l2jmobius.loginserver.L2LoginServer#PROTOCOL_REV
* @see com.l2jmobius.loginserver.LoginServer#PROTOCOL_REV
*/
private static final int REVISION = 0x0106;
private final String _hostname;

View File

@ -139,8 +139,8 @@ public class GameServerThread extends Thread
_gsi.setDown();
LOGGER.info("Server [" + getServerId() + "] " + GameServerTable.getInstance().getServerNameById(getServerId()) + " is now set as disconnected");
}
L2LoginServer.getInstance().getGameServerListener().removeGameServer(this);
L2LoginServer.getInstance().getGameServerListener().removeFloodProtection(_connectionIp);
LoginServer.getInstance().getGameServerListener().removeGameServer(this);
LoginServer.getInstance().getGameServerListener().removeFloodProtection(_connectionIp);
}
}

View File

@ -1,216 +0,0 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.loginserver;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.net.UnknownHostException;
import java.security.GeneralSecurityException;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;
import com.l2jmobius.Config;
import com.l2jmobius.Server;
import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.loginserver.network.ClientNetworkManager;
/**
* @author KenM
*/
public final class L2LoginServer
{
private final Logger LOGGER = Logger.getLogger(L2LoginServer.class.getName());
public static final int PROTOCOL_REV = 0x0106;
private static L2LoginServer _instance;
private GameServerListener _gameServerListener;
private Thread _restartLoginServer;
public static void main(String[] args) throws Exception
{
new L2LoginServer();
}
public static L2LoginServer getInstance()
{
return _instance;
}
private L2LoginServer() throws Exception
{
_instance = this;
Server.serverMode = Server.MODE_LOGINSERVER;
// Local Constants
final String LOG_FOLDER = "log"; // Name of folder for log file
final String LOG_NAME = "./log.cfg"; // Name of log file
/*** Main ***/
// Create log folder
final File logFolder = new File(".", LOG_FOLDER);
logFolder.mkdir();
// Create input stream for log file -- or store file data into memory
try (InputStream is = new FileInputStream(new File(LOG_NAME)))
{
LogManager.getLogManager().readConfiguration(is);
}
catch (IOException e)
{
LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage());
}
// Load Config
Config.load();
// Prepare Database
DatabaseFactory.getInstance();
try
{
LoginController.load();
}
catch (GeneralSecurityException e)
{
LOGGER.log(Level.SEVERE, "FATAL: Failed initializing LoginController. Reason: " + e.getMessage(), e);
System.exit(1);
}
GameServerTable.getInstance();
loadBanFile();
try
{
_gameServerListener = new GameServerListener();
_gameServerListener.start();
LOGGER.info("Listening for GameServers on " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT);
}
catch (IOException e)
{
LOGGER.log(Level.SEVERE, "FATAL: Failed to start the Game Server Listener. Reason: " + e.getMessage(), e);
System.exit(1);
}
ClientNetworkManager.getInstance().start();
}
public GameServerListener getGameServerListener()
{
return _gameServerListener;
}
private void loadBanFile()
{
final File bannedFile = new File("./banned_ip.cfg");
if (bannedFile.exists() && bannedFile.isFile())
{
try (FileInputStream fis = new FileInputStream(bannedFile);
InputStreamReader is = new InputStreamReader(fis);
LineNumberReader lnr = new LineNumberReader(is))
{
//@formatter:off
lnr.lines()
.map(String::trim)
.filter(l -> !l.isEmpty() && (l.charAt(0) != '#'))
.forEach(line -> {
String[] parts = line.split("#", 2); // address[ duration][ # comments]
line = parts[0];
parts = line.split("\\s+"); // durations might be aligned via multiple spaces
final String address = parts[0];
long duration = 0;
if (parts.length > 1)
{
try
{
duration = Long.parseLong(parts[1]);
}
catch (NumberFormatException nfe)
{
LOGGER.warning("Skipped: Incorrect ban duration (" + parts[1] + ") on (" + bannedFile.getName() + "). Line: " + lnr.getLineNumber());
return;
}
}
try
{
LoginController.getInstance().addBanForAddress(address, duration);
}
catch (UnknownHostException e)
{
LOGGER.warning("Skipped: Invalid address (" + address + ") on (" + bannedFile.getName() + "). Line: " + lnr.getLineNumber());
}
});
//@formatter:on
}
catch (IOException e)
{
LOGGER.log(Level.WARNING, "Error while reading the bans file (" + bannedFile.getName() + "). Details: " + e.getMessage(), e);
}
LOGGER.info("Loaded " + LoginController.getInstance().getBannedIps().size() + " IP Bans.");
}
else
{
LOGGER.warning("IP Bans file (" + bannedFile.getName() + ") is missing or is a directory, skipped.");
}
if (Config.LOGIN_SERVER_SCHEDULE_RESTART)
{
LOGGER.info("Scheduled LS restart after " + Config.LOGIN_SERVER_SCHEDULE_RESTART_TIME + " hours");
_restartLoginServer = new LoginServerRestart();
_restartLoginServer.setDaemon(true);
_restartLoginServer.start();
}
}
class LoginServerRestart extends Thread
{
public LoginServerRestart()
{
setName("LoginServerRestart");
}
@Override
public void run()
{
while (!isInterrupted())
{
try
{
Thread.sleep(Config.LOGIN_SERVER_SCHEDULE_RESTART_TIME * 3600000);
}
catch (InterruptedException e)
{
return;
}
shutdown(true);
}
}
}
public void shutdown(boolean restart)
{
Runtime.getRuntime().exit(restart ? 2 : 0);
}
}

View File

@ -0,0 +1,216 @@
/*
* This file is part of the L2J Mobius project.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package com.l2jmobius.loginserver;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.LineNumberReader;
import java.net.UnknownHostException;
import java.security.GeneralSecurityException;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;
import com.l2jmobius.Config;
import com.l2jmobius.Server;
import com.l2jmobius.commons.database.DatabaseFactory;
import com.l2jmobius.loginserver.network.ClientNetworkManager;
/**
* @author KenM
*/
public final class LoginServer
{
private final Logger LOGGER = Logger.getLogger(LoginServer.class.getName());
public static final int PROTOCOL_REV = 0x0106;
private static LoginServer _instance;
private GameServerListener _gameServerListener;
private Thread _restartLoginServer;
public static void main(String[] args) throws Exception
{
new LoginServer();
}
public static LoginServer getInstance()
{
return _instance;
}
private LoginServer() throws Exception
{
_instance = this;
Server.serverMode = Server.MODE_LOGINSERVER;
// Local Constants
final String LOG_FOLDER = "log"; // Name of folder for log file
final String LOG_NAME = "./log.cfg"; // Name of log file
/*** Main ***/
// Create log folder
final File logFolder = new File(".", LOG_FOLDER);
logFolder.mkdir();
// Create input stream for log file -- or store file data into memory
try (InputStream is = new FileInputStream(new File(LOG_NAME)))
{
LogManager.getLogManager().readConfiguration(is);
}
catch (IOException e)
{
LOGGER.warning(getClass().getSimpleName() + ": " + e.getMessage());
}
// Load Config
Config.load();
// Prepare Database
DatabaseFactory.getInstance();
try
{
LoginController.load();
}
catch (GeneralSecurityException e)
{
LOGGER.log(Level.SEVERE, "FATAL: Failed initializing LoginController. Reason: " + e.getMessage(), e);
System.exit(1);
}
GameServerTable.getInstance();
loadBanFile();
try
{
_gameServerListener = new GameServerListener();
_gameServerListener.start();
LOGGER.info("Listening for GameServers on " + Config.GAME_SERVER_LOGIN_HOST + ":" + Config.GAME_SERVER_LOGIN_PORT);
}
catch (IOException e)
{
LOGGER.log(Level.SEVERE, "FATAL: Failed to start the Game Server Listener. Reason: " + e.getMessage(), e);
System.exit(1);
}
ClientNetworkManager.getInstance().start();
}
public GameServerListener getGameServerListener()
{
return _gameServerListener;
}
private void loadBanFile()
{
final File bannedFile = new File("./banned_ip.cfg");
if (bannedFile.exists() && bannedFile.isFile())
{
try (FileInputStream fis = new FileInputStream(bannedFile);
InputStreamReader is = new InputStreamReader(fis);
LineNumberReader lnr = new LineNumberReader(is))
{
//@formatter:off
lnr.lines()
.map(String::trim)
.filter(l -> !l.isEmpty() && (l.charAt(0) != '#'))
.forEach(line -> {
String[] parts = line.split("#", 2); // address[ duration][ # comments]
line = parts[0];
parts = line.split("\\s+"); // durations might be aligned via multiple spaces
final String address = parts[0];
long duration = 0;
if (parts.length > 1)
{
try
{
duration = Long.parseLong(parts[1]);
}
catch (NumberFormatException nfe)
{
LOGGER.warning("Skipped: Incorrect ban duration (" + parts[1] + ") on (" + bannedFile.getName() + "). Line: " + lnr.getLineNumber());
return;
}
}
try
{
LoginController.getInstance().addBanForAddress(address, duration);
}
catch (UnknownHostException e)
{
LOGGER.warning("Skipped: Invalid address (" + address + ") on (" + bannedFile.getName() + "). Line: " + lnr.getLineNumber());
}
});
//@formatter:on
}
catch (IOException e)
{
LOGGER.log(Level.WARNING, "Error while reading the bans file (" + bannedFile.getName() + "). Details: " + e.getMessage(), e);
}
LOGGER.info("Loaded " + LoginController.getInstance().getBannedIps().size() + " IP Bans.");
}
else
{
LOGGER.warning("IP Bans file (" + bannedFile.getName() + ") is missing or is a directory, skipped.");
}
if (Config.LOGIN_SERVER_SCHEDULE_RESTART)
{
LOGGER.info("Scheduled LS restart after " + Config.LOGIN_SERVER_SCHEDULE_RESTART_TIME + " hours");
_restartLoginServer = new LoginServerRestart();
_restartLoginServer.setDaemon(true);
_restartLoginServer.start();
}
}
class LoginServerRestart extends Thread
{
public LoginServerRestart()
{
setName("LoginServerRestart");
}
@Override
public void run()
{
while (!isInterrupted())
{
try
{
Thread.sleep(Config.LOGIN_SERVER_SCHEDULE_RESTART_TIME * 3600000);
}
catch (InterruptedException e)
{
return;
}
shutdown(true);
}
}
}
public void shutdown(boolean restart)
{
Runtime.getRuntime().exit(restart ? 2 : 0);
}
}

View File

@ -17,7 +17,7 @@
package com.l2jmobius.loginserver.network.loginserverpackets;
import com.l2jmobius.commons.network.BaseSendablePacket;
import com.l2jmobius.loginserver.L2LoginServer;
import com.l2jmobius.loginserver.LoginServer;
/**
* @author -Wooden-
@ -33,7 +33,7 @@ public class InitLS extends BaseSendablePacket
public InitLS(byte[] publickey)
{
writeC(0x00);
writeD(L2LoginServer.PROTOCOL_REV);
writeD(LoginServer.PROTOCOL_REV);
writeD(publickey.length);
writeB(publickey);
}

View File

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
<listEntry value="/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/loginserver/L2LoginServer.java"/>
<listEntry value="/L2J_Mobius_Classic_2.0_Zaken/java/com/l2jmobius/loginserver/LoginServer.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
@ -13,7 +13,7 @@
</listAttribute>
<booleanAttribute key="org.eclipse.jdt.debug.ui.INCLUDE_EXTERNAL_JARS" value="true"/>
<booleanAttribute key="org.eclipse.jdt.launching.ATTR_USE_START_ON_FIRST_THREAD" value="true"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.l2jmobius.loginserver.L2LoginServer"/>
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="com.l2jmobius.loginserver.LoginServer"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="L2J_Mobius_Classic_2.0_Zaken"/>
<stringAttribute key="org.eclipse.jdt.launching.WORKING_DIRECTORY" value="${workspace_loc:L2J_Mobius_Classic_2.0_Zaken}/dist/login/"/>
</launchConfiguration>