Sync with L2jServer HighFive Jul 25th 2015.

This commit is contained in:
MobiusDev
2015-07-26 10:59:25 +00:00
parent 83854bc5e5
commit 1fc14085f5
161 changed files with 2288 additions and 2181 deletions

View File

@@ -35,7 +35,7 @@ import java.util.Map;
import org.w3c.dom.Document;
import org.w3c.dom.NodeList;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
import com.l2jserver.loginserver.network.gameserverpackets.ServerStatus;
import com.l2jserver.util.IPSubnet;
import com.l2jserver.util.Rnd;
@@ -113,7 +113,7 @@ public final class GameServerTable implements IXmlReader
*/
private void loadRegisteredGameServers()
{
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
try (Connection con = ConnectionFactory.getInstance().getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT * FROM gameservers"))
{
@@ -220,7 +220,7 @@ public final class GameServerTable implements IXmlReader
public void registerServerOnDB(byte[] hexId, int id, String externalHost)
{
register(id, new GameServerInfo(id, hexId));
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
try (Connection con = ConnectionFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO gameservers (hexid,server_id,host) values (?,?,?)"))
{
ps.setString(1, hexToString(hexId));

View File

@@ -27,7 +27,6 @@ import java.io.LineNumberReader;
import java.net.InetAddress;
import java.net.UnknownHostException;
import java.security.GeneralSecurityException;
import java.sql.SQLException;
import java.util.logging.Level;
import java.util.logging.LogManager;
import java.util.logging.Logger;
@@ -36,8 +35,8 @@ import commons.mmocore.SelectorConfig;
import commons.mmocore.SelectorThread;
import com.l2jserver.Config;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.Server;
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
import com.l2jserver.loginserver.network.L2LoginClient;
import com.l2jserver.loginserver.network.L2LoginPacketHandler;
import com.l2jserver.status.Status;
@@ -94,15 +93,7 @@ public final class L2LoginServer
Config.load();
// Prepare Database
try
{
L2DatabaseFactory.getInstance();
}
catch (SQLException e)
{
_log.log(Level.SEVERE, "FATAL: Failed initializing database. Reason: " + e.getMessage(), e);
System.exit(1);
}
ConnectionFactory.getInstance();
try
{

View File

@@ -42,7 +42,7 @@ import java.util.logging.Logger;
import javax.crypto.Cipher;
import com.l2jserver.Config;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
import com.l2jserver.loginserver.GameServerTable.GameServerInfo;
import com.l2jserver.loginserver.model.data.AccountInfo;
import com.l2jserver.loginserver.network.L2LoginClient;
@@ -218,7 +218,7 @@ public class LoginController
byte[] raw = password.getBytes(StandardCharsets.UTF_8);
String hashBase64 = Base64.getEncoder().encodeToString(md.digest(raw));
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
try (Connection con = ConnectionFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(USER_INFO_SELECT))
{
ps.setString(1, Long.toString(System.currentTimeMillis()));
@@ -253,7 +253,7 @@ public class LoginController
return null;
}
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
try (Connection con = ConnectionFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(AUTOCREATE_ACCOUNTS_INSERT))
{
ps.setString(1, login);
@@ -453,7 +453,7 @@ public class LoginController
if (loginOk && (client.getLastServer() != serverId))
{
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
try (Connection con = ConnectionFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_LAST_SERVER_UPDATE))
{
ps.setInt(1, serverId);
@@ -472,7 +472,7 @@ public class LoginController
public void setAccountAccessLevel(String account, int banLevel)
{
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
try (Connection con = ConnectionFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_ACCESS_LEVEL_UPDATE))
{
ps.setInt(1, banLevel);
@@ -487,7 +487,7 @@ public class LoginController
public void setAccountLastTracert(String account, String pcIp, String hop1, String hop2, String hop3, String hop4)
{
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
try (Connection con = ConnectionFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_IPS_UPDATE))
{
ps.setString(1, pcIp);
@@ -547,7 +547,7 @@ public class LoginController
{
List<InetAddress> ipWhiteList = new ArrayList<>();
List<InetAddress> ipBlackList = new ArrayList<>();
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
try (Connection con = ConnectionFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_IPAUTH_SELECT))
{
ps.setString(1, info.getLogin());
@@ -593,7 +593,7 @@ public class LoginController
client.setAccessLevel(info.getAccessLevel());
client.setLastServer(info.getLastServer());
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
try (Connection con = ConnectionFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_INFO_UPDATE))
{
ps.setLong(1, System.currentTimeMillis());

View File

@@ -27,7 +27,7 @@ import java.util.Collection;
import java.util.logging.Level;
import java.util.logging.Logger;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
import com.l2jserver.loginserver.GameServerTable;
import com.l2jserver.loginserver.GameServerTable.GameServerInfo;
import com.l2jserver.loginserver.GameServerThread;
@@ -82,7 +82,7 @@ public class ChangePassword extends BaseRecievePacket
int passUpdated = 0;
// SQL connection
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
try (Connection con = ConnectionFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("SELECT password FROM accounts WHERE login=?"))
{
ps.setString(1, accountName);
@@ -101,7 +101,7 @@ public class ChangePassword extends BaseRecievePacket
password = md.digest(password);
// SQL connection
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
try (Connection con = ConnectionFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE accounts SET password=? WHERE login=?"))
{
ps.setString(1, Base64.getEncoder().encodeToString(password));

View File

@@ -24,7 +24,7 @@ import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.util.logging.Logger;
import com.l2jserver.L2DatabaseFactory;
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
import com.l2jserver.loginserver.LoginController;
import com.l2jserver.util.network.BaseRecievePacket;
@@ -60,7 +60,7 @@ public class RequestTempBan extends BaseRecievePacket
private void banUser()
{
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
try (Connection con = ConnectionFactory.getInstance().getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO account_data VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE value=?"))
{
ps.setString(1, _accountName);