diff --git a/L2J_Mobius_1.0_Ertheia/.classpath b/L2J_Mobius_1.0_Ertheia/.classpath
index 0e50693da9..619d354392 100644
--- a/L2J_Mobius_1.0_Ertheia/.classpath
+++ b/L2J_Mobius_1.0_Ertheia/.classpath
@@ -5,11 +5,12 @@
-
+
-
+
+
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java
index 9a3b363f56..68ef6d5320 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java
@@ -76,7 +76,7 @@ public final class AdminChangeAccessLevel implements IAdminCommandHandler
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET accesslevel=? WHERE char_name=?");
statement.setInt(1, lvl);
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
index f883e863a5..785740eaae 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
@@ -631,7 +631,7 @@ public class AdminEditChar implements IAdminCommandHandler
if (player == null)
{
- final Connection con = DatabaseFactory.getInstance().getConnection();
+ final Connection con = DatabaseFactory.getConnection();
final PreparedStatement ps = con.prepareStatement("UPDATE characters SET " + (changeCreateExpiryTime ? "clan_create_expiry_time" : "clan_join_expiry_time") + " WHERE char_name=? LIMIT 1");
ps.setString(1, playerName);
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java
index 764ab77c25..969633adcb 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java
@@ -62,7 +62,7 @@ public class AdminRepairChar implements IAdminCommandHandler
}
final String cmd = "UPDATE characters SET x=-84318, y=244579, z=-3730 WHERE char_name=?";
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(cmd);
statement.setString(1, parts[1]);
@@ -87,13 +87,13 @@ public class AdminRepairChar implements IAdminCommandHandler
return;
}
- // connection = L2DatabaseFactory.getInstance().getConnection();
+ // connection = L2DatabaseFactory.getConnection();
statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=?");
statement.setInt(1, objId);
statement.execute();
statement.close();
- // connection = L2DatabaseFactory.getInstance().getConnection();
+ // connection = L2DatabaseFactory.getConnection();
statement = con.prepareStatement("UPDATE items SET loc=\"INVENTORY\" WHERE owner_id=?");
statement.setInt(1, objId);
statement.execute();
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java
index 780c3b0088..da0c7dcad2 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java
@@ -173,7 +173,7 @@ public class AdminShowQuests implements IAdminCommandHandler
private static void showQuestMenu(L2PcInstance target, L2PcInstance actor, String[] val)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
ResultSet rs;
PreparedStatement req;
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java
index 35508761a2..a8b6ed6963 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java
@@ -489,7 +489,7 @@ public class AdminTeleport implements IAdminCommandHandler
final int x = activeChar.getX();
final int y = activeChar.getY();
final int z = activeChar.getZ();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=? WHERE char_name=?");
statement.setInt(1, x);
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java
index b4e722f105..3913b5b368 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java
@@ -61,7 +61,7 @@ public class FavoriteBoard implements IParseBoardHandler
// Load Favorite links
final String list = HtmCache.getInstance().getHtm(activeChar, "data/html/CommunityBoard/favorite_list.html");
final StringBuilder sb = new StringBuilder();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_FAVORITES))
{
ps.setInt(1, activeChar.getObjectId());
@@ -98,7 +98,7 @@ public class FavoriteBoard implements IParseBoardHandler
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_FAVORITE))
{
ps.setInt(1, activeChar.getObjectId());
@@ -123,7 +123,7 @@ public class FavoriteBoard implements IParseBoardHandler
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_FAVORITE))
{
ps.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/communityboard/HomeBoard.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
index bed19004d2..1f5572ec39 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
@@ -300,7 +300,7 @@ public final class HomeBoard implements IParseBoardHandler
private static int getFavoriteCount(L2PcInstance player)
{
int count = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(COUNT_FAVORITES))
{
ps.setInt(1, player.getObjectId());
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
index 59ecba44bb..e0708990b7 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
@@ -62,7 +62,7 @@ public class ClanWarsList implements IUserCommandHandler
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
String query;
// Attack List
diff --git a/L2J_Mobius_1.0_Ertheia/dist/game/java.cfg b/L2J_Mobius_1.0_Ertheia/dist/game/java.cfg
index cb4a4dc204..58213e428e 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/game/java.cfg
+++ b/L2J_Mobius_1.0_Ertheia/dist/game/java.cfg
@@ -1 +1 @@
--server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
\ No newline at end of file
+-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=error -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
\ No newline at end of file
diff --git a/L2J_Mobius_1.0_Ertheia/dist/libs/HikariCP-3.2.0.jar b/L2J_Mobius_1.0_Ertheia/dist/libs/HikariCP-3.2.0.jar
new file mode 100644
index 0000000000..a030a7f8dc
Binary files /dev/null and b/L2J_Mobius_1.0_Ertheia/dist/libs/HikariCP-3.2.0.jar differ
diff --git a/L2J_Mobius_1.0_Ertheia/dist/libs/c3p0-0.9.5.2.jar b/L2J_Mobius_1.0_Ertheia/dist/libs/c3p0-0.9.5.2.jar
deleted file mode 100644
index 579cedd980..0000000000
Binary files a/L2J_Mobius_1.0_Ertheia/dist/libs/c3p0-0.9.5.2.jar and /dev/null differ
diff --git a/L2J_Mobius_1.0_Ertheia/dist/libs/mchange-commons-java-0.2.12.jar b/L2J_Mobius_1.0_Ertheia/dist/libs/mchange-commons-java-0.2.12.jar
deleted file mode 100644
index af11054860..0000000000
Binary files a/L2J_Mobius_1.0_Ertheia/dist/libs/mchange-commons-java-0.2.12.jar and /dev/null differ
diff --git a/L2J_Mobius_1.0_Ertheia/dist/libs/slf4j-api-1.7.25.jar b/L2J_Mobius_1.0_Ertheia/dist/libs/slf4j-api-1.7.25.jar
new file mode 100644
index 0000000000..7e62f1336d
Binary files /dev/null and b/L2J_Mobius_1.0_Ertheia/dist/libs/slf4j-api-1.7.25.jar differ
diff --git a/L2J_Mobius_1.0_Ertheia/dist/libs/slf4j-simple-1.7.25.jar b/L2J_Mobius_1.0_Ertheia/dist/libs/slf4j-simple-1.7.25.jar
new file mode 100644
index 0000000000..b29ca12719
Binary files /dev/null and b/L2J_Mobius_1.0_Ertheia/dist/libs/slf4j-simple-1.7.25.jar differ
diff --git a/L2J_Mobius_1.0_Ertheia/dist/login/java.cfg b/L2J_Mobius_1.0_Ertheia/dist/login/java.cfg
index 00ae5b3a66..bda4cdd24d 100644
--- a/L2J_Mobius_1.0_Ertheia/dist/login/java.cfg
+++ b/L2J_Mobius_1.0_Ertheia/dist/login/java.cfg
@@ -1 +1 @@
--server -Xms128m -Xmx256m
\ No newline at end of file
+-server -Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=error -Xms128m -Xmx256m
\ No newline at end of file
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/commons/database/DatabaseFactory.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/commons/database/DatabaseFactory.java
index 68d02d4171..dd481d2fd0 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/commons/database/DatabaseFactory.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/commons/database/DatabaseFactory.java
@@ -16,122 +16,68 @@
*/
package com.l2jmobius.commons.database;
-import java.beans.PropertyVetoException;
import java.sql.Connection;
-import java.sql.SQLException;
import java.util.logging.Logger;
import com.l2jmobius.Config;
-import com.mchange.v2.c3p0.ComboPooledDataSource;
+import com.zaxxer.hikari.HikariDataSource;
/**
- * Database Factory implementation.
- * @author Zoey76, Mobius
+ * @author Mobius
*/
public class DatabaseFactory
{
private static final Logger LOGGER = Logger.getLogger(DatabaseFactory.class.getName());
- private final ComboPooledDataSource _dataSource;
+ private static final HikariDataSource _hds = new HikariDataSource();
- public DatabaseFactory()
+ public static void init()
{
- if (Config.DATABASE_MAX_CONNECTIONS < 2)
- {
- Config.DATABASE_MAX_CONNECTIONS = 2;
- LOGGER.warning("A minimum of 2 connections are required.");
- }
-
- _dataSource = new ComboPooledDataSource();
- _dataSource.setAutoCommitOnClose(true);
-
- _dataSource.setInitialPoolSize(10);
- _dataSource.setMinPoolSize(10);
- _dataSource.setMaxPoolSize(Math.max(10, Config.DATABASE_MAX_CONNECTIONS));
-
- _dataSource.setAcquireRetryAttempts(0); // try to obtain connections indefinitely (0 = never quit)
- _dataSource.setAcquireRetryDelay(500); // 500 milliseconds wait before try to acquire connection again
- _dataSource.setCheckoutTimeout(0); // 0 = wait indefinitely for new connection if pool is exhausted
- _dataSource.setAcquireIncrement(5); // if pool is exhausted, get 5 more connections at a time cause there is
- // a "long" delay on acquire connection so taking more than one connection at once will make connection pooling more effective.
-
- // this "connection_test_table" is automatically created if not already there
- _dataSource.setAutomaticTestTable("connection_test_table");
- _dataSource.setTestConnectionOnCheckin(false);
-
- // testing OnCheckin used with IdleConnectionTestPeriod is faster than testing on checkout
-
- _dataSource.setIdleConnectionTestPeriod(3600); // test idle connection every 60 sec
- _dataSource.setMaxIdleTime(Config.DATABASE_MAX_IDLE_TIME); // 0 = idle connections never expire
- // *THANKS* to connection testing configured above but I prefer to disconnect all connections not used for more than 1 hour
-
- // enables statement caching, there is a "semi-bug" in c3p0 0.9.0 but in 0.9.0.2 and later it's fixed
- _dataSource.setMaxStatementsPerConnection(100);
-
- _dataSource.setBreakAfterAcquireFailure(false); // never fail if any way possible setting this to true will make c3p0 "crash"
- // and refuse to work till restart thus making acquire errors "FATAL" ... we don't want that it should be possible to recover
+ _hds.setDriverClassName(Config.DATABASE_DRIVER);
+ _hds.setJdbcUrl(Config.DATABASE_URL);
+ _hds.setUsername(Config.DATABASE_LOGIN);
+ _hds.setPassword(Config.DATABASE_PASSWORD);
+ _hds.setMaximumPoolSize(Config.DATABASE_MAX_CONNECTIONS);
+ _hds.setIdleTimeout(Config.DATABASE_MAX_IDLE_TIME);
+ // Test if connection is valid.
try
{
- _dataSource.setDriverClass(Config.DATABASE_DRIVER);
+ _hds.getConnection().close();
+ LOGGER.info("Database: Initialized.");
}
- catch (PropertyVetoException e)
+ catch (Exception e)
{
e.printStackTrace();
}
- _dataSource.setJdbcUrl(Config.DATABASE_URL);
- _dataSource.setUser(Config.DATABASE_LOGIN);
- _dataSource.setPassword(Config.DATABASE_PASSWORD);
-
- /* Test the connection */
- try
- {
- _dataSource.getConnection().close();
- }
- catch (SQLException e)
- {
- e.printStackTrace();
- }
-
- LOGGER.info("Database: Initialized.");
}
- public Connection getConnection()
+ public static Connection getConnection()
{
Connection con = null;
while (con == null)
{
try
{
- con = _dataSource.getConnection();
+ con = _hds.getConnection();
}
- catch (SQLException e)
+ catch (Exception e)
{
- LOGGER.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage());
+ LOGGER.severe("DatabaseFactory: Cound not get a connection. " + e);
}
}
return con;
}
- public void close()
+ public static void close()
{
try
{
- _dataSource.close();
+ _hds.close();
}
catch (Exception e)
{
- LOGGER.info(e.getMessage());
+ LOGGER.severe("DatabaseFactory: There was a problem closing the data source. " + e);
}
}
-
- public static DatabaseFactory getInstance()
- {
- return SingletonHolder.INSTANCE;
- }
-
- private static class SingletonHolder
- {
- protected static final DatabaseFactory INSTANCE = new DatabaseFactory();
- }
}
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/GameServer.java
index 55a99298a3..ae4c96ff96 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/GameServer.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/GameServer.java
@@ -192,7 +192,7 @@ public class GameServer
// Initialize config
Config.load();
printSection("Database");
- DatabaseFactory.getInstance();
+ DatabaseFactory.init();
printSection("ThreadPool");
ThreadPool.init();
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/LoginServerThread.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/LoginServerThread.java
index ea976c4545..22b6b4cf67 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/LoginServerThread.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/LoginServerThread.java
@@ -584,7 +584,7 @@ public class LoginServerThread extends Thread
int chars = 0;
final List charToDel = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT deletetime FROM characters WHERE account_name=?"))
{
ps.setString(1, account);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/Shutdown.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/Shutdown.java
index 72caae1c02..ec983b9153 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/Shutdown.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/Shutdown.java
@@ -204,7 +204,7 @@ public class Shutdown extends Thread
// commit data, last chance
try
{
- DatabaseFactory.getInstance().close();
+ DatabaseFactory.close();
LOGGER.info("Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
}
catch (Throwable t)
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
index 3f98953c02..320a104fca 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
@@ -93,7 +93,7 @@ public class Forum
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM forums WHERE forum_id=?"))
{
ps.setInt(1, _forumId);
@@ -114,7 +114,7 @@ public class Forum
LOGGER.log(Level.WARNING, "Data error on Forum " + _forumId + " : " + e.getMessage(), e);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM topic WHERE topic_forum_id=? ORDER BY topic_id DESC"))
{
ps.setInt(1, _forumId);
@@ -139,7 +139,7 @@ public class Forum
private void getChildren()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT forum_id FROM forums WHERE forum_parent=?"))
{
ps.setInt(1, _forumId);
@@ -217,7 +217,7 @@ public class Forum
public void insertIntoDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO forums (forum_id,forum_name,forum_parent,forum_post,forum_type,forum_perm,forum_owner_id) VALUES (?,?,?,?,?,?,?)"))
{
ps.setInt(1, _forumId);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
index fa2f1da2d9..5f970fa0a5 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
@@ -72,7 +72,7 @@ public class Post
private void insertindb(CPost cp)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)"))
{
ps.setInt(1, cp.postId);
@@ -112,7 +112,7 @@ public class Post
public void deleteme(Topic t)
{
PostBBSManager.getInstance().delPostByTopic(t);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM posts WHERE post_forum_id=? AND post_topic_id=?"))
{
ps.setInt(1, t.getForumID());
@@ -130,7 +130,7 @@ public class Post
*/
private void load(Topic t)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM posts WHERE post_forum_id=? AND post_topic_id=? ORDER BY post_id ASC"))
{
ps.setInt(1, t.getForumID());
@@ -162,7 +162,7 @@ public class Post
*/
public void updatetxt(int i)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?"))
{
final CPost cp = getCPost(i);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
index ae7b7c6318..2cb2303f58 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
@@ -71,7 +71,7 @@ public class Topic
private void insertindb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO topic (topic_id,topic_forum_id,topic_name,topic_date,topic_ownername,topic_ownerid,topic_type,topic_reply) values (?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, _id);
@@ -129,7 +129,7 @@ public class Topic
{
TopicBBSManager.getInstance().delTopic(this);
f.rmTopicByID(_id);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM topic WHERE topic_id=? AND topic_forum_id=?"))
{
ps.setInt(1, _id);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
index 57a47cf456..c68fb57089 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
@@ -40,7 +40,7 @@ public class ForumsBBSManager extends BaseBBSManager
protected ForumsBBSManager()
{
_table = new CopyOnWriteArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT forum_id FROM forums WHERE forum_type = 0"))
{
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java
index adc2b28a17..b3b101e521 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java
@@ -52,7 +52,7 @@ public final class AnnouncementsTable
private void load()
{
_announcements.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery("SELECT * FROM announcements"))
{
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java
index 4aa8b72edb..5bb8ebbe43 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java
@@ -99,7 +99,7 @@ public class CharNameTable
int id = -1;
int accessLevel = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT charId,accesslevel FROM characters WHERE char_name=?"))
{
ps.setString(1, name);
@@ -145,7 +145,7 @@ public class CharNameTable
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT char_name,accesslevel FROM characters WHERE charId=?"))
{
ps.setInt(1, id);
@@ -176,7 +176,7 @@ public class CharNameTable
public synchronized boolean doesCharNameExist(String name)
{
boolean result = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT COUNT(*) as count FROM characters WHERE char_name=?"))
{
ps.setString(1, name);
@@ -197,7 +197,7 @@ public class CharNameTable
public int getAccountCharacterCount(String account)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT COUNT(char_name) as count FROM characters WHERE account_name=?"))
{
ps.setString(1, account);
@@ -218,7 +218,7 @@ public class CharNameTable
public int getLevelById(int objectId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT level FROM characters WHERE charId = ?"))
{
ps.setInt(1, objectId);
@@ -239,7 +239,7 @@ public class CharNameTable
public int getClassIdById(int objectId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT classid FROM characters WHERE charId = ?"))
{
ps.setInt(1, objectId);
@@ -260,7 +260,7 @@ public class CharNameTable
public int getClanIdById(int objectId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clanId FROM characters WHERE charId = ?"))
{
ps.setInt(1, objectId);
@@ -281,7 +281,7 @@ public class CharNameTable
private void loadAll()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT charId, char_name, accesslevel FROM characters"))
{
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java
index 021a434a38..6315404c36 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java
@@ -70,7 +70,7 @@ public class CharSummonTable
{
if (Config.RESTORE_SERVITOR_ON_RECONNECT)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(INIT_SUMMONS))
{
@@ -87,7 +87,7 @@ public class CharSummonTable
if (Config.RESTORE_PET_ON_RECONNECT)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(INIT_PET))
{
@@ -111,7 +111,7 @@ public class CharSummonTable
return !v.isEmpty() ? v : null;
});
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(REMOVE_SUMMON))
{
ps.setInt(1, activeChar.getObjectId());
@@ -181,7 +181,7 @@ public class CharSummonTable
public void restoreServitor(L2PcInstance activeChar)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(LOAD_SUMMON))
{
ps.setInt(1, activeChar.getObjectId());
@@ -229,7 +229,7 @@ public class CharSummonTable
_servitors.computeIfAbsent(summon.getOwner().getObjectId(), k -> ConcurrentHashMap.newKeySet()).add(summon.getObjectId());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SAVE_SUMMON))
{
ps.setInt(1, summon.getOwner().getObjectId());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java
index 77aa1fb5fb..024b76d419 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java
@@ -79,7 +79,7 @@ public class ClanTable
L2Clan clan;
// Count the clans
int clanCount = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT clan_id FROM clan_data"))
{
@@ -258,7 +258,7 @@ public class ClanTable
_clans.remove(clanId);
IdFactory.getInstance().releaseId(clanId);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM clan_data WHERE clan_id=?"))
{
@@ -357,7 +357,7 @@ public class ClanTable
public void storeclanswars(ClanWar war)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO clan_wars (clan1, clan2, clan1Kill, clan2Kill, winnerClan, startTime, endTime, state) VALUES(?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, war.getAttackerClanId());
@@ -388,7 +388,7 @@ public class ClanTable
clan1.broadcastClanStatus();
clan2.broadcastClanStatus();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM clan_wars WHERE clan1=? AND clan2=?"))
{
ps.setInt(1, clanId1);
@@ -403,7 +403,7 @@ public class ClanTable
private void restorewars()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery("SELECT clan1, clan2, clan1Kill, clan2Kill, winnerClan, startTime, endTime, state FROM clan_wars"))
{
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java
index f90657a886..907f92e5f6 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java
@@ -72,7 +72,7 @@ public final class CrestTable
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
ResultSet rs = statement.executeQuery("SELECT `crest_id`, `data`, `type` FROM `crests` ORDER BY `crest_id` DESC"))
{
@@ -154,7 +154,7 @@ public final class CrestTable
*/
public L2Crest createCrest(byte[] data, CrestType crestType)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO `crests`(`crest_id`, `data`, `type`) VALUES(?, ?, ?)"))
{
final L2Crest crest = new L2Crest(_nextId.getAndIncrement(), data, crestType);
@@ -187,7 +187,7 @@ public final class CrestTable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM `crests` WHERE `crest_id` = ?"))
{
statement.setInt(1, crestId);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java
index 2be088cd17..b281c6dbe0 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java
@@ -56,7 +56,7 @@ public class OfflineTradersTable
public void storeOffliners()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS);
PreparedStatement stm3 = con.prepareStatement(SAVE_OFFLINE_STATUS);
@@ -173,7 +173,7 @@ public class OfflineTradersTable
{
LOGGER.info(getClass().getSimpleName() + ": Loading offline traders...");
int nTraders = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement stm = con.createStatement();
ResultSet rs = stm.executeQuery(LOAD_OFFLINE_STATUS))
{
@@ -329,7 +329,7 @@ public class OfflineTradersTable
public static synchronized void onTransaction(L2PcInstance trader, boolean finished, boolean firstCall)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_PLAYER);
PreparedStatement stm3 = con.prepareStatement(SAVE_ITEMS);
@@ -453,7 +453,7 @@ public class OfflineTradersTable
{
PlayerCountManager.getInstance().decOfflineTradeCount();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_PLAYER))
{
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java
index 333e0e2289..4013e5e460 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java
@@ -42,7 +42,7 @@ public class PetNameTable
public boolean doesPetNameExist(String name, int petNpcId)
{
boolean result = true;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT name FROM pets p, items i WHERE p.item_obj_id = i.object_id AND name=? AND i.item_id IN (?)"))
{
ps.setString(1, name);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java
index 33e2d0df1d..0de4769849 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java
@@ -66,7 +66,7 @@ public final class BuyListData implements IGameXmlReader
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _buyLists.size() + " BuyLists.");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rs = statement.executeQuery("SELECT * FROM `buylists`"))
{
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/datatables/BotReportTable.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/datatables/BotReportTable.java
index 8d2d8e65ee..67d9b69779 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/datatables/BotReportTable.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/datatables/BotReportTable.java
@@ -112,7 +112,7 @@ public final class BotReportTable
*/
private void loadReportedCharData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery(SQL_LOAD_REPORTED_CHAR_DATA))
{
@@ -181,7 +181,7 @@ public final class BotReportTable
*/
public void saveReportedCharData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
PreparedStatement ps = con.prepareStatement(SQL_INSERT_REPORTED_CHAR_DATA))
{
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/datatables/ItemTable.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/datatables/ItemTable.java
index c8f34ed812..e4f3a0098d 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/datatables/ItemTable.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/datatables/ItemTable.java
@@ -386,7 +386,7 @@ public class ItemTable
// if it's a pet control item, delete the pet as well
if (item.getItem().isPetItem())
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
{
// Delete the pet in db
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
index baaadc776c..34f7280917 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -128,7 +128,7 @@ public abstract class IdFactory
*/
private void setAllCharacterOffline()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("UPDATE characters SET online = 0");
@@ -145,7 +145,7 @@ public abstract class IdFactory
*/
private void cleanUpDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement stmt = con.createStatement())
{
final long cleanupStart = System.currentTimeMillis();
@@ -253,7 +253,7 @@ public abstract class IdFactory
private void cleanUpTimeStamps()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
int cleanCount = 0;
for (String line : TIMESTAMPS_CLEAN)
@@ -279,7 +279,7 @@ public abstract class IdFactory
protected final Integer[] extractUsedObjectIDTable() throws Exception
{
final List temp = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
String extractUsedObjectIdsQuery = "";
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
index 9e5d1cedcf..21ed01119d 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
@@ -42,7 +42,7 @@ public class StackIDFactory extends IdFactory
_curOID = FIRST_OID;
_tempOID = FIRST_OID;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// con.createStatement().execute("drop table if exists tmp_obj_id");
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java
index c1c614e3f8..85f3d57b5d 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java
@@ -169,7 +169,7 @@ public class AirShipManager
_airShipsInfo.put(ownerId, info);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_DB))
{
ps.setInt(1, ownerId);
@@ -265,7 +265,7 @@ public class AirShipManager
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(LOAD_DB))
{
@@ -296,7 +296,7 @@ public class AirShipManager
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_DB))
{
ps.setInt(1, info.getInt("fuel"));
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
index afc836f427..0808ef7947 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
@@ -198,7 +198,7 @@ public final class CastleManager implements InstanceListManager
}
}
// else offline-player circlet removal
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM items WHERE owner_id = ? and item_id = ?"))
{
ps.setInt(1, member.getObjectId());
@@ -215,7 +215,7 @@ public final class CastleManager implements InstanceListManager
@Override
public void loadInstances()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT id FROM castle ORDER BY id"))
{
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
index 6a9dff749b..4c73fd01a3 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
@@ -162,7 +162,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
private void loadDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stProduction = con.prepareStatement("SELECT * FROM castle_manor_production WHERE castle_id=?");
PreparedStatement stProcure = con.prepareStatement("SELECT * FROM castle_manor_procure WHERE castle_id=?"))
{
@@ -436,7 +436,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
_productionNext.put(castleId, list);
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement dps = con.prepareStatement("DELETE FROM castle_manor_production WHERE castle_id = ? AND next_period = 1");
PreparedStatement ips = con.prepareStatement(INSERT_PRODUCT))
{
@@ -472,7 +472,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
_procureNext.put(castleId, list);
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement dps = con.prepareStatement("DELETE FROM castle_manor_procure WHERE castle_id = ? AND next_period = 1");
PreparedStatement ips = con.prepareStatement(INSERT_CROP))
{
@@ -506,7 +506,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
public final void updateCurrentProduction(int castleId, Collection items)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle_manor_production SET amount = ? WHERE castle_id = ? AND seed_id = ? AND next_period = 0"))
{
for (SeedProduction sp : items)
@@ -526,7 +526,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
public final void updateCurrentProcure(int castleId, Collection items)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle_manor_procure SET amount = ? WHERE castle_id = ? AND crop_id = ? AND next_period = 0"))
{
for (CropProcure sp : items)
@@ -599,7 +599,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
@Override
public final boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ds = con.prepareStatement("DELETE FROM castle_manor_production");
PreparedStatement is = con.prepareStatement(INSERT_PRODUCT);
PreparedStatement dp = con.prepareStatement("DELETE FROM castle_manor_procure");
@@ -697,7 +697,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ds = con.prepareStatement("DELETE FROM castle_manor_production WHERE castle_id = ?");
PreparedStatement dc = con.prepareStatement("DELETE FROM castle_manor_procure WHERE castle_id = ?"))
{
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java
index d2f42532d1..f55bf19583 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java
@@ -91,7 +91,7 @@ public class CeremonyOfChaosManager extends AbstractEventManager clanApplicantList = _applicantList.get(clanId);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_APPLICANT))
{
statement.setInt(1, playerId);
@@ -189,7 +189,7 @@ public class ClanEntryManager
{
_applicantList.computeIfAbsent(clanId, k -> new ConcurrentHashMap<>()).put(info.getPlayerId(), info);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_APPLICANT))
{
statement.setInt(1, info.getPlayerId());
@@ -216,7 +216,7 @@ public class ClanEntryManager
{
if (!_playerLocked.containsKey(playerId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_WAITING_LIST))
{
statement.setInt(1, info.getPlayerId());
@@ -237,7 +237,7 @@ public class ClanEntryManager
{
if (_waitingList.containsKey(playerId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_WAITING_LIST))
{
statement.setInt(1, playerId);
@@ -258,7 +258,7 @@ public class ClanEntryManager
{
if (!_clanList.containsKey(clanId) && !_clanLocked.containsKey(clanId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_CLAN_RECRUIT))
{
statement.setInt(1, info.getClanId());
@@ -283,7 +283,7 @@ public class ClanEntryManager
{
if (_clanList.containsKey(clanId) && !_clanLocked.containsKey(clanId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CLAN_RECRUIT))
{
statement.setInt(1, info.getKarma());
@@ -307,7 +307,7 @@ public class ClanEntryManager
{
if (_clanList.containsKey(clanId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_CLAN_RECRUIT))
{
statement.setInt(1, clanId);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java
index e424e0ad7e..6ba2c94bb2 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java
@@ -79,7 +79,7 @@ public final class CommissionManager
protected CommissionManager()
{
final Map itemInstances = new HashMap<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement(SELECT_ALL_ITEMS))
{
@@ -245,7 +245,7 @@ public final class CommissionManager
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_COMMISSION_ITEM, Statement.RETURN_GENERATED_KEYS))
{
final Instant startTime = Instant.now();
@@ -398,7 +398,7 @@ public final class CommissionManager
*/
private boolean deleteItemFromDB(long commissionId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_COMMISSION_ITEM))
{
ps.setLong(1, commissionId);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
index 9e5b85cf52..398058a743 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
@@ -142,7 +142,7 @@ public final class CursedWeaponsManager implements IGameXmlReader
private void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT itemId, charId, playerReputation, playerPkKills, nbKills, endTime FROM cursed_weapons"))
{
@@ -167,7 +167,7 @@ public final class CursedWeaponsManager implements IGameXmlReader
private void controlPlayers()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT owner_id FROM items WHERE item_id=?"))
{
// TODO: See comments below...
@@ -338,7 +338,7 @@ public final class CursedWeaponsManager implements IGameXmlReader
public static void removeFromDb(int itemId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM cursed_weapons WHERE itemId = ?"))
{
ps.setInt(1, itemId);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java
index ced8c5abd2..a881e85ae4 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java
@@ -85,7 +85,7 @@ public class DBSpawnManager
_storedInfo.clear();
_schedules.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM npc_respawns");
ResultSet rset = statement.executeQuery())
{
@@ -275,7 +275,7 @@ public class DBSpawnManager
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO npc_respawns (id, x, y, z, heading, respawnTime, currentHp, currentMp) VALUES(?, ?, ?, ?, ?, ?, ?, ?)"))
{
statement.setInt(1, spawn.getId());
@@ -331,7 +331,7 @@ public class DBSpawnManager
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO npc_respawns (id, x, y, z, heading, respawnTime, currentHp, currentMp) VALUES(?, ?, ?, ?, ?, ?, ?, ?)"))
{
statement.setInt(1, spawn.getId());
@@ -380,7 +380,7 @@ public class DBSpawnManager
if (updateDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM npc_respawns WHERE id = ?"))
{
ps.setInt(1, npcId);
@@ -401,7 +401,7 @@ public class DBSpawnManager
*/
private void updateDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE npc_respawns SET respawnTime = ?, currentHP = ?, currentMP = ? WHERE id = ?"))
{
for (Integer npcId : _storedInfo.keySet())
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java
index c960d1ec87..490ebab3ac 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java
@@ -117,7 +117,7 @@ public class DailyTaskManager extends AbstractEventManager>
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement st = con.prepareStatement("UPDATE character_subclasses SET vitality_points = ?"))
{
@@ -147,7 +147,7 @@ public class DailyTaskManager extends AbstractEventManager>
private void resetExtendDrop()
{
// Update data for offline players.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_variables WHERE var = ?"))
{
ps.setString(1, PlayerVariables.EXTEND_DROP);
@@ -170,7 +170,7 @@ public class DailyTaskManager extends AbstractEventManager>
private void resetDailySkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final List dailySkills = getVariables().getList("reset_skills", SkillHolder.class, Collections.emptyList());
for (SkillHolder skill : dailySkills)
@@ -197,7 +197,7 @@ public class DailyTaskManager extends AbstractEventManager>
}
// Update data for offline players.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE character_variables SET val = ? WHERE var = ?"))
{
ps.setInt(1, 0);
@@ -222,7 +222,7 @@ public class DailyTaskManager extends AbstractEventManager>
private void resetRecommends()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("UPDATE character_reco_bonus SET rec_left = ?, rec_have = 0 WHERE rec_have <= 20"))
{
@@ -255,7 +255,7 @@ public class DailyTaskManager extends AbstractEventManager>
if (Config.TRAINING_CAMP_ENABLE)
{
// Update data for offline players.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM account_gsdata WHERE var = ?"))
{
ps.setString(1, "TRAINING_CAMP_DURATION");
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java
index f635c19883..7101b82852 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java
@@ -46,7 +46,7 @@ public class FactionManager
private void loadAll()
{
_playerFactions.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT charId, faction FROM characters"))
{
@@ -75,7 +75,7 @@ public class FactionManager
return factionId;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT faction FROM characters WHERE charId=?"))
{
ps.setInt(1, id);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/FortManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
index 0fbe44bc6d..56ab9144cf 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
@@ -121,7 +121,7 @@ public final class FortManager implements InstanceListManager
@Override
public void loadInstances()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT id FROM fort ORDER BY id"))
{
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
index 0a5245dafc..4eb6258b05 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
@@ -86,7 +86,7 @@ public final class FortSiegeManager
}
boolean register = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clan_id FROM fortsiege_clans where clan_id=? and fort_id=?"))
{
ps.setInt(1, clan.getId());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
index e9f6bb3475..044d74609a 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
@@ -56,7 +56,7 @@ public final class GlobalVariablesManager extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery(SELECT_QUERY))
{
@@ -87,7 +87,7 @@ public final class GlobalVariablesManager extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement del = con.createStatement();
PreparedStatement st = con.prepareStatement(INSERT_QUERY))
{
@@ -119,7 +119,7 @@ public final class GlobalVariablesManager extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement del = con.createStatement())
{
del.execute(DELETE_QUERY);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
index 0a62e46364..30f9519c00 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
@@ -62,7 +62,7 @@ public final class GrandBossManager implements IStorable
private void init()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT * from grandboss_data ORDER BY boss_id"))
{
@@ -150,7 +150,7 @@ public final class GrandBossManager implements IStorable
@Override
public boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
for (Entry e : _storedInfo.entrySet())
{
@@ -202,7 +202,7 @@ public final class GrandBossManager implements IStorable
private void updateDb(int bossId, boolean statusOnly)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final L2GrandBossInstance boss = _bosses.get(bossId);
final StatsSet info = _storedInfo.get(bossId);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java
index 0939f2cf18..4a0efbc831 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java
@@ -498,7 +498,7 @@ public final class InstanceManager implements IGameXmlReader
*/
private void restoreInstanceTimes()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT * FROM character_instance_time ORDER BY charId"))
{
@@ -550,7 +550,7 @@ public final class InstanceManager implements IGameXmlReader
// Remove them
if (!invalidPenalty.isEmpty())
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_INSTANCE_TIME))
{
for (Integer id : invalidPenalty)
@@ -615,7 +615,7 @@ public final class InstanceManager implements IGameXmlReader
*/
public void deleteInstanceTime(L2PcInstance player, int id)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_INSTANCE_TIME))
{
ps.setInt(1, player.getObjectId());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java
index e0599ea3fe..eb105b45f3 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java
@@ -55,7 +55,7 @@ public final class ItemAuctionManager implements IGameXmlReader
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery("SELECT auctionId FROM item_auction ORDER BY auctionId DESC LIMIT 0, 1"))
{
@@ -134,7 +134,7 @@ public final class ItemAuctionManager implements IGameXmlReader
public static void deleteAuction(int auctionId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement statement = con.prepareStatement("DELETE FROM item_auction WHERE auctionId=?"))
{
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
index fba190d620..5bbbecc082 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
@@ -80,7 +80,7 @@ public final class ItemsOnGroundManager implements Runnable
str = "UPDATE itemsonground SET drop_time = ? WHERE drop_time = -1";
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(str))
{
ps.setLong(1, System.currentTimeMillis());
@@ -93,7 +93,7 @@ public final class ItemsOnGroundManager implements Runnable
}
// Add items to world
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable FROM itemsonground"))
{
int count = 0;
@@ -178,7 +178,7 @@ public final class ItemsOnGroundManager implements Runnable
public void emptyTable()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("DELETE FROM itemsonground");
@@ -204,7 +204,7 @@ public final class ItemsOnGroundManager implements Runnable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO itemsonground(object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable) VALUES(?,?,?,?,?,?,?,?,?)"))
{
for (L2ItemInstance item : _items)
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/MailManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/MailManager.java
index 0b4c7601cb..fbc14a23e6 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/MailManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/MailManager.java
@@ -57,7 +57,7 @@ public final class MailManager
private void load()
{
int count = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT * FROM messages ORDER BY expiration"))
{
@@ -192,7 +192,7 @@ public final class MailManager
public void sendMessage(Message msg)
{
_messages.put(msg.getId(), msg);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = Message.getStatement(msg, con))
{
ps.execute();
@@ -214,7 +214,7 @@ public final class MailManager
public final void markAsReadInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isUnread = 'false' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -228,7 +228,7 @@ public final class MailManager
public final void markAsDeletedBySenderInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isDeletedBySender = 'true' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -242,7 +242,7 @@ public final class MailManager
public final void markAsDeletedByReceiverInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isDeletedByReceiver = 'true' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -256,7 +256,7 @@ public final class MailManager
public final void removeAttachmentsInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET hasAttachments = 'false' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -270,7 +270,7 @@ public final class MailManager
public final void deleteMessageInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM messages WHERE messageId = ?"))
{
ps.setInt(1, msgId);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java
index f47cf3f813..82a7f2288b 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java
@@ -54,7 +54,7 @@ public class MentorManager
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery("SELECT * FROM character_mentees"))
{
@@ -76,7 +76,7 @@ public class MentorManager
*/
public void deleteMentee(int mentorId, int menteeId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_mentees WHERE mentorId = ? AND charId = ?"))
{
statement.setInt(1, mentorId);
@@ -95,7 +95,7 @@ public class MentorManager
*/
public void deleteMentor(int mentorId, int menteeId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_mentees WHERE mentorId = ? AND charId = ?"))
{
statement.setInt(1, mentorId);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
index a29ed155fc..c03a9a8aae 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
@@ -128,7 +128,7 @@ public class PremiumManager
private void loadPremiumData(String accountName)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stmt = con.prepareStatement(LOAD_SQL))
{
stmt.setString(1, accountName);
@@ -160,7 +160,7 @@ public class PremiumManager
long newPremiumExpiration = oldPremiumExpiration + addTime;
// UPDATE DATABASE
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stmt = con.prepareStatement(UPDATE_SQL))
{
stmt.setLong(1, newPremiumExpiration);
@@ -205,7 +205,7 @@ public class PremiumManager
premiumData.remove(accountName);
// UPDATE DATABASE
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stmt = con.prepareStatement(DELETE_SQL))
{
stmt.setString(1, accountName);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java
index 001e262042..7438bf62f8 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java
@@ -56,7 +56,7 @@ public final class PunishmentManager
int expired = 0;
// Load punishments.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery("SELECT * FROM punishments"))
{
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
index b99c5e77d5..fe296e2e53 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
@@ -57,7 +57,7 @@ public final class SiegeGuardManager
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
ResultSet rs = con.createStatement().executeQuery("SELECT * FROM castle_siege_guards Where isHired = 1"))
{
while (rs.next())
@@ -158,7 +158,7 @@ public final class SiegeGuardManager
final SiegeGuardHolder holder = getSiegeGuardByItem(castle.getResidenceId(), itemId);
if (holder != null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("Insert Into castle_siege_guards (castleId, npcId, x, y, z, heading, respawnDelay, isHired) Values (?, ?, ?, ?, ?, ?, ?, ?)"))
{
statement.setInt(1, castle.getResidenceId());
@@ -249,7 +249,7 @@ public final class SiegeGuardManager
*/
private void loadSiegeGuard(Castle castle)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_siege_guards Where castleId = ? And isHired = ?"))
{
ps.setInt(1, castle.getResidenceId());
@@ -283,7 +283,7 @@ public final class SiegeGuardManager
*/
public void removeSiegeGuard(int npcId, IPositionable pos)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("Delete From castle_siege_guards Where npcId = ? And x = ? AND y = ? AND z = ? AND isHired = 1"))
{
ps.setInt(1, npcId);
@@ -304,7 +304,7 @@ public final class SiegeGuardManager
*/
public void removeSiegeGuards(Castle castle)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("Delete From castle_siege_guards Where castleId = ? And isHired = 1"))
{
ps.setInt(1, castle.getResidenceId());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
index e7fa0b41a8..65bd2b1bcf 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
@@ -88,7 +88,7 @@ public final class SiegeManager
}
boolean register = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT clan_id FROM siege_clans where clan_id=? and castle_id=?"))
{
statement.setInt(1, clan.getId());
@@ -275,7 +275,7 @@ public final class SiegeManager
private void loadTrapUpgrade(int castleId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_trapupgrade WHERE castleId=?"))
{
ps.setInt(1, castleId);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/BlockList.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/BlockList.java
index f34f2aa666..9498d19d95 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/BlockList.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/BlockList.java
@@ -71,7 +71,7 @@ public class BlockList
private static List loadList(int ObjId)
{
final List list = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=? AND relation=1"))
{
statement.setInt(1, ObjId);
@@ -98,7 +98,7 @@ public class BlockList
private void updateInDB(int targetId, boolean state)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (state) // add
{
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/CursedWeapon.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/CursedWeapon.java
index 2265d6876c..e767a0de19 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/CursedWeapon.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/CursedWeapon.java
@@ -136,7 +136,7 @@ public class CursedWeapon implements INamable
// Remove from Db
LOGGER.info(_name + " being removed offline.");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement del = con.prepareStatement("DELETE FROM items WHERE owner_id=? AND item_id=?");
PreparedStatement ps = con.prepareStatement("UPDATE characters SET reputation=?, pkkills=? WHERE charId=?"))
{
@@ -471,7 +471,7 @@ public class CursedWeapon implements INamable
public void saveData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement del = con.prepareStatement("DELETE FROM cursed_weapons WHERE itemId = ?");
PreparedStatement ps = con.prepareStatement("INSERT INTO cursed_weapons (itemId, charId, playerReputation, playerPkKills, nbKills, endTime) VALUES (?, ?, ?, ?, ?, ?)"))
{
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2Clan.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2Clan.java
index 7c8a94bb83..59244b5066 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2Clan.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2Clan.java
@@ -265,7 +265,7 @@ public class L2Clan implements IIdentifiable, INamable
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET clan_privs = ? WHERE charId = ?"))
{
ps.setInt(1, 0);
@@ -305,7 +305,7 @@ public class L2Clan implements IIdentifiable, INamable
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET clan_privs = ? WHERE charId = ?"))
{
ps.setInt(1, EnumIntBitmask.getAllBitmask(ClanPrivilege.class));
@@ -882,7 +882,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateBloodAllianceCountInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET blood_alliance_count=? WHERE clan_id=?"))
{
ps.setInt(1, _bloodAllianceCount);
@@ -926,7 +926,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateBloodOathCountInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET blood_oath_count=? WHERE clan_id=?"))
{
ps.setInt(1, _bloodOathCount);
@@ -942,7 +942,7 @@ public class L2Clan implements IIdentifiable, INamable
public void updateInDB()
{
// Update reputation
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET reputation_score=? WHERE clan_id=?"))
{
ps.setInt(1, _reputationScore);
@@ -977,7 +977,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateClanInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET leader_id=?,ally_id=?,ally_name=?,reputation_score=?,ally_penalty_expiry_time=?,ally_penalty_type=?,char_penalty_expiry_time=?,dissolving_expiry_time=?,new_leader_id=? WHERE clan_id=?"))
{
ps.setInt(1, getLeaderId());
@@ -1015,7 +1015,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void store()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_CLAN_DATA))
{
ps.setInt(1, _clanId);
@@ -1046,7 +1046,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
private void removeMemberInDatabase(L2ClanMember member, long clanJoinExpiryTime, long clanCreateExpiryTime)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("UPDATE characters SET clanid=0, title=?, clan_join_expiry_time=?, clan_create_expiry_time=?, clan_privs=0, wantspeace=0, subpledge=0, lvl_joined_academy=0, apprentice=0, sponsor=0 WHERE charId=?");
PreparedStatement ps2 = con.prepareStatement("UPDATE characters SET apprentice=0 WHERE apprentice=?");
PreparedStatement ps3 = con.prepareStatement("UPDATE characters SET sponsor=0 WHERE sponsor=?"))
@@ -1071,7 +1071,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_CLAN_DATA))
{
ps.setInt(1, _clanId);
@@ -1146,7 +1146,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreNotice()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT enabled,notice FROM clan_notices WHERE clan_id=?"))
{
ps.setInt(1, _clanId);
@@ -1177,7 +1177,7 @@ public class L2Clan implements IIdentifiable, INamable
notice = notice.substring(0, MAX_NOTICE_LENGTH - 1);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_notices (clan_id,notice,enabled) values (?,?,?) ON DUPLICATE KEY UPDATE notice=?,enabled=?"))
{
ps.setInt(1, _clanId);
@@ -1236,7 +1236,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreSkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT skill_id,skill_level,sub_pledge_id FROM clan_skills WHERE clan_id=?"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -1359,7 +1359,7 @@ public class L2Clan implements IIdentifiable, INamable
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (oldSkill != null)
{
@@ -1769,7 +1769,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreSubPledges()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT sub_pledge_id,name,leader_id FROM clan_subpledges WHERE clan_id=?"))
{
// Retrieve all subpledges of this clan from the database
@@ -1869,7 +1869,7 @@ public class L2Clan implements IIdentifiable, INamable
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_subpledges (clan_id,sub_pledge_id,name,leader_id) values (?,?,?,?)"))
{
ps.setInt(1, _clanId);
@@ -1952,7 +1952,7 @@ public class L2Clan implements IIdentifiable, INamable
public void updateSubPledgeInDB(int pledgeType)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_subpledges SET leader_id=?, name=? WHERE clan_id=? AND sub_pledge_id=?"))
{
ps.setInt(1, getSubPledge(pledgeType).getLeaderId());
@@ -1969,7 +1969,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreRankPrivs()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT privs,rank,party FROM clan_privs WHERE clan_id=?"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -2018,7 +2018,7 @@ public class L2Clan implements IIdentifiable, INamable
{
_privs.get(rank).setPrivs(privs);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_privs (clan_id,rank,party,privs) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE privs = ?"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -2054,7 +2054,7 @@ public class L2Clan implements IIdentifiable, INamable
{
_privs.put(rank, new RankPrivs(rank, 0, privs));
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_privs (clan_id,rank,party,privs) VALUES (?,?,?,?)"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -2173,7 +2173,7 @@ public class L2Clan implements IIdentifiable, INamable
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET auction_bid_at=? WHERE clan_id=?"))
{
ps.setInt(1, id);
@@ -2716,7 +2716,7 @@ public class L2Clan implements IIdentifiable, INamable
public void changeLevel(int level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET clan_level = ? WHERE clan_id = ?"))
{
ps.setInt(1, level);
@@ -2762,7 +2762,7 @@ public class L2Clan implements IIdentifiable, INamable
setCrestId(crestId);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET crest_id = ? WHERE clan_id = ?"))
{
ps.setInt(1, crestId);
@@ -2799,7 +2799,7 @@ public class L2Clan implements IIdentifiable, INamable
allyId = _allyId;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(sqlStatement))
{
ps.setInt(1, crestId);
@@ -2845,7 +2845,7 @@ public class L2Clan implements IIdentifiable, INamable
setCrestLargeId(crestId);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET crest_large_id = ? WHERE clan_id = ?"))
{
ps.setInt(1, crestId);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2ClanMember.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2ClanMember.java
index 8827f75a89..f1efba8e6e 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2ClanMember.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2ClanMember.java
@@ -244,7 +244,7 @@ public class L2ClanMember
*/
public void updatePledgeType()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET subpledge=? WHERE charId=?"))
{
ps.setLong(1, _pledgeType);
@@ -289,7 +289,7 @@ public class L2ClanMember
*/
public void updatePowerGrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET power_grade=? WHERE charId=?"))
{
ps.setLong(1, _powerGrade);
@@ -800,7 +800,7 @@ public class L2ClanMember
*/
public void saveApprenticeAndSponsor(int apprentice, int sponsor)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET apprentice=?,sponsor=? WHERE charId=?"))
{
ps.setInt(1, apprentice);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2ContactList.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2ContactList.java
index ea5f1f9d5d..5b5f5ab2bc 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2ContactList.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2ContactList.java
@@ -58,7 +58,7 @@ public class L2ContactList
{
_contacts.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY_LOAD))
{
statement.setInt(1, activeChar.getObjectId());
@@ -124,7 +124,7 @@ public class L2ContactList
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY_ADD))
{
statement.setInt(1, activeChar.getObjectId());
@@ -161,7 +161,7 @@ public class L2ContactList
_contacts.remove(name);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY_REMOVE))
{
statement.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2Mentee.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2Mentee.java
index 5c086b9d83..5414107ac4 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2Mentee.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/L2Mentee.java
@@ -49,7 +49,7 @@ public class L2Mentee
final L2PcInstance player = getPlayerInstance();
if (player == null) // Only if player is offline
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT char_name, level, base_class FROM characters WHERE charId = ?"))
{
statement.setInt(1, _objectId);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/MacroList.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/MacroList.java
index 577b101249..176fa12d48 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/MacroList.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/MacroList.java
@@ -124,7 +124,7 @@ public class MacroList implements IRestorable
private void registerMacroInDb(Macro macro)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO character_macroses (charId,id,icon,name,descr,acronym,commands) values(?,?,?,?,?,?,?)"))
{
ps.setInt(1, _owner.getObjectId());
@@ -160,7 +160,7 @@ public class MacroList implements IRestorable
private void deleteMacroFromDb(Macro macro)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_macroses WHERE charId=? AND id=?"))
{
ps.setInt(1, _owner.getObjectId());
@@ -177,7 +177,7 @@ public class MacroList implements IRestorable
public boolean restoreMe()
{
_macroses.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT charId, id, icon, name, descr, acronym, commands FROM character_macroses WHERE charId=?"))
{
ps.setInt(1, _owner.getObjectId());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/ShortCuts.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/ShortCuts.java
index 81e2c6f902..cbb856704d 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/ShortCuts.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/ShortCuts.java
@@ -85,7 +85,7 @@ public class ShortCuts implements IRestorable
deleteShortCutFromDb(oldShortCut);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("REPLACE INTO character_shortcuts (charId,slot,page,type,shortcut_id,level,sub_level,class_index) values(?,?,?,?,?,?,?,?)"))
{
statement.setInt(1, _owner.getObjectId());
@@ -154,7 +154,7 @@ public class ShortCuts implements IRestorable
*/
private void deleteShortCutFromDb(Shortcut shortcut)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=? AND slot=? AND page=? AND class_index=?"))
{
statement.setInt(1, _owner.getObjectId());
@@ -173,7 +173,7 @@ public class ShortCuts implements IRestorable
public boolean restoreMe()
{
_shortCuts.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT charId, slot, page, type, shortcut_id, level, sub_level FROM character_shortcuts WHERE charId=? AND class_index=?"))
{
statement.setInt(1, _owner.getObjectId());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
index c32fcfaef2..6201400953 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
@@ -1343,7 +1343,7 @@ public final class L2PcInstance extends L2Playable
private void insertNewRecipeData(int recipeId, boolean isDwarf)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_recipebook (charId, id, classIndex, type) values(?,?,?,?)"))
{
statement.setInt(1, getObjectId());
@@ -1360,7 +1360,7 @@ public final class L2PcInstance extends L2Playable
private void deleteRecipeData(int recipeId, boolean isDwarf)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_recipebook WHERE charId=? AND id=? AND classIndex=?"))
{
statement.setInt(1, getObjectId());
@@ -6334,7 +6334,7 @@ public final class L2PcInstance extends L2Playable
if (updateInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_CHARACTER_ACCESS))
{
ps.setInt(1, accessLevel.getLevel());
@@ -6453,7 +6453,7 @@ public final class L2PcInstance extends L2Playable
*/
public void updateOnlineStatus()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE characters SET online=?, lastAccess=? WHERE charId=?"))
{
statement.setInt(1, isOnlineInt());
@@ -6473,7 +6473,7 @@ public final class L2PcInstance extends L2Playable
*/
private boolean createDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_CHARACTER))
{
statement.setString(1, _accountName);
@@ -6537,7 +6537,7 @@ public final class L2PcInstance extends L2Playable
double currentCp = 0;
double currentHp = 0;
double currentMp = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHARACTER))
{
// Retrieve the L2PcInstance from the characters table of the database
@@ -6898,7 +6898,7 @@ public final class L2PcInstance extends L2Playable
*/
private static boolean restoreSubClassData(L2PcInstance player)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_SUBCLASSES))
{
statement.setInt(1, player.getObjectId());
@@ -6989,7 +6989,7 @@ public final class L2PcInstance extends L2Playable
private void restoreRecipeBook(boolean loadCommon)
{
final String sql = loadCommon ? "SELECT id, type, classIndex FROM character_recipebook WHERE charId=?" : "SELECT id FROM character_recipebook WHERE charId=? AND classIndex=? AND type = 1";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(sql))
{
statement.setInt(1, getObjectId());
@@ -7042,7 +7042,7 @@ public final class L2PcInstance extends L2Playable
private void loadPremiumItemList()
{
final String sql = "SELECT itemNum, itemId, itemCount, itemSender FROM character_premium_items WHERE charId=?";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(sql))
{
statement.setInt(1, getObjectId());
@@ -7066,7 +7066,7 @@ public final class L2PcInstance extends L2Playable
public void updatePremiumItem(int itemNum, long newcount)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE character_premium_items SET itemCount=? WHERE charId=? AND itemNum=? "))
{
statement.setLong(1, newcount);
@@ -7082,7 +7082,7 @@ public final class L2PcInstance extends L2Playable
public void deletePremiumItem(int itemNum)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_premium_items WHERE charId=? AND itemNum=? "))
{
statement.setInt(1, getObjectId());
@@ -7135,7 +7135,7 @@ public final class L2PcInstance extends L2Playable
final long exp = getStat().getBaseExp();
final int level = getStat().getBaseLevel();
final long sp = getStat().getBaseSp();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CHARACTER))
{
statement.setInt(1, level);
@@ -7220,7 +7220,7 @@ public final class L2PcInstance extends L2Playable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CHAR_SUBCLASS))
{
for (SubClass subClass : getSubClasses().values())
@@ -7251,7 +7251,7 @@ public final class L2PcInstance extends L2Playable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
{
@@ -7371,7 +7371,7 @@ public final class L2PcInstance extends L2Playable
private void storeItemReuseDelay()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(DELETE_ITEM_REUSE_SAVE);
PreparedStatement ps2 = con.prepareStatement(ADD_ITEM_REUSE_SAVE))
{
@@ -7488,7 +7488,7 @@ public final class L2PcInstance extends L2Playable
final Skill oldSkill = super.removeSkill(skill, true);
if (oldSkill != null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_SKILL_FROM_CHAR))
{
// Remove or update a L2PcInstance skill from the character_skills table of the database
@@ -7531,7 +7531,7 @@ public final class L2PcInstance extends L2Playable
private void storeSkill(Skill newSkill, Skill oldSkill, int newClassIndex)
{
final int classIndex = (newClassIndex > -1) ? newClassIndex : _classIndex;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if ((oldSkill != null) && (newSkill != null))
{
@@ -7581,7 +7581,7 @@ public final class L2PcInstance extends L2Playable
}
final int classIndex = (newClassIndex > -1) ? newClassIndex : _classIndex;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_NEW_SKILLS))
{
con.setAutoCommit(false);
@@ -7608,7 +7608,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restoreSkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -7660,7 +7660,7 @@ public final class L2PcInstance extends L2Playable
@Override
public void restoreEffects()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_SKILL_SAVE))
{
statement.setInt(1, getObjectId());
@@ -7717,7 +7717,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restoreItemReuse()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_ITEM_REUSE_SAVE);
PreparedStatement delete = con.prepareStatement(DELETE_ITEM_REUSE_SAVE))
{
@@ -7788,7 +7788,7 @@ public final class L2PcInstance extends L2Playable
_henna[i - 1] = null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_HENNAS))
{
statement.setInt(1, getObjectId());
@@ -7896,7 +7896,7 @@ public final class L2PcInstance extends L2Playable
_henna[slot - 1] = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_CHAR_HENNA))
{
statement.setInt(1, getObjectId());
@@ -7994,7 +7994,7 @@ public final class L2PcInstance extends L2Playable
// Calculate Henna modifiers of this L2PcInstance
recalcHennaStats();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(ADD_CHAR_HENNA))
{
statement.setInt(1, getObjectId());
@@ -9631,7 +9631,7 @@ public final class L2PcInstance extends L2Playable
newClass.setLevel(Config.BASE_DUALCLASS_LEVEL);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(ADD_CHAR_SUBCLASS))
{
// Store the basic info about this new sub-class.
@@ -9731,7 +9731,7 @@ public final class L2PcInstance extends L2Playable
// Remove after stats are recalculated.
getSubClasses().remove(classIndex);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
@@ -11968,7 +11968,7 @@ public final class L2PcInstance extends L2Playable
{
String req;
req = "UPDATE pets SET fed=? WHERE item_obj_id = ?";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(req))
{
statement.setInt(1, _curFeed);
@@ -12095,7 +12095,7 @@ public final class L2PcInstance extends L2Playable
bookmark.setTag(tag);
bookmark.setName(name);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_TP_BOOKMARK))
{
statement.setInt(1, icon);
@@ -12118,7 +12118,7 @@ public final class L2PcInstance extends L2Playable
{
if (_tpbookmarks.remove(id) != null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_TP_BOOKMARK))
{
statement.setInt(1, getObjectId());
@@ -12261,7 +12261,7 @@ public final class L2PcInstance extends L2Playable
sm.addItemName(20033);
sendPacket(sm);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_TP_BOOKMARK))
{
statement.setInt(1, getObjectId());
@@ -12283,7 +12283,7 @@ public final class L2PcInstance extends L2Playable
public void restoreTeleportBookmark()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_TP_BOOKMARK))
{
statement.setInt(1, getObjectId());
@@ -12495,7 +12495,7 @@ public final class L2PcInstance extends L2Playable
_friendList.clear();
final String sqlQuery = "SELECT friendId FROM character_friends WHERE charId=? AND relation=0";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(sqlQuery))
{
statement.setInt(1, getObjectId());
@@ -12585,7 +12585,7 @@ public final class L2PcInstance extends L2Playable
{
if (hasManufactureShop())
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement st = con.prepareStatement(DELETE_CHAR_RECIPE_SHOP))
{
@@ -12623,7 +12623,7 @@ public final class L2PcInstance extends L2Playable
_manufactureItems.clear();
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_RECIPE_SHOP))
{
statement.setInt(1, getObjectId());
@@ -13041,7 +13041,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restorePetInventoryItems()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT object_id FROM `items` WHERE `owner_id`=? AND (`loc`='PET' OR `loc`='PET_EQUIP') LIMIT 1;"))
{
statement.setInt(1, getObjectId());
@@ -13081,7 +13081,7 @@ public final class L2PcInstance extends L2Playable
*/
private void loadRecommendations()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT rec_have, rec_left FROM character_reco_bonus WHERE charId = ?"))
{
statement.setInt(1, getObjectId());
@@ -13105,7 +13105,7 @@ public final class L2PcInstance extends L2Playable
*/
public void storeRecommendations()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO character_reco_bonus (charId,rec_have,rec_left,time_left) VALUES (?,?,?,?)"))
{
ps.setInt(1, getObjectId());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
index c5b882a533..2a22ce6fa1 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
@@ -788,7 +788,7 @@ public class L2PetInstance extends L2Summon
}
// pet control item no longer exists, delete the pet from the db
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id = ?"))
{
statement.setInt(1, _controlObjectId);
@@ -846,7 +846,7 @@ public class L2PetInstance extends L2Summon
private static L2PetInstance restore(L2ItemInstance control, L2NpcTemplate template, L2PcInstance owner)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT item_obj_id, name, level, curHp, curMp, exp, sp, fed FROM pets WHERE item_obj_id=?"))
{
L2PetInstance pet;
@@ -942,7 +942,7 @@ public class L2PetInstance extends L2Summon
req = "UPDATE pets SET name=?,level=?,curHp=?,curMp=?,exp=?,sp=?,fed=?,ownerId=?,restore=? WHERE item_obj_id = ?";
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(req))
{
statement.setString(1, getName());
@@ -992,7 +992,7 @@ public class L2PetInstance extends L2Summon
// Clear list for overwrite
SummonEffectsTable.getInstance().getPetEffects().getOrDefault(getControlObjectId(), Collections.emptyList()).clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement ps2 = con.prepareStatement(ADD_SKILL_SAVE))
{
@@ -1067,7 +1067,7 @@ public class L2PetInstance extends L2Summon
@Override
public void restoreEffects()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(RESTORE_SKILL_SAVE);
PreparedStatement ps2 = con.prepareStatement(DELETE_SKILL_SAVE))
{
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java
index 320505de11..8cbf9119b6 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java
@@ -288,7 +288,7 @@ public class L2ServitorInstance extends L2Summon implements Runnable
SummonEffectsTable.getInstance().getServitorEffects(getOwner()).getOrDefault(getReferenceSkill(), Collections.emptyList()).clear();
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_SKILL_SAVE))
{
// Delete all current stored effects for summon to avoid dupe
@@ -389,7 +389,7 @@ public class L2ServitorInstance extends L2Summon implements Runnable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (!SummonEffectsTable.getInstance().getServitorEffectsOwner().containsKey(getOwner().getObjectId()) || !SummonEffectsTable.getInstance().getServitorEffectsOwner().get(getOwner().getObjectId()).containsKey(getOwner().getClassIndex()) || !SummonEffectsTable.getInstance().getServitorEffects(getOwner()).containsKey(getReferenceSkill()))
{
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/announce/Announcement.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/announce/Announcement.java
index 4e5aa84b0f..a7117539ad 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/announce/Announcement.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/announce/Announcement.java
@@ -108,7 +108,7 @@ public class Announcement implements IAnnouncement
@Override
public boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
{
ps.setInt(1, _type.ordinal());
@@ -134,7 +134,7 @@ public class Announcement implements IAnnouncement
@Override
public boolean updateMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_QUERY))
{
ps.setInt(1, _type.ordinal());
@@ -154,7 +154,7 @@ public class Announcement implements IAnnouncement
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_QUERY))
{
ps.setInt(1, _id);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java
index 1adc7b039f..21eb44294e 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java
@@ -94,7 +94,7 @@ public final class AutoAnnouncement extends Announcement implements Runnable
@Override
public boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
{
st.setInt(1, getType().ordinal());
@@ -123,7 +123,7 @@ public final class AutoAnnouncement extends Announcement implements Runnable
@Override
public boolean updateMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(UPDATE_QUERY))
{
st.setInt(1, getType().ordinal());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/buylist/Product.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/buylist/Product.java
index 8360f7712c..639a9bfa1a 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/buylist/Product.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/buylist/Product.java
@@ -157,7 +157,7 @@ public final class Product
private void save()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO `buylists`(`buylist_id`, `item_id`, `count`, `next_restock_time`) VALUES(?, ?, ?, ?) ON DUPLICATE KEY UPDATE `count` = ?, `next_restock_time` = ?"))
{
statement.setInt(1, _buyListId);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java
index 757b5512d0..5d970e7abd 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java
@@ -58,7 +58,7 @@ public class ClanHallAuction
private final void loadBidder()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(LOAD_CLANHALL_BIDDERS))
{
ps.setInt(1, _clanHallId);
@@ -102,7 +102,7 @@ public class ClanHallAuction
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_CLANHALL_BIDDER))
{
ps.setInt(1, _clanHallId);
@@ -121,7 +121,7 @@ public class ClanHallAuction
public void removeBid(L2Clan clan)
{
getBids().remove(clan.getId());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_CLANHALL_BIDDER))
{
ps.setInt(1, clan.getId());
@@ -170,7 +170,7 @@ public class ClanHallAuction
clanHall.setOwner(highestBidder.getClan());
getBids().clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_CLANHALL_BIDDERS))
{
ps.setInt(1, _clanHallId);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Castle.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Castle.java
index 2f1da41c76..88d3ad7201 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Castle.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Castle.java
@@ -218,7 +218,7 @@ public final class Castle extends AbstractResidence
public void dbSave()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_functions (castle_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)"))
{
ps.setInt(1, getResidenceId());
@@ -360,7 +360,7 @@ public final class Castle extends AbstractResidence
_treasury += amount;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET treasury = ? WHERE id = ?"))
{
ps.setLong(1, _treasury);
@@ -643,7 +643,7 @@ public final class Castle extends AbstractResidence
@Override
protected void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("SELECT * FROM castle WHERE id = ?");
PreparedStatement ps2 = con.prepareStatement("SELECT clan_id FROM clan_data WHERE hasCastle = ?"))
{
@@ -689,7 +689,7 @@ public final class Castle extends AbstractResidence
/** Load All Functions */
private void loadFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_functions WHERE castle_id = ?"))
{
ps.setInt(1, getResidenceId());
@@ -714,7 +714,7 @@ public final class Castle extends AbstractResidence
public void removeFunction(int functionType)
{
_function.remove(functionType);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_functions WHERE castle_id=? AND type=?"))
{
ps.setInt(1, getResidenceId());
@@ -786,7 +786,7 @@ public final class Castle extends AbstractResidence
// This method loads castle door upgrade data from database
private void loadDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_doorupgrade WHERE castleId=?"))
{
ps.setInt(1, getResidenceId());
@@ -812,7 +812,7 @@ public final class Castle extends AbstractResidence
door.setCurrentHp(door.getCurrentHp());
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_doorupgrade WHERE castleId=?"))
{
ps.setInt(1, getResidenceId());
@@ -837,7 +837,7 @@ public final class Castle extends AbstractResidence
if (save)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_doorupgrade (doorId, ratio, castleId) values (?,?,?)"))
{
ps.setInt(1, doorId);
@@ -864,7 +864,7 @@ public final class Castle extends AbstractResidence
CastleManorManager.getInstance().resetManorData(getResidenceId());
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Need to remove has castle flag from clan_data, should be checked from castle table.
try (PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET hasCastle = 0 WHERE hasCastle = ?"))
@@ -1032,7 +1032,7 @@ public final class Castle extends AbstractResidence
public void updateShowNpcCrest()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET showNpcCrest = ? WHERE id = ?"))
{
ps.setString(1, String.valueOf(_showNpcCrest));
@@ -1076,7 +1076,7 @@ public final class Castle extends AbstractResidence
{
_ticketBuyCount = count;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET ticketBuyCount = ? WHERE id = ?"))
{
ps.setInt(1, _ticketBuyCount);
@@ -1099,7 +1099,7 @@ public final class Castle extends AbstractResidence
{
if (save)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_trapupgrade (castleId, towerIndex, level) values (?,?,?)"))
{
ps.setInt(1, getResidenceId());
@@ -1126,7 +1126,7 @@ public final class Castle extends AbstractResidence
ts.setUpgradeLevel(0);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_trapupgrade WHERE castleId=?"))
{
ps.setInt(1, getResidenceId());
@@ -1209,7 +1209,7 @@ public final class Castle extends AbstractResidence
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET side = ? WHERE id = ?"))
{
ps.setString(1, side.toString());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/ClanHall.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
index 6fc9b45046..79906bc875 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
@@ -100,7 +100,7 @@ public final class ClanHall extends AbstractResidence
@Override
protected void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement loadStatement = con.prepareStatement(LOAD_CLANHALL);
PreparedStatement insertStatement = con.prepareStatement(INSERT_CLANHALL))
{
@@ -133,7 +133,7 @@ public final class ClanHall extends AbstractResidence
public void updateDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CLANHALL))
{
statement.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Couple.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Couple.java
index c40e7d454a..45294842ce 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Couple.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Couple.java
@@ -45,7 +45,7 @@ public class Couple
{
_Id = coupleId;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM mods_wedding WHERE id = ?"))
{
ps.setInt(1, _Id);
@@ -85,7 +85,7 @@ public class Couple
_weddingDate = Calendar.getInstance();
_weddingDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
{
_Id = IdFactory.getInstance().getNextId();
@@ -105,7 +105,7 @@ public class Couple
public void marry()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE mods_wedding set married = ?, weddingDate = ? where id = ?"))
{
ps.setBoolean(1, true);
@@ -123,7 +123,7 @@ public class Couple
public void divorce()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM mods_wedding WHERE id=?"))
{
ps.setInt(1, _Id);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Fort.java
index e6262fdc29..3b29461e3a 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Fort.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Fort.java
@@ -214,7 +214,7 @@ public final class Fort extends AbstractResidence
public void dbSave()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO fort_functions (fort_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)"))
{
ps.setInt(1, getResidenceId());
@@ -487,7 +487,7 @@ public final class Fort extends AbstractResidence
public void saveFortVariables()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET supplyLvL=? WHERE id = ?"))
{
ps.setInt(1, _supplyLvL);
@@ -552,7 +552,7 @@ public final class Fort extends AbstractResidence
@Override
protected void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort WHERE id = ?"))
{
ps.setInt(1, getResidenceId());
@@ -613,7 +613,7 @@ public final class Fort extends AbstractResidence
/** Load All Functions */
private void loadFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_functions WHERE fort_id = ?"))
{
ps.setInt(1, getResidenceId());
@@ -638,7 +638,7 @@ public final class Fort extends AbstractResidence
public void removeFunction(int functionType)
{
_function.remove(functionType);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM fort_functions WHERE fort_id=? AND type=?"))
{
ps.setInt(1, getResidenceId());
@@ -730,7 +730,7 @@ public final class Fort extends AbstractResidence
// This method loads fort door upgrade data from database
private void loadDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_doorupgrade WHERE fortId = ?"))
{
ps.setInt(1, getResidenceId());
@@ -750,7 +750,7 @@ public final class Fort extends AbstractResidence
private void removeDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM fort_doorupgrade WHERE fortId = ?"))
{
ps.setInt(1, getResidenceId());
@@ -764,7 +764,7 @@ public final class Fort extends AbstractResidence
private void saveDoorUpgrade(int doorId, int hp, int pDef, int mDef)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO fort_doorupgrade (doorId, hp, pDef, mDef) VALUES (?,?,?,?)"))
{
ps.setInt(1, doorId);
@@ -793,7 +793,7 @@ public final class Fort extends AbstractResidence
_lastOwnedTime.setTimeInMillis(0);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET owner=?,lastOwnedTime=?,state=?,castleId=? WHERE id = ?"))
{
ps.setInt(1, clanId);
@@ -998,7 +998,7 @@ public final class Fort extends AbstractResidence
{
_state = state;
_castleId = castleId;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET state=?,castleId=? WHERE id = ?"))
{
ps.setInt(1, _state);
@@ -1130,7 +1130,7 @@ public final class Fort extends AbstractResidence
private void initNpcs()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_spawnlist WHERE fortId = ? AND spawnType = ?"))
{
ps.setInt(1, getResidenceId());
@@ -1159,7 +1159,7 @@ public final class Fort extends AbstractResidence
private void initSiegeNpcs()
{
_siegeNpcs.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, npcId, x, y, z, heading FROM fort_spawnlist WHERE fortId = ? AND spawnType = ? ORDER BY id"))
{
ps.setInt(1, getResidenceId());
@@ -1186,7 +1186,7 @@ public final class Fort extends AbstractResidence
private void initNpcCommanders()
{
_npcCommanders.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, npcId, x, y, z, heading FROM fort_spawnlist WHERE fortId = ? AND spawnType = ? ORDER BY id"))
{
ps.setInt(1, getResidenceId());
@@ -1216,7 +1216,7 @@ public final class Fort extends AbstractResidence
_specialEnvoys.clear();
_envoyCastles.clear();
_availableCastles.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, npcId, x, y, z, heading, castleId FROM fort_spawnlist WHERE fortId = ? AND spawnType = ? ORDER BY id"))
{
ps.setInt(1, getResidenceId());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/FortSiege.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/FortSiege.java
index ffba04e6c3..d558045fab 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/FortSiege.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/FortSiege.java
@@ -501,7 +501,7 @@ public class FortSiege implements Siegable
/** Clear all registered siege clans from database for fort */
public void clearSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM fortsiege_clans WHERE fort_id=?"))
{
ps.setInt(1, _fort.getResidenceId());
@@ -785,7 +785,7 @@ public class FortSiege implements Siegable
private void removeSiegeClan(int clanId)
{
final String query = (clanId != 0) ? DELETE_FORT_SIEGECLANS_BY_CLAN_ID : DELETE_FORT_SIEGECLANS;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(query))
{
statement.setInt(1, _fort.getResidenceId());
@@ -999,7 +999,7 @@ public class FortSiege implements Siegable
private void loadSiegeClan()
{
_attackerClans.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clan_id FROM fortsiege_clans WHERE fort_id=?"))
{
ps.setInt(1, _fort.getResidenceId());
@@ -1057,7 +1057,7 @@ public class FortSiege implements Siegable
/** Save siege date to database. */
private void saveSiegeDate()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET siegeDate = ? WHERE id = ?"))
{
ps.setLong(1, _fort.getSiegeDate().getTimeInMillis());
@@ -1081,7 +1081,7 @@ public class FortSiege implements Siegable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO fortsiege_clans (clan_id,fort_id) values (?,?)"))
{
statement.setInt(1, clan.getId());
@@ -1146,7 +1146,7 @@ public class FortSiege implements Siegable
public void loadSiegeGuard()
{
_siegeGuards.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT npcId, x, y, z, heading, respawnDelay FROM fort_siege_guards WHERE fortId = ?"))
{
final int fortId = _fort.getResidenceId();
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Hero.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Hero.java
index 924ecead2f..27be59aa41 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Hero.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Hero.java
@@ -114,7 +114,7 @@ public class Hero
_herodiary.clear();
_heroMessage.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s1 = con.createStatement();
ResultSet rset = s1.executeQuery(GET_HEROES);
PreparedStatement ps = con.prepareStatement(GET_CLAN_ALLY);
@@ -211,7 +211,7 @@ public class Hero
*/
public void loadMessage(int charId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT message FROM heroes WHERE charId=?"))
{
statement.setInt(1, charId);
@@ -233,7 +233,7 @@ public class Hero
{
final List _diary = new CopyOnWriteArrayList<>();
int diaryentries = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM heroes_diary WHERE charId=? ORDER BY time ASC"))
{
statement.setInt(1, charId);
@@ -300,7 +300,7 @@ public class Hero
int _losses = 0;
int _draws = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM olympiad_fights WHERE (charOneId=? OR charTwoId=?) AND start ORDER BY start ASC"))
{
statement.setInt(1, charId);
@@ -699,7 +699,7 @@ public class Hero
public void updateHeroes(boolean setDefault)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (setDefault)
{
@@ -841,7 +841,7 @@ public class Hero
public void setDiaryData(int charId, int action, int param)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO heroes_diary (charId, time, action, param) values(?,?,?,?)"))
{
statement.setInt(1, charId);
@@ -877,7 +877,7 @@ public class Hero
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE heroes SET message=? WHERE charId=?;"))
{
statement.setString(1, _heroMessage.get(charId));
@@ -892,7 +892,7 @@ public class Hero
private void deleteItemsInDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_ITEMS))
{
statement.execute();
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Siege.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Siege.java
index bf5839337c..7876c9c6dd 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Siege.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/entity/Siege.java
@@ -760,7 +760,7 @@ public class Siege implements Siegable
/** Clear all registered siege clans from database for castle */
public void clearSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=?"))
{
statement.setInt(1, _castle.getResidenceId());
@@ -788,7 +788,7 @@ public class Siege implements Siegable
/** Clear all siege clans waiting for approval from database for castle */
public void clearSiegeWaitingClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=? and type = 2"))
{
statement.setInt(1, _castle.getResidenceId());
@@ -972,7 +972,7 @@ public class Siege implements Siegable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=? and clan_id=?"))
{
statement.setInt(1, _castle.getResidenceId());
@@ -1238,7 +1238,7 @@ public class Siege implements Siegable
private void loadSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT clan_id,type FROM siege_clans where castle_id=?"))
{
getAttackerClans().clear();
@@ -1349,7 +1349,7 @@ public class Siege implements Siegable
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castle), 1000);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE castle SET siegeDate = ?, regTimeEnd = ?, regTimeOver = ? WHERE id = ?"))
{
statement.setLong(1, _castle.getSiegeDate().getTimeInMillis());
@@ -1378,7 +1378,7 @@ public class Siege implements Siegable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if ((typeId == DEFENDER) || (typeId == DEFENDER_NOT_APPROVED) || (typeId == OWNER))
{
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java
index ac490ba86d..f23e511ede 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java
@@ -138,7 +138,7 @@ public class EventScheduler
public boolean updateLastRun()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO event_schedulers (eventName, schedulerName, lastRun) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE eventName = ?, schedulerName = ?, lastRun = ?"))
{
ps.setString(1, _eventManager.getName());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java
index 3185dae127..fc59ec7842 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java
@@ -52,7 +52,7 @@ public class HaventRunConditionalScheduler implements IConditionalEventScheduler
throw new NullPointerException("Scheduler not found: " + _name);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT lastRun FROM event_schedulers WHERE eventName = ? AND schedulerName = ?"))
{
ps.setString(1, _eventManager.getName());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/instancezone/Instance.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/instancezone/Instance.java
index 053ffa54cf..ccef54aad0 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/instancezone/Instance.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/instancezone/Instance.java
@@ -815,7 +815,7 @@ public final class Instance implements IIdentifiable, INamable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT IGNORE INTO character_instance_time (charId,instanceId,time) VALUES (?,?,?)"))
{
// Save to database
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java
index 24c473792a..3f1ad0c250 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java
@@ -191,7 +191,7 @@ public final class ItemAuction
public final void storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO item_auction (auctionId,instanceId,auctionItemId,startingTime,endingTime,auctionStateId) VALUES (?,?,?,?,?,?) ON DUPLICATE KEY UPDATE auctionStateId=?"))
{
statement.setInt(1, _auctionId);
@@ -225,7 +225,7 @@ public final class ItemAuction
final void updatePlayerBidInternal(ItemAuctionBid bid, boolean delete)
{
final String query = delete ? DELETE_ITEM_AUCTION_BID : INSERT_ITEM_AUCTION_BID;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(query))
{
ps.setInt(1, _auctionId);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java
index ec5eb4074e..d388e90796 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java
@@ -161,7 +161,7 @@ public final class ItemAuctionInstance
throw new IllegalArgumentException("No items defined");
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_AUCTION_ID_BY_INSTANCE_ID))
{
ps.setInt(1, _instanceId);
@@ -533,7 +533,7 @@ public final class ItemAuctionInstance
private ItemAuction loadAuction(int auctionId) throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
int auctionItemId = 0;
long startingTime = 0;
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java
index 87a89d8fc1..6d71b5e0fb 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java
@@ -1783,7 +1783,7 @@ public abstract class Inventory extends ItemContainer
@Override
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM items WHERE owner_id=? AND (loc=? OR loc=?) ORDER BY loc_data"))
{
ps.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java
index 1501c166e8..9a71ec3c76 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java
@@ -673,7 +673,7 @@ public abstract class ItemContainer
*/
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM items WHERE owner_id=? AND (loc=?)"))
{
ps.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java
index 9e94b591e8..09cbc47e3b 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java
@@ -112,7 +112,7 @@ public class Mail extends ItemContainer
@Override
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM items WHERE owner_id=? AND loc=? AND loc_data=?"))
{
statement.setInt(1, _ownerId);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java
index c01533e2c8..815125ad28 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java
@@ -738,7 +738,7 @@ public class PcInventory extends Inventory
public static int[][] restoreVisibleInventory(int objectId)
{
final int[][] paperdoll = new int[33][4];
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement2 = con.prepareStatement("SELECT object_id,item_id,loc_data,enchant_level FROM items WHERE owner_id=? AND loc='PAPERDOLL'"))
{
statement2.setInt(1, objectId);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java
index 3d8a2dea49..471923446d 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java
@@ -976,7 +976,7 @@ public final class L2ItemInstance extends L2Object
final VariationInstance augment = _augmentation;
_augmentation = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_variations WHERE itemId = ?"))
{
ps.setInt(1, getObjectId());
@@ -993,7 +993,7 @@ public final class L2ItemInstance extends L2Object
public void restoreAttributes()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("SELECT mineralId,option1,option2 FROM item_variations WHERE itemId=?");
PreparedStatement ps2 = con.prepareStatement("SELECT elemType,elemValue FROM item_elementals WHERE itemId=?"))
{
@@ -1034,7 +1034,7 @@ public final class L2ItemInstance extends L2Object
public void updateItemOptions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
updateItemOptions(con);
}
@@ -1062,7 +1062,7 @@ public final class L2ItemInstance extends L2Object
public void updateItemElementals()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
updateItemElements(con);
}
@@ -1224,7 +1224,7 @@ public final class L2ItemInstance extends L2Object
_elementals.remove(type);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_elementals WHERE itemId = ? AND elemType = ?"))
{
ps.setInt(1, getObjectId());
@@ -1249,7 +1249,7 @@ public final class L2ItemInstance extends L2Object
_elementals.clear();
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_elementals WHERE itemId = ?"))
{
ps.setInt(1, getObjectId());
@@ -1581,7 +1581,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE items SET owner_id=?,count=?,loc=?,loc_data=?,enchant_level=?,custom_type1=?,custom_type2=?,mana_left=?,time=? WHERE object_id = ?"))
{
ps.setInt(1, _ownerId);
@@ -1614,7 +1614,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO items (owner_id,item_id,count,loc,loc_data,enchant_level,object_id,custom_type1,custom_type2,mana_left,time) VALUES (?,?,?,?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, _ownerId);
@@ -1658,7 +1658,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM items WHERE object_id = ?"))
{
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java
index 44b0ac9c43..1ad8f4c201 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java
@@ -142,7 +142,7 @@ public class Olympiad extends ListenersContainer
{
_nobles.clear();
boolean loaded = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_LOAD_DATA);
ResultSet rset = statement.executeQuery())
{
@@ -221,7 +221,7 @@ public class Olympiad extends ListenersContainer
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_LOAD_NOBLES);
ResultSet rset = statement.executeQuery())
{
@@ -295,7 +295,7 @@ public class Olympiad extends ListenersContainer
{
_noblesRank.clear();
final Map tmpPlace = new HashMap<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(GET_ALL_CLASSIFIED_NOBLESS);
ResultSet rset = statement.executeQuery())
{
@@ -806,7 +806,7 @@ public class Olympiad extends ListenersContainer
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
for (Entry entry : _nobles.entrySet())
{
@@ -878,7 +878,7 @@ public class Olympiad extends ListenersContainer
{
saveNobleData();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_SAVE_DATA))
{
statement.setInt(1, _currentCycle);
@@ -919,7 +919,7 @@ public class Olympiad extends ListenersContainer
protected void updateMonthlyData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(OLYMPIAD_MONTH_CLEAR);
PreparedStatement ps2 = con.prepareStatement(OLYMPIAD_MONTH_CREATE))
{
@@ -963,7 +963,7 @@ public class Olympiad extends ListenersContainer
final List heroesToBe = new LinkedList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_GET_HEROS))
{
StatsSet hero;
@@ -998,7 +998,7 @@ public class Olympiad extends ListenersContainer
{
final List names = new ArrayList<>();
final String query = Config.ALT_OLY_SHOW_MONTHLY_WINNERS ? ((classId == 132) ? GET_EACH_CLASS_LEADER_SOULHOUND : GET_EACH_CLASS_LEADER) : ((classId == 132) ? GET_EACH_CLASS_LEADER_CURRENT_SOULHOUND : GET_EACH_CLASS_LEADER_CURRENT);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(query))
{
ps.setInt(1, classId);
@@ -1108,7 +1108,7 @@ public class Olympiad extends ListenersContainer
public int getLastNobleOlympiadPoints(int objId)
{
int result = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT olympiad_points FROM olympiad_nobles_eom WHERE charId = ?"))
{
ps.setInt(1, objId);
@@ -1252,7 +1252,7 @@ public class Olympiad extends ListenersContainer
protected void deleteNobles()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_DELETE_ALL))
{
statement.execute();
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java
index 9249ca2223..2824298209 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java
@@ -743,7 +743,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
protected static void saveResults(Participant one, Participant two, int winner, long startTime, long fightTime, CompetitionType type)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO olympiad_fights (charOneId, charTwoId, charOneClass, charTwoClass, winner, start, time, classed) values(?,?,?,?,?,?,?,?)"))
{
statement.setInt(1, one.getObjectId());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java
index d73e56cbe8..c805ee421d 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java
@@ -185,7 +185,7 @@ public class PunishmentTask implements Runnable
{
if (!_isStored)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
{
st.setString(1, _key);
@@ -224,7 +224,7 @@ public class PunishmentTask implements Runnable
{
if (_isStored)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(UPDATE_QUERY))
{
st.setLong(1, System.currentTimeMillis());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java
index 248d5997e4..0dea776f93 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java
@@ -409,7 +409,7 @@ public class LongTimeEvent extends Quest
}
}
// Update database
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM items WHERE item_id=?"))
{
statement.setInt(1, itemId);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/quest/Quest.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/quest/Quest.java
index f7ea5f451e..5ad0c2aebd 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/quest/Quest.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/quest/Quest.java
@@ -1589,7 +1589,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void playerEnter(L2PcInstance player)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement invalidQuestData = con.prepareStatement("DELETE FROM character_quests WHERE charId = ? AND name = ?");
PreparedStatement invalidQuestDataVar = con.prepareStatement("DELETE FROM character_quests WHERE charId = ? AND name = ? AND var = ?");
PreparedStatement ps1 = con.prepareStatement("SELECT name, value FROM character_quests WHERE charId = ? AND var = ?"))
@@ -1671,7 +1671,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void createQuestVarInDb(QuestState qs, String var, String value)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_quests (charId,name,var,value) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE value=?"))
{
statement.setInt(1, qs.getPlayer().getObjectId());
@@ -1695,7 +1695,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void updateQuestVarInDb(QuestState qs, String var, String value)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE character_quests SET value=? WHERE charId=? AND name=? AND var = ?"))
{
statement.setString(1, value);
@@ -1717,7 +1717,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void deleteQuestVarInDb(QuestState qs, String var)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_quests WHERE charId=? AND name=? AND var=?"))
{
statement.setInt(1, qs.getPlayer().getObjectId());
@@ -1738,7 +1738,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void deleteQuestInDb(QuestState qs, boolean repeatable)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(repeatable ? QUEST_DELETE_FROM_CHAR_QUERY : QUEST_DELETE_FROM_CHAR_QUERY_NON_REPEATABLE_QUERY))
{
ps.setInt(1, qs.getPlayer().getObjectId());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java
index 11c78a1a47..9af2be9039 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java
@@ -126,7 +126,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
protected void initFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM residence_functions WHERE residenceId = ?"))
{
ps.setInt(1, _residenceId);
@@ -164,7 +164,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
public void addFunction(ResidenceFunction func)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO residence_functions (id, level, expiration, residenceId) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE level = ?, expiration = ?"))
{
ps.setInt(1, func.getId());
@@ -196,7 +196,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
public void removeFunction(ResidenceFunction func)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM residence_functions WHERE residenceId = ? and id = ?"))
{
ps.setInt(1, _residenceId);
@@ -219,7 +219,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
public void removeFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM residence_functions WHERE residenceId = ?"))
{
ps.setInt(1, _residenceId);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
index 8b91fc77d2..53958bcf5c 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
@@ -50,7 +50,7 @@ public class AccountVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setString(1, _accountName);
@@ -83,7 +83,7 @@ public class AccountVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -120,7 +120,7 @@ public class AccountVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java
index 50fcf2ab6f..5af41a23af 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java
@@ -50,7 +50,7 @@ public class ClanVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setInt(1, _objectId);
@@ -83,7 +83,7 @@ public class ClanVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -120,7 +120,7 @@ public class ClanVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java
index c7ba2ff071..048b15a86e 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java
@@ -55,7 +55,7 @@ public class ItemVariables extends AbstractVariables
public static boolean hasVariables(int objectId)
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_COUNT))
{
st.setInt(1, objectId);
@@ -79,7 +79,7 @@ public class ItemVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setInt(1, _objectId);
@@ -112,7 +112,7 @@ public class ItemVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -149,7 +149,7 @@ public class ItemVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
index de6f796ad4..74e0dcae96 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
@@ -76,7 +76,7 @@ public class PlayerVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setInt(1, _objectId);
@@ -109,7 +109,7 @@ public class PlayerVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -146,7 +146,7 @@ public class PlayerVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/L2GameClient.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/L2GameClient.java
index f1e975876e..fd5baeb233 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/L2GameClient.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/L2GameClient.java
@@ -329,7 +329,7 @@ public final class L2GameClient extends ChannelInboundHandler
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps2 = con.prepareStatement("UPDATE characters SET deletetime=? WHERE charId=?"))
{
ps2.setLong(1, System.currentTimeMillis() + (Config.DELETE_DAYS * 86400000)); // 24*60*60*1000 = 86400000
@@ -354,7 +354,7 @@ public final class L2GameClient extends ChannelInboundHandler
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE characters SET deletetime=0 WHERE charId=?"))
{
statement.setInt(1, objectId);
@@ -377,7 +377,7 @@ public final class L2GameClient extends ChannelInboundHandler
CharNameTable.getInstance().removeName(objid);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM character_contacts WHERE charId=? OR contactId=?"))
{
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
index 297edda360..afcc3fcbb0 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
@@ -164,7 +164,7 @@ public final class RequestDestroyItem implements IClientIncomingPacket
pet.unSummon(activeChar);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
{
statement.setInt(1, _objectId);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java
index 29ab10a108..a9c8dadb8a 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java
@@ -62,7 +62,7 @@ public class RequestPetitionFeedback implements IClientIncomingPacket
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_FEEDBACK))
{
statement.setString(1, player.getName());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java
index a2d7c3bba4..537d7f2618 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java
@@ -73,7 +73,7 @@ public final class RequestAnswerFriendInvite implements IClientIncomingPacket
if (_response == 1)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_friends (charId, friendId) VALUES (?, ?), (?, ?)"))
{
statement.setInt(1, requestor.getObjectId());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java
index 03435f7f4d..bfe07c3aed 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java
@@ -75,7 +75,7 @@ public final class RequestFriendDel implements IClientIncomingPacket
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_friends WHERE (charId=? AND friendId=?) OR (charId=? AND friendId=?)"))
{
statement.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java
index 94715a15c1..27668b0d62 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java
@@ -74,7 +74,7 @@ public class ConfirmMenteeAdd implements IClientIncomingPacket
}
else if (validate(mentor, mentee))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_mentees (charId, mentorId) VALUES (?, ?)"))
{
statement.setInt(1, mentee.getObjectId());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java
index 7f30770ced..a9f76181bc 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java
@@ -225,7 +225,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
CharSelectInfoPackage charInfopackage;
final List characterList = new LinkedList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM characters WHERE account_name=? ORDER BY createDate"))
{
statement.setString(1, loginName);
@@ -258,7 +258,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
private static void loadCharacterSubclassInfo(CharSelectInfoPackage charInfopackage, int ObjectId, int activeClassId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT exp, sp, level, vitality_points FROM character_subclasses WHERE charId=? AND class_id=? ORDER BY charId"))
{
statement.setInt(1, ObjectId);
@@ -368,7 +368,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
if (weaponObjId > 0)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT mineralId,option1,option2 FROM item_variations WHERE itemId=?"))
{
statement.setInt(1, weaponObjId);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java
index 14cd41a31e..ebb3f90088 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java
@@ -70,7 +70,7 @@ public class FriendList implements IClientOutgoingPacket
if (player1 == null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT char_name, online, classid, level FROM characters WHERE charId = ?"))
{
statement.setInt(1, objId);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java
index 8344576a3e..8876431ff9 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java
@@ -72,7 +72,7 @@ public class SecondaryPasswordAuth
private void loadPassword()
{
String var, value = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SELECT_PASSWORD))
{
statement.setString(1, _activeClient.getAccountName());
@@ -117,7 +117,7 @@ public class SecondaryPasswordAuth
password = cryptPassword(password);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_PASSWORD))
{
statement.setString(1, _activeClient.getAccountName());
@@ -136,7 +136,7 @@ public class SecondaryPasswordAuth
public boolean insertWrongAttempt(int attempts)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_ATTEMPT))
{
statement.setString(1, _activeClient.getAccountName());
@@ -175,7 +175,7 @@ public class SecondaryPasswordAuth
newPassword = cryptPassword(newPassword);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_PASSWORD))
{
statement.setString(1, newPassword);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
index ca0cef4b3b..a78d28bdc9 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
@@ -95,7 +95,7 @@ public final class TaskManager
{
task.onTimeElapsed(this);
lastActivation = System.currentTimeMillis();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[1]))
{
statement.setLong(1, lastActivation);
@@ -182,7 +182,7 @@ public final class TaskManager
private void startAllTasks()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[0]);
ResultSet rset = statement.executeQuery())
{
@@ -314,7 +314,7 @@ public final class TaskManager
private static boolean addUniqueTask(String task, TaskTypes type, String param1, String param2, String param3, long lastActivation)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(SQL_STATEMENTS[2]))
{
ps1.setString(1, task);
@@ -350,7 +350,7 @@ public final class TaskManager
private static boolean addTask(String task, TaskTypes type, String param1, String param2, String param3, long lastActivation)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[3]))
{
statement.setString(1, task);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java
index 5e3e35c6a9..e81b95cba3 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java
@@ -76,7 +76,7 @@ public class TaskBirthday extends Task
private void checkBirthday(int year, int month, int day)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY))
{
statement.setString(1, "%-" + getNum(month + 1) + "-" + getNum(day));
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/Evolve.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/Evolve.java
index 66a22f62fd..f87e33ed8d 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/Evolve.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/gameserver/util/Evolve.java
@@ -248,7 +248,7 @@ public final class Evolve
}
// pet control item no longer exists, delete the pet from the db
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
{
ps.setInt(1, removedItem.getObjectId());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/GameServerTable.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/GameServerTable.java
index 1a0713b155..2410f6ede8 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/GameServerTable.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/GameServerTable.java
@@ -115,7 +115,7 @@ public final class GameServerTable implements IGameXmlReader
*/
private void loadRegisteredGameServers()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT * FROM gameservers"))
{
@@ -222,7 +222,7 @@ public final class GameServerTable implements IGameXmlReader
public void registerServerOnDB(byte[] hexId, int id, String externalHost)
{
register(id, new GameServerInfo(id, hexId));
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO gameservers (hexid,server_id,host) values (?,?,?)"))
{
ps.setString(1, hexToString(hexId));
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/LoginController.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/LoginController.java
index a896c7fd7a..fbee48fc33 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/LoginController.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/LoginController.java
@@ -176,7 +176,7 @@ public class LoginController
final byte[] raw = password.getBytes(StandardCharsets.UTF_8);
final String hashBase64 = Base64.getEncoder().encodeToString(md.digest(raw));
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(USER_INFO_SELECT))
{
ps.setString(1, Long.toString(System.currentTimeMillis()));
@@ -206,7 +206,7 @@ public class LoginController
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(AUTOCREATE_ACCOUNTS_INSERT))
{
ps.setString(1, login);
@@ -405,7 +405,7 @@ public class LoginController
if (loginOk && (client.getLastServer() != serverId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_LAST_SERVER_UPDATE))
{
ps.setInt(1, serverId);
@@ -424,7 +424,7 @@ public class LoginController
public void setAccountAccessLevel(String account, int banLevel)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_ACCESS_LEVEL_UPDATE))
{
ps.setInt(1, banLevel);
@@ -439,7 +439,7 @@ public class LoginController
public void setAccountLastTracert(String account, String pcIp, String hop1, String hop2, String hop3, String hop4)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_IPS_UPDATE))
{
ps.setString(1, pcIp);
@@ -499,7 +499,7 @@ public class LoginController
{
final List ipWhiteList = new ArrayList<>();
final List ipBlackList = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_IPAUTH_SELECT))
{
ps.setString(1, info.getLogin());
@@ -545,7 +545,7 @@ public class LoginController
client.setAccessLevel(info.getAccessLevel());
client.setLastServer(info.getLastServer());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_INFO_UPDATE))
{
ps.setLong(1, System.currentTimeMillis());
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/LoginServer.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/LoginServer.java
index 39377afee3..d598992bdf 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/LoginServer.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/LoginServer.java
@@ -89,7 +89,7 @@ public final class LoginServer
Config.load();
// Prepare Database
- DatabaseFactory.getInstance();
+ DatabaseFactory.init();
try
{
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java
index 69ba99271d..6c73dea27a 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java
@@ -78,7 +78,7 @@ public class ChangePassword extends BaseRecievePacket
int passUpdated = 0;
// SQL connection
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT password FROM accounts WHERE login=?"))
{
ps.setString(1, accountName);
@@ -95,7 +95,7 @@ public class ChangePassword extends BaseRecievePacket
{
final byte[] password = md.digest(newpass.getBytes("UTF-8"));
// SQL connection
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE accounts SET password=? WHERE login=?"))
{
ps.setString(1, Base64.getEncoder().encodeToString(password));
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java
index f9a24a80d8..785946a687 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java
@@ -58,7 +58,7 @@ public class RequestTempBan extends BaseRecievePacket
private void banUser()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO account_data VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE value=?"))
{
ps.setString(1, _accountName);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
index 59b0e01835..4fb705c8b1 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
@@ -43,6 +43,7 @@ public class SQLAccountManager
{
Server.serverMode = Server.MODE_LOGINSERVER;
Config.load();
+ DatabaseFactory.init();
try (Scanner _scn = new Scanner(System.in))
{
@@ -166,7 +167,7 @@ public class SQLAccountManager
}
q = q.concat(" ORDER BY login ASC");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(q);
ResultSet rset = ps.executeQuery())
{
@@ -187,7 +188,7 @@ public class SQLAccountManager
private static void addOrUpdateAccount(String account, String password, String level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE accounts(login, password, accessLevel) VALUES (?, ?, ?)"))
{
final MessageDigest md = MessageDigest.getInstance("SHA");
@@ -213,7 +214,7 @@ public class SQLAccountManager
private static void changeAccountLevel(String account, String level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE accounts SET accessLevel = ? WHERE login = ?"))
{
ps.setString(1, level);
@@ -236,7 +237,7 @@ public class SQLAccountManager
private static void deleteAccount(String account)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM accounts WHERE login = ?"))
{
ps.setString(1, account);
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java
index 4ac531c664..fd25fddae4 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java
@@ -34,7 +34,7 @@ public class DBInstallerConsole implements DBOutputInterface
public DBInstallerConsole(String db, String dir) throws Exception
{
- System.out.println("Welcome to L2J DataBase installer");
+ System.out.println("Welcome to DataBase installer");
final Preferences prop = Preferences.userRoot();
RunTasks rt = null;
try (Scanner scn = new Scanner(new CloseShieldedInputStream(System.in)))
diff --git a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
index c90c8127a6..8e5a6bde49 100644
--- a/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
+++ b/L2J_Mobius_1.0_Ertheia/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
@@ -187,6 +187,7 @@ public abstract class BaseGameServerRegister
Server.serverMode = Server.MODE_LOGINSERVER;
Config.load();
+ DatabaseFactory.init();
GameServerTable.getInstance();
_loaded = true;
@@ -215,7 +216,7 @@ public abstract class BaseGameServerRegister
*/
public static void unregisterGameServer(int id) throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM gameservers WHERE server_id = ?"))
{
@@ -231,7 +232,7 @@ public abstract class BaseGameServerRegister
*/
public static void unregisterAllGameServers() throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("DELETE FROM gameservers");
diff --git a/L2J_Mobius_1.0_Ertheia/launcher/Gameserver.launch b/L2J_Mobius_1.0_Ertheia/launcher/Gameserver.launch
index 2a24251c07..31a7c2da44 100644
--- a/L2J_Mobius_1.0_Ertheia/launcher/Gameserver.launch
+++ b/L2J_Mobius_1.0_Ertheia/launcher/Gameserver.launch
@@ -7,12 +7,13 @@
-
+
+
diff --git a/L2J_Mobius_1.0_Ertheia/launcher/Loginserver.launch b/L2J_Mobius_1.0_Ertheia/launcher/Loginserver.launch
index 54dd0f788b..1fdde6060d 100644
--- a/L2J_Mobius_1.0_Ertheia/launcher/Loginserver.launch
+++ b/L2J_Mobius_1.0_Ertheia/launcher/Loginserver.launch
@@ -7,7 +7,7 @@
-
+
@@ -15,5 +15,6 @@
+
diff --git a/L2J_Mobius_2.5_Underground/.classpath b/L2J_Mobius_2.5_Underground/.classpath
index 0e50693da9..619d354392 100644
--- a/L2J_Mobius_2.5_Underground/.classpath
+++ b/L2J_Mobius_2.5_Underground/.classpath
@@ -5,11 +5,12 @@
-
+
-
+
+
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java
index 9a3b363f56..68ef6d5320 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java
@@ -76,7 +76,7 @@ public final class AdminChangeAccessLevel implements IAdminCommandHandler
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET accesslevel=? WHERE char_name=?");
statement.setInt(1, lvl);
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
index df8b849989..3a1d5a2069 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
@@ -631,7 +631,7 @@ public class AdminEditChar implements IAdminCommandHandler
if (player == null)
{
- final Connection con = DatabaseFactory.getInstance().getConnection();
+ final Connection con = DatabaseFactory.getConnection();
final PreparedStatement ps = con.prepareStatement("UPDATE characters SET " + (changeCreateExpiryTime ? "clan_create_expiry_time" : "clan_join_expiry_time") + " WHERE char_name=? LIMIT 1");
ps.setString(1, playerName);
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java
index 764ab77c25..969633adcb 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java
@@ -62,7 +62,7 @@ public class AdminRepairChar implements IAdminCommandHandler
}
final String cmd = "UPDATE characters SET x=-84318, y=244579, z=-3730 WHERE char_name=?";
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(cmd);
statement.setString(1, parts[1]);
@@ -87,13 +87,13 @@ public class AdminRepairChar implements IAdminCommandHandler
return;
}
- // connection = L2DatabaseFactory.getInstance().getConnection();
+ // connection = L2DatabaseFactory.getConnection();
statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=?");
statement.setInt(1, objId);
statement.execute();
statement.close();
- // connection = L2DatabaseFactory.getInstance().getConnection();
+ // connection = L2DatabaseFactory.getConnection();
statement = con.prepareStatement("UPDATE items SET loc=\"INVENTORY\" WHERE owner_id=?");
statement.setInt(1, objId);
statement.execute();
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java
index 780c3b0088..da0c7dcad2 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java
@@ -173,7 +173,7 @@ public class AdminShowQuests implements IAdminCommandHandler
private static void showQuestMenu(L2PcInstance target, L2PcInstance actor, String[] val)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
ResultSet rs;
PreparedStatement req;
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java
index 35508761a2..a8b6ed6963 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java
@@ -489,7 +489,7 @@ public class AdminTeleport implements IAdminCommandHandler
final int x = activeChar.getX();
final int y = activeChar.getY();
final int z = activeChar.getZ();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=? WHERE char_name=?");
statement.setInt(1, x);
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java
index b4e722f105..3913b5b368 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java
@@ -61,7 +61,7 @@ public class FavoriteBoard implements IParseBoardHandler
// Load Favorite links
final String list = HtmCache.getInstance().getHtm(activeChar, "data/html/CommunityBoard/favorite_list.html");
final StringBuilder sb = new StringBuilder();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_FAVORITES))
{
ps.setInt(1, activeChar.getObjectId());
@@ -98,7 +98,7 @@ public class FavoriteBoard implements IParseBoardHandler
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_FAVORITE))
{
ps.setInt(1, activeChar.getObjectId());
@@ -123,7 +123,7 @@ public class FavoriteBoard implements IParseBoardHandler
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_FAVORITE))
{
ps.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/communityboard/HomeBoard.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
index bed19004d2..1f5572ec39 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
@@ -300,7 +300,7 @@ public final class HomeBoard implements IParseBoardHandler
private static int getFavoriteCount(L2PcInstance player)
{
int count = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(COUNT_FAVORITES))
{
ps.setInt(1, player.getObjectId());
diff --git a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
index 59ecba44bb..e0708990b7 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
+++ b/L2J_Mobius_2.5_Underground/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
@@ -62,7 +62,7 @@ public class ClanWarsList implements IUserCommandHandler
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
String query;
// Attack List
diff --git a/L2J_Mobius_2.5_Underground/dist/game/java.cfg b/L2J_Mobius_2.5_Underground/dist/game/java.cfg
index cb4a4dc204..58213e428e 100644
--- a/L2J_Mobius_2.5_Underground/dist/game/java.cfg
+++ b/L2J_Mobius_2.5_Underground/dist/game/java.cfg
@@ -1 +1 @@
--server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
\ No newline at end of file
+-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=error -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
\ No newline at end of file
diff --git a/L2J_Mobius_2.5_Underground/dist/libs/HikariCP-3.2.0.jar b/L2J_Mobius_2.5_Underground/dist/libs/HikariCP-3.2.0.jar
new file mode 100644
index 0000000000..a030a7f8dc
Binary files /dev/null and b/L2J_Mobius_2.5_Underground/dist/libs/HikariCP-3.2.0.jar differ
diff --git a/L2J_Mobius_2.5_Underground/dist/libs/c3p0-0.9.5.2.jar b/L2J_Mobius_2.5_Underground/dist/libs/c3p0-0.9.5.2.jar
deleted file mode 100644
index 579cedd980..0000000000
Binary files a/L2J_Mobius_2.5_Underground/dist/libs/c3p0-0.9.5.2.jar and /dev/null differ
diff --git a/L2J_Mobius_2.5_Underground/dist/libs/mchange-commons-java-0.2.12.jar b/L2J_Mobius_2.5_Underground/dist/libs/mchange-commons-java-0.2.12.jar
deleted file mode 100644
index af11054860..0000000000
Binary files a/L2J_Mobius_2.5_Underground/dist/libs/mchange-commons-java-0.2.12.jar and /dev/null differ
diff --git a/L2J_Mobius_2.5_Underground/dist/libs/slf4j-api-1.7.25.jar b/L2J_Mobius_2.5_Underground/dist/libs/slf4j-api-1.7.25.jar
new file mode 100644
index 0000000000..7e62f1336d
Binary files /dev/null and b/L2J_Mobius_2.5_Underground/dist/libs/slf4j-api-1.7.25.jar differ
diff --git a/L2J_Mobius_2.5_Underground/dist/libs/slf4j-simple-1.7.25.jar b/L2J_Mobius_2.5_Underground/dist/libs/slf4j-simple-1.7.25.jar
new file mode 100644
index 0000000000..b29ca12719
Binary files /dev/null and b/L2J_Mobius_2.5_Underground/dist/libs/slf4j-simple-1.7.25.jar differ
diff --git a/L2J_Mobius_2.5_Underground/dist/login/java.cfg b/L2J_Mobius_2.5_Underground/dist/login/java.cfg
index 00ae5b3a66..bda4cdd24d 100644
--- a/L2J_Mobius_2.5_Underground/dist/login/java.cfg
+++ b/L2J_Mobius_2.5_Underground/dist/login/java.cfg
@@ -1 +1 @@
--server -Xms128m -Xmx256m
\ No newline at end of file
+-server -Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=error -Xms128m -Xmx256m
\ No newline at end of file
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/commons/database/DatabaseFactory.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/commons/database/DatabaseFactory.java
index 68d02d4171..dd481d2fd0 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/commons/database/DatabaseFactory.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/commons/database/DatabaseFactory.java
@@ -16,122 +16,68 @@
*/
package com.l2jmobius.commons.database;
-import java.beans.PropertyVetoException;
import java.sql.Connection;
-import java.sql.SQLException;
import java.util.logging.Logger;
import com.l2jmobius.Config;
-import com.mchange.v2.c3p0.ComboPooledDataSource;
+import com.zaxxer.hikari.HikariDataSource;
/**
- * Database Factory implementation.
- * @author Zoey76, Mobius
+ * @author Mobius
*/
public class DatabaseFactory
{
private static final Logger LOGGER = Logger.getLogger(DatabaseFactory.class.getName());
- private final ComboPooledDataSource _dataSource;
+ private static final HikariDataSource _hds = new HikariDataSource();
- public DatabaseFactory()
+ public static void init()
{
- if (Config.DATABASE_MAX_CONNECTIONS < 2)
- {
- Config.DATABASE_MAX_CONNECTIONS = 2;
- LOGGER.warning("A minimum of 2 connections are required.");
- }
-
- _dataSource = new ComboPooledDataSource();
- _dataSource.setAutoCommitOnClose(true);
-
- _dataSource.setInitialPoolSize(10);
- _dataSource.setMinPoolSize(10);
- _dataSource.setMaxPoolSize(Math.max(10, Config.DATABASE_MAX_CONNECTIONS));
-
- _dataSource.setAcquireRetryAttempts(0); // try to obtain connections indefinitely (0 = never quit)
- _dataSource.setAcquireRetryDelay(500); // 500 milliseconds wait before try to acquire connection again
- _dataSource.setCheckoutTimeout(0); // 0 = wait indefinitely for new connection if pool is exhausted
- _dataSource.setAcquireIncrement(5); // if pool is exhausted, get 5 more connections at a time cause there is
- // a "long" delay on acquire connection so taking more than one connection at once will make connection pooling more effective.
-
- // this "connection_test_table" is automatically created if not already there
- _dataSource.setAutomaticTestTable("connection_test_table");
- _dataSource.setTestConnectionOnCheckin(false);
-
- // testing OnCheckin used with IdleConnectionTestPeriod is faster than testing on checkout
-
- _dataSource.setIdleConnectionTestPeriod(3600); // test idle connection every 60 sec
- _dataSource.setMaxIdleTime(Config.DATABASE_MAX_IDLE_TIME); // 0 = idle connections never expire
- // *THANKS* to connection testing configured above but I prefer to disconnect all connections not used for more than 1 hour
-
- // enables statement caching, there is a "semi-bug" in c3p0 0.9.0 but in 0.9.0.2 and later it's fixed
- _dataSource.setMaxStatementsPerConnection(100);
-
- _dataSource.setBreakAfterAcquireFailure(false); // never fail if any way possible setting this to true will make c3p0 "crash"
- // and refuse to work till restart thus making acquire errors "FATAL" ... we don't want that it should be possible to recover
+ _hds.setDriverClassName(Config.DATABASE_DRIVER);
+ _hds.setJdbcUrl(Config.DATABASE_URL);
+ _hds.setUsername(Config.DATABASE_LOGIN);
+ _hds.setPassword(Config.DATABASE_PASSWORD);
+ _hds.setMaximumPoolSize(Config.DATABASE_MAX_CONNECTIONS);
+ _hds.setIdleTimeout(Config.DATABASE_MAX_IDLE_TIME);
+ // Test if connection is valid.
try
{
- _dataSource.setDriverClass(Config.DATABASE_DRIVER);
+ _hds.getConnection().close();
+ LOGGER.info("Database: Initialized.");
}
- catch (PropertyVetoException e)
+ catch (Exception e)
{
e.printStackTrace();
}
- _dataSource.setJdbcUrl(Config.DATABASE_URL);
- _dataSource.setUser(Config.DATABASE_LOGIN);
- _dataSource.setPassword(Config.DATABASE_PASSWORD);
-
- /* Test the connection */
- try
- {
- _dataSource.getConnection().close();
- }
- catch (SQLException e)
- {
- e.printStackTrace();
- }
-
- LOGGER.info("Database: Initialized.");
}
- public Connection getConnection()
+ public static Connection getConnection()
{
Connection con = null;
while (con == null)
{
try
{
- con = _dataSource.getConnection();
+ con = _hds.getConnection();
}
- catch (SQLException e)
+ catch (Exception e)
{
- LOGGER.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage());
+ LOGGER.severe("DatabaseFactory: Cound not get a connection. " + e);
}
}
return con;
}
- public void close()
+ public static void close()
{
try
{
- _dataSource.close();
+ _hds.close();
}
catch (Exception e)
{
- LOGGER.info(e.getMessage());
+ LOGGER.severe("DatabaseFactory: There was a problem closing the data source. " + e);
}
}
-
- public static DatabaseFactory getInstance()
- {
- return SingletonHolder.INSTANCE;
- }
-
- private static class SingletonHolder
- {
- protected static final DatabaseFactory INSTANCE = new DatabaseFactory();
- }
}
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/GameServer.java
index 7028d9efe1..be5ac73b54 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/GameServer.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/GameServer.java
@@ -196,7 +196,7 @@ public class GameServer
// Initialize config
Config.load();
printSection("Database");
- DatabaseFactory.getInstance();
+ DatabaseFactory.init();
printSection("ThreadPool");
ThreadPool.init();
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/LoginServerThread.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/LoginServerThread.java
index ea976c4545..22b6b4cf67 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/LoginServerThread.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/LoginServerThread.java
@@ -584,7 +584,7 @@ public class LoginServerThread extends Thread
int chars = 0;
final List charToDel = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT deletetime FROM characters WHERE account_name=?"))
{
ps.setString(1, account);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/Shutdown.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/Shutdown.java
index 72caae1c02..ec983b9153 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/Shutdown.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/Shutdown.java
@@ -204,7 +204,7 @@ public class Shutdown extends Thread
// commit data, last chance
try
{
- DatabaseFactory.getInstance().close();
+ DatabaseFactory.close();
LOGGER.info("Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
}
catch (Throwable t)
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
index 3f98953c02..320a104fca 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
@@ -93,7 +93,7 @@ public class Forum
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM forums WHERE forum_id=?"))
{
ps.setInt(1, _forumId);
@@ -114,7 +114,7 @@ public class Forum
LOGGER.log(Level.WARNING, "Data error on Forum " + _forumId + " : " + e.getMessage(), e);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM topic WHERE topic_forum_id=? ORDER BY topic_id DESC"))
{
ps.setInt(1, _forumId);
@@ -139,7 +139,7 @@ public class Forum
private void getChildren()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT forum_id FROM forums WHERE forum_parent=?"))
{
ps.setInt(1, _forumId);
@@ -217,7 +217,7 @@ public class Forum
public void insertIntoDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO forums (forum_id,forum_name,forum_parent,forum_post,forum_type,forum_perm,forum_owner_id) VALUES (?,?,?,?,?,?,?)"))
{
ps.setInt(1, _forumId);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
index fa2f1da2d9..5f970fa0a5 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
@@ -72,7 +72,7 @@ public class Post
private void insertindb(CPost cp)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)"))
{
ps.setInt(1, cp.postId);
@@ -112,7 +112,7 @@ public class Post
public void deleteme(Topic t)
{
PostBBSManager.getInstance().delPostByTopic(t);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM posts WHERE post_forum_id=? AND post_topic_id=?"))
{
ps.setInt(1, t.getForumID());
@@ -130,7 +130,7 @@ public class Post
*/
private void load(Topic t)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM posts WHERE post_forum_id=? AND post_topic_id=? ORDER BY post_id ASC"))
{
ps.setInt(1, t.getForumID());
@@ -162,7 +162,7 @@ public class Post
*/
public void updatetxt(int i)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?"))
{
final CPost cp = getCPost(i);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
index ae7b7c6318..2cb2303f58 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
@@ -71,7 +71,7 @@ public class Topic
private void insertindb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO topic (topic_id,topic_forum_id,topic_name,topic_date,topic_ownername,topic_ownerid,topic_type,topic_reply) values (?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, _id);
@@ -129,7 +129,7 @@ public class Topic
{
TopicBBSManager.getInstance().delTopic(this);
f.rmTopicByID(_id);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM topic WHERE topic_id=? AND topic_forum_id=?"))
{
ps.setInt(1, _id);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
index 57a47cf456..c68fb57089 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
@@ -40,7 +40,7 @@ public class ForumsBBSManager extends BaseBBSManager
protected ForumsBBSManager()
{
_table = new CopyOnWriteArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT forum_id FROM forums WHERE forum_type = 0"))
{
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java
index adc2b28a17..b3b101e521 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java
@@ -52,7 +52,7 @@ public final class AnnouncementsTable
private void load()
{
_announcements.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery("SELECT * FROM announcements"))
{
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java
index 4aa8b72edb..5bb8ebbe43 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java
@@ -99,7 +99,7 @@ public class CharNameTable
int id = -1;
int accessLevel = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT charId,accesslevel FROM characters WHERE char_name=?"))
{
ps.setString(1, name);
@@ -145,7 +145,7 @@ public class CharNameTable
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT char_name,accesslevel FROM characters WHERE charId=?"))
{
ps.setInt(1, id);
@@ -176,7 +176,7 @@ public class CharNameTable
public synchronized boolean doesCharNameExist(String name)
{
boolean result = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT COUNT(*) as count FROM characters WHERE char_name=?"))
{
ps.setString(1, name);
@@ -197,7 +197,7 @@ public class CharNameTable
public int getAccountCharacterCount(String account)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT COUNT(char_name) as count FROM characters WHERE account_name=?"))
{
ps.setString(1, account);
@@ -218,7 +218,7 @@ public class CharNameTable
public int getLevelById(int objectId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT level FROM characters WHERE charId = ?"))
{
ps.setInt(1, objectId);
@@ -239,7 +239,7 @@ public class CharNameTable
public int getClassIdById(int objectId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT classid FROM characters WHERE charId = ?"))
{
ps.setInt(1, objectId);
@@ -260,7 +260,7 @@ public class CharNameTable
public int getClanIdById(int objectId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clanId FROM characters WHERE charId = ?"))
{
ps.setInt(1, objectId);
@@ -281,7 +281,7 @@ public class CharNameTable
private void loadAll()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT charId, char_name, accesslevel FROM characters"))
{
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java
index 021a434a38..6315404c36 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java
@@ -70,7 +70,7 @@ public class CharSummonTable
{
if (Config.RESTORE_SERVITOR_ON_RECONNECT)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(INIT_SUMMONS))
{
@@ -87,7 +87,7 @@ public class CharSummonTable
if (Config.RESTORE_PET_ON_RECONNECT)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(INIT_PET))
{
@@ -111,7 +111,7 @@ public class CharSummonTable
return !v.isEmpty() ? v : null;
});
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(REMOVE_SUMMON))
{
ps.setInt(1, activeChar.getObjectId());
@@ -181,7 +181,7 @@ public class CharSummonTable
public void restoreServitor(L2PcInstance activeChar)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(LOAD_SUMMON))
{
ps.setInt(1, activeChar.getObjectId());
@@ -229,7 +229,7 @@ public class CharSummonTable
_servitors.computeIfAbsent(summon.getOwner().getObjectId(), k -> ConcurrentHashMap.newKeySet()).add(summon.getObjectId());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SAVE_SUMMON))
{
ps.setInt(1, summon.getOwner().getObjectId());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java
index 77aa1fb5fb..024b76d419 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java
@@ -79,7 +79,7 @@ public class ClanTable
L2Clan clan;
// Count the clans
int clanCount = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT clan_id FROM clan_data"))
{
@@ -258,7 +258,7 @@ public class ClanTable
_clans.remove(clanId);
IdFactory.getInstance().releaseId(clanId);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM clan_data WHERE clan_id=?"))
{
@@ -357,7 +357,7 @@ public class ClanTable
public void storeclanswars(ClanWar war)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO clan_wars (clan1, clan2, clan1Kill, clan2Kill, winnerClan, startTime, endTime, state) VALUES(?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, war.getAttackerClanId());
@@ -388,7 +388,7 @@ public class ClanTable
clan1.broadcastClanStatus();
clan2.broadcastClanStatus();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM clan_wars WHERE clan1=? AND clan2=?"))
{
ps.setInt(1, clanId1);
@@ -403,7 +403,7 @@ public class ClanTable
private void restorewars()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery("SELECT clan1, clan2, clan1Kill, clan2Kill, winnerClan, startTime, endTime, state FROM clan_wars"))
{
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java
index f90657a886..907f92e5f6 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java
@@ -72,7 +72,7 @@ public final class CrestTable
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
ResultSet rs = statement.executeQuery("SELECT `crest_id`, `data`, `type` FROM `crests` ORDER BY `crest_id` DESC"))
{
@@ -154,7 +154,7 @@ public final class CrestTable
*/
public L2Crest createCrest(byte[] data, CrestType crestType)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO `crests`(`crest_id`, `data`, `type`) VALUES(?, ?, ?)"))
{
final L2Crest crest = new L2Crest(_nextId.getAndIncrement(), data, crestType);
@@ -187,7 +187,7 @@ public final class CrestTable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM `crests` WHERE `crest_id` = ?"))
{
statement.setInt(1, crestId);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java
index 2be088cd17..b281c6dbe0 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java
@@ -56,7 +56,7 @@ public class OfflineTradersTable
public void storeOffliners()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS);
PreparedStatement stm3 = con.prepareStatement(SAVE_OFFLINE_STATUS);
@@ -173,7 +173,7 @@ public class OfflineTradersTable
{
LOGGER.info(getClass().getSimpleName() + ": Loading offline traders...");
int nTraders = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement stm = con.createStatement();
ResultSet rs = stm.executeQuery(LOAD_OFFLINE_STATUS))
{
@@ -329,7 +329,7 @@ public class OfflineTradersTable
public static synchronized void onTransaction(L2PcInstance trader, boolean finished, boolean firstCall)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_PLAYER);
PreparedStatement stm3 = con.prepareStatement(SAVE_ITEMS);
@@ -453,7 +453,7 @@ public class OfflineTradersTable
{
PlayerCountManager.getInstance().decOfflineTradeCount();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_PLAYER))
{
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java
index 333e0e2289..4013e5e460 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java
@@ -42,7 +42,7 @@ public class PetNameTable
public boolean doesPetNameExist(String name, int petNpcId)
{
boolean result = true;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT name FROM pets p, items i WHERE p.item_obj_id = i.object_id AND name=? AND i.item_id IN (?)"))
{
ps.setString(1, name);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java
index 33e2d0df1d..0de4769849 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java
@@ -66,7 +66,7 @@ public final class BuyListData implements IGameXmlReader
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _buyLists.size() + " BuyLists.");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rs = statement.executeQuery("SELECT * FROM `buylists`"))
{
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/datatables/BotReportTable.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/datatables/BotReportTable.java
index 8d2d8e65ee..67d9b69779 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/datatables/BotReportTable.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/datatables/BotReportTable.java
@@ -112,7 +112,7 @@ public final class BotReportTable
*/
private void loadReportedCharData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery(SQL_LOAD_REPORTED_CHAR_DATA))
{
@@ -181,7 +181,7 @@ public final class BotReportTable
*/
public void saveReportedCharData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
PreparedStatement ps = con.prepareStatement(SQL_INSERT_REPORTED_CHAR_DATA))
{
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/datatables/ItemTable.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/datatables/ItemTable.java
index c8f34ed812..e4f3a0098d 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/datatables/ItemTable.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/datatables/ItemTable.java
@@ -386,7 +386,7 @@ public class ItemTable
// if it's a pet control item, delete the pet as well
if (item.getItem().isPetItem())
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
{
// Delete the pet in db
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java
index be6c70ea35..721671de46 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java
@@ -71,7 +71,7 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer
public synchronized void reset()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_daily_rewards WHERE rewardId = ? AND status = ?"))
{
ps.setInt(1, _holder.getId());
@@ -111,7 +111,7 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer
protected void storePlayerEntry(DailyMissionPlayerEntry entry)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO character_daily_rewards (charId, rewardId, status, progress, lastCompleted) VALUES (?, ?, ?, ?, ?)"))
{
ps.setInt(1, entry.getObjectId());
@@ -138,7 +138,7 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer
return existingEntry;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM character_daily_rewards WHERE charId = ? AND rewardId = ?"))
{
ps.setInt(1, objectId);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
index baaadc776c..34f7280917 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -128,7 +128,7 @@ public abstract class IdFactory
*/
private void setAllCharacterOffline()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("UPDATE characters SET online = 0");
@@ -145,7 +145,7 @@ public abstract class IdFactory
*/
private void cleanUpDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement stmt = con.createStatement())
{
final long cleanupStart = System.currentTimeMillis();
@@ -253,7 +253,7 @@ public abstract class IdFactory
private void cleanUpTimeStamps()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
int cleanCount = 0;
for (String line : TIMESTAMPS_CLEAN)
@@ -279,7 +279,7 @@ public abstract class IdFactory
protected final Integer[] extractUsedObjectIDTable() throws Exception
{
final List temp = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
String extractUsedObjectIdsQuery = "";
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
index 9e5d1cedcf..21ed01119d 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
@@ -42,7 +42,7 @@ public class StackIDFactory extends IdFactory
_curOID = FIRST_OID;
_tempOID = FIRST_OID;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// con.createStatement().execute("drop table if exists tmp_obj_id");
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java
index c1c614e3f8..85f3d57b5d 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java
@@ -169,7 +169,7 @@ public class AirShipManager
_airShipsInfo.put(ownerId, info);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_DB))
{
ps.setInt(1, ownerId);
@@ -265,7 +265,7 @@ public class AirShipManager
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(LOAD_DB))
{
@@ -296,7 +296,7 @@ public class AirShipManager
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_DB))
{
ps.setInt(1, info.getInt("fuel"));
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
index afc836f427..0808ef7947 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
@@ -198,7 +198,7 @@ public final class CastleManager implements InstanceListManager
}
}
// else offline-player circlet removal
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM items WHERE owner_id = ? and item_id = ?"))
{
ps.setInt(1, member.getObjectId());
@@ -215,7 +215,7 @@ public final class CastleManager implements InstanceListManager
@Override
public void loadInstances()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT id FROM castle ORDER BY id"))
{
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
index 6a9dff749b..4c73fd01a3 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
@@ -162,7 +162,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
private void loadDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stProduction = con.prepareStatement("SELECT * FROM castle_manor_production WHERE castle_id=?");
PreparedStatement stProcure = con.prepareStatement("SELECT * FROM castle_manor_procure WHERE castle_id=?"))
{
@@ -436,7 +436,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
_productionNext.put(castleId, list);
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement dps = con.prepareStatement("DELETE FROM castle_manor_production WHERE castle_id = ? AND next_period = 1");
PreparedStatement ips = con.prepareStatement(INSERT_PRODUCT))
{
@@ -472,7 +472,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
_procureNext.put(castleId, list);
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement dps = con.prepareStatement("DELETE FROM castle_manor_procure WHERE castle_id = ? AND next_period = 1");
PreparedStatement ips = con.prepareStatement(INSERT_CROP))
{
@@ -506,7 +506,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
public final void updateCurrentProduction(int castleId, Collection items)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle_manor_production SET amount = ? WHERE castle_id = ? AND seed_id = ? AND next_period = 0"))
{
for (SeedProduction sp : items)
@@ -526,7 +526,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
public final void updateCurrentProcure(int castleId, Collection items)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle_manor_procure SET amount = ? WHERE castle_id = ? AND crop_id = ? AND next_period = 0"))
{
for (CropProcure sp : items)
@@ -599,7 +599,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
@Override
public final boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ds = con.prepareStatement("DELETE FROM castle_manor_production");
PreparedStatement is = con.prepareStatement(INSERT_PRODUCT);
PreparedStatement dp = con.prepareStatement("DELETE FROM castle_manor_procure");
@@ -697,7 +697,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ds = con.prepareStatement("DELETE FROM castle_manor_production WHERE castle_id = ?");
PreparedStatement dc = con.prepareStatement("DELETE FROM castle_manor_procure WHERE castle_id = ?"))
{
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java
index f4229564fe..e808c70557 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java
@@ -91,7 +91,7 @@ public class CeremonyOfChaosManager extends AbstractEventManager clanApplicantList = _applicantList.get(clanId);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_APPLICANT))
{
statement.setInt(1, playerId);
@@ -189,7 +189,7 @@ public class ClanEntryManager
{
_applicantList.computeIfAbsent(clanId, k -> new ConcurrentHashMap<>()).put(info.getPlayerId(), info);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_APPLICANT))
{
statement.setInt(1, info.getPlayerId());
@@ -216,7 +216,7 @@ public class ClanEntryManager
{
if (!_playerLocked.containsKey(playerId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_WAITING_LIST))
{
statement.setInt(1, info.getPlayerId());
@@ -237,7 +237,7 @@ public class ClanEntryManager
{
if (_waitingList.containsKey(playerId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_WAITING_LIST))
{
statement.setInt(1, playerId);
@@ -258,7 +258,7 @@ public class ClanEntryManager
{
if (!_clanList.containsKey(clanId) && !_clanLocked.containsKey(clanId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_CLAN_RECRUIT))
{
statement.setInt(1, info.getClanId());
@@ -283,7 +283,7 @@ public class ClanEntryManager
{
if (_clanList.containsKey(clanId) && !_clanLocked.containsKey(clanId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CLAN_RECRUIT))
{
statement.setInt(1, info.getKarma());
@@ -307,7 +307,7 @@ public class ClanEntryManager
{
if (_clanList.containsKey(clanId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_CLAN_RECRUIT))
{
statement.setInt(1, clanId);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java
index e424e0ad7e..6ba2c94bb2 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java
@@ -79,7 +79,7 @@ public final class CommissionManager
protected CommissionManager()
{
final Map itemInstances = new HashMap<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement(SELECT_ALL_ITEMS))
{
@@ -245,7 +245,7 @@ public final class CommissionManager
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_COMMISSION_ITEM, Statement.RETURN_GENERATED_KEYS))
{
final Instant startTime = Instant.now();
@@ -398,7 +398,7 @@ public final class CommissionManager
*/
private boolean deleteItemFromDB(long commissionId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_COMMISSION_ITEM))
{
ps.setLong(1, commissionId);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
index 9e5b85cf52..398058a743 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
@@ -142,7 +142,7 @@ public final class CursedWeaponsManager implements IGameXmlReader
private void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT itemId, charId, playerReputation, playerPkKills, nbKills, endTime FROM cursed_weapons"))
{
@@ -167,7 +167,7 @@ public final class CursedWeaponsManager implements IGameXmlReader
private void controlPlayers()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT owner_id FROM items WHERE item_id=?"))
{
// TODO: See comments below...
@@ -338,7 +338,7 @@ public final class CursedWeaponsManager implements IGameXmlReader
public static void removeFromDb(int itemId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM cursed_weapons WHERE itemId = ?"))
{
ps.setInt(1, itemId);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java
index ced8c5abd2..a881e85ae4 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java
@@ -85,7 +85,7 @@ public class DBSpawnManager
_storedInfo.clear();
_schedules.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM npc_respawns");
ResultSet rset = statement.executeQuery())
{
@@ -275,7 +275,7 @@ public class DBSpawnManager
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO npc_respawns (id, x, y, z, heading, respawnTime, currentHp, currentMp) VALUES(?, ?, ?, ?, ?, ?, ?, ?)"))
{
statement.setInt(1, spawn.getId());
@@ -331,7 +331,7 @@ public class DBSpawnManager
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO npc_respawns (id, x, y, z, heading, respawnTime, currentHp, currentMp) VALUES(?, ?, ?, ?, ?, ?, ?, ?)"))
{
statement.setInt(1, spawn.getId());
@@ -380,7 +380,7 @@ public class DBSpawnManager
if (updateDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM npc_respawns WHERE id = ?"))
{
ps.setInt(1, npcId);
@@ -401,7 +401,7 @@ public class DBSpawnManager
*/
private void updateDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE npc_respawns SET respawnTime = ?, currentHP = ?, currentMP = ? WHERE id = ?"))
{
for (Integer npcId : _storedInfo.keySet())
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java
index 3dd467d653..f25bc2e852 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java
@@ -120,7 +120,7 @@ public class DailyTaskManager extends AbstractEventManager>
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement st = con.prepareStatement("UPDATE character_subclasses SET vitality_points = ?"))
{
@@ -150,7 +150,7 @@ public class DailyTaskManager extends AbstractEventManager>
private void resetExtendDrop()
{
// Update data for offline players.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_variables WHERE var = ?"))
{
ps.setString(1, PlayerVariables.EXTEND_DROP);
@@ -173,7 +173,7 @@ public class DailyTaskManager extends AbstractEventManager>
private void resetDailySkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final List dailySkills = getVariables().getList("reset_skills", SkillHolder.class, Collections.emptyList());
for (SkillHolder skill : dailySkills)
@@ -200,7 +200,7 @@ public class DailyTaskManager extends AbstractEventManager>
}
// Update data for offline players.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE character_variables SET val = ? WHERE var = ?"))
{
ps.setInt(1, 0);
@@ -225,7 +225,7 @@ public class DailyTaskManager extends AbstractEventManager>
private void resetRecommends()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("UPDATE character_reco_bonus SET rec_left = ?, rec_have = 0 WHERE rec_have <= 20"))
{
@@ -258,7 +258,7 @@ public class DailyTaskManager extends AbstractEventManager>
if (Config.TRAINING_CAMP_ENABLE)
{
// Update data for offline players.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM account_gsdata WHERE var = ?"))
{
ps.setString(1, "TRAINING_CAMP_DURATION");
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java
index f635c19883..7101b82852 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java
@@ -46,7 +46,7 @@ public class FactionManager
private void loadAll()
{
_playerFactions.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT charId, faction FROM characters"))
{
@@ -75,7 +75,7 @@ public class FactionManager
return factionId;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT faction FROM characters WHERE charId=?"))
{
ps.setInt(1, id);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/FortManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
index 0fbe44bc6d..56ab9144cf 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
@@ -121,7 +121,7 @@ public final class FortManager implements InstanceListManager
@Override
public void loadInstances()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT id FROM fort ORDER BY id"))
{
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
index 0a5245dafc..4eb6258b05 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
@@ -86,7 +86,7 @@ public final class FortSiegeManager
}
boolean register = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clan_id FROM fortsiege_clans where clan_id=? and fort_id=?"))
{
ps.setInt(1, clan.getId());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
index e9f6bb3475..044d74609a 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
@@ -56,7 +56,7 @@ public final class GlobalVariablesManager extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery(SELECT_QUERY))
{
@@ -87,7 +87,7 @@ public final class GlobalVariablesManager extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement del = con.createStatement();
PreparedStatement st = con.prepareStatement(INSERT_QUERY))
{
@@ -119,7 +119,7 @@ public final class GlobalVariablesManager extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement del = con.createStatement())
{
del.execute(DELETE_QUERY);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
index 0a62e46364..30f9519c00 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
@@ -62,7 +62,7 @@ public final class GrandBossManager implements IStorable
private void init()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT * from grandboss_data ORDER BY boss_id"))
{
@@ -150,7 +150,7 @@ public final class GrandBossManager implements IStorable
@Override
public boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
for (Entry e : _storedInfo.entrySet())
{
@@ -202,7 +202,7 @@ public final class GrandBossManager implements IStorable
private void updateDb(int bossId, boolean statusOnly)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final L2GrandBossInstance boss = _bosses.get(bossId);
final StatsSet info = _storedInfo.get(bossId);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java
index 0939f2cf18..4a0efbc831 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java
@@ -498,7 +498,7 @@ public final class InstanceManager implements IGameXmlReader
*/
private void restoreInstanceTimes()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT * FROM character_instance_time ORDER BY charId"))
{
@@ -550,7 +550,7 @@ public final class InstanceManager implements IGameXmlReader
// Remove them
if (!invalidPenalty.isEmpty())
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_INSTANCE_TIME))
{
for (Integer id : invalidPenalty)
@@ -615,7 +615,7 @@ public final class InstanceManager implements IGameXmlReader
*/
public void deleteInstanceTime(L2PcInstance player, int id)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_INSTANCE_TIME))
{
ps.setInt(1, player.getObjectId());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java
index e0599ea3fe..eb105b45f3 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java
@@ -55,7 +55,7 @@ public final class ItemAuctionManager implements IGameXmlReader
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery("SELECT auctionId FROM item_auction ORDER BY auctionId DESC LIMIT 0, 1"))
{
@@ -134,7 +134,7 @@ public final class ItemAuctionManager implements IGameXmlReader
public static void deleteAuction(int auctionId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement statement = con.prepareStatement("DELETE FROM item_auction WHERE auctionId=?"))
{
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
index fba190d620..5bbbecc082 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
@@ -80,7 +80,7 @@ public final class ItemsOnGroundManager implements Runnable
str = "UPDATE itemsonground SET drop_time = ? WHERE drop_time = -1";
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(str))
{
ps.setLong(1, System.currentTimeMillis());
@@ -93,7 +93,7 @@ public final class ItemsOnGroundManager implements Runnable
}
// Add items to world
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable FROM itemsonground"))
{
int count = 0;
@@ -178,7 +178,7 @@ public final class ItemsOnGroundManager implements Runnable
public void emptyTable()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("DELETE FROM itemsonground");
@@ -204,7 +204,7 @@ public final class ItemsOnGroundManager implements Runnable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO itemsonground(object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable) VALUES(?,?,?,?,?,?,?,?,?)"))
{
for (L2ItemInstance item : _items)
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/MailManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/MailManager.java
index 0b4c7601cb..fbc14a23e6 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/MailManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/MailManager.java
@@ -57,7 +57,7 @@ public final class MailManager
private void load()
{
int count = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT * FROM messages ORDER BY expiration"))
{
@@ -192,7 +192,7 @@ public final class MailManager
public void sendMessage(Message msg)
{
_messages.put(msg.getId(), msg);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = Message.getStatement(msg, con))
{
ps.execute();
@@ -214,7 +214,7 @@ public final class MailManager
public final void markAsReadInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isUnread = 'false' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -228,7 +228,7 @@ public final class MailManager
public final void markAsDeletedBySenderInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isDeletedBySender = 'true' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -242,7 +242,7 @@ public final class MailManager
public final void markAsDeletedByReceiverInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isDeletedByReceiver = 'true' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -256,7 +256,7 @@ public final class MailManager
public final void removeAttachmentsInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET hasAttachments = 'false' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -270,7 +270,7 @@ public final class MailManager
public final void deleteMessageInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM messages WHERE messageId = ?"))
{
ps.setInt(1, msgId);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java
index f47cf3f813..82a7f2288b 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java
@@ -54,7 +54,7 @@ public class MentorManager
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery("SELECT * FROM character_mentees"))
{
@@ -76,7 +76,7 @@ public class MentorManager
*/
public void deleteMentee(int mentorId, int menteeId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_mentees WHERE mentorId = ? AND charId = ?"))
{
statement.setInt(1, mentorId);
@@ -95,7 +95,7 @@ public class MentorManager
*/
public void deleteMentor(int mentorId, int menteeId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_mentees WHERE mentorId = ? AND charId = ?"))
{
statement.setInt(1, mentorId);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
index a29ed155fc..c03a9a8aae 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
@@ -128,7 +128,7 @@ public class PremiumManager
private void loadPremiumData(String accountName)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stmt = con.prepareStatement(LOAD_SQL))
{
stmt.setString(1, accountName);
@@ -160,7 +160,7 @@ public class PremiumManager
long newPremiumExpiration = oldPremiumExpiration + addTime;
// UPDATE DATABASE
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stmt = con.prepareStatement(UPDATE_SQL))
{
stmt.setLong(1, newPremiumExpiration);
@@ -205,7 +205,7 @@ public class PremiumManager
premiumData.remove(accountName);
// UPDATE DATABASE
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stmt = con.prepareStatement(DELETE_SQL))
{
stmt.setString(1, accountName);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java
index 001e262042..7438bf62f8 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java
@@ -56,7 +56,7 @@ public final class PunishmentManager
int expired = 0;
// Load punishments.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery("SELECT * FROM punishments"))
{
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
index b99c5e77d5..fe296e2e53 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
@@ -57,7 +57,7 @@ public final class SiegeGuardManager
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
ResultSet rs = con.createStatement().executeQuery("SELECT * FROM castle_siege_guards Where isHired = 1"))
{
while (rs.next())
@@ -158,7 +158,7 @@ public final class SiegeGuardManager
final SiegeGuardHolder holder = getSiegeGuardByItem(castle.getResidenceId(), itemId);
if (holder != null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("Insert Into castle_siege_guards (castleId, npcId, x, y, z, heading, respawnDelay, isHired) Values (?, ?, ?, ?, ?, ?, ?, ?)"))
{
statement.setInt(1, castle.getResidenceId());
@@ -249,7 +249,7 @@ public final class SiegeGuardManager
*/
private void loadSiegeGuard(Castle castle)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_siege_guards Where castleId = ? And isHired = ?"))
{
ps.setInt(1, castle.getResidenceId());
@@ -283,7 +283,7 @@ public final class SiegeGuardManager
*/
public void removeSiegeGuard(int npcId, IPositionable pos)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("Delete From castle_siege_guards Where npcId = ? And x = ? AND y = ? AND z = ? AND isHired = 1"))
{
ps.setInt(1, npcId);
@@ -304,7 +304,7 @@ public final class SiegeGuardManager
*/
public void removeSiegeGuards(Castle castle)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("Delete From castle_siege_guards Where castleId = ? And isHired = 1"))
{
ps.setInt(1, castle.getResidenceId());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
index 38d9a81244..d5b2c9dc80 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
@@ -88,7 +88,7 @@ public final class SiegeManager
}
boolean register = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT clan_id FROM siege_clans where clan_id=? and castle_id=?"))
{
statement.setInt(1, clan.getId());
@@ -275,7 +275,7 @@ public final class SiegeManager
private void loadTrapUpgrade(int castleId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_trapupgrade WHERE castleId=?"))
{
ps.setInt(1, castleId);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/BlockList.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/BlockList.java
index f34f2aa666..9498d19d95 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/BlockList.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/BlockList.java
@@ -71,7 +71,7 @@ public class BlockList
private static List loadList(int ObjId)
{
final List list = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=? AND relation=1"))
{
statement.setInt(1, ObjId);
@@ -98,7 +98,7 @@ public class BlockList
private void updateInDB(int targetId, boolean state)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (state) // add
{
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/CursedWeapon.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/CursedWeapon.java
index 2265d6876c..e767a0de19 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/CursedWeapon.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/CursedWeapon.java
@@ -136,7 +136,7 @@ public class CursedWeapon implements INamable
// Remove from Db
LOGGER.info(_name + " being removed offline.");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement del = con.prepareStatement("DELETE FROM items WHERE owner_id=? AND item_id=?");
PreparedStatement ps = con.prepareStatement("UPDATE characters SET reputation=?, pkkills=? WHERE charId=?"))
{
@@ -471,7 +471,7 @@ public class CursedWeapon implements INamable
public void saveData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement del = con.prepareStatement("DELETE FROM cursed_weapons WHERE itemId = ?");
PreparedStatement ps = con.prepareStatement("INSERT INTO cursed_weapons (itemId, charId, playerReputation, playerPkKills, nbKills, endTime) VALUES (?, ?, ?, ?, ?, ?)"))
{
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Clan.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Clan.java
index 7733a32091..9454ec2cda 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Clan.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Clan.java
@@ -266,7 +266,7 @@ public class L2Clan implements IIdentifiable, INamable
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET clan_privs = ? WHERE charId = ?"))
{
ps.setInt(1, 0);
@@ -306,7 +306,7 @@ public class L2Clan implements IIdentifiable, INamable
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET clan_privs = ? WHERE charId = ?"))
{
ps.setInt(1, EnumIntBitmask.getAllBitmask(ClanPrivilege.class));
@@ -883,7 +883,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateBloodAllianceCountInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET blood_alliance_count=? WHERE clan_id=?"))
{
ps.setInt(1, _bloodAllianceCount);
@@ -927,7 +927,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateBloodOathCountInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET blood_oath_count=? WHERE clan_id=?"))
{
ps.setInt(1, _bloodOathCount);
@@ -943,7 +943,7 @@ public class L2Clan implements IIdentifiable, INamable
public void updateInDB()
{
// Update reputation
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET reputation_score=? WHERE clan_id=?"))
{
ps.setInt(1, _reputationScore);
@@ -978,7 +978,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateClanInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET leader_id=?,ally_id=?,ally_name=?,reputation_score=?,ally_penalty_expiry_time=?,ally_penalty_type=?,char_penalty_expiry_time=?,dissolving_expiry_time=?,new_leader_id=? WHERE clan_id=?"))
{
ps.setInt(1, getLeaderId());
@@ -1016,7 +1016,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void store()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_CLAN_DATA))
{
ps.setInt(1, _clanId);
@@ -1047,7 +1047,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
private void removeMemberInDatabase(L2ClanMember member, long clanJoinExpiryTime, long clanCreateExpiryTime)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("UPDATE characters SET clanid=0, title=?, clan_join_expiry_time=?, clan_create_expiry_time=?, clan_privs=0, wantspeace=0, subpledge=0, lvl_joined_academy=0, apprentice=0, sponsor=0 WHERE charId=?");
PreparedStatement ps2 = con.prepareStatement("UPDATE characters SET apprentice=0 WHERE apprentice=?");
PreparedStatement ps3 = con.prepareStatement("UPDATE characters SET sponsor=0 WHERE sponsor=?"))
@@ -1072,7 +1072,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_CLAN_DATA))
{
ps.setInt(1, _clanId);
@@ -1147,7 +1147,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreNotice()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT enabled,notice FROM clan_notices WHERE clan_id=?"))
{
ps.setInt(1, _clanId);
@@ -1178,7 +1178,7 @@ public class L2Clan implements IIdentifiable, INamable
notice = notice.substring(0, MAX_NOTICE_LENGTH - 1);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_notices (clan_id,notice,enabled) values (?,?,?) ON DUPLICATE KEY UPDATE notice=?,enabled=?"))
{
ps.setInt(1, _clanId);
@@ -1237,7 +1237,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreSkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT skill_id,skill_level,sub_pledge_id FROM clan_skills WHERE clan_id=?"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -1360,7 +1360,7 @@ public class L2Clan implements IIdentifiable, INamable
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (oldSkill != null)
{
@@ -1770,7 +1770,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreSubPledges()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT sub_pledge_id,name,leader_id FROM clan_subpledges WHERE clan_id=?"))
{
// Retrieve all subpledges of this clan from the database
@@ -1870,7 +1870,7 @@ public class L2Clan implements IIdentifiable, INamable
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_subpledges (clan_id,sub_pledge_id,name,leader_id) values (?,?,?,?)"))
{
ps.setInt(1, _clanId);
@@ -1953,7 +1953,7 @@ public class L2Clan implements IIdentifiable, INamable
public void updateSubPledgeInDB(int pledgeType)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_subpledges SET leader_id=?, name=? WHERE clan_id=? AND sub_pledge_id=?"))
{
ps.setInt(1, getSubPledge(pledgeType).getLeaderId());
@@ -1970,7 +1970,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreRankPrivs()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT privs,rank,party FROM clan_privs WHERE clan_id=?"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -2019,7 +2019,7 @@ public class L2Clan implements IIdentifiable, INamable
{
_privs.get(rank).setPrivs(privs);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_privs (clan_id,rank,party,privs) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE privs = ?"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -2055,7 +2055,7 @@ public class L2Clan implements IIdentifiable, INamable
{
_privs.put(rank, new RankPrivs(rank, 0, privs));
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_privs (clan_id,rank,party,privs) VALUES (?,?,?,?)"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -2174,7 +2174,7 @@ public class L2Clan implements IIdentifiable, INamable
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET auction_bid_at=? WHERE clan_id=?"))
{
ps.setInt(1, id);
@@ -2717,7 +2717,7 @@ public class L2Clan implements IIdentifiable, INamable
public void changeLevel(int level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET clan_level = ? WHERE clan_id = ?"))
{
ps.setInt(1, level);
@@ -2763,7 +2763,7 @@ public class L2Clan implements IIdentifiable, INamable
setCrestId(crestId);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET crest_id = ? WHERE clan_id = ?"))
{
ps.setInt(1, crestId);
@@ -2800,7 +2800,7 @@ public class L2Clan implements IIdentifiable, INamable
allyId = _allyId;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(sqlStatement))
{
ps.setInt(1, crestId);
@@ -2846,7 +2846,7 @@ public class L2Clan implements IIdentifiable, INamable
setCrestLargeId(crestId);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET crest_large_id = ? WHERE clan_id = ?"))
{
ps.setInt(1, crestId);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2ClanMember.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2ClanMember.java
index 1ae5225355..8655fe5918 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2ClanMember.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2ClanMember.java
@@ -244,7 +244,7 @@ public class L2ClanMember
*/
public void updatePledgeType()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET subpledge=? WHERE charId=?"))
{
ps.setLong(1, _pledgeType);
@@ -289,7 +289,7 @@ public class L2ClanMember
*/
public void updatePowerGrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET power_grade=? WHERE charId=?"))
{
ps.setLong(1, _powerGrade);
@@ -800,7 +800,7 @@ public class L2ClanMember
*/
public void saveApprenticeAndSponsor(int apprentice, int sponsor)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET apprentice=?,sponsor=? WHERE charId=?"))
{
ps.setInt(1, apprentice);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2ContactList.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2ContactList.java
index ea5f1f9d5d..5b5f5ab2bc 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2ContactList.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2ContactList.java
@@ -58,7 +58,7 @@ public class L2ContactList
{
_contacts.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY_LOAD))
{
statement.setInt(1, activeChar.getObjectId());
@@ -124,7 +124,7 @@ public class L2ContactList
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY_ADD))
{
statement.setInt(1, activeChar.getObjectId());
@@ -161,7 +161,7 @@ public class L2ContactList
_contacts.remove(name);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY_REMOVE))
{
statement.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Mentee.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Mentee.java
index 5c086b9d83..5414107ac4 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Mentee.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/L2Mentee.java
@@ -49,7 +49,7 @@ public class L2Mentee
final L2PcInstance player = getPlayerInstance();
if (player == null) // Only if player is offline
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT char_name, level, base_class FROM characters WHERE charId = ?"))
{
statement.setInt(1, _objectId);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/MacroList.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/MacroList.java
index 577b101249..176fa12d48 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/MacroList.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/MacroList.java
@@ -124,7 +124,7 @@ public class MacroList implements IRestorable
private void registerMacroInDb(Macro macro)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO character_macroses (charId,id,icon,name,descr,acronym,commands) values(?,?,?,?,?,?,?)"))
{
ps.setInt(1, _owner.getObjectId());
@@ -160,7 +160,7 @@ public class MacroList implements IRestorable
private void deleteMacroFromDb(Macro macro)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_macroses WHERE charId=? AND id=?"))
{
ps.setInt(1, _owner.getObjectId());
@@ -177,7 +177,7 @@ public class MacroList implements IRestorable
public boolean restoreMe()
{
_macroses.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT charId, id, icon, name, descr, acronym, commands FROM character_macroses WHERE charId=?"))
{
ps.setInt(1, _owner.getObjectId());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/ShortCuts.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/ShortCuts.java
index 81e2c6f902..cbb856704d 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/ShortCuts.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/ShortCuts.java
@@ -85,7 +85,7 @@ public class ShortCuts implements IRestorable
deleteShortCutFromDb(oldShortCut);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("REPLACE INTO character_shortcuts (charId,slot,page,type,shortcut_id,level,sub_level,class_index) values(?,?,?,?,?,?,?,?)"))
{
statement.setInt(1, _owner.getObjectId());
@@ -154,7 +154,7 @@ public class ShortCuts implements IRestorable
*/
private void deleteShortCutFromDb(Shortcut shortcut)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=? AND slot=? AND page=? AND class_index=?"))
{
statement.setInt(1, _owner.getObjectId());
@@ -173,7 +173,7 @@ public class ShortCuts implements IRestorable
public boolean restoreMe()
{
_shortCuts.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT charId, slot, page, type, shortcut_id, level, sub_level FROM character_shortcuts WHERE charId=? AND class_index=?"))
{
statement.setInt(1, _owner.getObjectId());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
index 7c7925be81..6831d4812b 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
@@ -1349,7 +1349,7 @@ public final class L2PcInstance extends L2Playable
private void insertNewRecipeData(int recipeId, boolean isDwarf)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_recipebook (charId, id, classIndex, type) values(?,?,?,?)"))
{
statement.setInt(1, getObjectId());
@@ -1366,7 +1366,7 @@ public final class L2PcInstance extends L2Playable
private void deleteRecipeData(int recipeId, boolean isDwarf)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_recipebook WHERE charId=? AND id=? AND classIndex=?"))
{
statement.setInt(1, getObjectId());
@@ -6340,7 +6340,7 @@ public final class L2PcInstance extends L2Playable
if (updateInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_CHARACTER_ACCESS))
{
ps.setInt(1, accessLevel.getLevel());
@@ -6459,7 +6459,7 @@ public final class L2PcInstance extends L2Playable
*/
public void updateOnlineStatus()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE characters SET online=?, lastAccess=? WHERE charId=?"))
{
statement.setInt(1, isOnlineInt());
@@ -6479,7 +6479,7 @@ public final class L2PcInstance extends L2Playable
*/
private boolean createDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_CHARACTER))
{
statement.setString(1, _accountName);
@@ -6543,7 +6543,7 @@ public final class L2PcInstance extends L2Playable
double currentCp = 0;
double currentHp = 0;
double currentMp = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHARACTER))
{
// Retrieve the L2PcInstance from the characters table of the database
@@ -6905,7 +6905,7 @@ public final class L2PcInstance extends L2Playable
*/
private static boolean restoreSubClassData(L2PcInstance player)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_SUBCLASSES))
{
statement.setInt(1, player.getObjectId());
@@ -6996,7 +6996,7 @@ public final class L2PcInstance extends L2Playable
private void restoreRecipeBook(boolean loadCommon)
{
final String sql = loadCommon ? "SELECT id, type, classIndex FROM character_recipebook WHERE charId=?" : "SELECT id FROM character_recipebook WHERE charId=? AND classIndex=? AND type = 1";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(sql))
{
statement.setInt(1, getObjectId());
@@ -7049,7 +7049,7 @@ public final class L2PcInstance extends L2Playable
private void loadPremiumItemList()
{
final String sql = "SELECT itemNum, itemId, itemCount, itemSender FROM character_premium_items WHERE charId=?";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(sql))
{
statement.setInt(1, getObjectId());
@@ -7073,7 +7073,7 @@ public final class L2PcInstance extends L2Playable
public void updatePremiumItem(int itemNum, long newcount)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE character_premium_items SET itemCount=? WHERE charId=? AND itemNum=? "))
{
statement.setLong(1, newcount);
@@ -7089,7 +7089,7 @@ public final class L2PcInstance extends L2Playable
public void deletePremiumItem(int itemNum)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_premium_items WHERE charId=? AND itemNum=? "))
{
statement.setInt(1, getObjectId());
@@ -7142,7 +7142,7 @@ public final class L2PcInstance extends L2Playable
final long exp = getStat().getBaseExp();
final int level = getStat().getBaseLevel();
final long sp = getStat().getBaseSp();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CHARACTER))
{
statement.setInt(1, level);
@@ -7227,7 +7227,7 @@ public final class L2PcInstance extends L2Playable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CHAR_SUBCLASS))
{
for (SubClass subClass : getSubClasses().values())
@@ -7258,7 +7258,7 @@ public final class L2PcInstance extends L2Playable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
{
@@ -7378,7 +7378,7 @@ public final class L2PcInstance extends L2Playable
private void storeItemReuseDelay()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(DELETE_ITEM_REUSE_SAVE);
PreparedStatement ps2 = con.prepareStatement(ADD_ITEM_REUSE_SAVE))
{
@@ -7495,7 +7495,7 @@ public final class L2PcInstance extends L2Playable
final Skill oldSkill = super.removeSkill(skill, true);
if (oldSkill != null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_SKILL_FROM_CHAR))
{
// Remove or update a L2PcInstance skill from the character_skills table of the database
@@ -7538,7 +7538,7 @@ public final class L2PcInstance extends L2Playable
private void storeSkill(Skill newSkill, Skill oldSkill, int newClassIndex)
{
final int classIndex = (newClassIndex > -1) ? newClassIndex : _classIndex;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if ((oldSkill != null) && (newSkill != null))
{
@@ -7588,7 +7588,7 @@ public final class L2PcInstance extends L2Playable
}
final int classIndex = (newClassIndex > -1) ? newClassIndex : _classIndex;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_NEW_SKILLS))
{
con.setAutoCommit(false);
@@ -7615,7 +7615,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restoreSkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -7667,7 +7667,7 @@ public final class L2PcInstance extends L2Playable
@Override
public void restoreEffects()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_SKILL_SAVE))
{
statement.setInt(1, getObjectId());
@@ -7724,7 +7724,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restoreItemReuse()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_ITEM_REUSE_SAVE);
PreparedStatement delete = con.prepareStatement(DELETE_ITEM_REUSE_SAVE))
{
@@ -7795,7 +7795,7 @@ public final class L2PcInstance extends L2Playable
_henna[i - 1] = null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_HENNAS))
{
statement.setInt(1, getObjectId());
@@ -7903,7 +7903,7 @@ public final class L2PcInstance extends L2Playable
_henna[slot - 1] = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_CHAR_HENNA))
{
statement.setInt(1, getObjectId());
@@ -8001,7 +8001,7 @@ public final class L2PcInstance extends L2Playable
// Calculate Henna modifiers of this L2PcInstance
recalcHennaStats();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(ADD_CHAR_HENNA))
{
statement.setInt(1, getObjectId());
@@ -9638,7 +9638,7 @@ public final class L2PcInstance extends L2Playable
newClass.setLevel(Config.BASE_DUALCLASS_LEVEL);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(ADD_CHAR_SUBCLASS))
{
// Store the basic info about this new sub-class.
@@ -9738,7 +9738,7 @@ public final class L2PcInstance extends L2Playable
// Remove after stats are recalculated.
getSubClasses().remove(classIndex);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
@@ -11975,7 +11975,7 @@ public final class L2PcInstance extends L2Playable
{
String req;
req = "UPDATE pets SET fed=? WHERE item_obj_id = ?";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(req))
{
statement.setInt(1, _curFeed);
@@ -12102,7 +12102,7 @@ public final class L2PcInstance extends L2Playable
bookmark.setTag(tag);
bookmark.setName(name);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_TP_BOOKMARK))
{
statement.setInt(1, icon);
@@ -12125,7 +12125,7 @@ public final class L2PcInstance extends L2Playable
{
if (_tpbookmarks.remove(id) != null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_TP_BOOKMARK))
{
statement.setInt(1, getObjectId());
@@ -12268,7 +12268,7 @@ public final class L2PcInstance extends L2Playable
sm.addItemName(20033);
sendPacket(sm);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_TP_BOOKMARK))
{
statement.setInt(1, getObjectId());
@@ -12290,7 +12290,7 @@ public final class L2PcInstance extends L2Playable
public void restoreTeleportBookmark()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_TP_BOOKMARK))
{
statement.setInt(1, getObjectId());
@@ -12502,7 +12502,7 @@ public final class L2PcInstance extends L2Playable
_friendList.clear();
final String sqlQuery = "SELECT friendId FROM character_friends WHERE charId=? AND relation=0";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(sqlQuery))
{
statement.setInt(1, getObjectId());
@@ -12592,7 +12592,7 @@ public final class L2PcInstance extends L2Playable
{
if (hasManufactureShop())
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement st = con.prepareStatement(DELETE_CHAR_RECIPE_SHOP))
{
@@ -12630,7 +12630,7 @@ public final class L2PcInstance extends L2Playable
_manufactureItems.clear();
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_RECIPE_SHOP))
{
statement.setInt(1, getObjectId());
@@ -13048,7 +13048,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restorePetInventoryItems()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT object_id FROM `items` WHERE `owner_id`=? AND (`loc`='PET' OR `loc`='PET_EQUIP') LIMIT 1;"))
{
statement.setInt(1, getObjectId());
@@ -13088,7 +13088,7 @@ public final class L2PcInstance extends L2Playable
*/
private void loadRecommendations()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT rec_have, rec_left FROM character_reco_bonus WHERE charId = ?"))
{
statement.setInt(1, getObjectId());
@@ -13112,7 +13112,7 @@ public final class L2PcInstance extends L2Playable
*/
public void storeRecommendations()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO character_reco_bonus (charId,rec_have,rec_left,time_left) VALUES (?,?,?,?)"))
{
ps.setInt(1, getObjectId());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
index c5b882a533..2a22ce6fa1 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
@@ -788,7 +788,7 @@ public class L2PetInstance extends L2Summon
}
// pet control item no longer exists, delete the pet from the db
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id = ?"))
{
statement.setInt(1, _controlObjectId);
@@ -846,7 +846,7 @@ public class L2PetInstance extends L2Summon
private static L2PetInstance restore(L2ItemInstance control, L2NpcTemplate template, L2PcInstance owner)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT item_obj_id, name, level, curHp, curMp, exp, sp, fed FROM pets WHERE item_obj_id=?"))
{
L2PetInstance pet;
@@ -942,7 +942,7 @@ public class L2PetInstance extends L2Summon
req = "UPDATE pets SET name=?,level=?,curHp=?,curMp=?,exp=?,sp=?,fed=?,ownerId=?,restore=? WHERE item_obj_id = ?";
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(req))
{
statement.setString(1, getName());
@@ -992,7 +992,7 @@ public class L2PetInstance extends L2Summon
// Clear list for overwrite
SummonEffectsTable.getInstance().getPetEffects().getOrDefault(getControlObjectId(), Collections.emptyList()).clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement ps2 = con.prepareStatement(ADD_SKILL_SAVE))
{
@@ -1067,7 +1067,7 @@ public class L2PetInstance extends L2Summon
@Override
public void restoreEffects()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(RESTORE_SKILL_SAVE);
PreparedStatement ps2 = con.prepareStatement(DELETE_SKILL_SAVE))
{
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java
index 320505de11..8cbf9119b6 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java
@@ -288,7 +288,7 @@ public class L2ServitorInstance extends L2Summon implements Runnable
SummonEffectsTable.getInstance().getServitorEffects(getOwner()).getOrDefault(getReferenceSkill(), Collections.emptyList()).clear();
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_SKILL_SAVE))
{
// Delete all current stored effects for summon to avoid dupe
@@ -389,7 +389,7 @@ public class L2ServitorInstance extends L2Summon implements Runnable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (!SummonEffectsTable.getInstance().getServitorEffectsOwner().containsKey(getOwner().getObjectId()) || !SummonEffectsTable.getInstance().getServitorEffectsOwner().get(getOwner().getObjectId()).containsKey(getOwner().getClassIndex()) || !SummonEffectsTable.getInstance().getServitorEffects(getOwner()).containsKey(getReferenceSkill()))
{
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/announce/Announcement.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/announce/Announcement.java
index 4e5aa84b0f..a7117539ad 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/announce/Announcement.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/announce/Announcement.java
@@ -108,7 +108,7 @@ public class Announcement implements IAnnouncement
@Override
public boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
{
ps.setInt(1, _type.ordinal());
@@ -134,7 +134,7 @@ public class Announcement implements IAnnouncement
@Override
public boolean updateMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_QUERY))
{
ps.setInt(1, _type.ordinal());
@@ -154,7 +154,7 @@ public class Announcement implements IAnnouncement
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_QUERY))
{
ps.setInt(1, _id);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java
index 1adc7b039f..21eb44294e 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java
@@ -94,7 +94,7 @@ public final class AutoAnnouncement extends Announcement implements Runnable
@Override
public boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
{
st.setInt(1, getType().ordinal());
@@ -123,7 +123,7 @@ public final class AutoAnnouncement extends Announcement implements Runnable
@Override
public boolean updateMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(UPDATE_QUERY))
{
st.setInt(1, getType().ordinal());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/buylist/Product.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/buylist/Product.java
index 8360f7712c..639a9bfa1a 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/buylist/Product.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/buylist/Product.java
@@ -157,7 +157,7 @@ public final class Product
private void save()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO `buylists`(`buylist_id`, `item_id`, `count`, `next_restock_time`) VALUES(?, ?, ?, ?) ON DUPLICATE KEY UPDATE `count` = ?, `next_restock_time` = ?"))
{
statement.setInt(1, _buyListId);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java
index 757b5512d0..5d970e7abd 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java
@@ -58,7 +58,7 @@ public class ClanHallAuction
private final void loadBidder()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(LOAD_CLANHALL_BIDDERS))
{
ps.setInt(1, _clanHallId);
@@ -102,7 +102,7 @@ public class ClanHallAuction
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_CLANHALL_BIDDER))
{
ps.setInt(1, _clanHallId);
@@ -121,7 +121,7 @@ public class ClanHallAuction
public void removeBid(L2Clan clan)
{
getBids().remove(clan.getId());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_CLANHALL_BIDDER))
{
ps.setInt(1, clan.getId());
@@ -170,7 +170,7 @@ public class ClanHallAuction
clanHall.setOwner(highestBidder.getClan());
getBids().clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_CLANHALL_BIDDERS))
{
ps.setInt(1, _clanHallId);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Castle.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Castle.java
index 2f1da41c76..88d3ad7201 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Castle.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Castle.java
@@ -218,7 +218,7 @@ public final class Castle extends AbstractResidence
public void dbSave()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_functions (castle_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)"))
{
ps.setInt(1, getResidenceId());
@@ -360,7 +360,7 @@ public final class Castle extends AbstractResidence
_treasury += amount;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET treasury = ? WHERE id = ?"))
{
ps.setLong(1, _treasury);
@@ -643,7 +643,7 @@ public final class Castle extends AbstractResidence
@Override
protected void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("SELECT * FROM castle WHERE id = ?");
PreparedStatement ps2 = con.prepareStatement("SELECT clan_id FROM clan_data WHERE hasCastle = ?"))
{
@@ -689,7 +689,7 @@ public final class Castle extends AbstractResidence
/** Load All Functions */
private void loadFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_functions WHERE castle_id = ?"))
{
ps.setInt(1, getResidenceId());
@@ -714,7 +714,7 @@ public final class Castle extends AbstractResidence
public void removeFunction(int functionType)
{
_function.remove(functionType);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_functions WHERE castle_id=? AND type=?"))
{
ps.setInt(1, getResidenceId());
@@ -786,7 +786,7 @@ public final class Castle extends AbstractResidence
// This method loads castle door upgrade data from database
private void loadDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_doorupgrade WHERE castleId=?"))
{
ps.setInt(1, getResidenceId());
@@ -812,7 +812,7 @@ public final class Castle extends AbstractResidence
door.setCurrentHp(door.getCurrentHp());
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_doorupgrade WHERE castleId=?"))
{
ps.setInt(1, getResidenceId());
@@ -837,7 +837,7 @@ public final class Castle extends AbstractResidence
if (save)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_doorupgrade (doorId, ratio, castleId) values (?,?,?)"))
{
ps.setInt(1, doorId);
@@ -864,7 +864,7 @@ public final class Castle extends AbstractResidence
CastleManorManager.getInstance().resetManorData(getResidenceId());
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Need to remove has castle flag from clan_data, should be checked from castle table.
try (PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET hasCastle = 0 WHERE hasCastle = ?"))
@@ -1032,7 +1032,7 @@ public final class Castle extends AbstractResidence
public void updateShowNpcCrest()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET showNpcCrest = ? WHERE id = ?"))
{
ps.setString(1, String.valueOf(_showNpcCrest));
@@ -1076,7 +1076,7 @@ public final class Castle extends AbstractResidence
{
_ticketBuyCount = count;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET ticketBuyCount = ? WHERE id = ?"))
{
ps.setInt(1, _ticketBuyCount);
@@ -1099,7 +1099,7 @@ public final class Castle extends AbstractResidence
{
if (save)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_trapupgrade (castleId, towerIndex, level) values (?,?,?)"))
{
ps.setInt(1, getResidenceId());
@@ -1126,7 +1126,7 @@ public final class Castle extends AbstractResidence
ts.setUpgradeLevel(0);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_trapupgrade WHERE castleId=?"))
{
ps.setInt(1, getResidenceId());
@@ -1209,7 +1209,7 @@ public final class Castle extends AbstractResidence
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET side = ? WHERE id = ?"))
{
ps.setString(1, side.toString());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/ClanHall.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
index 6fc9b45046..79906bc875 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
@@ -100,7 +100,7 @@ public final class ClanHall extends AbstractResidence
@Override
protected void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement loadStatement = con.prepareStatement(LOAD_CLANHALL);
PreparedStatement insertStatement = con.prepareStatement(INSERT_CLANHALL))
{
@@ -133,7 +133,7 @@ public final class ClanHall extends AbstractResidence
public void updateDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CLANHALL))
{
statement.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Couple.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Couple.java
index c40e7d454a..45294842ce 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Couple.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Couple.java
@@ -45,7 +45,7 @@ public class Couple
{
_Id = coupleId;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM mods_wedding WHERE id = ?"))
{
ps.setInt(1, _Id);
@@ -85,7 +85,7 @@ public class Couple
_weddingDate = Calendar.getInstance();
_weddingDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
{
_Id = IdFactory.getInstance().getNextId();
@@ -105,7 +105,7 @@ public class Couple
public void marry()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE mods_wedding set married = ?, weddingDate = ? where id = ?"))
{
ps.setBoolean(1, true);
@@ -123,7 +123,7 @@ public class Couple
public void divorce()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM mods_wedding WHERE id=?"))
{
ps.setInt(1, _Id);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Fort.java
index e6262fdc29..3b29461e3a 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Fort.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Fort.java
@@ -214,7 +214,7 @@ public final class Fort extends AbstractResidence
public void dbSave()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO fort_functions (fort_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)"))
{
ps.setInt(1, getResidenceId());
@@ -487,7 +487,7 @@ public final class Fort extends AbstractResidence
public void saveFortVariables()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET supplyLvL=? WHERE id = ?"))
{
ps.setInt(1, _supplyLvL);
@@ -552,7 +552,7 @@ public final class Fort extends AbstractResidence
@Override
protected void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort WHERE id = ?"))
{
ps.setInt(1, getResidenceId());
@@ -613,7 +613,7 @@ public final class Fort extends AbstractResidence
/** Load All Functions */
private void loadFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_functions WHERE fort_id = ?"))
{
ps.setInt(1, getResidenceId());
@@ -638,7 +638,7 @@ public final class Fort extends AbstractResidence
public void removeFunction(int functionType)
{
_function.remove(functionType);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM fort_functions WHERE fort_id=? AND type=?"))
{
ps.setInt(1, getResidenceId());
@@ -730,7 +730,7 @@ public final class Fort extends AbstractResidence
// This method loads fort door upgrade data from database
private void loadDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_doorupgrade WHERE fortId = ?"))
{
ps.setInt(1, getResidenceId());
@@ -750,7 +750,7 @@ public final class Fort extends AbstractResidence
private void removeDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM fort_doorupgrade WHERE fortId = ?"))
{
ps.setInt(1, getResidenceId());
@@ -764,7 +764,7 @@ public final class Fort extends AbstractResidence
private void saveDoorUpgrade(int doorId, int hp, int pDef, int mDef)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO fort_doorupgrade (doorId, hp, pDef, mDef) VALUES (?,?,?,?)"))
{
ps.setInt(1, doorId);
@@ -793,7 +793,7 @@ public final class Fort extends AbstractResidence
_lastOwnedTime.setTimeInMillis(0);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET owner=?,lastOwnedTime=?,state=?,castleId=? WHERE id = ?"))
{
ps.setInt(1, clanId);
@@ -998,7 +998,7 @@ public final class Fort extends AbstractResidence
{
_state = state;
_castleId = castleId;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET state=?,castleId=? WHERE id = ?"))
{
ps.setInt(1, _state);
@@ -1130,7 +1130,7 @@ public final class Fort extends AbstractResidence
private void initNpcs()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_spawnlist WHERE fortId = ? AND spawnType = ?"))
{
ps.setInt(1, getResidenceId());
@@ -1159,7 +1159,7 @@ public final class Fort extends AbstractResidence
private void initSiegeNpcs()
{
_siegeNpcs.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, npcId, x, y, z, heading FROM fort_spawnlist WHERE fortId = ? AND spawnType = ? ORDER BY id"))
{
ps.setInt(1, getResidenceId());
@@ -1186,7 +1186,7 @@ public final class Fort extends AbstractResidence
private void initNpcCommanders()
{
_npcCommanders.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, npcId, x, y, z, heading FROM fort_spawnlist WHERE fortId = ? AND spawnType = ? ORDER BY id"))
{
ps.setInt(1, getResidenceId());
@@ -1216,7 +1216,7 @@ public final class Fort extends AbstractResidence
_specialEnvoys.clear();
_envoyCastles.clear();
_availableCastles.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, npcId, x, y, z, heading, castleId FROM fort_spawnlist WHERE fortId = ? AND spawnType = ? ORDER BY id"))
{
ps.setInt(1, getResidenceId());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/FortSiege.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/FortSiege.java
index ffba04e6c3..d558045fab 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/FortSiege.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/FortSiege.java
@@ -501,7 +501,7 @@ public class FortSiege implements Siegable
/** Clear all registered siege clans from database for fort */
public void clearSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM fortsiege_clans WHERE fort_id=?"))
{
ps.setInt(1, _fort.getResidenceId());
@@ -785,7 +785,7 @@ public class FortSiege implements Siegable
private void removeSiegeClan(int clanId)
{
final String query = (clanId != 0) ? DELETE_FORT_SIEGECLANS_BY_CLAN_ID : DELETE_FORT_SIEGECLANS;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(query))
{
statement.setInt(1, _fort.getResidenceId());
@@ -999,7 +999,7 @@ public class FortSiege implements Siegable
private void loadSiegeClan()
{
_attackerClans.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clan_id FROM fortsiege_clans WHERE fort_id=?"))
{
ps.setInt(1, _fort.getResidenceId());
@@ -1057,7 +1057,7 @@ public class FortSiege implements Siegable
/** Save siege date to database. */
private void saveSiegeDate()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET siegeDate = ? WHERE id = ?"))
{
ps.setLong(1, _fort.getSiegeDate().getTimeInMillis());
@@ -1081,7 +1081,7 @@ public class FortSiege implements Siegable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO fortsiege_clans (clan_id,fort_id) values (?,?)"))
{
statement.setInt(1, clan.getId());
@@ -1146,7 +1146,7 @@ public class FortSiege implements Siegable
public void loadSiegeGuard()
{
_siegeGuards.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT npcId, x, y, z, heading, respawnDelay FROM fort_siege_guards WHERE fortId = ?"))
{
final int fortId = _fort.getResidenceId();
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Hero.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Hero.java
index 924ecead2f..27be59aa41 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Hero.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Hero.java
@@ -114,7 +114,7 @@ public class Hero
_herodiary.clear();
_heroMessage.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s1 = con.createStatement();
ResultSet rset = s1.executeQuery(GET_HEROES);
PreparedStatement ps = con.prepareStatement(GET_CLAN_ALLY);
@@ -211,7 +211,7 @@ public class Hero
*/
public void loadMessage(int charId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT message FROM heroes WHERE charId=?"))
{
statement.setInt(1, charId);
@@ -233,7 +233,7 @@ public class Hero
{
final List _diary = new CopyOnWriteArrayList<>();
int diaryentries = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM heroes_diary WHERE charId=? ORDER BY time ASC"))
{
statement.setInt(1, charId);
@@ -300,7 +300,7 @@ public class Hero
int _losses = 0;
int _draws = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM olympiad_fights WHERE (charOneId=? OR charTwoId=?) AND start ORDER BY start ASC"))
{
statement.setInt(1, charId);
@@ -699,7 +699,7 @@ public class Hero
public void updateHeroes(boolean setDefault)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (setDefault)
{
@@ -841,7 +841,7 @@ public class Hero
public void setDiaryData(int charId, int action, int param)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO heroes_diary (charId, time, action, param) values(?,?,?,?)"))
{
statement.setInt(1, charId);
@@ -877,7 +877,7 @@ public class Hero
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE heroes SET message=? WHERE charId=?;"))
{
statement.setString(1, _heroMessage.get(charId));
@@ -892,7 +892,7 @@ public class Hero
private void deleteItemsInDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_ITEMS))
{
statement.execute();
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Siege.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Siege.java
index d4cb96aabf..f20c39da7f 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Siege.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/entity/Siege.java
@@ -760,7 +760,7 @@ public class Siege implements Siegable
/** Clear all registered siege clans from database for castle */
public void clearSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=?"))
{
statement.setInt(1, _castle.getResidenceId());
@@ -788,7 +788,7 @@ public class Siege implements Siegable
/** Clear all siege clans waiting for approval from database for castle */
public void clearSiegeWaitingClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=? and type = 2"))
{
statement.setInt(1, _castle.getResidenceId());
@@ -972,7 +972,7 @@ public class Siege implements Siegable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=? and clan_id=?"))
{
statement.setInt(1, _castle.getResidenceId());
@@ -1238,7 +1238,7 @@ public class Siege implements Siegable
private void loadSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT clan_id,type FROM siege_clans where castle_id=?"))
{
getAttackerClans().clear();
@@ -1349,7 +1349,7 @@ public class Siege implements Siegable
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castle), 1000);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE castle SET siegeDate = ?, regTimeEnd = ?, regTimeOver = ? WHERE id = ?"))
{
statement.setLong(1, _castle.getSiegeDate().getTimeInMillis());
@@ -1378,7 +1378,7 @@ public class Siege implements Siegable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if ((typeId == DEFENDER) || (typeId == DEFENDER_NOT_APPROVED) || (typeId == OWNER))
{
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java
index ac490ba86d..f23e511ede 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java
@@ -138,7 +138,7 @@ public class EventScheduler
public boolean updateLastRun()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO event_schedulers (eventName, schedulerName, lastRun) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE eventName = ?, schedulerName = ?, lastRun = ?"))
{
ps.setString(1, _eventManager.getName());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java
index 3185dae127..fc59ec7842 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java
@@ -52,7 +52,7 @@ public class HaventRunConditionalScheduler implements IConditionalEventScheduler
throw new NullPointerException("Scheduler not found: " + _name);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT lastRun FROM event_schedulers WHERE eventName = ? AND schedulerName = ?"))
{
ps.setString(1, _eventManager.getName());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/instancezone/Instance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/instancezone/Instance.java
index 053ffa54cf..ccef54aad0 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/instancezone/Instance.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/instancezone/Instance.java
@@ -815,7 +815,7 @@ public final class Instance implements IIdentifiable, INamable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT IGNORE INTO character_instance_time (charId,instanceId,time) VALUES (?,?,?)"))
{
// Save to database
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java
index 24c473792a..3f1ad0c250 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java
@@ -191,7 +191,7 @@ public final class ItemAuction
public final void storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO item_auction (auctionId,instanceId,auctionItemId,startingTime,endingTime,auctionStateId) VALUES (?,?,?,?,?,?) ON DUPLICATE KEY UPDATE auctionStateId=?"))
{
statement.setInt(1, _auctionId);
@@ -225,7 +225,7 @@ public final class ItemAuction
final void updatePlayerBidInternal(ItemAuctionBid bid, boolean delete)
{
final String query = delete ? DELETE_ITEM_AUCTION_BID : INSERT_ITEM_AUCTION_BID;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(query))
{
ps.setInt(1, _auctionId);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java
index ec5eb4074e..d388e90796 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java
@@ -161,7 +161,7 @@ public final class ItemAuctionInstance
throw new IllegalArgumentException("No items defined");
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_AUCTION_ID_BY_INSTANCE_ID))
{
ps.setInt(1, _instanceId);
@@ -533,7 +533,7 @@ public final class ItemAuctionInstance
private ItemAuction loadAuction(int auctionId) throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
int auctionItemId = 0;
long startingTime = 0;
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java
index 102306be1b..f73b31f758 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java
@@ -1813,7 +1813,7 @@ public abstract class Inventory extends ItemContainer
@Override
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM items WHERE owner_id=? AND (loc=? OR loc=?) ORDER BY loc_data"))
{
ps.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java
index 1501c166e8..9a71ec3c76 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java
@@ -673,7 +673,7 @@ public abstract class ItemContainer
*/
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM items WHERE owner_id=? AND (loc=?)"))
{
ps.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java
index 9e94b591e8..09cbc47e3b 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java
@@ -112,7 +112,7 @@ public class Mail extends ItemContainer
@Override
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM items WHERE owner_id=? AND loc=? AND loc_data=?"))
{
statement.setInt(1, _ownerId);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java
index 9228d151c2..a3a85dfeba 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java
@@ -738,7 +738,7 @@ public class PcInventory extends Inventory
public static int[][] restoreVisibleInventory(int objectId)
{
final int[][] paperdoll = new int[33][4];
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement2 = con.prepareStatement("SELECT object_id,item_id,loc_data,enchant_level FROM items WHERE owner_id=? AND loc='PAPERDOLL'"))
{
statement2.setInt(1, objectId);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java
index 4b3cd1f785..37575f09ea 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java
@@ -983,7 +983,7 @@ public final class L2ItemInstance extends L2Object
final VariationInstance augment = _augmentation;
_augmentation = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_variations WHERE itemId = ?"))
{
ps.setInt(1, getObjectId());
@@ -1000,7 +1000,7 @@ public final class L2ItemInstance extends L2Object
public void restoreAttributes()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("SELECT mineralId,option1,option2 FROM item_variations WHERE itemId=?");
PreparedStatement ps2 = con.prepareStatement("SELECT elemType,elemValue FROM item_elementals WHERE itemId=?"))
{
@@ -1041,7 +1041,7 @@ public final class L2ItemInstance extends L2Object
public void updateItemOptions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
updateItemOptions(con);
}
@@ -1069,7 +1069,7 @@ public final class L2ItemInstance extends L2Object
public void updateItemElementals()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
updateItemElements(con);
}
@@ -1231,7 +1231,7 @@ public final class L2ItemInstance extends L2Object
_elementals.remove(type);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_elementals WHERE itemId = ? AND elemType = ?"))
{
ps.setInt(1, getObjectId());
@@ -1256,7 +1256,7 @@ public final class L2ItemInstance extends L2Object
_elementals.clear();
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_elementals WHERE itemId = ?"))
{
ps.setInt(1, getObjectId());
@@ -1588,7 +1588,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE items SET owner_id=?,count=?,loc=?,loc_data=?,enchant_level=?,custom_type1=?,custom_type2=?,mana_left=?,time=? WHERE object_id = ?"))
{
ps.setInt(1, _ownerId);
@@ -1621,7 +1621,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO items (owner_id,item_id,count,loc,loc_data,enchant_level,object_id,custom_type1,custom_type2,mana_left,time) VALUES (?,?,?,?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, _ownerId);
@@ -1669,7 +1669,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM items WHERE object_id = ?"))
{
@@ -2161,7 +2161,7 @@ public final class L2ItemInstance extends L2Object
private void removeSpecialAbility(EnsoulOption option)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_special_abilities WHERE objectId = ? AND optionId = ?"))
{
ps.setInt(1, getObjectId());
@@ -2215,7 +2215,7 @@ public final class L2ItemInstance extends L2Object
private void restoreSpecialAbilities()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM item_special_abilities WHERE objectId = ? ORDER BY position"))
{
ps.setInt(1, getObjectId());
@@ -2242,7 +2242,7 @@ public final class L2ItemInstance extends L2Object
public void updateSpecialAbilities()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
updateSpecialAbilities(con);
}
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java
index 44b0ac9c43..1ad8f4c201 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java
@@ -142,7 +142,7 @@ public class Olympiad extends ListenersContainer
{
_nobles.clear();
boolean loaded = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_LOAD_DATA);
ResultSet rset = statement.executeQuery())
{
@@ -221,7 +221,7 @@ public class Olympiad extends ListenersContainer
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_LOAD_NOBLES);
ResultSet rset = statement.executeQuery())
{
@@ -295,7 +295,7 @@ public class Olympiad extends ListenersContainer
{
_noblesRank.clear();
final Map tmpPlace = new HashMap<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(GET_ALL_CLASSIFIED_NOBLESS);
ResultSet rset = statement.executeQuery())
{
@@ -806,7 +806,7 @@ public class Olympiad extends ListenersContainer
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
for (Entry entry : _nobles.entrySet())
{
@@ -878,7 +878,7 @@ public class Olympiad extends ListenersContainer
{
saveNobleData();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_SAVE_DATA))
{
statement.setInt(1, _currentCycle);
@@ -919,7 +919,7 @@ public class Olympiad extends ListenersContainer
protected void updateMonthlyData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(OLYMPIAD_MONTH_CLEAR);
PreparedStatement ps2 = con.prepareStatement(OLYMPIAD_MONTH_CREATE))
{
@@ -963,7 +963,7 @@ public class Olympiad extends ListenersContainer
final List heroesToBe = new LinkedList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_GET_HEROS))
{
StatsSet hero;
@@ -998,7 +998,7 @@ public class Olympiad extends ListenersContainer
{
final List names = new ArrayList<>();
final String query = Config.ALT_OLY_SHOW_MONTHLY_WINNERS ? ((classId == 132) ? GET_EACH_CLASS_LEADER_SOULHOUND : GET_EACH_CLASS_LEADER) : ((classId == 132) ? GET_EACH_CLASS_LEADER_CURRENT_SOULHOUND : GET_EACH_CLASS_LEADER_CURRENT);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(query))
{
ps.setInt(1, classId);
@@ -1108,7 +1108,7 @@ public class Olympiad extends ListenersContainer
public int getLastNobleOlympiadPoints(int objId)
{
int result = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT olympiad_points FROM olympiad_nobles_eom WHERE charId = ?"))
{
ps.setInt(1, objId);
@@ -1252,7 +1252,7 @@ public class Olympiad extends ListenersContainer
protected void deleteNobles()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_DELETE_ALL))
{
statement.execute();
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java
index 9249ca2223..2824298209 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java
@@ -743,7 +743,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
protected static void saveResults(Participant one, Participant two, int winner, long startTime, long fightTime, CompetitionType type)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO olympiad_fights (charOneId, charTwoId, charOneClass, charTwoClass, winner, start, time, classed) values(?,?,?,?,?,?,?,?)"))
{
statement.setInt(1, one.getObjectId());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java
index d73e56cbe8..c805ee421d 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java
@@ -185,7 +185,7 @@ public class PunishmentTask implements Runnable
{
if (!_isStored)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
{
st.setString(1, _key);
@@ -224,7 +224,7 @@ public class PunishmentTask implements Runnable
{
if (_isStored)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(UPDATE_QUERY))
{
st.setLong(1, System.currentTimeMillis());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java
index 248d5997e4..0dea776f93 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java
@@ -409,7 +409,7 @@ public class LongTimeEvent extends Quest
}
}
// Update database
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM items WHERE item_id=?"))
{
statement.setInt(1, itemId);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/quest/Quest.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/quest/Quest.java
index d880abb16b..a8a037aa98 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/quest/Quest.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/quest/Quest.java
@@ -1591,7 +1591,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void playerEnter(L2PcInstance player)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement invalidQuestData = con.prepareStatement("DELETE FROM character_quests WHERE charId = ? AND name = ?");
PreparedStatement invalidQuestDataVar = con.prepareStatement("DELETE FROM character_quests WHERE charId = ? AND name = ? AND var = ?");
PreparedStatement ps1 = con.prepareStatement("SELECT name, value FROM character_quests WHERE charId = ? AND var = ?"))
@@ -1673,7 +1673,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void createQuestVarInDb(QuestState qs, String var, String value)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_quests (charId,name,var,value) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE value=?"))
{
statement.setInt(1, qs.getPlayer().getObjectId());
@@ -1697,7 +1697,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void updateQuestVarInDb(QuestState qs, String var, String value)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE character_quests SET value=? WHERE charId=? AND name=? AND var = ?"))
{
statement.setString(1, value);
@@ -1719,7 +1719,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void deleteQuestVarInDb(QuestState qs, String var)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_quests WHERE charId=? AND name=? AND var=?"))
{
statement.setInt(1, qs.getPlayer().getObjectId());
@@ -1740,7 +1740,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void deleteQuestInDb(QuestState qs, boolean repeatable)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(repeatable ? QUEST_DELETE_FROM_CHAR_QUERY : QUEST_DELETE_FROM_CHAR_QUERY_NON_REPEATABLE_QUERY))
{
ps.setInt(1, qs.getPlayer().getObjectId());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java
index 11c78a1a47..9af2be9039 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java
@@ -126,7 +126,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
protected void initFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM residence_functions WHERE residenceId = ?"))
{
ps.setInt(1, _residenceId);
@@ -164,7 +164,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
public void addFunction(ResidenceFunction func)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO residence_functions (id, level, expiration, residenceId) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE level = ?, expiration = ?"))
{
ps.setInt(1, func.getId());
@@ -196,7 +196,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
public void removeFunction(ResidenceFunction func)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM residence_functions WHERE residenceId = ? and id = ?"))
{
ps.setInt(1, _residenceId);
@@ -219,7 +219,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
public void removeFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM residence_functions WHERE residenceId = ?"))
{
ps.setInt(1, _residenceId);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
index 8b91fc77d2..53958bcf5c 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
@@ -50,7 +50,7 @@ public class AccountVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setString(1, _accountName);
@@ -83,7 +83,7 @@ public class AccountVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -120,7 +120,7 @@ public class AccountVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java
index 50fcf2ab6f..5af41a23af 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java
@@ -50,7 +50,7 @@ public class ClanVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setInt(1, _objectId);
@@ -83,7 +83,7 @@ public class ClanVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -120,7 +120,7 @@ public class ClanVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java
index c7ba2ff071..048b15a86e 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java
@@ -55,7 +55,7 @@ public class ItemVariables extends AbstractVariables
public static boolean hasVariables(int objectId)
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_COUNT))
{
st.setInt(1, objectId);
@@ -79,7 +79,7 @@ public class ItemVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setInt(1, _objectId);
@@ -112,7 +112,7 @@ public class ItemVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -149,7 +149,7 @@ public class ItemVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
index 85508e687b..c677c68971 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
@@ -76,7 +76,7 @@ public class PlayerVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setInt(1, _objectId);
@@ -109,7 +109,7 @@ public class PlayerVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -146,7 +146,7 @@ public class PlayerVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/L2GameClient.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/L2GameClient.java
index f1e975876e..fd5baeb233 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/L2GameClient.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/L2GameClient.java
@@ -329,7 +329,7 @@ public final class L2GameClient extends ChannelInboundHandler
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps2 = con.prepareStatement("UPDATE characters SET deletetime=? WHERE charId=?"))
{
ps2.setLong(1, System.currentTimeMillis() + (Config.DELETE_DAYS * 86400000)); // 24*60*60*1000 = 86400000
@@ -354,7 +354,7 @@ public final class L2GameClient extends ChannelInboundHandler
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE characters SET deletetime=0 WHERE charId=?"))
{
statement.setInt(1, objectId);
@@ -377,7 +377,7 @@ public final class L2GameClient extends ChannelInboundHandler
CharNameTable.getInstance().removeName(objid);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM character_contacts WHERE charId=? OR contactId=?"))
{
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
index 297edda360..afcc3fcbb0 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
@@ -164,7 +164,7 @@ public final class RequestDestroyItem implements IClientIncomingPacket
pet.unSummon(activeChar);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
{
statement.setInt(1, _objectId);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java
index 29ab10a108..a9c8dadb8a 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java
@@ -62,7 +62,7 @@ public class RequestPetitionFeedback implements IClientIncomingPacket
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_FEEDBACK))
{
statement.setString(1, player.getName());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java
index a2d7c3bba4..537d7f2618 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java
@@ -73,7 +73,7 @@ public final class RequestAnswerFriendInvite implements IClientIncomingPacket
if (_response == 1)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_friends (charId, friendId) VALUES (?, ?), (?, ?)"))
{
statement.setInt(1, requestor.getObjectId());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java
index 03435f7f4d..bfe07c3aed 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java
@@ -75,7 +75,7 @@ public final class RequestFriendDel implements IClientIncomingPacket
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_friends WHERE (charId=? AND friendId=?) OR (charId=? AND friendId=?)"))
{
statement.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java
index 94715a15c1..27668b0d62 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java
@@ -74,7 +74,7 @@ public class ConfirmMenteeAdd implements IClientIncomingPacket
}
else if (validate(mentor, mentee))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_mentees (charId, mentorId) VALUES (?, ?)"))
{
statement.setInt(1, mentee.getObjectId());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java
index a766651521..a2da095429 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java
@@ -225,7 +225,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
CharSelectInfoPackage charInfopackage;
final List characterList = new LinkedList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM characters WHERE account_name=? ORDER BY createDate"))
{
statement.setString(1, loginName);
@@ -258,7 +258,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
private static void loadCharacterSubclassInfo(CharSelectInfoPackage charInfopackage, int ObjectId, int activeClassId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT exp, sp, level, vitality_points FROM character_subclasses WHERE charId=? AND class_id=? ORDER BY charId"))
{
statement.setInt(1, ObjectId);
@@ -368,7 +368,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
if (weaponObjId > 0)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT mineralId,option1,option2 FROM item_variations WHERE itemId=?"))
{
statement.setInt(1, weaponObjId);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java
index 14cd41a31e..ebb3f90088 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java
@@ -70,7 +70,7 @@ public class FriendList implements IClientOutgoingPacket
if (player1 == null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT char_name, online, classid, level FROM characters WHERE charId = ?"))
{
statement.setInt(1, objId);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java
index 8344576a3e..8876431ff9 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java
@@ -72,7 +72,7 @@ public class SecondaryPasswordAuth
private void loadPassword()
{
String var, value = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SELECT_PASSWORD))
{
statement.setString(1, _activeClient.getAccountName());
@@ -117,7 +117,7 @@ public class SecondaryPasswordAuth
password = cryptPassword(password);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_PASSWORD))
{
statement.setString(1, _activeClient.getAccountName());
@@ -136,7 +136,7 @@ public class SecondaryPasswordAuth
public boolean insertWrongAttempt(int attempts)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_ATTEMPT))
{
statement.setString(1, _activeClient.getAccountName());
@@ -175,7 +175,7 @@ public class SecondaryPasswordAuth
newPassword = cryptPassword(newPassword);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_PASSWORD))
{
statement.setString(1, newPassword);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
index ca0cef4b3b..a78d28bdc9 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
@@ -95,7 +95,7 @@ public final class TaskManager
{
task.onTimeElapsed(this);
lastActivation = System.currentTimeMillis();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[1]))
{
statement.setLong(1, lastActivation);
@@ -182,7 +182,7 @@ public final class TaskManager
private void startAllTasks()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[0]);
ResultSet rset = statement.executeQuery())
{
@@ -314,7 +314,7 @@ public final class TaskManager
private static boolean addUniqueTask(String task, TaskTypes type, String param1, String param2, String param3, long lastActivation)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(SQL_STATEMENTS[2]))
{
ps1.setString(1, task);
@@ -350,7 +350,7 @@ public final class TaskManager
private static boolean addTask(String task, TaskTypes type, String param1, String param2, String param3, long lastActivation)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[3]))
{
statement.setString(1, task);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java
index 5e3e35c6a9..e81b95cba3 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java
@@ -76,7 +76,7 @@ public class TaskBirthday extends Task
private void checkBirthday(int year, int month, int day)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY))
{
statement.setString(1, "%-" + getNum(month + 1) + "-" + getNum(day));
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/Evolve.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/Evolve.java
index 66a22f62fd..f87e33ed8d 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/Evolve.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/gameserver/util/Evolve.java
@@ -248,7 +248,7 @@ public final class Evolve
}
// pet control item no longer exists, delete the pet from the db
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
{
ps.setInt(1, removedItem.getObjectId());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/GameServerTable.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/GameServerTable.java
index 1a0713b155..2410f6ede8 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/GameServerTable.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/GameServerTable.java
@@ -115,7 +115,7 @@ public final class GameServerTable implements IGameXmlReader
*/
private void loadRegisteredGameServers()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT * FROM gameservers"))
{
@@ -222,7 +222,7 @@ public final class GameServerTable implements IGameXmlReader
public void registerServerOnDB(byte[] hexId, int id, String externalHost)
{
register(id, new GameServerInfo(id, hexId));
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO gameservers (hexid,server_id,host) values (?,?,?)"))
{
ps.setString(1, hexToString(hexId));
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/LoginController.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/LoginController.java
index a896c7fd7a..fbee48fc33 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/LoginController.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/LoginController.java
@@ -176,7 +176,7 @@ public class LoginController
final byte[] raw = password.getBytes(StandardCharsets.UTF_8);
final String hashBase64 = Base64.getEncoder().encodeToString(md.digest(raw));
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(USER_INFO_SELECT))
{
ps.setString(1, Long.toString(System.currentTimeMillis()));
@@ -206,7 +206,7 @@ public class LoginController
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(AUTOCREATE_ACCOUNTS_INSERT))
{
ps.setString(1, login);
@@ -405,7 +405,7 @@ public class LoginController
if (loginOk && (client.getLastServer() != serverId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_LAST_SERVER_UPDATE))
{
ps.setInt(1, serverId);
@@ -424,7 +424,7 @@ public class LoginController
public void setAccountAccessLevel(String account, int banLevel)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_ACCESS_LEVEL_UPDATE))
{
ps.setInt(1, banLevel);
@@ -439,7 +439,7 @@ public class LoginController
public void setAccountLastTracert(String account, String pcIp, String hop1, String hop2, String hop3, String hop4)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_IPS_UPDATE))
{
ps.setString(1, pcIp);
@@ -499,7 +499,7 @@ public class LoginController
{
final List ipWhiteList = new ArrayList<>();
final List ipBlackList = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_IPAUTH_SELECT))
{
ps.setString(1, info.getLogin());
@@ -545,7 +545,7 @@ public class LoginController
client.setAccessLevel(info.getAccessLevel());
client.setLastServer(info.getLastServer());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_INFO_UPDATE))
{
ps.setLong(1, System.currentTimeMillis());
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/LoginServer.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/LoginServer.java
index 39377afee3..d598992bdf 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/LoginServer.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/LoginServer.java
@@ -89,7 +89,7 @@ public final class LoginServer
Config.load();
// Prepare Database
- DatabaseFactory.getInstance();
+ DatabaseFactory.init();
try
{
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java
index 69ba99271d..6c73dea27a 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java
@@ -78,7 +78,7 @@ public class ChangePassword extends BaseRecievePacket
int passUpdated = 0;
// SQL connection
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT password FROM accounts WHERE login=?"))
{
ps.setString(1, accountName);
@@ -95,7 +95,7 @@ public class ChangePassword extends BaseRecievePacket
{
final byte[] password = md.digest(newpass.getBytes("UTF-8"));
// SQL connection
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE accounts SET password=? WHERE login=?"))
{
ps.setString(1, Base64.getEncoder().encodeToString(password));
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java
index f9a24a80d8..785946a687 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java
@@ -58,7 +58,7 @@ public class RequestTempBan extends BaseRecievePacket
private void banUser()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO account_data VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE value=?"))
{
ps.setString(1, _accountName);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
index 59b0e01835..4fb705c8b1 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
@@ -43,6 +43,7 @@ public class SQLAccountManager
{
Server.serverMode = Server.MODE_LOGINSERVER;
Config.load();
+ DatabaseFactory.init();
try (Scanner _scn = new Scanner(System.in))
{
@@ -166,7 +167,7 @@ public class SQLAccountManager
}
q = q.concat(" ORDER BY login ASC");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(q);
ResultSet rset = ps.executeQuery())
{
@@ -187,7 +188,7 @@ public class SQLAccountManager
private static void addOrUpdateAccount(String account, String password, String level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE accounts(login, password, accessLevel) VALUES (?, ?, ?)"))
{
final MessageDigest md = MessageDigest.getInstance("SHA");
@@ -213,7 +214,7 @@ public class SQLAccountManager
private static void changeAccountLevel(String account, String level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE accounts SET accessLevel = ? WHERE login = ?"))
{
ps.setString(1, level);
@@ -236,7 +237,7 @@ public class SQLAccountManager
private static void deleteAccount(String account)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM accounts WHERE login = ?"))
{
ps.setString(1, account);
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java
index 4ac531c664..fd25fddae4 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java
@@ -34,7 +34,7 @@ public class DBInstallerConsole implements DBOutputInterface
public DBInstallerConsole(String db, String dir) throws Exception
{
- System.out.println("Welcome to L2J DataBase installer");
+ System.out.println("Welcome to DataBase installer");
final Preferences prop = Preferences.userRoot();
RunTasks rt = null;
try (Scanner scn = new Scanner(new CloseShieldedInputStream(System.in)))
diff --git a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
index c90c8127a6..8e5a6bde49 100644
--- a/L2J_Mobius_2.5_Underground/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
+++ b/L2J_Mobius_2.5_Underground/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
@@ -187,6 +187,7 @@ public abstract class BaseGameServerRegister
Server.serverMode = Server.MODE_LOGINSERVER;
Config.load();
+ DatabaseFactory.init();
GameServerTable.getInstance();
_loaded = true;
@@ -215,7 +216,7 @@ public abstract class BaseGameServerRegister
*/
public static void unregisterGameServer(int id) throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM gameservers WHERE server_id = ?"))
{
@@ -231,7 +232,7 @@ public abstract class BaseGameServerRegister
*/
public static void unregisterAllGameServers() throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("DELETE FROM gameservers");
diff --git a/L2J_Mobius_2.5_Underground/launcher/Gameserver.launch b/L2J_Mobius_2.5_Underground/launcher/Gameserver.launch
index c78e27d008..f4ce633660 100644
--- a/L2J_Mobius_2.5_Underground/launcher/Gameserver.launch
+++ b/L2J_Mobius_2.5_Underground/launcher/Gameserver.launch
@@ -7,12 +7,13 @@
-
+
+
diff --git a/L2J_Mobius_2.5_Underground/launcher/Loginserver.launch b/L2J_Mobius_2.5_Underground/launcher/Loginserver.launch
index 2fc70ddd7c..6d99605959 100644
--- a/L2J_Mobius_2.5_Underground/launcher/Loginserver.launch
+++ b/L2J_Mobius_2.5_Underground/launcher/Loginserver.launch
@@ -7,7 +7,7 @@
-
+
@@ -15,5 +15,6 @@
+
diff --git a/L2J_Mobius_3.0_Helios/.classpath b/L2J_Mobius_3.0_Helios/.classpath
index 0e50693da9..619d354392 100644
--- a/L2J_Mobius_3.0_Helios/.classpath
+++ b/L2J_Mobius_3.0_Helios/.classpath
@@ -5,11 +5,12 @@
-
+
-
+
+
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java
index 9a3b363f56..68ef6d5320 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java
@@ -76,7 +76,7 @@ public final class AdminChangeAccessLevel implements IAdminCommandHandler
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET accesslevel=? WHERE char_name=?");
statement.setInt(1, lvl);
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
index df8b849989..3a1d5a2069 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
@@ -631,7 +631,7 @@ public class AdminEditChar implements IAdminCommandHandler
if (player == null)
{
- final Connection con = DatabaseFactory.getInstance().getConnection();
+ final Connection con = DatabaseFactory.getConnection();
final PreparedStatement ps = con.prepareStatement("UPDATE characters SET " + (changeCreateExpiryTime ? "clan_create_expiry_time" : "clan_join_expiry_time") + " WHERE char_name=? LIMIT 1");
ps.setString(1, playerName);
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java
index 764ab77c25..969633adcb 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java
@@ -62,7 +62,7 @@ public class AdminRepairChar implements IAdminCommandHandler
}
final String cmd = "UPDATE characters SET x=-84318, y=244579, z=-3730 WHERE char_name=?";
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(cmd);
statement.setString(1, parts[1]);
@@ -87,13 +87,13 @@ public class AdminRepairChar implements IAdminCommandHandler
return;
}
- // connection = L2DatabaseFactory.getInstance().getConnection();
+ // connection = L2DatabaseFactory.getConnection();
statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=?");
statement.setInt(1, objId);
statement.execute();
statement.close();
- // connection = L2DatabaseFactory.getInstance().getConnection();
+ // connection = L2DatabaseFactory.getConnection();
statement = con.prepareStatement("UPDATE items SET loc=\"INVENTORY\" WHERE owner_id=?");
statement.setInt(1, objId);
statement.execute();
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java
index 780c3b0088..da0c7dcad2 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java
@@ -173,7 +173,7 @@ public class AdminShowQuests implements IAdminCommandHandler
private static void showQuestMenu(L2PcInstance target, L2PcInstance actor, String[] val)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
ResultSet rs;
PreparedStatement req;
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java
index 35508761a2..a8b6ed6963 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java
@@ -489,7 +489,7 @@ public class AdminTeleport implements IAdminCommandHandler
final int x = activeChar.getX();
final int y = activeChar.getY();
final int z = activeChar.getZ();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=? WHERE char_name=?");
statement.setInt(1, x);
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java
index b4e722f105..3913b5b368 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java
@@ -61,7 +61,7 @@ public class FavoriteBoard implements IParseBoardHandler
// Load Favorite links
final String list = HtmCache.getInstance().getHtm(activeChar, "data/html/CommunityBoard/favorite_list.html");
final StringBuilder sb = new StringBuilder();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_FAVORITES))
{
ps.setInt(1, activeChar.getObjectId());
@@ -98,7 +98,7 @@ public class FavoriteBoard implements IParseBoardHandler
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_FAVORITE))
{
ps.setInt(1, activeChar.getObjectId());
@@ -123,7 +123,7 @@ public class FavoriteBoard implements IParseBoardHandler
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_FAVORITE))
{
ps.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/communityboard/HomeBoard.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
index bed19004d2..1f5572ec39 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
@@ -300,7 +300,7 @@ public final class HomeBoard implements IParseBoardHandler
private static int getFavoriteCount(L2PcInstance player)
{
int count = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(COUNT_FAVORITES))
{
ps.setInt(1, player.getObjectId());
diff --git a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
index 59ecba44bb..e0708990b7 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
+++ b/L2J_Mobius_3.0_Helios/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
@@ -62,7 +62,7 @@ public class ClanWarsList implements IUserCommandHandler
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
String query;
// Attack List
diff --git a/L2J_Mobius_3.0_Helios/dist/game/java.cfg b/L2J_Mobius_3.0_Helios/dist/game/java.cfg
index cb4a4dc204..58213e428e 100644
--- a/L2J_Mobius_3.0_Helios/dist/game/java.cfg
+++ b/L2J_Mobius_3.0_Helios/dist/game/java.cfg
@@ -1 +1 @@
--server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
\ No newline at end of file
+-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=error -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
\ No newline at end of file
diff --git a/L2J_Mobius_3.0_Helios/dist/libs/HikariCP-3.2.0.jar b/L2J_Mobius_3.0_Helios/dist/libs/HikariCP-3.2.0.jar
new file mode 100644
index 0000000000..a030a7f8dc
Binary files /dev/null and b/L2J_Mobius_3.0_Helios/dist/libs/HikariCP-3.2.0.jar differ
diff --git a/L2J_Mobius_3.0_Helios/dist/libs/c3p0-0.9.5.2.jar b/L2J_Mobius_3.0_Helios/dist/libs/c3p0-0.9.5.2.jar
deleted file mode 100644
index 579cedd980..0000000000
Binary files a/L2J_Mobius_3.0_Helios/dist/libs/c3p0-0.9.5.2.jar and /dev/null differ
diff --git a/L2J_Mobius_3.0_Helios/dist/libs/mchange-commons-java-0.2.12.jar b/L2J_Mobius_3.0_Helios/dist/libs/mchange-commons-java-0.2.12.jar
deleted file mode 100644
index af11054860..0000000000
Binary files a/L2J_Mobius_3.0_Helios/dist/libs/mchange-commons-java-0.2.12.jar and /dev/null differ
diff --git a/L2J_Mobius_3.0_Helios/dist/libs/slf4j-api-1.7.25.jar b/L2J_Mobius_3.0_Helios/dist/libs/slf4j-api-1.7.25.jar
new file mode 100644
index 0000000000..7e62f1336d
Binary files /dev/null and b/L2J_Mobius_3.0_Helios/dist/libs/slf4j-api-1.7.25.jar differ
diff --git a/L2J_Mobius_3.0_Helios/dist/libs/slf4j-simple-1.7.25.jar b/L2J_Mobius_3.0_Helios/dist/libs/slf4j-simple-1.7.25.jar
new file mode 100644
index 0000000000..b29ca12719
Binary files /dev/null and b/L2J_Mobius_3.0_Helios/dist/libs/slf4j-simple-1.7.25.jar differ
diff --git a/L2J_Mobius_3.0_Helios/dist/login/java.cfg b/L2J_Mobius_3.0_Helios/dist/login/java.cfg
index 00ae5b3a66..bda4cdd24d 100644
--- a/L2J_Mobius_3.0_Helios/dist/login/java.cfg
+++ b/L2J_Mobius_3.0_Helios/dist/login/java.cfg
@@ -1 +1 @@
--server -Xms128m -Xmx256m
\ No newline at end of file
+-server -Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=error -Xms128m -Xmx256m
\ No newline at end of file
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/commons/database/DatabaseFactory.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/commons/database/DatabaseFactory.java
index 68d02d4171..dd481d2fd0 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/commons/database/DatabaseFactory.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/commons/database/DatabaseFactory.java
@@ -16,122 +16,68 @@
*/
package com.l2jmobius.commons.database;
-import java.beans.PropertyVetoException;
import java.sql.Connection;
-import java.sql.SQLException;
import java.util.logging.Logger;
import com.l2jmobius.Config;
-import com.mchange.v2.c3p0.ComboPooledDataSource;
+import com.zaxxer.hikari.HikariDataSource;
/**
- * Database Factory implementation.
- * @author Zoey76, Mobius
+ * @author Mobius
*/
public class DatabaseFactory
{
private static final Logger LOGGER = Logger.getLogger(DatabaseFactory.class.getName());
- private final ComboPooledDataSource _dataSource;
+ private static final HikariDataSource _hds = new HikariDataSource();
- public DatabaseFactory()
+ public static void init()
{
- if (Config.DATABASE_MAX_CONNECTIONS < 2)
- {
- Config.DATABASE_MAX_CONNECTIONS = 2;
- LOGGER.warning("A minimum of 2 connections are required.");
- }
-
- _dataSource = new ComboPooledDataSource();
- _dataSource.setAutoCommitOnClose(true);
-
- _dataSource.setInitialPoolSize(10);
- _dataSource.setMinPoolSize(10);
- _dataSource.setMaxPoolSize(Math.max(10, Config.DATABASE_MAX_CONNECTIONS));
-
- _dataSource.setAcquireRetryAttempts(0); // try to obtain connections indefinitely (0 = never quit)
- _dataSource.setAcquireRetryDelay(500); // 500 milliseconds wait before try to acquire connection again
- _dataSource.setCheckoutTimeout(0); // 0 = wait indefinitely for new connection if pool is exhausted
- _dataSource.setAcquireIncrement(5); // if pool is exhausted, get 5 more connections at a time cause there is
- // a "long" delay on acquire connection so taking more than one connection at once will make connection pooling more effective.
-
- // this "connection_test_table" is automatically created if not already there
- _dataSource.setAutomaticTestTable("connection_test_table");
- _dataSource.setTestConnectionOnCheckin(false);
-
- // testing OnCheckin used with IdleConnectionTestPeriod is faster than testing on checkout
-
- _dataSource.setIdleConnectionTestPeriod(3600); // test idle connection every 60 sec
- _dataSource.setMaxIdleTime(Config.DATABASE_MAX_IDLE_TIME); // 0 = idle connections never expire
- // *THANKS* to connection testing configured above but I prefer to disconnect all connections not used for more than 1 hour
-
- // enables statement caching, there is a "semi-bug" in c3p0 0.9.0 but in 0.9.0.2 and later it's fixed
- _dataSource.setMaxStatementsPerConnection(100);
-
- _dataSource.setBreakAfterAcquireFailure(false); // never fail if any way possible setting this to true will make c3p0 "crash"
- // and refuse to work till restart thus making acquire errors "FATAL" ... we don't want that it should be possible to recover
+ _hds.setDriverClassName(Config.DATABASE_DRIVER);
+ _hds.setJdbcUrl(Config.DATABASE_URL);
+ _hds.setUsername(Config.DATABASE_LOGIN);
+ _hds.setPassword(Config.DATABASE_PASSWORD);
+ _hds.setMaximumPoolSize(Config.DATABASE_MAX_CONNECTIONS);
+ _hds.setIdleTimeout(Config.DATABASE_MAX_IDLE_TIME);
+ // Test if connection is valid.
try
{
- _dataSource.setDriverClass(Config.DATABASE_DRIVER);
+ _hds.getConnection().close();
+ LOGGER.info("Database: Initialized.");
}
- catch (PropertyVetoException e)
+ catch (Exception e)
{
e.printStackTrace();
}
- _dataSource.setJdbcUrl(Config.DATABASE_URL);
- _dataSource.setUser(Config.DATABASE_LOGIN);
- _dataSource.setPassword(Config.DATABASE_PASSWORD);
-
- /* Test the connection */
- try
- {
- _dataSource.getConnection().close();
- }
- catch (SQLException e)
- {
- e.printStackTrace();
- }
-
- LOGGER.info("Database: Initialized.");
}
- public Connection getConnection()
+ public static Connection getConnection()
{
Connection con = null;
while (con == null)
{
try
{
- con = _dataSource.getConnection();
+ con = _hds.getConnection();
}
- catch (SQLException e)
+ catch (Exception e)
{
- LOGGER.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage());
+ LOGGER.severe("DatabaseFactory: Cound not get a connection. " + e);
}
}
return con;
}
- public void close()
+ public static void close()
{
try
{
- _dataSource.close();
+ _hds.close();
}
catch (Exception e)
{
- LOGGER.info(e.getMessage());
+ LOGGER.severe("DatabaseFactory: There was a problem closing the data source. " + e);
}
}
-
- public static DatabaseFactory getInstance()
- {
- return SingletonHolder.INSTANCE;
- }
-
- private static class SingletonHolder
- {
- protected static final DatabaseFactory INSTANCE = new DatabaseFactory();
- }
}
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/GameServer.java
index 7028d9efe1..be5ac73b54 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/GameServer.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/GameServer.java
@@ -196,7 +196,7 @@ public class GameServer
// Initialize config
Config.load();
printSection("Database");
- DatabaseFactory.getInstance();
+ DatabaseFactory.init();
printSection("ThreadPool");
ThreadPool.init();
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/LoginServerThread.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/LoginServerThread.java
index e26cf1111a..ba22e9ae11 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/LoginServerThread.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/LoginServerThread.java
@@ -587,7 +587,7 @@ public class LoginServerThread extends Thread
int chars = 0;
final List charToDel = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT deletetime FROM characters WHERE account_name=?"))
{
ps.setString(1, account);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/Shutdown.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/Shutdown.java
index 72caae1c02..ec983b9153 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/Shutdown.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/Shutdown.java
@@ -204,7 +204,7 @@ public class Shutdown extends Thread
// commit data, last chance
try
{
- DatabaseFactory.getInstance().close();
+ DatabaseFactory.close();
LOGGER.info("Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
}
catch (Throwable t)
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
index 3f98953c02..320a104fca 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
@@ -93,7 +93,7 @@ public class Forum
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM forums WHERE forum_id=?"))
{
ps.setInt(1, _forumId);
@@ -114,7 +114,7 @@ public class Forum
LOGGER.log(Level.WARNING, "Data error on Forum " + _forumId + " : " + e.getMessage(), e);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM topic WHERE topic_forum_id=? ORDER BY topic_id DESC"))
{
ps.setInt(1, _forumId);
@@ -139,7 +139,7 @@ public class Forum
private void getChildren()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT forum_id FROM forums WHERE forum_parent=?"))
{
ps.setInt(1, _forumId);
@@ -217,7 +217,7 @@ public class Forum
public void insertIntoDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO forums (forum_id,forum_name,forum_parent,forum_post,forum_type,forum_perm,forum_owner_id) VALUES (?,?,?,?,?,?,?)"))
{
ps.setInt(1, _forumId);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
index fa2f1da2d9..5f970fa0a5 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
@@ -72,7 +72,7 @@ public class Post
private void insertindb(CPost cp)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)"))
{
ps.setInt(1, cp.postId);
@@ -112,7 +112,7 @@ public class Post
public void deleteme(Topic t)
{
PostBBSManager.getInstance().delPostByTopic(t);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM posts WHERE post_forum_id=? AND post_topic_id=?"))
{
ps.setInt(1, t.getForumID());
@@ -130,7 +130,7 @@ public class Post
*/
private void load(Topic t)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM posts WHERE post_forum_id=? AND post_topic_id=? ORDER BY post_id ASC"))
{
ps.setInt(1, t.getForumID());
@@ -162,7 +162,7 @@ public class Post
*/
public void updatetxt(int i)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?"))
{
final CPost cp = getCPost(i);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
index ae7b7c6318..2cb2303f58 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
@@ -71,7 +71,7 @@ public class Topic
private void insertindb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO topic (topic_id,topic_forum_id,topic_name,topic_date,topic_ownername,topic_ownerid,topic_type,topic_reply) values (?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, _id);
@@ -129,7 +129,7 @@ public class Topic
{
TopicBBSManager.getInstance().delTopic(this);
f.rmTopicByID(_id);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM topic WHERE topic_id=? AND topic_forum_id=?"))
{
ps.setInt(1, _id);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
index 57a47cf456..c68fb57089 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
@@ -40,7 +40,7 @@ public class ForumsBBSManager extends BaseBBSManager
protected ForumsBBSManager()
{
_table = new CopyOnWriteArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT forum_id FROM forums WHERE forum_type = 0"))
{
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java
index adc2b28a17..b3b101e521 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java
@@ -52,7 +52,7 @@ public final class AnnouncementsTable
private void load()
{
_announcements.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery("SELECT * FROM announcements"))
{
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java
index 4aa8b72edb..5bb8ebbe43 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java
@@ -99,7 +99,7 @@ public class CharNameTable
int id = -1;
int accessLevel = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT charId,accesslevel FROM characters WHERE char_name=?"))
{
ps.setString(1, name);
@@ -145,7 +145,7 @@ public class CharNameTable
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT char_name,accesslevel FROM characters WHERE charId=?"))
{
ps.setInt(1, id);
@@ -176,7 +176,7 @@ public class CharNameTable
public synchronized boolean doesCharNameExist(String name)
{
boolean result = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT COUNT(*) as count FROM characters WHERE char_name=?"))
{
ps.setString(1, name);
@@ -197,7 +197,7 @@ public class CharNameTable
public int getAccountCharacterCount(String account)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT COUNT(char_name) as count FROM characters WHERE account_name=?"))
{
ps.setString(1, account);
@@ -218,7 +218,7 @@ public class CharNameTable
public int getLevelById(int objectId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT level FROM characters WHERE charId = ?"))
{
ps.setInt(1, objectId);
@@ -239,7 +239,7 @@ public class CharNameTable
public int getClassIdById(int objectId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT classid FROM characters WHERE charId = ?"))
{
ps.setInt(1, objectId);
@@ -260,7 +260,7 @@ public class CharNameTable
public int getClanIdById(int objectId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clanId FROM characters WHERE charId = ?"))
{
ps.setInt(1, objectId);
@@ -281,7 +281,7 @@ public class CharNameTable
private void loadAll()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT charId, char_name, accesslevel FROM characters"))
{
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java
index 021a434a38..6315404c36 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java
@@ -70,7 +70,7 @@ public class CharSummonTable
{
if (Config.RESTORE_SERVITOR_ON_RECONNECT)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(INIT_SUMMONS))
{
@@ -87,7 +87,7 @@ public class CharSummonTable
if (Config.RESTORE_PET_ON_RECONNECT)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(INIT_PET))
{
@@ -111,7 +111,7 @@ public class CharSummonTable
return !v.isEmpty() ? v : null;
});
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(REMOVE_SUMMON))
{
ps.setInt(1, activeChar.getObjectId());
@@ -181,7 +181,7 @@ public class CharSummonTable
public void restoreServitor(L2PcInstance activeChar)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(LOAD_SUMMON))
{
ps.setInt(1, activeChar.getObjectId());
@@ -229,7 +229,7 @@ public class CharSummonTable
_servitors.computeIfAbsent(summon.getOwner().getObjectId(), k -> ConcurrentHashMap.newKeySet()).add(summon.getObjectId());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SAVE_SUMMON))
{
ps.setInt(1, summon.getOwner().getObjectId());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java
index d0cd743b0f..aee103e2e5 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java
@@ -80,7 +80,7 @@ public class ClanTable
L2Clan clan;
// Count the clans
int clanCount = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT clan_id FROM clan_data"))
{
@@ -262,7 +262,7 @@ public class ClanTable
_clans.remove(clanId);
IdFactory.getInstance().releaseId(clanId);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM clan_data WHERE clan_id=?"))
{
@@ -361,7 +361,7 @@ public class ClanTable
public void storeclanswars(ClanWar war)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO clan_wars (clan1, clan2, clan1Kill, clan2Kill, winnerClan, startTime, endTime, state) VALUES(?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, war.getAttackerClanId());
@@ -392,7 +392,7 @@ public class ClanTable
clan1.broadcastClanStatus();
clan2.broadcastClanStatus();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM clan_wars WHERE clan1=? AND clan2=?"))
{
ps.setInt(1, clanId1);
@@ -407,7 +407,7 @@ public class ClanTable
private void restorewars()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery("SELECT clan1, clan2, clan1Kill, clan2Kill, winnerClan, startTime, endTime, state FROM clan_wars"))
{
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java
index f90657a886..907f92e5f6 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java
@@ -72,7 +72,7 @@ public final class CrestTable
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
ResultSet rs = statement.executeQuery("SELECT `crest_id`, `data`, `type` FROM `crests` ORDER BY `crest_id` DESC"))
{
@@ -154,7 +154,7 @@ public final class CrestTable
*/
public L2Crest createCrest(byte[] data, CrestType crestType)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO `crests`(`crest_id`, `data`, `type`) VALUES(?, ?, ?)"))
{
final L2Crest crest = new L2Crest(_nextId.getAndIncrement(), data, crestType);
@@ -187,7 +187,7 @@ public final class CrestTable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM `crests` WHERE `crest_id` = ?"))
{
statement.setInt(1, crestId);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java
index 2be088cd17..b281c6dbe0 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java
@@ -56,7 +56,7 @@ public class OfflineTradersTable
public void storeOffliners()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS);
PreparedStatement stm3 = con.prepareStatement(SAVE_OFFLINE_STATUS);
@@ -173,7 +173,7 @@ public class OfflineTradersTable
{
LOGGER.info(getClass().getSimpleName() + ": Loading offline traders...");
int nTraders = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement stm = con.createStatement();
ResultSet rs = stm.executeQuery(LOAD_OFFLINE_STATUS))
{
@@ -329,7 +329,7 @@ public class OfflineTradersTable
public static synchronized void onTransaction(L2PcInstance trader, boolean finished, boolean firstCall)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_PLAYER);
PreparedStatement stm3 = con.prepareStatement(SAVE_ITEMS);
@@ -453,7 +453,7 @@ public class OfflineTradersTable
{
PlayerCountManager.getInstance().decOfflineTradeCount();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_PLAYER))
{
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java
index 333e0e2289..4013e5e460 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java
@@ -42,7 +42,7 @@ public class PetNameTable
public boolean doesPetNameExist(String name, int petNpcId)
{
boolean result = true;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT name FROM pets p, items i WHERE p.item_obj_id = i.object_id AND name=? AND i.item_id IN (?)"))
{
ps.setString(1, name);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java
index 33e2d0df1d..0de4769849 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java
@@ -66,7 +66,7 @@ public final class BuyListData implements IGameXmlReader
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _buyLists.size() + " BuyLists.");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rs = statement.executeQuery("SELECT * FROM `buylists`"))
{
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/datatables/BotReportTable.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/datatables/BotReportTable.java
index 8d2d8e65ee..67d9b69779 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/datatables/BotReportTable.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/datatables/BotReportTable.java
@@ -112,7 +112,7 @@ public final class BotReportTable
*/
private void loadReportedCharData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery(SQL_LOAD_REPORTED_CHAR_DATA))
{
@@ -181,7 +181,7 @@ public final class BotReportTable
*/
public void saveReportedCharData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
PreparedStatement ps = con.prepareStatement(SQL_INSERT_REPORTED_CHAR_DATA))
{
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/datatables/ItemTable.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/datatables/ItemTable.java
index c8f34ed812..e4f3a0098d 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/datatables/ItemTable.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/datatables/ItemTable.java
@@ -386,7 +386,7 @@ public class ItemTable
// if it's a pet control item, delete the pet as well
if (item.getItem().isPetItem())
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
{
// Delete the pet in db
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java
index be6c70ea35..721671de46 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java
@@ -71,7 +71,7 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer
public synchronized void reset()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_daily_rewards WHERE rewardId = ? AND status = ?"))
{
ps.setInt(1, _holder.getId());
@@ -111,7 +111,7 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer
protected void storePlayerEntry(DailyMissionPlayerEntry entry)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO character_daily_rewards (charId, rewardId, status, progress, lastCompleted) VALUES (?, ?, ?, ?, ?)"))
{
ps.setInt(1, entry.getObjectId());
@@ -138,7 +138,7 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer
return existingEntry;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM character_daily_rewards WHERE charId = ? AND rewardId = ?"))
{
ps.setInt(1, objectId);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
index baaadc776c..34f7280917 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -128,7 +128,7 @@ public abstract class IdFactory
*/
private void setAllCharacterOffline()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("UPDATE characters SET online = 0");
@@ -145,7 +145,7 @@ public abstract class IdFactory
*/
private void cleanUpDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement stmt = con.createStatement())
{
final long cleanupStart = System.currentTimeMillis();
@@ -253,7 +253,7 @@ public abstract class IdFactory
private void cleanUpTimeStamps()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
int cleanCount = 0;
for (String line : TIMESTAMPS_CLEAN)
@@ -279,7 +279,7 @@ public abstract class IdFactory
protected final Integer[] extractUsedObjectIDTable() throws Exception
{
final List temp = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
String extractUsedObjectIdsQuery = "";
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
index 9e5d1cedcf..21ed01119d 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
@@ -42,7 +42,7 @@ public class StackIDFactory extends IdFactory
_curOID = FIRST_OID;
_tempOID = FIRST_OID;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// con.createStatement().execute("drop table if exists tmp_obj_id");
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java
index c1c614e3f8..85f3d57b5d 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java
@@ -169,7 +169,7 @@ public class AirShipManager
_airShipsInfo.put(ownerId, info);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_DB))
{
ps.setInt(1, ownerId);
@@ -265,7 +265,7 @@ public class AirShipManager
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(LOAD_DB))
{
@@ -296,7 +296,7 @@ public class AirShipManager
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_DB))
{
ps.setInt(1, info.getInt("fuel"));
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
index afc836f427..0808ef7947 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
@@ -198,7 +198,7 @@ public final class CastleManager implements InstanceListManager
}
}
// else offline-player circlet removal
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM items WHERE owner_id = ? and item_id = ?"))
{
ps.setInt(1, member.getObjectId());
@@ -215,7 +215,7 @@ public final class CastleManager implements InstanceListManager
@Override
public void loadInstances()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT id FROM castle ORDER BY id"))
{
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
index 6a9dff749b..4c73fd01a3 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
@@ -162,7 +162,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
private void loadDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stProduction = con.prepareStatement("SELECT * FROM castle_manor_production WHERE castle_id=?");
PreparedStatement stProcure = con.prepareStatement("SELECT * FROM castle_manor_procure WHERE castle_id=?"))
{
@@ -436,7 +436,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
_productionNext.put(castleId, list);
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement dps = con.prepareStatement("DELETE FROM castle_manor_production WHERE castle_id = ? AND next_period = 1");
PreparedStatement ips = con.prepareStatement(INSERT_PRODUCT))
{
@@ -472,7 +472,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
_procureNext.put(castleId, list);
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement dps = con.prepareStatement("DELETE FROM castle_manor_procure WHERE castle_id = ? AND next_period = 1");
PreparedStatement ips = con.prepareStatement(INSERT_CROP))
{
@@ -506,7 +506,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
public final void updateCurrentProduction(int castleId, Collection items)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle_manor_production SET amount = ? WHERE castle_id = ? AND seed_id = ? AND next_period = 0"))
{
for (SeedProduction sp : items)
@@ -526,7 +526,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
public final void updateCurrentProcure(int castleId, Collection items)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle_manor_procure SET amount = ? WHERE castle_id = ? AND crop_id = ? AND next_period = 0"))
{
for (CropProcure sp : items)
@@ -599,7 +599,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
@Override
public final boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ds = con.prepareStatement("DELETE FROM castle_manor_production");
PreparedStatement is = con.prepareStatement(INSERT_PRODUCT);
PreparedStatement dp = con.prepareStatement("DELETE FROM castle_manor_procure");
@@ -697,7 +697,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ds = con.prepareStatement("DELETE FROM castle_manor_production WHERE castle_id = ?");
PreparedStatement dc = con.prepareStatement("DELETE FROM castle_manor_procure WHERE castle_id = ?"))
{
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java
index f4229564fe..e808c70557 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java
@@ -91,7 +91,7 @@ public class CeremonyOfChaosManager extends AbstractEventManager clanApplicantList = _applicantList.get(clanId);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_APPLICANT))
{
statement.setInt(1, playerId);
@@ -189,7 +189,7 @@ public class ClanEntryManager
{
_applicantList.computeIfAbsent(clanId, k -> new ConcurrentHashMap<>()).put(info.getPlayerId(), info);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_APPLICANT))
{
statement.setInt(1, info.getPlayerId());
@@ -216,7 +216,7 @@ public class ClanEntryManager
{
if (!_playerLocked.containsKey(playerId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_WAITING_LIST))
{
statement.setInt(1, info.getPlayerId());
@@ -237,7 +237,7 @@ public class ClanEntryManager
{
if (_waitingList.containsKey(playerId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_WAITING_LIST))
{
statement.setInt(1, playerId);
@@ -258,7 +258,7 @@ public class ClanEntryManager
{
if (!_clanList.containsKey(clanId) && !_clanLocked.containsKey(clanId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_CLAN_RECRUIT))
{
statement.setInt(1, info.getClanId());
@@ -283,7 +283,7 @@ public class ClanEntryManager
{
if (_clanList.containsKey(clanId) && !_clanLocked.containsKey(clanId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CLAN_RECRUIT))
{
statement.setInt(1, info.getKarma());
@@ -307,7 +307,7 @@ public class ClanEntryManager
{
if (_clanList.containsKey(clanId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_CLAN_RECRUIT))
{
statement.setInt(1, clanId);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java
index e424e0ad7e..6ba2c94bb2 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java
@@ -79,7 +79,7 @@ public final class CommissionManager
protected CommissionManager()
{
final Map itemInstances = new HashMap<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement(SELECT_ALL_ITEMS))
{
@@ -245,7 +245,7 @@ public final class CommissionManager
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_COMMISSION_ITEM, Statement.RETURN_GENERATED_KEYS))
{
final Instant startTime = Instant.now();
@@ -398,7 +398,7 @@ public final class CommissionManager
*/
private boolean deleteItemFromDB(long commissionId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_COMMISSION_ITEM))
{
ps.setLong(1, commissionId);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
index 9e5b85cf52..398058a743 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
@@ -142,7 +142,7 @@ public final class CursedWeaponsManager implements IGameXmlReader
private void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT itemId, charId, playerReputation, playerPkKills, nbKills, endTime FROM cursed_weapons"))
{
@@ -167,7 +167,7 @@ public final class CursedWeaponsManager implements IGameXmlReader
private void controlPlayers()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT owner_id FROM items WHERE item_id=?"))
{
// TODO: See comments below...
@@ -338,7 +338,7 @@ public final class CursedWeaponsManager implements IGameXmlReader
public static void removeFromDb(int itemId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM cursed_weapons WHERE itemId = ?"))
{
ps.setInt(1, itemId);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java
index ced8c5abd2..a881e85ae4 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java
@@ -85,7 +85,7 @@ public class DBSpawnManager
_storedInfo.clear();
_schedules.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM npc_respawns");
ResultSet rset = statement.executeQuery())
{
@@ -275,7 +275,7 @@ public class DBSpawnManager
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO npc_respawns (id, x, y, z, heading, respawnTime, currentHp, currentMp) VALUES(?, ?, ?, ?, ?, ?, ?, ?)"))
{
statement.setInt(1, spawn.getId());
@@ -331,7 +331,7 @@ public class DBSpawnManager
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO npc_respawns (id, x, y, z, heading, respawnTime, currentHp, currentMp) VALUES(?, ?, ?, ?, ?, ?, ?, ?)"))
{
statement.setInt(1, spawn.getId());
@@ -380,7 +380,7 @@ public class DBSpawnManager
if (updateDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM npc_respawns WHERE id = ?"))
{
ps.setInt(1, npcId);
@@ -401,7 +401,7 @@ public class DBSpawnManager
*/
private void updateDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE npc_respawns SET respawnTime = ?, currentHP = ?, currentMP = ? WHERE id = ?"))
{
for (Integer npcId : _storedInfo.keySet())
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java
index 3dd467d653..f25bc2e852 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java
@@ -120,7 +120,7 @@ public class DailyTaskManager extends AbstractEventManager>
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement st = con.prepareStatement("UPDATE character_subclasses SET vitality_points = ?"))
{
@@ -150,7 +150,7 @@ public class DailyTaskManager extends AbstractEventManager>
private void resetExtendDrop()
{
// Update data for offline players.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_variables WHERE var = ?"))
{
ps.setString(1, PlayerVariables.EXTEND_DROP);
@@ -173,7 +173,7 @@ public class DailyTaskManager extends AbstractEventManager>
private void resetDailySkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final List dailySkills = getVariables().getList("reset_skills", SkillHolder.class, Collections.emptyList());
for (SkillHolder skill : dailySkills)
@@ -200,7 +200,7 @@ public class DailyTaskManager extends AbstractEventManager>
}
// Update data for offline players.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE character_variables SET val = ? WHERE var = ?"))
{
ps.setInt(1, 0);
@@ -225,7 +225,7 @@ public class DailyTaskManager extends AbstractEventManager>
private void resetRecommends()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("UPDATE character_reco_bonus SET rec_left = ?, rec_have = 0 WHERE rec_have <= 20"))
{
@@ -258,7 +258,7 @@ public class DailyTaskManager extends AbstractEventManager>
if (Config.TRAINING_CAMP_ENABLE)
{
// Update data for offline players.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM account_gsdata WHERE var = ?"))
{
ps.setString(1, "TRAINING_CAMP_DURATION");
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java
index f635c19883..7101b82852 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java
@@ -46,7 +46,7 @@ public class FactionManager
private void loadAll()
{
_playerFactions.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT charId, faction FROM characters"))
{
@@ -75,7 +75,7 @@ public class FactionManager
return factionId;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT faction FROM characters WHERE charId=?"))
{
ps.setInt(1, id);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/FortManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
index 0fbe44bc6d..56ab9144cf 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
@@ -121,7 +121,7 @@ public final class FortManager implements InstanceListManager
@Override
public void loadInstances()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT id FROM fort ORDER BY id"))
{
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
index 0a5245dafc..4eb6258b05 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
@@ -86,7 +86,7 @@ public final class FortSiegeManager
}
boolean register = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clan_id FROM fortsiege_clans where clan_id=? and fort_id=?"))
{
ps.setInt(1, clan.getId());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
index e9f6bb3475..044d74609a 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
@@ -56,7 +56,7 @@ public final class GlobalVariablesManager extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery(SELECT_QUERY))
{
@@ -87,7 +87,7 @@ public final class GlobalVariablesManager extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement del = con.createStatement();
PreparedStatement st = con.prepareStatement(INSERT_QUERY))
{
@@ -119,7 +119,7 @@ public final class GlobalVariablesManager extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement del = con.createStatement())
{
del.execute(DELETE_QUERY);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
index 0a62e46364..30f9519c00 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
@@ -62,7 +62,7 @@ public final class GrandBossManager implements IStorable
private void init()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT * from grandboss_data ORDER BY boss_id"))
{
@@ -150,7 +150,7 @@ public final class GrandBossManager implements IStorable
@Override
public boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
for (Entry e : _storedInfo.entrySet())
{
@@ -202,7 +202,7 @@ public final class GrandBossManager implements IStorable
private void updateDb(int bossId, boolean statusOnly)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final L2GrandBossInstance boss = _bosses.get(bossId);
final StatsSet info = _storedInfo.get(bossId);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java
index 0939f2cf18..4a0efbc831 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java
@@ -498,7 +498,7 @@ public final class InstanceManager implements IGameXmlReader
*/
private void restoreInstanceTimes()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT * FROM character_instance_time ORDER BY charId"))
{
@@ -550,7 +550,7 @@ public final class InstanceManager implements IGameXmlReader
// Remove them
if (!invalidPenalty.isEmpty())
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_INSTANCE_TIME))
{
for (Integer id : invalidPenalty)
@@ -615,7 +615,7 @@ public final class InstanceManager implements IGameXmlReader
*/
public void deleteInstanceTime(L2PcInstance player, int id)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_INSTANCE_TIME))
{
ps.setInt(1, player.getObjectId());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java
index e0599ea3fe..eb105b45f3 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java
@@ -55,7 +55,7 @@ public final class ItemAuctionManager implements IGameXmlReader
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery("SELECT auctionId FROM item_auction ORDER BY auctionId DESC LIMIT 0, 1"))
{
@@ -134,7 +134,7 @@ public final class ItemAuctionManager implements IGameXmlReader
public static void deleteAuction(int auctionId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement statement = con.prepareStatement("DELETE FROM item_auction WHERE auctionId=?"))
{
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
index fba190d620..5bbbecc082 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
@@ -80,7 +80,7 @@ public final class ItemsOnGroundManager implements Runnable
str = "UPDATE itemsonground SET drop_time = ? WHERE drop_time = -1";
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(str))
{
ps.setLong(1, System.currentTimeMillis());
@@ -93,7 +93,7 @@ public final class ItemsOnGroundManager implements Runnable
}
// Add items to world
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable FROM itemsonground"))
{
int count = 0;
@@ -178,7 +178,7 @@ public final class ItemsOnGroundManager implements Runnable
public void emptyTable()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("DELETE FROM itemsonground");
@@ -204,7 +204,7 @@ public final class ItemsOnGroundManager implements Runnable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO itemsonground(object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable) VALUES(?,?,?,?,?,?,?,?,?)"))
{
for (L2ItemInstance item : _items)
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/MailManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/MailManager.java
index 0b4c7601cb..fbc14a23e6 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/MailManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/MailManager.java
@@ -57,7 +57,7 @@ public final class MailManager
private void load()
{
int count = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT * FROM messages ORDER BY expiration"))
{
@@ -192,7 +192,7 @@ public final class MailManager
public void sendMessage(Message msg)
{
_messages.put(msg.getId(), msg);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = Message.getStatement(msg, con))
{
ps.execute();
@@ -214,7 +214,7 @@ public final class MailManager
public final void markAsReadInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isUnread = 'false' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -228,7 +228,7 @@ public final class MailManager
public final void markAsDeletedBySenderInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isDeletedBySender = 'true' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -242,7 +242,7 @@ public final class MailManager
public final void markAsDeletedByReceiverInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isDeletedByReceiver = 'true' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -256,7 +256,7 @@ public final class MailManager
public final void removeAttachmentsInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET hasAttachments = 'false' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -270,7 +270,7 @@ public final class MailManager
public final void deleteMessageInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM messages WHERE messageId = ?"))
{
ps.setInt(1, msgId);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java
index f47cf3f813..82a7f2288b 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java
@@ -54,7 +54,7 @@ public class MentorManager
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery("SELECT * FROM character_mentees"))
{
@@ -76,7 +76,7 @@ public class MentorManager
*/
public void deleteMentee(int mentorId, int menteeId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_mentees WHERE mentorId = ? AND charId = ?"))
{
statement.setInt(1, mentorId);
@@ -95,7 +95,7 @@ public class MentorManager
*/
public void deleteMentor(int mentorId, int menteeId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_mentees WHERE mentorId = ? AND charId = ?"))
{
statement.setInt(1, mentorId);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
index a29ed155fc..c03a9a8aae 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
@@ -128,7 +128,7 @@ public class PremiumManager
private void loadPremiumData(String accountName)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stmt = con.prepareStatement(LOAD_SQL))
{
stmt.setString(1, accountName);
@@ -160,7 +160,7 @@ public class PremiumManager
long newPremiumExpiration = oldPremiumExpiration + addTime;
// UPDATE DATABASE
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stmt = con.prepareStatement(UPDATE_SQL))
{
stmt.setLong(1, newPremiumExpiration);
@@ -205,7 +205,7 @@ public class PremiumManager
premiumData.remove(accountName);
// UPDATE DATABASE
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stmt = con.prepareStatement(DELETE_SQL))
{
stmt.setString(1, accountName);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java
index 001e262042..7438bf62f8 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java
@@ -56,7 +56,7 @@ public final class PunishmentManager
int expired = 0;
// Load punishments.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery("SELECT * FROM punishments"))
{
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
index b99c5e77d5..fe296e2e53 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
@@ -57,7 +57,7 @@ public final class SiegeGuardManager
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
ResultSet rs = con.createStatement().executeQuery("SELECT * FROM castle_siege_guards Where isHired = 1"))
{
while (rs.next())
@@ -158,7 +158,7 @@ public final class SiegeGuardManager
final SiegeGuardHolder holder = getSiegeGuardByItem(castle.getResidenceId(), itemId);
if (holder != null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("Insert Into castle_siege_guards (castleId, npcId, x, y, z, heading, respawnDelay, isHired) Values (?, ?, ?, ?, ?, ?, ?, ?)"))
{
statement.setInt(1, castle.getResidenceId());
@@ -249,7 +249,7 @@ public final class SiegeGuardManager
*/
private void loadSiegeGuard(Castle castle)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_siege_guards Where castleId = ? And isHired = ?"))
{
ps.setInt(1, castle.getResidenceId());
@@ -283,7 +283,7 @@ public final class SiegeGuardManager
*/
public void removeSiegeGuard(int npcId, IPositionable pos)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("Delete From castle_siege_guards Where npcId = ? And x = ? AND y = ? AND z = ? AND isHired = 1"))
{
ps.setInt(1, npcId);
@@ -304,7 +304,7 @@ public final class SiegeGuardManager
*/
public void removeSiegeGuards(Castle castle)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("Delete From castle_siege_guards Where castleId = ? And isHired = 1"))
{
ps.setInt(1, castle.getResidenceId());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
index 38d9a81244..d5b2c9dc80 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
@@ -88,7 +88,7 @@ public final class SiegeManager
}
boolean register = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT clan_id FROM siege_clans where clan_id=? and castle_id=?"))
{
statement.setInt(1, clan.getId());
@@ -275,7 +275,7 @@ public final class SiegeManager
private void loadTrapUpgrade(int castleId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_trapupgrade WHERE castleId=?"))
{
ps.setInt(1, castleId);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/BlockList.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/BlockList.java
index f34f2aa666..9498d19d95 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/BlockList.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/BlockList.java
@@ -71,7 +71,7 @@ public class BlockList
private static List loadList(int ObjId)
{
final List list = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=? AND relation=1"))
{
statement.setInt(1, ObjId);
@@ -98,7 +98,7 @@ public class BlockList
private void updateInDB(int targetId, boolean state)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (state) // add
{
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/CursedWeapon.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/CursedWeapon.java
index 2265d6876c..e767a0de19 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/CursedWeapon.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/CursedWeapon.java
@@ -136,7 +136,7 @@ public class CursedWeapon implements INamable
// Remove from Db
LOGGER.info(_name + " being removed offline.");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement del = con.prepareStatement("DELETE FROM items WHERE owner_id=? AND item_id=?");
PreparedStatement ps = con.prepareStatement("UPDATE characters SET reputation=?, pkkills=? WHERE charId=?"))
{
@@ -471,7 +471,7 @@ public class CursedWeapon implements INamable
public void saveData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement del = con.prepareStatement("DELETE FROM cursed_weapons WHERE itemId = ?");
PreparedStatement ps = con.prepareStatement("INSERT INTO cursed_weapons (itemId, charId, playerReputation, playerPkKills, nbKills, endTime) VALUES (?, ?, ?, ?, ?, ?)"))
{
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Clan.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Clan.java
index 7733a32091..9454ec2cda 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Clan.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Clan.java
@@ -266,7 +266,7 @@ public class L2Clan implements IIdentifiable, INamable
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET clan_privs = ? WHERE charId = ?"))
{
ps.setInt(1, 0);
@@ -306,7 +306,7 @@ public class L2Clan implements IIdentifiable, INamable
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET clan_privs = ? WHERE charId = ?"))
{
ps.setInt(1, EnumIntBitmask.getAllBitmask(ClanPrivilege.class));
@@ -883,7 +883,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateBloodAllianceCountInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET blood_alliance_count=? WHERE clan_id=?"))
{
ps.setInt(1, _bloodAllianceCount);
@@ -927,7 +927,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateBloodOathCountInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET blood_oath_count=? WHERE clan_id=?"))
{
ps.setInt(1, _bloodOathCount);
@@ -943,7 +943,7 @@ public class L2Clan implements IIdentifiable, INamable
public void updateInDB()
{
// Update reputation
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET reputation_score=? WHERE clan_id=?"))
{
ps.setInt(1, _reputationScore);
@@ -978,7 +978,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateClanInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET leader_id=?,ally_id=?,ally_name=?,reputation_score=?,ally_penalty_expiry_time=?,ally_penalty_type=?,char_penalty_expiry_time=?,dissolving_expiry_time=?,new_leader_id=? WHERE clan_id=?"))
{
ps.setInt(1, getLeaderId());
@@ -1016,7 +1016,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void store()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_CLAN_DATA))
{
ps.setInt(1, _clanId);
@@ -1047,7 +1047,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
private void removeMemberInDatabase(L2ClanMember member, long clanJoinExpiryTime, long clanCreateExpiryTime)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("UPDATE characters SET clanid=0, title=?, clan_join_expiry_time=?, clan_create_expiry_time=?, clan_privs=0, wantspeace=0, subpledge=0, lvl_joined_academy=0, apprentice=0, sponsor=0 WHERE charId=?");
PreparedStatement ps2 = con.prepareStatement("UPDATE characters SET apprentice=0 WHERE apprentice=?");
PreparedStatement ps3 = con.prepareStatement("UPDATE characters SET sponsor=0 WHERE sponsor=?"))
@@ -1072,7 +1072,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_CLAN_DATA))
{
ps.setInt(1, _clanId);
@@ -1147,7 +1147,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreNotice()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT enabled,notice FROM clan_notices WHERE clan_id=?"))
{
ps.setInt(1, _clanId);
@@ -1178,7 +1178,7 @@ public class L2Clan implements IIdentifiable, INamable
notice = notice.substring(0, MAX_NOTICE_LENGTH - 1);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_notices (clan_id,notice,enabled) values (?,?,?) ON DUPLICATE KEY UPDATE notice=?,enabled=?"))
{
ps.setInt(1, _clanId);
@@ -1237,7 +1237,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreSkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT skill_id,skill_level,sub_pledge_id FROM clan_skills WHERE clan_id=?"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -1360,7 +1360,7 @@ public class L2Clan implements IIdentifiable, INamable
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (oldSkill != null)
{
@@ -1770,7 +1770,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreSubPledges()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT sub_pledge_id,name,leader_id FROM clan_subpledges WHERE clan_id=?"))
{
// Retrieve all subpledges of this clan from the database
@@ -1870,7 +1870,7 @@ public class L2Clan implements IIdentifiable, INamable
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_subpledges (clan_id,sub_pledge_id,name,leader_id) values (?,?,?,?)"))
{
ps.setInt(1, _clanId);
@@ -1953,7 +1953,7 @@ public class L2Clan implements IIdentifiable, INamable
public void updateSubPledgeInDB(int pledgeType)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_subpledges SET leader_id=?, name=? WHERE clan_id=? AND sub_pledge_id=?"))
{
ps.setInt(1, getSubPledge(pledgeType).getLeaderId());
@@ -1970,7 +1970,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreRankPrivs()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT privs,rank,party FROM clan_privs WHERE clan_id=?"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -2019,7 +2019,7 @@ public class L2Clan implements IIdentifiable, INamable
{
_privs.get(rank).setPrivs(privs);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_privs (clan_id,rank,party,privs) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE privs = ?"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -2055,7 +2055,7 @@ public class L2Clan implements IIdentifiable, INamable
{
_privs.put(rank, new RankPrivs(rank, 0, privs));
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_privs (clan_id,rank,party,privs) VALUES (?,?,?,?)"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -2174,7 +2174,7 @@ public class L2Clan implements IIdentifiable, INamable
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET auction_bid_at=? WHERE clan_id=?"))
{
ps.setInt(1, id);
@@ -2717,7 +2717,7 @@ public class L2Clan implements IIdentifiable, INamable
public void changeLevel(int level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET clan_level = ? WHERE clan_id = ?"))
{
ps.setInt(1, level);
@@ -2763,7 +2763,7 @@ public class L2Clan implements IIdentifiable, INamable
setCrestId(crestId);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET crest_id = ? WHERE clan_id = ?"))
{
ps.setInt(1, crestId);
@@ -2800,7 +2800,7 @@ public class L2Clan implements IIdentifiable, INamable
allyId = _allyId;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(sqlStatement))
{
ps.setInt(1, crestId);
@@ -2846,7 +2846,7 @@ public class L2Clan implements IIdentifiable, INamable
setCrestLargeId(crestId);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET crest_large_id = ? WHERE clan_id = ?"))
{
ps.setInt(1, crestId);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2ClanMember.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2ClanMember.java
index 1ae5225355..8655fe5918 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2ClanMember.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2ClanMember.java
@@ -244,7 +244,7 @@ public class L2ClanMember
*/
public void updatePledgeType()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET subpledge=? WHERE charId=?"))
{
ps.setLong(1, _pledgeType);
@@ -289,7 +289,7 @@ public class L2ClanMember
*/
public void updatePowerGrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET power_grade=? WHERE charId=?"))
{
ps.setLong(1, _powerGrade);
@@ -800,7 +800,7 @@ public class L2ClanMember
*/
public void saveApprenticeAndSponsor(int apprentice, int sponsor)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET apprentice=?,sponsor=? WHERE charId=?"))
{
ps.setInt(1, apprentice);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2ContactList.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2ContactList.java
index ea5f1f9d5d..5b5f5ab2bc 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2ContactList.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2ContactList.java
@@ -58,7 +58,7 @@ public class L2ContactList
{
_contacts.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY_LOAD))
{
statement.setInt(1, activeChar.getObjectId());
@@ -124,7 +124,7 @@ public class L2ContactList
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY_ADD))
{
statement.setInt(1, activeChar.getObjectId());
@@ -161,7 +161,7 @@ public class L2ContactList
_contacts.remove(name);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY_REMOVE))
{
statement.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Mentee.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Mentee.java
index 5c086b9d83..5414107ac4 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Mentee.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/L2Mentee.java
@@ -49,7 +49,7 @@ public class L2Mentee
final L2PcInstance player = getPlayerInstance();
if (player == null) // Only if player is offline
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT char_name, level, base_class FROM characters WHERE charId = ?"))
{
statement.setInt(1, _objectId);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/MacroList.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/MacroList.java
index 577b101249..176fa12d48 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/MacroList.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/MacroList.java
@@ -124,7 +124,7 @@ public class MacroList implements IRestorable
private void registerMacroInDb(Macro macro)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO character_macroses (charId,id,icon,name,descr,acronym,commands) values(?,?,?,?,?,?,?)"))
{
ps.setInt(1, _owner.getObjectId());
@@ -160,7 +160,7 @@ public class MacroList implements IRestorable
private void deleteMacroFromDb(Macro macro)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_macroses WHERE charId=? AND id=?"))
{
ps.setInt(1, _owner.getObjectId());
@@ -177,7 +177,7 @@ public class MacroList implements IRestorable
public boolean restoreMe()
{
_macroses.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT charId, id, icon, name, descr, acronym, commands FROM character_macroses WHERE charId=?"))
{
ps.setInt(1, _owner.getObjectId());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/ShortCuts.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/ShortCuts.java
index 81e2c6f902..cbb856704d 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/ShortCuts.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/ShortCuts.java
@@ -85,7 +85,7 @@ public class ShortCuts implements IRestorable
deleteShortCutFromDb(oldShortCut);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("REPLACE INTO character_shortcuts (charId,slot,page,type,shortcut_id,level,sub_level,class_index) values(?,?,?,?,?,?,?,?)"))
{
statement.setInt(1, _owner.getObjectId());
@@ -154,7 +154,7 @@ public class ShortCuts implements IRestorable
*/
private void deleteShortCutFromDb(Shortcut shortcut)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=? AND slot=? AND page=? AND class_index=?"))
{
statement.setInt(1, _owner.getObjectId());
@@ -173,7 +173,7 @@ public class ShortCuts implements IRestorable
public boolean restoreMe()
{
_shortCuts.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT charId, slot, page, type, shortcut_id, level, sub_level FROM character_shortcuts WHERE charId=? AND class_index=?"))
{
statement.setInt(1, _owner.getObjectId());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
index 7a49e553f3..5e70c11fd8 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
@@ -1351,7 +1351,7 @@ public final class L2PcInstance extends L2Playable
private void insertNewRecipeData(int recipeId, boolean isDwarf)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_recipebook (charId, id, classIndex, type) values(?,?,?,?)"))
{
statement.setInt(1, getObjectId());
@@ -1368,7 +1368,7 @@ public final class L2PcInstance extends L2Playable
private void deleteRecipeData(int recipeId, boolean isDwarf)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_recipebook WHERE charId=? AND id=? AND classIndex=?"))
{
statement.setInt(1, getObjectId());
@@ -6342,7 +6342,7 @@ public final class L2PcInstance extends L2Playable
if (updateInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_CHARACTER_ACCESS))
{
ps.setInt(1, accessLevel.getLevel());
@@ -6461,7 +6461,7 @@ public final class L2PcInstance extends L2Playable
*/
public void updateOnlineStatus()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE characters SET online=?, lastAccess=? WHERE charId=?"))
{
statement.setInt(1, isOnlineInt());
@@ -6481,7 +6481,7 @@ public final class L2PcInstance extends L2Playable
*/
private boolean createDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_CHARACTER))
{
statement.setString(1, _accountName);
@@ -6545,7 +6545,7 @@ public final class L2PcInstance extends L2Playable
double currentCp = 0;
double currentHp = 0;
double currentMp = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHARACTER))
{
// Retrieve the L2PcInstance from the characters table of the database
@@ -6907,7 +6907,7 @@ public final class L2PcInstance extends L2Playable
*/
private static boolean restoreSubClassData(L2PcInstance player)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_SUBCLASSES))
{
statement.setInt(1, player.getObjectId());
@@ -6998,7 +6998,7 @@ public final class L2PcInstance extends L2Playable
private void restoreRecipeBook(boolean loadCommon)
{
final String sql = loadCommon ? "SELECT id, type, classIndex FROM character_recipebook WHERE charId=?" : "SELECT id FROM character_recipebook WHERE charId=? AND classIndex=? AND type = 1";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(sql))
{
statement.setInt(1, getObjectId());
@@ -7051,7 +7051,7 @@ public final class L2PcInstance extends L2Playable
private void loadPremiumItemList()
{
final String sql = "SELECT itemNum, itemId, itemCount, itemSender FROM character_premium_items WHERE charId=?";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(sql))
{
statement.setInt(1, getObjectId());
@@ -7075,7 +7075,7 @@ public final class L2PcInstance extends L2Playable
public void updatePremiumItem(int itemNum, long newcount)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE character_premium_items SET itemCount=? WHERE charId=? AND itemNum=? "))
{
statement.setLong(1, newcount);
@@ -7091,7 +7091,7 @@ public final class L2PcInstance extends L2Playable
public void deletePremiumItem(int itemNum)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_premium_items WHERE charId=? AND itemNum=? "))
{
statement.setInt(1, getObjectId());
@@ -7144,7 +7144,7 @@ public final class L2PcInstance extends L2Playable
final long exp = getStat().getBaseExp();
final int level = getStat().getBaseLevel();
final long sp = getStat().getBaseSp();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CHARACTER))
{
statement.setInt(1, level);
@@ -7229,7 +7229,7 @@ public final class L2PcInstance extends L2Playable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CHAR_SUBCLASS))
{
for (SubClass subClass : getSubClasses().values())
@@ -7260,7 +7260,7 @@ public final class L2PcInstance extends L2Playable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
{
@@ -7380,7 +7380,7 @@ public final class L2PcInstance extends L2Playable
private void storeItemReuseDelay()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(DELETE_ITEM_REUSE_SAVE);
PreparedStatement ps2 = con.prepareStatement(ADD_ITEM_REUSE_SAVE))
{
@@ -7497,7 +7497,7 @@ public final class L2PcInstance extends L2Playable
final Skill oldSkill = super.removeSkill(skill, true);
if (oldSkill != null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_SKILL_FROM_CHAR))
{
// Remove or update a L2PcInstance skill from the character_skills table of the database
@@ -7540,7 +7540,7 @@ public final class L2PcInstance extends L2Playable
private void storeSkill(Skill newSkill, Skill oldSkill, int newClassIndex)
{
final int classIndex = (newClassIndex > -1) ? newClassIndex : _classIndex;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if ((oldSkill != null) && (newSkill != null))
{
@@ -7590,7 +7590,7 @@ public final class L2PcInstance extends L2Playable
}
final int classIndex = (newClassIndex > -1) ? newClassIndex : _classIndex;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_NEW_SKILLS))
{
con.setAutoCommit(false);
@@ -7617,7 +7617,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restoreSkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -7669,7 +7669,7 @@ public final class L2PcInstance extends L2Playable
@Override
public void restoreEffects()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_SKILL_SAVE))
{
statement.setInt(1, getObjectId());
@@ -7726,7 +7726,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restoreItemReuse()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_ITEM_REUSE_SAVE);
PreparedStatement delete = con.prepareStatement(DELETE_ITEM_REUSE_SAVE))
{
@@ -7797,7 +7797,7 @@ public final class L2PcInstance extends L2Playable
_henna[i - 1] = null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_HENNAS))
{
statement.setInt(1, getObjectId());
@@ -7905,7 +7905,7 @@ public final class L2PcInstance extends L2Playable
_henna[slot - 1] = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_CHAR_HENNA))
{
statement.setInt(1, getObjectId());
@@ -8003,7 +8003,7 @@ public final class L2PcInstance extends L2Playable
// Calculate Henna modifiers of this L2PcInstance
recalcHennaStats();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(ADD_CHAR_HENNA))
{
statement.setInt(1, getObjectId());
@@ -9648,7 +9648,7 @@ public final class L2PcInstance extends L2Playable
newClass.setLevel(Config.BASE_DUALCLASS_LEVEL);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(ADD_CHAR_SUBCLASS))
{
// Store the basic info about this new sub-class.
@@ -9748,7 +9748,7 @@ public final class L2PcInstance extends L2Playable
// Remove after stats are recalculated.
getSubClasses().remove(classIndex);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
@@ -11985,7 +11985,7 @@ public final class L2PcInstance extends L2Playable
{
String req;
req = "UPDATE pets SET fed=? WHERE item_obj_id = ?";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(req))
{
statement.setInt(1, _curFeed);
@@ -12112,7 +12112,7 @@ public final class L2PcInstance extends L2Playable
bookmark.setTag(tag);
bookmark.setName(name);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_TP_BOOKMARK))
{
statement.setInt(1, icon);
@@ -12135,7 +12135,7 @@ public final class L2PcInstance extends L2Playable
{
if (_tpbookmarks.remove(id) != null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_TP_BOOKMARK))
{
statement.setInt(1, getObjectId());
@@ -12278,7 +12278,7 @@ public final class L2PcInstance extends L2Playable
sm.addItemName(20033);
sendPacket(sm);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_TP_BOOKMARK))
{
statement.setInt(1, getObjectId());
@@ -12300,7 +12300,7 @@ public final class L2PcInstance extends L2Playable
public void restoreTeleportBookmark()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_TP_BOOKMARK))
{
statement.setInt(1, getObjectId());
@@ -12512,7 +12512,7 @@ public final class L2PcInstance extends L2Playable
_friendList.clear();
final String sqlQuery = "SELECT friendId FROM character_friends WHERE charId=? AND relation=0";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(sqlQuery))
{
statement.setInt(1, getObjectId());
@@ -12602,7 +12602,7 @@ public final class L2PcInstance extends L2Playable
{
if (hasManufactureShop())
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement st = con.prepareStatement(DELETE_CHAR_RECIPE_SHOP))
{
@@ -12640,7 +12640,7 @@ public final class L2PcInstance extends L2Playable
_manufactureItems.clear();
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_RECIPE_SHOP))
{
statement.setInt(1, getObjectId());
@@ -13058,7 +13058,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restorePetInventoryItems()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT object_id FROM `items` WHERE `owner_id`=? AND (`loc`='PET' OR `loc`='PET_EQUIP') LIMIT 1;"))
{
statement.setInt(1, getObjectId());
@@ -13098,7 +13098,7 @@ public final class L2PcInstance extends L2Playable
*/
private void loadRecommendations()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT rec_have, rec_left FROM character_reco_bonus WHERE charId = ?"))
{
statement.setInt(1, getObjectId());
@@ -13122,7 +13122,7 @@ public final class L2PcInstance extends L2Playable
*/
public void storeRecommendations()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO character_reco_bonus (charId,rec_have,rec_left,time_left) VALUES (?,?,?,?)"))
{
ps.setInt(1, getObjectId());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
index c5b882a533..2a22ce6fa1 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
@@ -788,7 +788,7 @@ public class L2PetInstance extends L2Summon
}
// pet control item no longer exists, delete the pet from the db
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id = ?"))
{
statement.setInt(1, _controlObjectId);
@@ -846,7 +846,7 @@ public class L2PetInstance extends L2Summon
private static L2PetInstance restore(L2ItemInstance control, L2NpcTemplate template, L2PcInstance owner)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT item_obj_id, name, level, curHp, curMp, exp, sp, fed FROM pets WHERE item_obj_id=?"))
{
L2PetInstance pet;
@@ -942,7 +942,7 @@ public class L2PetInstance extends L2Summon
req = "UPDATE pets SET name=?,level=?,curHp=?,curMp=?,exp=?,sp=?,fed=?,ownerId=?,restore=? WHERE item_obj_id = ?";
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(req))
{
statement.setString(1, getName());
@@ -992,7 +992,7 @@ public class L2PetInstance extends L2Summon
// Clear list for overwrite
SummonEffectsTable.getInstance().getPetEffects().getOrDefault(getControlObjectId(), Collections.emptyList()).clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement ps2 = con.prepareStatement(ADD_SKILL_SAVE))
{
@@ -1067,7 +1067,7 @@ public class L2PetInstance extends L2Summon
@Override
public void restoreEffects()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(RESTORE_SKILL_SAVE);
PreparedStatement ps2 = con.prepareStatement(DELETE_SKILL_SAVE))
{
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java
index 320505de11..8cbf9119b6 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java
@@ -288,7 +288,7 @@ public class L2ServitorInstance extends L2Summon implements Runnable
SummonEffectsTable.getInstance().getServitorEffects(getOwner()).getOrDefault(getReferenceSkill(), Collections.emptyList()).clear();
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_SKILL_SAVE))
{
// Delete all current stored effects for summon to avoid dupe
@@ -389,7 +389,7 @@ public class L2ServitorInstance extends L2Summon implements Runnable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (!SummonEffectsTable.getInstance().getServitorEffectsOwner().containsKey(getOwner().getObjectId()) || !SummonEffectsTable.getInstance().getServitorEffectsOwner().get(getOwner().getObjectId()).containsKey(getOwner().getClassIndex()) || !SummonEffectsTable.getInstance().getServitorEffects(getOwner()).containsKey(getReferenceSkill()))
{
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/announce/Announcement.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/announce/Announcement.java
index 4e5aa84b0f..a7117539ad 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/announce/Announcement.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/announce/Announcement.java
@@ -108,7 +108,7 @@ public class Announcement implements IAnnouncement
@Override
public boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
{
ps.setInt(1, _type.ordinal());
@@ -134,7 +134,7 @@ public class Announcement implements IAnnouncement
@Override
public boolean updateMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_QUERY))
{
ps.setInt(1, _type.ordinal());
@@ -154,7 +154,7 @@ public class Announcement implements IAnnouncement
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_QUERY))
{
ps.setInt(1, _id);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java
index 1adc7b039f..21eb44294e 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java
@@ -94,7 +94,7 @@ public final class AutoAnnouncement extends Announcement implements Runnable
@Override
public boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
{
st.setInt(1, getType().ordinal());
@@ -123,7 +123,7 @@ public final class AutoAnnouncement extends Announcement implements Runnable
@Override
public boolean updateMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(UPDATE_QUERY))
{
st.setInt(1, getType().ordinal());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/buylist/Product.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/buylist/Product.java
index 8360f7712c..639a9bfa1a 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/buylist/Product.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/buylist/Product.java
@@ -157,7 +157,7 @@ public final class Product
private void save()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO `buylists`(`buylist_id`, `item_id`, `count`, `next_restock_time`) VALUES(?, ?, ?, ?) ON DUPLICATE KEY UPDATE `count` = ?, `next_restock_time` = ?"))
{
statement.setInt(1, _buyListId);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java
index 757b5512d0..5d970e7abd 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java
@@ -58,7 +58,7 @@ public class ClanHallAuction
private final void loadBidder()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(LOAD_CLANHALL_BIDDERS))
{
ps.setInt(1, _clanHallId);
@@ -102,7 +102,7 @@ public class ClanHallAuction
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_CLANHALL_BIDDER))
{
ps.setInt(1, _clanHallId);
@@ -121,7 +121,7 @@ public class ClanHallAuction
public void removeBid(L2Clan clan)
{
getBids().remove(clan.getId());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_CLANHALL_BIDDER))
{
ps.setInt(1, clan.getId());
@@ -170,7 +170,7 @@ public class ClanHallAuction
clanHall.setOwner(highestBidder.getClan());
getBids().clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_CLANHALL_BIDDERS))
{
ps.setInt(1, _clanHallId);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Castle.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Castle.java
index 2f1da41c76..88d3ad7201 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Castle.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Castle.java
@@ -218,7 +218,7 @@ public final class Castle extends AbstractResidence
public void dbSave()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_functions (castle_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)"))
{
ps.setInt(1, getResidenceId());
@@ -360,7 +360,7 @@ public final class Castle extends AbstractResidence
_treasury += amount;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET treasury = ? WHERE id = ?"))
{
ps.setLong(1, _treasury);
@@ -643,7 +643,7 @@ public final class Castle extends AbstractResidence
@Override
protected void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("SELECT * FROM castle WHERE id = ?");
PreparedStatement ps2 = con.prepareStatement("SELECT clan_id FROM clan_data WHERE hasCastle = ?"))
{
@@ -689,7 +689,7 @@ public final class Castle extends AbstractResidence
/** Load All Functions */
private void loadFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_functions WHERE castle_id = ?"))
{
ps.setInt(1, getResidenceId());
@@ -714,7 +714,7 @@ public final class Castle extends AbstractResidence
public void removeFunction(int functionType)
{
_function.remove(functionType);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_functions WHERE castle_id=? AND type=?"))
{
ps.setInt(1, getResidenceId());
@@ -786,7 +786,7 @@ public final class Castle extends AbstractResidence
// This method loads castle door upgrade data from database
private void loadDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_doorupgrade WHERE castleId=?"))
{
ps.setInt(1, getResidenceId());
@@ -812,7 +812,7 @@ public final class Castle extends AbstractResidence
door.setCurrentHp(door.getCurrentHp());
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_doorupgrade WHERE castleId=?"))
{
ps.setInt(1, getResidenceId());
@@ -837,7 +837,7 @@ public final class Castle extends AbstractResidence
if (save)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_doorupgrade (doorId, ratio, castleId) values (?,?,?)"))
{
ps.setInt(1, doorId);
@@ -864,7 +864,7 @@ public final class Castle extends AbstractResidence
CastleManorManager.getInstance().resetManorData(getResidenceId());
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Need to remove has castle flag from clan_data, should be checked from castle table.
try (PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET hasCastle = 0 WHERE hasCastle = ?"))
@@ -1032,7 +1032,7 @@ public final class Castle extends AbstractResidence
public void updateShowNpcCrest()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET showNpcCrest = ? WHERE id = ?"))
{
ps.setString(1, String.valueOf(_showNpcCrest));
@@ -1076,7 +1076,7 @@ public final class Castle extends AbstractResidence
{
_ticketBuyCount = count;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET ticketBuyCount = ? WHERE id = ?"))
{
ps.setInt(1, _ticketBuyCount);
@@ -1099,7 +1099,7 @@ public final class Castle extends AbstractResidence
{
if (save)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_trapupgrade (castleId, towerIndex, level) values (?,?,?)"))
{
ps.setInt(1, getResidenceId());
@@ -1126,7 +1126,7 @@ public final class Castle extends AbstractResidence
ts.setUpgradeLevel(0);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_trapupgrade WHERE castleId=?"))
{
ps.setInt(1, getResidenceId());
@@ -1209,7 +1209,7 @@ public final class Castle extends AbstractResidence
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET side = ? WHERE id = ?"))
{
ps.setString(1, side.toString());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/ClanHall.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
index 6fc9b45046..79906bc875 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
@@ -100,7 +100,7 @@ public final class ClanHall extends AbstractResidence
@Override
protected void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement loadStatement = con.prepareStatement(LOAD_CLANHALL);
PreparedStatement insertStatement = con.prepareStatement(INSERT_CLANHALL))
{
@@ -133,7 +133,7 @@ public final class ClanHall extends AbstractResidence
public void updateDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CLANHALL))
{
statement.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Couple.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Couple.java
index c40e7d454a..45294842ce 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Couple.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Couple.java
@@ -45,7 +45,7 @@ public class Couple
{
_Id = coupleId;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM mods_wedding WHERE id = ?"))
{
ps.setInt(1, _Id);
@@ -85,7 +85,7 @@ public class Couple
_weddingDate = Calendar.getInstance();
_weddingDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
{
_Id = IdFactory.getInstance().getNextId();
@@ -105,7 +105,7 @@ public class Couple
public void marry()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE mods_wedding set married = ?, weddingDate = ? where id = ?"))
{
ps.setBoolean(1, true);
@@ -123,7 +123,7 @@ public class Couple
public void divorce()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM mods_wedding WHERE id=?"))
{
ps.setInt(1, _Id);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Fort.java
index e6262fdc29..3b29461e3a 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Fort.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Fort.java
@@ -214,7 +214,7 @@ public final class Fort extends AbstractResidence
public void dbSave()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO fort_functions (fort_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)"))
{
ps.setInt(1, getResidenceId());
@@ -487,7 +487,7 @@ public final class Fort extends AbstractResidence
public void saveFortVariables()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET supplyLvL=? WHERE id = ?"))
{
ps.setInt(1, _supplyLvL);
@@ -552,7 +552,7 @@ public final class Fort extends AbstractResidence
@Override
protected void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort WHERE id = ?"))
{
ps.setInt(1, getResidenceId());
@@ -613,7 +613,7 @@ public final class Fort extends AbstractResidence
/** Load All Functions */
private void loadFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_functions WHERE fort_id = ?"))
{
ps.setInt(1, getResidenceId());
@@ -638,7 +638,7 @@ public final class Fort extends AbstractResidence
public void removeFunction(int functionType)
{
_function.remove(functionType);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM fort_functions WHERE fort_id=? AND type=?"))
{
ps.setInt(1, getResidenceId());
@@ -730,7 +730,7 @@ public final class Fort extends AbstractResidence
// This method loads fort door upgrade data from database
private void loadDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_doorupgrade WHERE fortId = ?"))
{
ps.setInt(1, getResidenceId());
@@ -750,7 +750,7 @@ public final class Fort extends AbstractResidence
private void removeDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM fort_doorupgrade WHERE fortId = ?"))
{
ps.setInt(1, getResidenceId());
@@ -764,7 +764,7 @@ public final class Fort extends AbstractResidence
private void saveDoorUpgrade(int doorId, int hp, int pDef, int mDef)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO fort_doorupgrade (doorId, hp, pDef, mDef) VALUES (?,?,?,?)"))
{
ps.setInt(1, doorId);
@@ -793,7 +793,7 @@ public final class Fort extends AbstractResidence
_lastOwnedTime.setTimeInMillis(0);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET owner=?,lastOwnedTime=?,state=?,castleId=? WHERE id = ?"))
{
ps.setInt(1, clanId);
@@ -998,7 +998,7 @@ public final class Fort extends AbstractResidence
{
_state = state;
_castleId = castleId;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET state=?,castleId=? WHERE id = ?"))
{
ps.setInt(1, _state);
@@ -1130,7 +1130,7 @@ public final class Fort extends AbstractResidence
private void initNpcs()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_spawnlist WHERE fortId = ? AND spawnType = ?"))
{
ps.setInt(1, getResidenceId());
@@ -1159,7 +1159,7 @@ public final class Fort extends AbstractResidence
private void initSiegeNpcs()
{
_siegeNpcs.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, npcId, x, y, z, heading FROM fort_spawnlist WHERE fortId = ? AND spawnType = ? ORDER BY id"))
{
ps.setInt(1, getResidenceId());
@@ -1186,7 +1186,7 @@ public final class Fort extends AbstractResidence
private void initNpcCommanders()
{
_npcCommanders.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, npcId, x, y, z, heading FROM fort_spawnlist WHERE fortId = ? AND spawnType = ? ORDER BY id"))
{
ps.setInt(1, getResidenceId());
@@ -1216,7 +1216,7 @@ public final class Fort extends AbstractResidence
_specialEnvoys.clear();
_envoyCastles.clear();
_availableCastles.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, npcId, x, y, z, heading, castleId FROM fort_spawnlist WHERE fortId = ? AND spawnType = ? ORDER BY id"))
{
ps.setInt(1, getResidenceId());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/FortSiege.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/FortSiege.java
index ffba04e6c3..d558045fab 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/FortSiege.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/FortSiege.java
@@ -501,7 +501,7 @@ public class FortSiege implements Siegable
/** Clear all registered siege clans from database for fort */
public void clearSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM fortsiege_clans WHERE fort_id=?"))
{
ps.setInt(1, _fort.getResidenceId());
@@ -785,7 +785,7 @@ public class FortSiege implements Siegable
private void removeSiegeClan(int clanId)
{
final String query = (clanId != 0) ? DELETE_FORT_SIEGECLANS_BY_CLAN_ID : DELETE_FORT_SIEGECLANS;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(query))
{
statement.setInt(1, _fort.getResidenceId());
@@ -999,7 +999,7 @@ public class FortSiege implements Siegable
private void loadSiegeClan()
{
_attackerClans.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clan_id FROM fortsiege_clans WHERE fort_id=?"))
{
ps.setInt(1, _fort.getResidenceId());
@@ -1057,7 +1057,7 @@ public class FortSiege implements Siegable
/** Save siege date to database. */
private void saveSiegeDate()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET siegeDate = ? WHERE id = ?"))
{
ps.setLong(1, _fort.getSiegeDate().getTimeInMillis());
@@ -1081,7 +1081,7 @@ public class FortSiege implements Siegable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO fortsiege_clans (clan_id,fort_id) values (?,?)"))
{
statement.setInt(1, clan.getId());
@@ -1146,7 +1146,7 @@ public class FortSiege implements Siegable
public void loadSiegeGuard()
{
_siegeGuards.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT npcId, x, y, z, heading, respawnDelay FROM fort_siege_guards WHERE fortId = ?"))
{
final int fortId = _fort.getResidenceId();
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Hero.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Hero.java
index 924ecead2f..27be59aa41 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Hero.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Hero.java
@@ -114,7 +114,7 @@ public class Hero
_herodiary.clear();
_heroMessage.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s1 = con.createStatement();
ResultSet rset = s1.executeQuery(GET_HEROES);
PreparedStatement ps = con.prepareStatement(GET_CLAN_ALLY);
@@ -211,7 +211,7 @@ public class Hero
*/
public void loadMessage(int charId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT message FROM heroes WHERE charId=?"))
{
statement.setInt(1, charId);
@@ -233,7 +233,7 @@ public class Hero
{
final List _diary = new CopyOnWriteArrayList<>();
int diaryentries = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM heroes_diary WHERE charId=? ORDER BY time ASC"))
{
statement.setInt(1, charId);
@@ -300,7 +300,7 @@ public class Hero
int _losses = 0;
int _draws = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM olympiad_fights WHERE (charOneId=? OR charTwoId=?) AND start ORDER BY start ASC"))
{
statement.setInt(1, charId);
@@ -699,7 +699,7 @@ public class Hero
public void updateHeroes(boolean setDefault)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (setDefault)
{
@@ -841,7 +841,7 @@ public class Hero
public void setDiaryData(int charId, int action, int param)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO heroes_diary (charId, time, action, param) values(?,?,?,?)"))
{
statement.setInt(1, charId);
@@ -877,7 +877,7 @@ public class Hero
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE heroes SET message=? WHERE charId=?;"))
{
statement.setString(1, _heroMessage.get(charId));
@@ -892,7 +892,7 @@ public class Hero
private void deleteItemsInDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_ITEMS))
{
statement.execute();
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Siege.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Siege.java
index d4cb96aabf..f20c39da7f 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Siege.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/entity/Siege.java
@@ -760,7 +760,7 @@ public class Siege implements Siegable
/** Clear all registered siege clans from database for castle */
public void clearSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=?"))
{
statement.setInt(1, _castle.getResidenceId());
@@ -788,7 +788,7 @@ public class Siege implements Siegable
/** Clear all siege clans waiting for approval from database for castle */
public void clearSiegeWaitingClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=? and type = 2"))
{
statement.setInt(1, _castle.getResidenceId());
@@ -972,7 +972,7 @@ public class Siege implements Siegable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=? and clan_id=?"))
{
statement.setInt(1, _castle.getResidenceId());
@@ -1238,7 +1238,7 @@ public class Siege implements Siegable
private void loadSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT clan_id,type FROM siege_clans where castle_id=?"))
{
getAttackerClans().clear();
@@ -1349,7 +1349,7 @@ public class Siege implements Siegable
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castle), 1000);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE castle SET siegeDate = ?, regTimeEnd = ?, regTimeOver = ? WHERE id = ?"))
{
statement.setLong(1, _castle.getSiegeDate().getTimeInMillis());
@@ -1378,7 +1378,7 @@ public class Siege implements Siegable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if ((typeId == DEFENDER) || (typeId == DEFENDER_NOT_APPROVED) || (typeId == OWNER))
{
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java
index ac490ba86d..f23e511ede 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java
@@ -138,7 +138,7 @@ public class EventScheduler
public boolean updateLastRun()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO event_schedulers (eventName, schedulerName, lastRun) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE eventName = ?, schedulerName = ?, lastRun = ?"))
{
ps.setString(1, _eventManager.getName());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java
index 3185dae127..fc59ec7842 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java
@@ -52,7 +52,7 @@ public class HaventRunConditionalScheduler implements IConditionalEventScheduler
throw new NullPointerException("Scheduler not found: " + _name);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT lastRun FROM event_schedulers WHERE eventName = ? AND schedulerName = ?"))
{
ps.setString(1, _eventManager.getName());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/instancezone/Instance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/instancezone/Instance.java
index 053ffa54cf..ccef54aad0 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/instancezone/Instance.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/instancezone/Instance.java
@@ -815,7 +815,7 @@ public final class Instance implements IIdentifiable, INamable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT IGNORE INTO character_instance_time (charId,instanceId,time) VALUES (?,?,?)"))
{
// Save to database
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java
index 24c473792a..3f1ad0c250 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java
@@ -191,7 +191,7 @@ public final class ItemAuction
public final void storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO item_auction (auctionId,instanceId,auctionItemId,startingTime,endingTime,auctionStateId) VALUES (?,?,?,?,?,?) ON DUPLICATE KEY UPDATE auctionStateId=?"))
{
statement.setInt(1, _auctionId);
@@ -225,7 +225,7 @@ public final class ItemAuction
final void updatePlayerBidInternal(ItemAuctionBid bid, boolean delete)
{
final String query = delete ? DELETE_ITEM_AUCTION_BID : INSERT_ITEM_AUCTION_BID;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(query))
{
ps.setInt(1, _auctionId);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java
index ec5eb4074e..d388e90796 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java
@@ -161,7 +161,7 @@ public final class ItemAuctionInstance
throw new IllegalArgumentException("No items defined");
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_AUCTION_ID_BY_INSTANCE_ID))
{
ps.setInt(1, _instanceId);
@@ -533,7 +533,7 @@ public final class ItemAuctionInstance
private ItemAuction loadAuction(int auctionId) throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
int auctionItemId = 0;
long startingTime = 0;
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java
index 102306be1b..f73b31f758 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java
@@ -1813,7 +1813,7 @@ public abstract class Inventory extends ItemContainer
@Override
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM items WHERE owner_id=? AND (loc=? OR loc=?) ORDER BY loc_data"))
{
ps.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java
index 1501c166e8..9a71ec3c76 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java
@@ -673,7 +673,7 @@ public abstract class ItemContainer
*/
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM items WHERE owner_id=? AND (loc=?)"))
{
ps.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java
index 9e94b591e8..09cbc47e3b 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java
@@ -112,7 +112,7 @@ public class Mail extends ItemContainer
@Override
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM items WHERE owner_id=? AND loc=? AND loc_data=?"))
{
statement.setInt(1, _ownerId);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java
index 9228d151c2..a3a85dfeba 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java
@@ -738,7 +738,7 @@ public class PcInventory extends Inventory
public static int[][] restoreVisibleInventory(int objectId)
{
final int[][] paperdoll = new int[33][4];
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement2 = con.prepareStatement("SELECT object_id,item_id,loc_data,enchant_level FROM items WHERE owner_id=? AND loc='PAPERDOLL'"))
{
statement2.setInt(1, objectId);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java
index 4b3cd1f785..37575f09ea 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java
@@ -983,7 +983,7 @@ public final class L2ItemInstance extends L2Object
final VariationInstance augment = _augmentation;
_augmentation = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_variations WHERE itemId = ?"))
{
ps.setInt(1, getObjectId());
@@ -1000,7 +1000,7 @@ public final class L2ItemInstance extends L2Object
public void restoreAttributes()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("SELECT mineralId,option1,option2 FROM item_variations WHERE itemId=?");
PreparedStatement ps2 = con.prepareStatement("SELECT elemType,elemValue FROM item_elementals WHERE itemId=?"))
{
@@ -1041,7 +1041,7 @@ public final class L2ItemInstance extends L2Object
public void updateItemOptions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
updateItemOptions(con);
}
@@ -1069,7 +1069,7 @@ public final class L2ItemInstance extends L2Object
public void updateItemElementals()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
updateItemElements(con);
}
@@ -1231,7 +1231,7 @@ public final class L2ItemInstance extends L2Object
_elementals.remove(type);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_elementals WHERE itemId = ? AND elemType = ?"))
{
ps.setInt(1, getObjectId());
@@ -1256,7 +1256,7 @@ public final class L2ItemInstance extends L2Object
_elementals.clear();
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_elementals WHERE itemId = ?"))
{
ps.setInt(1, getObjectId());
@@ -1588,7 +1588,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE items SET owner_id=?,count=?,loc=?,loc_data=?,enchant_level=?,custom_type1=?,custom_type2=?,mana_left=?,time=? WHERE object_id = ?"))
{
ps.setInt(1, _ownerId);
@@ -1621,7 +1621,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO items (owner_id,item_id,count,loc,loc_data,enchant_level,object_id,custom_type1,custom_type2,mana_left,time) VALUES (?,?,?,?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, _ownerId);
@@ -1669,7 +1669,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM items WHERE object_id = ?"))
{
@@ -2161,7 +2161,7 @@ public final class L2ItemInstance extends L2Object
private void removeSpecialAbility(EnsoulOption option)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_special_abilities WHERE objectId = ? AND optionId = ?"))
{
ps.setInt(1, getObjectId());
@@ -2215,7 +2215,7 @@ public final class L2ItemInstance extends L2Object
private void restoreSpecialAbilities()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM item_special_abilities WHERE objectId = ? ORDER BY position"))
{
ps.setInt(1, getObjectId());
@@ -2242,7 +2242,7 @@ public final class L2ItemInstance extends L2Object
public void updateSpecialAbilities()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
updateSpecialAbilities(con);
}
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java
index 44b0ac9c43..1ad8f4c201 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java
@@ -142,7 +142,7 @@ public class Olympiad extends ListenersContainer
{
_nobles.clear();
boolean loaded = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_LOAD_DATA);
ResultSet rset = statement.executeQuery())
{
@@ -221,7 +221,7 @@ public class Olympiad extends ListenersContainer
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_LOAD_NOBLES);
ResultSet rset = statement.executeQuery())
{
@@ -295,7 +295,7 @@ public class Olympiad extends ListenersContainer
{
_noblesRank.clear();
final Map tmpPlace = new HashMap<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(GET_ALL_CLASSIFIED_NOBLESS);
ResultSet rset = statement.executeQuery())
{
@@ -806,7 +806,7 @@ public class Olympiad extends ListenersContainer
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
for (Entry entry : _nobles.entrySet())
{
@@ -878,7 +878,7 @@ public class Olympiad extends ListenersContainer
{
saveNobleData();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_SAVE_DATA))
{
statement.setInt(1, _currentCycle);
@@ -919,7 +919,7 @@ public class Olympiad extends ListenersContainer
protected void updateMonthlyData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(OLYMPIAD_MONTH_CLEAR);
PreparedStatement ps2 = con.prepareStatement(OLYMPIAD_MONTH_CREATE))
{
@@ -963,7 +963,7 @@ public class Olympiad extends ListenersContainer
final List heroesToBe = new LinkedList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_GET_HEROS))
{
StatsSet hero;
@@ -998,7 +998,7 @@ public class Olympiad extends ListenersContainer
{
final List names = new ArrayList<>();
final String query = Config.ALT_OLY_SHOW_MONTHLY_WINNERS ? ((classId == 132) ? GET_EACH_CLASS_LEADER_SOULHOUND : GET_EACH_CLASS_LEADER) : ((classId == 132) ? GET_EACH_CLASS_LEADER_CURRENT_SOULHOUND : GET_EACH_CLASS_LEADER_CURRENT);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(query))
{
ps.setInt(1, classId);
@@ -1108,7 +1108,7 @@ public class Olympiad extends ListenersContainer
public int getLastNobleOlympiadPoints(int objId)
{
int result = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT olympiad_points FROM olympiad_nobles_eom WHERE charId = ?"))
{
ps.setInt(1, objId);
@@ -1252,7 +1252,7 @@ public class Olympiad extends ListenersContainer
protected void deleteNobles()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_DELETE_ALL))
{
statement.execute();
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java
index 9249ca2223..2824298209 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java
@@ -743,7 +743,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
protected static void saveResults(Participant one, Participant two, int winner, long startTime, long fightTime, CompetitionType type)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO olympiad_fights (charOneId, charTwoId, charOneClass, charTwoClass, winner, start, time, classed) values(?,?,?,?,?,?,?,?)"))
{
statement.setInt(1, one.getObjectId());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java
index d73e56cbe8..c805ee421d 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java
@@ -185,7 +185,7 @@ public class PunishmentTask implements Runnable
{
if (!_isStored)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
{
st.setString(1, _key);
@@ -224,7 +224,7 @@ public class PunishmentTask implements Runnable
{
if (_isStored)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(UPDATE_QUERY))
{
st.setLong(1, System.currentTimeMillis());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java
index 248d5997e4..0dea776f93 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java
@@ -409,7 +409,7 @@ public class LongTimeEvent extends Quest
}
}
// Update database
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM items WHERE item_id=?"))
{
statement.setInt(1, itemId);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/quest/Quest.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/quest/Quest.java
index a52456d3c7..315e7c1cbc 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/quest/Quest.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/quest/Quest.java
@@ -1592,7 +1592,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void playerEnter(L2PcInstance player)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement invalidQuestData = con.prepareStatement("DELETE FROM character_quests WHERE charId = ? AND name = ?");
PreparedStatement invalidQuestDataVar = con.prepareStatement("DELETE FROM character_quests WHERE charId = ? AND name = ? AND var = ?");
PreparedStatement ps1 = con.prepareStatement("SELECT name, value FROM character_quests WHERE charId = ? AND var = ?"))
@@ -1674,7 +1674,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void createQuestVarInDb(QuestState qs, String var, String value)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_quests (charId,name,var,value) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE value=?"))
{
statement.setInt(1, qs.getPlayer().getObjectId());
@@ -1698,7 +1698,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void updateQuestVarInDb(QuestState qs, String var, String value)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE character_quests SET value=? WHERE charId=? AND name=? AND var = ?"))
{
statement.setString(1, value);
@@ -1720,7 +1720,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void deleteQuestVarInDb(QuestState qs, String var)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_quests WHERE charId=? AND name=? AND var=?"))
{
statement.setInt(1, qs.getPlayer().getObjectId());
@@ -1741,7 +1741,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void deleteQuestInDb(QuestState qs, boolean repeatable)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(repeatable ? QUEST_DELETE_FROM_CHAR_QUERY : QUEST_DELETE_FROM_CHAR_QUERY_NON_REPEATABLE_QUERY))
{
ps.setInt(1, qs.getPlayer().getObjectId());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java
index 11c78a1a47..9af2be9039 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java
@@ -126,7 +126,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
protected void initFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM residence_functions WHERE residenceId = ?"))
{
ps.setInt(1, _residenceId);
@@ -164,7 +164,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
public void addFunction(ResidenceFunction func)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO residence_functions (id, level, expiration, residenceId) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE level = ?, expiration = ?"))
{
ps.setInt(1, func.getId());
@@ -196,7 +196,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
public void removeFunction(ResidenceFunction func)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM residence_functions WHERE residenceId = ? and id = ?"))
{
ps.setInt(1, _residenceId);
@@ -219,7 +219,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
public void removeFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM residence_functions WHERE residenceId = ?"))
{
ps.setInt(1, _residenceId);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
index 8b91fc77d2..53958bcf5c 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
@@ -50,7 +50,7 @@ public class AccountVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setString(1, _accountName);
@@ -83,7 +83,7 @@ public class AccountVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -120,7 +120,7 @@ public class AccountVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java
index 50fcf2ab6f..5af41a23af 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java
@@ -50,7 +50,7 @@ public class ClanVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setInt(1, _objectId);
@@ -83,7 +83,7 @@ public class ClanVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -120,7 +120,7 @@ public class ClanVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java
index c7ba2ff071..048b15a86e 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java
@@ -55,7 +55,7 @@ public class ItemVariables extends AbstractVariables
public static boolean hasVariables(int objectId)
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_COUNT))
{
st.setInt(1, objectId);
@@ -79,7 +79,7 @@ public class ItemVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setInt(1, _objectId);
@@ -112,7 +112,7 @@ public class ItemVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -149,7 +149,7 @@ public class ItemVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
index 85508e687b..c677c68971 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
@@ -76,7 +76,7 @@ public class PlayerVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setInt(1, _objectId);
@@ -109,7 +109,7 @@ public class PlayerVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -146,7 +146,7 @@ public class PlayerVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/L2GameClient.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/L2GameClient.java
index f1e975876e..fd5baeb233 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/L2GameClient.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/L2GameClient.java
@@ -329,7 +329,7 @@ public final class L2GameClient extends ChannelInboundHandler
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps2 = con.prepareStatement("UPDATE characters SET deletetime=? WHERE charId=?"))
{
ps2.setLong(1, System.currentTimeMillis() + (Config.DELETE_DAYS * 86400000)); // 24*60*60*1000 = 86400000
@@ -354,7 +354,7 @@ public final class L2GameClient extends ChannelInboundHandler
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE characters SET deletetime=0 WHERE charId=?"))
{
statement.setInt(1, objectId);
@@ -377,7 +377,7 @@ public final class L2GameClient extends ChannelInboundHandler
CharNameTable.getInstance().removeName(objid);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM character_contacts WHERE charId=? OR contactId=?"))
{
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
index 297edda360..afcc3fcbb0 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
@@ -164,7 +164,7 @@ public final class RequestDestroyItem implements IClientIncomingPacket
pet.unSummon(activeChar);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
{
statement.setInt(1, _objectId);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java
index 29ab10a108..a9c8dadb8a 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java
@@ -62,7 +62,7 @@ public class RequestPetitionFeedback implements IClientIncomingPacket
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_FEEDBACK))
{
statement.setString(1, player.getName());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java
index a2d7c3bba4..537d7f2618 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java
@@ -73,7 +73,7 @@ public final class RequestAnswerFriendInvite implements IClientIncomingPacket
if (_response == 1)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_friends (charId, friendId) VALUES (?, ?), (?, ?)"))
{
statement.setInt(1, requestor.getObjectId());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java
index 03435f7f4d..bfe07c3aed 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java
@@ -75,7 +75,7 @@ public final class RequestFriendDel implements IClientIncomingPacket
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_friends WHERE (charId=? AND friendId=?) OR (charId=? AND friendId=?)"))
{
statement.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java
index 94715a15c1..27668b0d62 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java
@@ -74,7 +74,7 @@ public class ConfirmMenteeAdd implements IClientIncomingPacket
}
else if (validate(mentor, mentee))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_mentees (charId, mentorId) VALUES (?, ?)"))
{
statement.setInt(1, mentee.getObjectId());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java
index 91ada4fbba..002abfa04d 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java
@@ -226,7 +226,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
CharSelectInfoPackage charInfopackage;
final List characterList = new LinkedList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM characters WHERE account_name=? ORDER BY createDate"))
{
statement.setString(1, loginName);
@@ -259,7 +259,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
private static void loadCharacterSubclassInfo(CharSelectInfoPackage charInfopackage, int ObjectId, int activeClassId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT exp, sp, level, vitality_points FROM character_subclasses WHERE charId=? AND class_id=? ORDER BY charId"))
{
statement.setInt(1, ObjectId);
@@ -369,7 +369,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
if (weaponObjId > 0)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT mineralId,option1,option2 FROM item_variations WHERE itemId=?"))
{
statement.setInt(1, weaponObjId);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java
index 14cd41a31e..ebb3f90088 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java
@@ -70,7 +70,7 @@ public class FriendList implements IClientOutgoingPacket
if (player1 == null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT char_name, online, classid, level FROM characters WHERE charId = ?"))
{
statement.setInt(1, objId);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java
index 8344576a3e..8876431ff9 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java
@@ -72,7 +72,7 @@ public class SecondaryPasswordAuth
private void loadPassword()
{
String var, value = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SELECT_PASSWORD))
{
statement.setString(1, _activeClient.getAccountName());
@@ -117,7 +117,7 @@ public class SecondaryPasswordAuth
password = cryptPassword(password);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_PASSWORD))
{
statement.setString(1, _activeClient.getAccountName());
@@ -136,7 +136,7 @@ public class SecondaryPasswordAuth
public boolean insertWrongAttempt(int attempts)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_ATTEMPT))
{
statement.setString(1, _activeClient.getAccountName());
@@ -175,7 +175,7 @@ public class SecondaryPasswordAuth
newPassword = cryptPassword(newPassword);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_PASSWORD))
{
statement.setString(1, newPassword);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
index ca0cef4b3b..a78d28bdc9 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
@@ -95,7 +95,7 @@ public final class TaskManager
{
task.onTimeElapsed(this);
lastActivation = System.currentTimeMillis();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[1]))
{
statement.setLong(1, lastActivation);
@@ -182,7 +182,7 @@ public final class TaskManager
private void startAllTasks()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[0]);
ResultSet rset = statement.executeQuery())
{
@@ -314,7 +314,7 @@ public final class TaskManager
private static boolean addUniqueTask(String task, TaskTypes type, String param1, String param2, String param3, long lastActivation)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(SQL_STATEMENTS[2]))
{
ps1.setString(1, task);
@@ -350,7 +350,7 @@ public final class TaskManager
private static boolean addTask(String task, TaskTypes type, String param1, String param2, String param3, long lastActivation)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[3]))
{
statement.setString(1, task);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java
index 5e3e35c6a9..e81b95cba3 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java
@@ -76,7 +76,7 @@ public class TaskBirthday extends Task
private void checkBirthday(int year, int month, int day)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY))
{
statement.setString(1, "%-" + getNum(month + 1) + "-" + getNum(day));
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/Evolve.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/Evolve.java
index 66a22f62fd..f87e33ed8d 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/Evolve.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/gameserver/util/Evolve.java
@@ -248,7 +248,7 @@ public final class Evolve
}
// pet control item no longer exists, delete the pet from the db
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
{
ps.setInt(1, removedItem.getObjectId());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/GameServerTable.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/GameServerTable.java
index 1a0713b155..2410f6ede8 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/GameServerTable.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/GameServerTable.java
@@ -115,7 +115,7 @@ public final class GameServerTable implements IGameXmlReader
*/
private void loadRegisteredGameServers()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT * FROM gameservers"))
{
@@ -222,7 +222,7 @@ public final class GameServerTable implements IGameXmlReader
public void registerServerOnDB(byte[] hexId, int id, String externalHost)
{
register(id, new GameServerInfo(id, hexId));
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO gameservers (hexid,server_id,host) values (?,?,?)"))
{
ps.setString(1, hexToString(hexId));
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/LoginController.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/LoginController.java
index a896c7fd7a..fbee48fc33 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/LoginController.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/LoginController.java
@@ -176,7 +176,7 @@ public class LoginController
final byte[] raw = password.getBytes(StandardCharsets.UTF_8);
final String hashBase64 = Base64.getEncoder().encodeToString(md.digest(raw));
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(USER_INFO_SELECT))
{
ps.setString(1, Long.toString(System.currentTimeMillis()));
@@ -206,7 +206,7 @@ public class LoginController
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(AUTOCREATE_ACCOUNTS_INSERT))
{
ps.setString(1, login);
@@ -405,7 +405,7 @@ public class LoginController
if (loginOk && (client.getLastServer() != serverId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_LAST_SERVER_UPDATE))
{
ps.setInt(1, serverId);
@@ -424,7 +424,7 @@ public class LoginController
public void setAccountAccessLevel(String account, int banLevel)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_ACCESS_LEVEL_UPDATE))
{
ps.setInt(1, banLevel);
@@ -439,7 +439,7 @@ public class LoginController
public void setAccountLastTracert(String account, String pcIp, String hop1, String hop2, String hop3, String hop4)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_IPS_UPDATE))
{
ps.setString(1, pcIp);
@@ -499,7 +499,7 @@ public class LoginController
{
final List ipWhiteList = new ArrayList<>();
final List ipBlackList = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_IPAUTH_SELECT))
{
ps.setString(1, info.getLogin());
@@ -545,7 +545,7 @@ public class LoginController
client.setAccessLevel(info.getAccessLevel());
client.setLastServer(info.getLastServer());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_INFO_UPDATE))
{
ps.setLong(1, System.currentTimeMillis());
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/LoginServer.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/LoginServer.java
index 39377afee3..d598992bdf 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/LoginServer.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/LoginServer.java
@@ -89,7 +89,7 @@ public final class LoginServer
Config.load();
// Prepare Database
- DatabaseFactory.getInstance();
+ DatabaseFactory.init();
try
{
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java
index 69ba99271d..6c73dea27a 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java
@@ -78,7 +78,7 @@ public class ChangePassword extends BaseRecievePacket
int passUpdated = 0;
// SQL connection
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT password FROM accounts WHERE login=?"))
{
ps.setString(1, accountName);
@@ -95,7 +95,7 @@ public class ChangePassword extends BaseRecievePacket
{
final byte[] password = md.digest(newpass.getBytes("UTF-8"));
// SQL connection
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE accounts SET password=? WHERE login=?"))
{
ps.setString(1, Base64.getEncoder().encodeToString(password));
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java
index f9a24a80d8..785946a687 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java
@@ -58,7 +58,7 @@ public class RequestTempBan extends BaseRecievePacket
private void banUser()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO account_data VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE value=?"))
{
ps.setString(1, _accountName);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
index 59b0e01835..4fb705c8b1 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
@@ -43,6 +43,7 @@ public class SQLAccountManager
{
Server.serverMode = Server.MODE_LOGINSERVER;
Config.load();
+ DatabaseFactory.init();
try (Scanner _scn = new Scanner(System.in))
{
@@ -166,7 +167,7 @@ public class SQLAccountManager
}
q = q.concat(" ORDER BY login ASC");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(q);
ResultSet rset = ps.executeQuery())
{
@@ -187,7 +188,7 @@ public class SQLAccountManager
private static void addOrUpdateAccount(String account, String password, String level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE accounts(login, password, accessLevel) VALUES (?, ?, ?)"))
{
final MessageDigest md = MessageDigest.getInstance("SHA");
@@ -213,7 +214,7 @@ public class SQLAccountManager
private static void changeAccountLevel(String account, String level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE accounts SET accessLevel = ? WHERE login = ?"))
{
ps.setString(1, level);
@@ -236,7 +237,7 @@ public class SQLAccountManager
private static void deleteAccount(String account)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM accounts WHERE login = ?"))
{
ps.setString(1, account);
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java
index 4ac531c664..fd25fddae4 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java
@@ -34,7 +34,7 @@ public class DBInstallerConsole implements DBOutputInterface
public DBInstallerConsole(String db, String dir) throws Exception
{
- System.out.println("Welcome to L2J DataBase installer");
+ System.out.println("Welcome to DataBase installer");
final Preferences prop = Preferences.userRoot();
RunTasks rt = null;
try (Scanner scn = new Scanner(new CloseShieldedInputStream(System.in)))
diff --git a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
index c90c8127a6..8e5a6bde49 100644
--- a/L2J_Mobius_3.0_Helios/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
+++ b/L2J_Mobius_3.0_Helios/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
@@ -187,6 +187,7 @@ public abstract class BaseGameServerRegister
Server.serverMode = Server.MODE_LOGINSERVER;
Config.load();
+ DatabaseFactory.init();
GameServerTable.getInstance();
_loaded = true;
@@ -215,7 +216,7 @@ public abstract class BaseGameServerRegister
*/
public static void unregisterGameServer(int id) throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM gameservers WHERE server_id = ?"))
{
@@ -231,7 +232,7 @@ public abstract class BaseGameServerRegister
*/
public static void unregisterAllGameServers() throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("DELETE FROM gameservers");
diff --git a/L2J_Mobius_3.0_Helios/launcher/Gameserver.launch b/L2J_Mobius_3.0_Helios/launcher/Gameserver.launch
index 5efb78b893..c52bb3585d 100644
--- a/L2J_Mobius_3.0_Helios/launcher/Gameserver.launch
+++ b/L2J_Mobius_3.0_Helios/launcher/Gameserver.launch
@@ -7,12 +7,13 @@
-
+
+
diff --git a/L2J_Mobius_3.0_Helios/launcher/Loginserver.launch b/L2J_Mobius_3.0_Helios/launcher/Loginserver.launch
index acb7f2a9b8..524abb62e5 100644
--- a/L2J_Mobius_3.0_Helios/launcher/Loginserver.launch
+++ b/L2J_Mobius_3.0_Helios/launcher/Loginserver.launch
@@ -7,7 +7,7 @@
-
+
@@ -15,5 +15,6 @@
+
diff --git a/L2J_Mobius_4.0_GrandCrusade/.classpath b/L2J_Mobius_4.0_GrandCrusade/.classpath
index 0e50693da9..619d354392 100644
--- a/L2J_Mobius_4.0_GrandCrusade/.classpath
+++ b/L2J_Mobius_4.0_GrandCrusade/.classpath
@@ -5,11 +5,12 @@
-
+
-
+
+
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java
index 9a3b363f56..68ef6d5320 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java
@@ -76,7 +76,7 @@ public final class AdminChangeAccessLevel implements IAdminCommandHandler
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET accesslevel=? WHERE char_name=?");
statement.setInt(1, lvl);
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
index df8b849989..3a1d5a2069 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
@@ -631,7 +631,7 @@ public class AdminEditChar implements IAdminCommandHandler
if (player == null)
{
- final Connection con = DatabaseFactory.getInstance().getConnection();
+ final Connection con = DatabaseFactory.getConnection();
final PreparedStatement ps = con.prepareStatement("UPDATE characters SET " + (changeCreateExpiryTime ? "clan_create_expiry_time" : "clan_join_expiry_time") + " WHERE char_name=? LIMIT 1");
ps.setString(1, playerName);
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java
index 764ab77c25..969633adcb 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java
@@ -62,7 +62,7 @@ public class AdminRepairChar implements IAdminCommandHandler
}
final String cmd = "UPDATE characters SET x=-84318, y=244579, z=-3730 WHERE char_name=?";
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(cmd);
statement.setString(1, parts[1]);
@@ -87,13 +87,13 @@ public class AdminRepairChar implements IAdminCommandHandler
return;
}
- // connection = L2DatabaseFactory.getInstance().getConnection();
+ // connection = L2DatabaseFactory.getConnection();
statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=?");
statement.setInt(1, objId);
statement.execute();
statement.close();
- // connection = L2DatabaseFactory.getInstance().getConnection();
+ // connection = L2DatabaseFactory.getConnection();
statement = con.prepareStatement("UPDATE items SET loc=\"INVENTORY\" WHERE owner_id=?");
statement.setInt(1, objId);
statement.execute();
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java
index 780c3b0088..da0c7dcad2 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java
@@ -173,7 +173,7 @@ public class AdminShowQuests implements IAdminCommandHandler
private static void showQuestMenu(L2PcInstance target, L2PcInstance actor, String[] val)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
ResultSet rs;
PreparedStatement req;
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java
index 35508761a2..a8b6ed6963 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java
@@ -489,7 +489,7 @@ public class AdminTeleport implements IAdminCommandHandler
final int x = activeChar.getX();
final int y = activeChar.getY();
final int z = activeChar.getZ();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=? WHERE char_name=?");
statement.setInt(1, x);
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java
index b4e722f105..3913b5b368 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java
@@ -61,7 +61,7 @@ public class FavoriteBoard implements IParseBoardHandler
// Load Favorite links
final String list = HtmCache.getInstance().getHtm(activeChar, "data/html/CommunityBoard/favorite_list.html");
final StringBuilder sb = new StringBuilder();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_FAVORITES))
{
ps.setInt(1, activeChar.getObjectId());
@@ -98,7 +98,7 @@ public class FavoriteBoard implements IParseBoardHandler
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_FAVORITE))
{
ps.setInt(1, activeChar.getObjectId());
@@ -123,7 +123,7 @@ public class FavoriteBoard implements IParseBoardHandler
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_FAVORITE))
{
ps.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/communityboard/HomeBoard.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
index bed19004d2..1f5572ec39 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
@@ -300,7 +300,7 @@ public final class HomeBoard implements IParseBoardHandler
private static int getFavoriteCount(L2PcInstance player)
{
int count = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(COUNT_FAVORITES))
{
ps.setInt(1, player.getObjectId());
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
index 59ecba44bb..e0708990b7 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
@@ -62,7 +62,7 @@ public class ClanWarsList implements IUserCommandHandler
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
String query;
// Attack List
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/game/java.cfg b/L2J_Mobius_4.0_GrandCrusade/dist/game/java.cfg
index cb4a4dc204..58213e428e 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/game/java.cfg
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/game/java.cfg
@@ -1 +1 @@
--server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
\ No newline at end of file
+-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=error -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
\ No newline at end of file
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/libs/HikariCP-3.2.0.jar b/L2J_Mobius_4.0_GrandCrusade/dist/libs/HikariCP-3.2.0.jar
new file mode 100644
index 0000000000..a030a7f8dc
Binary files /dev/null and b/L2J_Mobius_4.0_GrandCrusade/dist/libs/HikariCP-3.2.0.jar differ
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/libs/c3p0-0.9.5.2.jar b/L2J_Mobius_4.0_GrandCrusade/dist/libs/c3p0-0.9.5.2.jar
deleted file mode 100644
index 579cedd980..0000000000
Binary files a/L2J_Mobius_4.0_GrandCrusade/dist/libs/c3p0-0.9.5.2.jar and /dev/null differ
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/libs/mchange-commons-java-0.2.12.jar b/L2J_Mobius_4.0_GrandCrusade/dist/libs/mchange-commons-java-0.2.12.jar
deleted file mode 100644
index af11054860..0000000000
Binary files a/L2J_Mobius_4.0_GrandCrusade/dist/libs/mchange-commons-java-0.2.12.jar and /dev/null differ
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/libs/slf4j-api-1.7.25.jar b/L2J_Mobius_4.0_GrandCrusade/dist/libs/slf4j-api-1.7.25.jar
new file mode 100644
index 0000000000..7e62f1336d
Binary files /dev/null and b/L2J_Mobius_4.0_GrandCrusade/dist/libs/slf4j-api-1.7.25.jar differ
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/libs/slf4j-simple-1.7.25.jar b/L2J_Mobius_4.0_GrandCrusade/dist/libs/slf4j-simple-1.7.25.jar
new file mode 100644
index 0000000000..b29ca12719
Binary files /dev/null and b/L2J_Mobius_4.0_GrandCrusade/dist/libs/slf4j-simple-1.7.25.jar differ
diff --git a/L2J_Mobius_4.0_GrandCrusade/dist/login/java.cfg b/L2J_Mobius_4.0_GrandCrusade/dist/login/java.cfg
index 00ae5b3a66..bda4cdd24d 100644
--- a/L2J_Mobius_4.0_GrandCrusade/dist/login/java.cfg
+++ b/L2J_Mobius_4.0_GrandCrusade/dist/login/java.cfg
@@ -1 +1 @@
--server -Xms128m -Xmx256m
\ No newline at end of file
+-server -Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=error -Xms128m -Xmx256m
\ No newline at end of file
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/commons/database/DatabaseFactory.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/commons/database/DatabaseFactory.java
index 68d02d4171..dd481d2fd0 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/commons/database/DatabaseFactory.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/commons/database/DatabaseFactory.java
@@ -16,122 +16,68 @@
*/
package com.l2jmobius.commons.database;
-import java.beans.PropertyVetoException;
import java.sql.Connection;
-import java.sql.SQLException;
import java.util.logging.Logger;
import com.l2jmobius.Config;
-import com.mchange.v2.c3p0.ComboPooledDataSource;
+import com.zaxxer.hikari.HikariDataSource;
/**
- * Database Factory implementation.
- * @author Zoey76, Mobius
+ * @author Mobius
*/
public class DatabaseFactory
{
private static final Logger LOGGER = Logger.getLogger(DatabaseFactory.class.getName());
- private final ComboPooledDataSource _dataSource;
+ private static final HikariDataSource _hds = new HikariDataSource();
- public DatabaseFactory()
+ public static void init()
{
- if (Config.DATABASE_MAX_CONNECTIONS < 2)
- {
- Config.DATABASE_MAX_CONNECTIONS = 2;
- LOGGER.warning("A minimum of 2 connections are required.");
- }
-
- _dataSource = new ComboPooledDataSource();
- _dataSource.setAutoCommitOnClose(true);
-
- _dataSource.setInitialPoolSize(10);
- _dataSource.setMinPoolSize(10);
- _dataSource.setMaxPoolSize(Math.max(10, Config.DATABASE_MAX_CONNECTIONS));
-
- _dataSource.setAcquireRetryAttempts(0); // try to obtain connections indefinitely (0 = never quit)
- _dataSource.setAcquireRetryDelay(500); // 500 milliseconds wait before try to acquire connection again
- _dataSource.setCheckoutTimeout(0); // 0 = wait indefinitely for new connection if pool is exhausted
- _dataSource.setAcquireIncrement(5); // if pool is exhausted, get 5 more connections at a time cause there is
- // a "long" delay on acquire connection so taking more than one connection at once will make connection pooling more effective.
-
- // this "connection_test_table" is automatically created if not already there
- _dataSource.setAutomaticTestTable("connection_test_table");
- _dataSource.setTestConnectionOnCheckin(false);
-
- // testing OnCheckin used with IdleConnectionTestPeriod is faster than testing on checkout
-
- _dataSource.setIdleConnectionTestPeriod(3600); // test idle connection every 60 sec
- _dataSource.setMaxIdleTime(Config.DATABASE_MAX_IDLE_TIME); // 0 = idle connections never expire
- // *THANKS* to connection testing configured above but I prefer to disconnect all connections not used for more than 1 hour
-
- // enables statement caching, there is a "semi-bug" in c3p0 0.9.0 but in 0.9.0.2 and later it's fixed
- _dataSource.setMaxStatementsPerConnection(100);
-
- _dataSource.setBreakAfterAcquireFailure(false); // never fail if any way possible setting this to true will make c3p0 "crash"
- // and refuse to work till restart thus making acquire errors "FATAL" ... we don't want that it should be possible to recover
+ _hds.setDriverClassName(Config.DATABASE_DRIVER);
+ _hds.setJdbcUrl(Config.DATABASE_URL);
+ _hds.setUsername(Config.DATABASE_LOGIN);
+ _hds.setPassword(Config.DATABASE_PASSWORD);
+ _hds.setMaximumPoolSize(Config.DATABASE_MAX_CONNECTIONS);
+ _hds.setIdleTimeout(Config.DATABASE_MAX_IDLE_TIME);
+ // Test if connection is valid.
try
{
- _dataSource.setDriverClass(Config.DATABASE_DRIVER);
+ _hds.getConnection().close();
+ LOGGER.info("Database: Initialized.");
}
- catch (PropertyVetoException e)
+ catch (Exception e)
{
e.printStackTrace();
}
- _dataSource.setJdbcUrl(Config.DATABASE_URL);
- _dataSource.setUser(Config.DATABASE_LOGIN);
- _dataSource.setPassword(Config.DATABASE_PASSWORD);
-
- /* Test the connection */
- try
- {
- _dataSource.getConnection().close();
- }
- catch (SQLException e)
- {
- e.printStackTrace();
- }
-
- LOGGER.info("Database: Initialized.");
}
- public Connection getConnection()
+ public static Connection getConnection()
{
Connection con = null;
while (con == null)
{
try
{
- con = _dataSource.getConnection();
+ con = _hds.getConnection();
}
- catch (SQLException e)
+ catch (Exception e)
{
- LOGGER.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage());
+ LOGGER.severe("DatabaseFactory: Cound not get a connection. " + e);
}
}
return con;
}
- public void close()
+ public static void close()
{
try
{
- _dataSource.close();
+ _hds.close();
}
catch (Exception e)
{
- LOGGER.info(e.getMessage());
+ LOGGER.severe("DatabaseFactory: There was a problem closing the data source. " + e);
}
}
-
- public static DatabaseFactory getInstance()
- {
- return SingletonHolder.INSTANCE;
- }
-
- private static class SingletonHolder
- {
- protected static final DatabaseFactory INSTANCE = new DatabaseFactory();
- }
}
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/GameServer.java
index 2caf4c41b4..14e03938f9 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/GameServer.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/GameServer.java
@@ -196,7 +196,7 @@ public class GameServer
// Initialize config
Config.load();
printSection("Database");
- DatabaseFactory.getInstance();
+ DatabaseFactory.init();
printSection("ThreadPool");
ThreadPool.init();
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/LoginServerThread.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/LoginServerThread.java
index e26cf1111a..ba22e9ae11 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/LoginServerThread.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/LoginServerThread.java
@@ -587,7 +587,7 @@ public class LoginServerThread extends Thread
int chars = 0;
final List charToDel = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT deletetime FROM characters WHERE account_name=?"))
{
ps.setString(1, account);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/Shutdown.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/Shutdown.java
index 72caae1c02..ec983b9153 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/Shutdown.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/Shutdown.java
@@ -204,7 +204,7 @@ public class Shutdown extends Thread
// commit data, last chance
try
{
- DatabaseFactory.getInstance().close();
+ DatabaseFactory.close();
LOGGER.info("Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
}
catch (Throwable t)
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
index 3f98953c02..320a104fca 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
@@ -93,7 +93,7 @@ public class Forum
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM forums WHERE forum_id=?"))
{
ps.setInt(1, _forumId);
@@ -114,7 +114,7 @@ public class Forum
LOGGER.log(Level.WARNING, "Data error on Forum " + _forumId + " : " + e.getMessage(), e);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM topic WHERE topic_forum_id=? ORDER BY topic_id DESC"))
{
ps.setInt(1, _forumId);
@@ -139,7 +139,7 @@ public class Forum
private void getChildren()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT forum_id FROM forums WHERE forum_parent=?"))
{
ps.setInt(1, _forumId);
@@ -217,7 +217,7 @@ public class Forum
public void insertIntoDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO forums (forum_id,forum_name,forum_parent,forum_post,forum_type,forum_perm,forum_owner_id) VALUES (?,?,?,?,?,?,?)"))
{
ps.setInt(1, _forumId);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
index fa2f1da2d9..5f970fa0a5 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
@@ -72,7 +72,7 @@ public class Post
private void insertindb(CPost cp)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)"))
{
ps.setInt(1, cp.postId);
@@ -112,7 +112,7 @@ public class Post
public void deleteme(Topic t)
{
PostBBSManager.getInstance().delPostByTopic(t);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM posts WHERE post_forum_id=? AND post_topic_id=?"))
{
ps.setInt(1, t.getForumID());
@@ -130,7 +130,7 @@ public class Post
*/
private void load(Topic t)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM posts WHERE post_forum_id=? AND post_topic_id=? ORDER BY post_id ASC"))
{
ps.setInt(1, t.getForumID());
@@ -162,7 +162,7 @@ public class Post
*/
public void updatetxt(int i)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?"))
{
final CPost cp = getCPost(i);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
index ae7b7c6318..2cb2303f58 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
@@ -71,7 +71,7 @@ public class Topic
private void insertindb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO topic (topic_id,topic_forum_id,topic_name,topic_date,topic_ownername,topic_ownerid,topic_type,topic_reply) values (?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, _id);
@@ -129,7 +129,7 @@ public class Topic
{
TopicBBSManager.getInstance().delTopic(this);
f.rmTopicByID(_id);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM topic WHERE topic_id=? AND topic_forum_id=?"))
{
ps.setInt(1, _id);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
index 57a47cf456..c68fb57089 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
@@ -40,7 +40,7 @@ public class ForumsBBSManager extends BaseBBSManager
protected ForumsBBSManager()
{
_table = new CopyOnWriteArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT forum_id FROM forums WHERE forum_type = 0"))
{
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java
index adc2b28a17..b3b101e521 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java
@@ -52,7 +52,7 @@ public final class AnnouncementsTable
private void load()
{
_announcements.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery("SELECT * FROM announcements"))
{
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java
index 4aa8b72edb..5bb8ebbe43 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java
@@ -99,7 +99,7 @@ public class CharNameTable
int id = -1;
int accessLevel = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT charId,accesslevel FROM characters WHERE char_name=?"))
{
ps.setString(1, name);
@@ -145,7 +145,7 @@ public class CharNameTable
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT char_name,accesslevel FROM characters WHERE charId=?"))
{
ps.setInt(1, id);
@@ -176,7 +176,7 @@ public class CharNameTable
public synchronized boolean doesCharNameExist(String name)
{
boolean result = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT COUNT(*) as count FROM characters WHERE char_name=?"))
{
ps.setString(1, name);
@@ -197,7 +197,7 @@ public class CharNameTable
public int getAccountCharacterCount(String account)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT COUNT(char_name) as count FROM characters WHERE account_name=?"))
{
ps.setString(1, account);
@@ -218,7 +218,7 @@ public class CharNameTable
public int getLevelById(int objectId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT level FROM characters WHERE charId = ?"))
{
ps.setInt(1, objectId);
@@ -239,7 +239,7 @@ public class CharNameTable
public int getClassIdById(int objectId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT classid FROM characters WHERE charId = ?"))
{
ps.setInt(1, objectId);
@@ -260,7 +260,7 @@ public class CharNameTable
public int getClanIdById(int objectId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clanId FROM characters WHERE charId = ?"))
{
ps.setInt(1, objectId);
@@ -281,7 +281,7 @@ public class CharNameTable
private void loadAll()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT charId, char_name, accesslevel FROM characters"))
{
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java
index 021a434a38..6315404c36 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java
@@ -70,7 +70,7 @@ public class CharSummonTable
{
if (Config.RESTORE_SERVITOR_ON_RECONNECT)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(INIT_SUMMONS))
{
@@ -87,7 +87,7 @@ public class CharSummonTable
if (Config.RESTORE_PET_ON_RECONNECT)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(INIT_PET))
{
@@ -111,7 +111,7 @@ public class CharSummonTable
return !v.isEmpty() ? v : null;
});
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(REMOVE_SUMMON))
{
ps.setInt(1, activeChar.getObjectId());
@@ -181,7 +181,7 @@ public class CharSummonTable
public void restoreServitor(L2PcInstance activeChar)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(LOAD_SUMMON))
{
ps.setInt(1, activeChar.getObjectId());
@@ -229,7 +229,7 @@ public class CharSummonTable
_servitors.computeIfAbsent(summon.getOwner().getObjectId(), k -> ConcurrentHashMap.newKeySet()).add(summon.getObjectId());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SAVE_SUMMON))
{
ps.setInt(1, summon.getOwner().getObjectId());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java
index d0cd743b0f..aee103e2e5 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java
@@ -80,7 +80,7 @@ public class ClanTable
L2Clan clan;
// Count the clans
int clanCount = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT clan_id FROM clan_data"))
{
@@ -262,7 +262,7 @@ public class ClanTable
_clans.remove(clanId);
IdFactory.getInstance().releaseId(clanId);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM clan_data WHERE clan_id=?"))
{
@@ -361,7 +361,7 @@ public class ClanTable
public void storeclanswars(ClanWar war)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO clan_wars (clan1, clan2, clan1Kill, clan2Kill, winnerClan, startTime, endTime, state) VALUES(?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, war.getAttackerClanId());
@@ -392,7 +392,7 @@ public class ClanTable
clan1.broadcastClanStatus();
clan2.broadcastClanStatus();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM clan_wars WHERE clan1=? AND clan2=?"))
{
ps.setInt(1, clanId1);
@@ -407,7 +407,7 @@ public class ClanTable
private void restorewars()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery("SELECT clan1, clan2, clan1Kill, clan2Kill, winnerClan, startTime, endTime, state FROM clan_wars"))
{
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java
index f90657a886..907f92e5f6 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java
@@ -72,7 +72,7 @@ public final class CrestTable
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
ResultSet rs = statement.executeQuery("SELECT `crest_id`, `data`, `type` FROM `crests` ORDER BY `crest_id` DESC"))
{
@@ -154,7 +154,7 @@ public final class CrestTable
*/
public L2Crest createCrest(byte[] data, CrestType crestType)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO `crests`(`crest_id`, `data`, `type`) VALUES(?, ?, ?)"))
{
final L2Crest crest = new L2Crest(_nextId.getAndIncrement(), data, crestType);
@@ -187,7 +187,7 @@ public final class CrestTable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM `crests` WHERE `crest_id` = ?"))
{
statement.setInt(1, crestId);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java
index a3f4789915..4a97fb936e 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java
@@ -58,7 +58,7 @@ public class OfflineTradersTable
public void storeOffliners()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS);
PreparedStatement stm3 = con.prepareStatement(SAVE_OFFLINE_STATUS);
@@ -175,7 +175,7 @@ public class OfflineTradersTable
{
LOGGER.info(getClass().getSimpleName() + ": Loading offline traders...");
int nTraders = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement stm = con.createStatement();
ResultSet rs = stm.executeQuery(LOAD_OFFLINE_STATUS))
{
@@ -333,7 +333,7 @@ public class OfflineTradersTable
public static synchronized void onTransaction(L2PcInstance trader, boolean finished, boolean firstCall)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_PLAYER);
PreparedStatement stm3 = con.prepareStatement(SAVE_ITEMS);
@@ -457,7 +457,7 @@ public class OfflineTradersTable
{
PlayerCountManager.getInstance().decOfflineTradeCount();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_PLAYER))
{
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java
index 333e0e2289..4013e5e460 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java
@@ -42,7 +42,7 @@ public class PetNameTable
public boolean doesPetNameExist(String name, int petNpcId)
{
boolean result = true;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT name FROM pets p, items i WHERE p.item_obj_id = i.object_id AND name=? AND i.item_id IN (?)"))
{
ps.setString(1, name);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java
index 33e2d0df1d..0de4769849 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java
@@ -66,7 +66,7 @@ public final class BuyListData implements IGameXmlReader
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _buyLists.size() + " BuyLists.");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rs = statement.executeQuery("SELECT * FROM `buylists`"))
{
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/datatables/BotReportTable.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/datatables/BotReportTable.java
index c61ba4dc54..743e6a839b 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/datatables/BotReportTable.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/datatables/BotReportTable.java
@@ -112,7 +112,7 @@ public final class BotReportTable
*/
private void loadReportedCharData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery(SQL_LOAD_REPORTED_CHAR_DATA))
{
@@ -181,7 +181,7 @@ public final class BotReportTable
*/
public void saveReportedCharData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
PreparedStatement ps = con.prepareStatement(SQL_INSERT_REPORTED_CHAR_DATA))
{
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/datatables/ItemTable.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/datatables/ItemTable.java
index c8f34ed812..e4f3a0098d 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/datatables/ItemTable.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/datatables/ItemTable.java
@@ -386,7 +386,7 @@ public class ItemTable
// if it's a pet control item, delete the pet as well
if (item.getItem().isPetItem())
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
{
// Delete the pet in db
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java
index 660b537dc5..5854717647 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java
@@ -77,7 +77,7 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer
public synchronized void reset()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_daily_rewards WHERE rewardId = ? AND status = ?"))
{
ps.setInt(1, _holder.getId());
@@ -118,7 +118,7 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer
protected void storePlayerEntry(DailyMissionPlayerEntry entry)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO character_daily_rewards (charId, rewardId, status, progress, lastCompleted) VALUES (?, ?, ?, ?, ?)"))
{
ps.setInt(1, entry.getObjectId());
@@ -145,7 +145,7 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer
return existingEntry;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM character_daily_rewards WHERE charId = ? AND rewardId = ?"))
{
ps.setInt(1, objectId);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
index baaadc776c..34f7280917 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -128,7 +128,7 @@ public abstract class IdFactory
*/
private void setAllCharacterOffline()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("UPDATE characters SET online = 0");
@@ -145,7 +145,7 @@ public abstract class IdFactory
*/
private void cleanUpDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement stmt = con.createStatement())
{
final long cleanupStart = System.currentTimeMillis();
@@ -253,7 +253,7 @@ public abstract class IdFactory
private void cleanUpTimeStamps()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
int cleanCount = 0;
for (String line : TIMESTAMPS_CLEAN)
@@ -279,7 +279,7 @@ public abstract class IdFactory
protected final Integer[] extractUsedObjectIDTable() throws Exception
{
final List temp = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
String extractUsedObjectIdsQuery = "";
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
index 9e5d1cedcf..21ed01119d 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
@@ -42,7 +42,7 @@ public class StackIDFactory extends IdFactory
_curOID = FIRST_OID;
_tempOID = FIRST_OID;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// con.createStatement().execute("drop table if exists tmp_obj_id");
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java
index c1c614e3f8..85f3d57b5d 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java
@@ -169,7 +169,7 @@ public class AirShipManager
_airShipsInfo.put(ownerId, info);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_DB))
{
ps.setInt(1, ownerId);
@@ -265,7 +265,7 @@ public class AirShipManager
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(LOAD_DB))
{
@@ -296,7 +296,7 @@ public class AirShipManager
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_DB))
{
ps.setInt(1, info.getInt("fuel"));
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
index afc836f427..0808ef7947 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
@@ -198,7 +198,7 @@ public final class CastleManager implements InstanceListManager
}
}
// else offline-player circlet removal
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM items WHERE owner_id = ? and item_id = ?"))
{
ps.setInt(1, member.getObjectId());
@@ -215,7 +215,7 @@ public final class CastleManager implements InstanceListManager
@Override
public void loadInstances()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT id FROM castle ORDER BY id"))
{
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
index 6a9dff749b..4c73fd01a3 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
@@ -162,7 +162,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
private void loadDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stProduction = con.prepareStatement("SELECT * FROM castle_manor_production WHERE castle_id=?");
PreparedStatement stProcure = con.prepareStatement("SELECT * FROM castle_manor_procure WHERE castle_id=?"))
{
@@ -436,7 +436,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
_productionNext.put(castleId, list);
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement dps = con.prepareStatement("DELETE FROM castle_manor_production WHERE castle_id = ? AND next_period = 1");
PreparedStatement ips = con.prepareStatement(INSERT_PRODUCT))
{
@@ -472,7 +472,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
_procureNext.put(castleId, list);
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement dps = con.prepareStatement("DELETE FROM castle_manor_procure WHERE castle_id = ? AND next_period = 1");
PreparedStatement ips = con.prepareStatement(INSERT_CROP))
{
@@ -506,7 +506,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
public final void updateCurrentProduction(int castleId, Collection items)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle_manor_production SET amount = ? WHERE castle_id = ? AND seed_id = ? AND next_period = 0"))
{
for (SeedProduction sp : items)
@@ -526,7 +526,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
public final void updateCurrentProcure(int castleId, Collection items)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle_manor_procure SET amount = ? WHERE castle_id = ? AND crop_id = ? AND next_period = 0"))
{
for (CropProcure sp : items)
@@ -599,7 +599,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
@Override
public final boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ds = con.prepareStatement("DELETE FROM castle_manor_production");
PreparedStatement is = con.prepareStatement(INSERT_PRODUCT);
PreparedStatement dp = con.prepareStatement("DELETE FROM castle_manor_procure");
@@ -697,7 +697,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ds = con.prepareStatement("DELETE FROM castle_manor_production WHERE castle_id = ?");
PreparedStatement dc = con.prepareStatement("DELETE FROM castle_manor_procure WHERE castle_id = ?"))
{
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java
index f4229564fe..e808c70557 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java
@@ -91,7 +91,7 @@ public class CeremonyOfChaosManager extends AbstractEventManager clanApplicantList = _applicantList.get(clanId);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_APPLICANT))
{
statement.setInt(1, playerId);
@@ -189,7 +189,7 @@ public class ClanEntryManager
{
_applicantList.computeIfAbsent(clanId, k -> new ConcurrentHashMap<>()).put(info.getPlayerId(), info);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_APPLICANT))
{
statement.setInt(1, info.getPlayerId());
@@ -216,7 +216,7 @@ public class ClanEntryManager
{
if (!_playerLocked.containsKey(playerId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_WAITING_LIST))
{
statement.setInt(1, info.getPlayerId());
@@ -237,7 +237,7 @@ public class ClanEntryManager
{
if (_waitingList.containsKey(playerId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_WAITING_LIST))
{
statement.setInt(1, playerId);
@@ -258,7 +258,7 @@ public class ClanEntryManager
{
if (!_clanList.containsKey(clanId) && !_clanLocked.containsKey(clanId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_CLAN_RECRUIT))
{
statement.setInt(1, info.getClanId());
@@ -283,7 +283,7 @@ public class ClanEntryManager
{
if (_clanList.containsKey(clanId) && !_clanLocked.containsKey(clanId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CLAN_RECRUIT))
{
statement.setInt(1, info.getKarma());
@@ -307,7 +307,7 @@ public class ClanEntryManager
{
if (_clanList.containsKey(clanId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_CLAN_RECRUIT))
{
statement.setInt(1, clanId);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java
index e424e0ad7e..6ba2c94bb2 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java
@@ -79,7 +79,7 @@ public final class CommissionManager
protected CommissionManager()
{
final Map itemInstances = new HashMap<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement(SELECT_ALL_ITEMS))
{
@@ -245,7 +245,7 @@ public final class CommissionManager
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_COMMISSION_ITEM, Statement.RETURN_GENERATED_KEYS))
{
final Instant startTime = Instant.now();
@@ -398,7 +398,7 @@ public final class CommissionManager
*/
private boolean deleteItemFromDB(long commissionId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_COMMISSION_ITEM))
{
ps.setLong(1, commissionId);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
index 9e5b85cf52..398058a743 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
@@ -142,7 +142,7 @@ public final class CursedWeaponsManager implements IGameXmlReader
private void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT itemId, charId, playerReputation, playerPkKills, nbKills, endTime FROM cursed_weapons"))
{
@@ -167,7 +167,7 @@ public final class CursedWeaponsManager implements IGameXmlReader
private void controlPlayers()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT owner_id FROM items WHERE item_id=?"))
{
// TODO: See comments below...
@@ -338,7 +338,7 @@ public final class CursedWeaponsManager implements IGameXmlReader
public static void removeFromDb(int itemId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM cursed_weapons WHERE itemId = ?"))
{
ps.setInt(1, itemId);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java
index ced8c5abd2..a881e85ae4 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java
@@ -85,7 +85,7 @@ public class DBSpawnManager
_storedInfo.clear();
_schedules.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM npc_respawns");
ResultSet rset = statement.executeQuery())
{
@@ -275,7 +275,7 @@ public class DBSpawnManager
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO npc_respawns (id, x, y, z, heading, respawnTime, currentHp, currentMp) VALUES(?, ?, ?, ?, ?, ?, ?, ?)"))
{
statement.setInt(1, spawn.getId());
@@ -331,7 +331,7 @@ public class DBSpawnManager
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO npc_respawns (id, x, y, z, heading, respawnTime, currentHp, currentMp) VALUES(?, ?, ?, ?, ?, ?, ?, ?)"))
{
statement.setInt(1, spawn.getId());
@@ -380,7 +380,7 @@ public class DBSpawnManager
if (updateDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM npc_respawns WHERE id = ?"))
{
ps.setInt(1, npcId);
@@ -401,7 +401,7 @@ public class DBSpawnManager
*/
private void updateDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE npc_respawns SET respawnTime = ?, currentHP = ?, currentMP = ? WHERE id = ?"))
{
for (Integer npcId : _storedInfo.keySet())
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java
index 3dd467d653..f25bc2e852 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java
@@ -120,7 +120,7 @@ public class DailyTaskManager extends AbstractEventManager>
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement st = con.prepareStatement("UPDATE character_subclasses SET vitality_points = ?"))
{
@@ -150,7 +150,7 @@ public class DailyTaskManager extends AbstractEventManager>
private void resetExtendDrop()
{
// Update data for offline players.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_variables WHERE var = ?"))
{
ps.setString(1, PlayerVariables.EXTEND_DROP);
@@ -173,7 +173,7 @@ public class DailyTaskManager extends AbstractEventManager>
private void resetDailySkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final List dailySkills = getVariables().getList("reset_skills", SkillHolder.class, Collections.emptyList());
for (SkillHolder skill : dailySkills)
@@ -200,7 +200,7 @@ public class DailyTaskManager extends AbstractEventManager>
}
// Update data for offline players.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE character_variables SET val = ? WHERE var = ?"))
{
ps.setInt(1, 0);
@@ -225,7 +225,7 @@ public class DailyTaskManager extends AbstractEventManager>
private void resetRecommends()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("UPDATE character_reco_bonus SET rec_left = ?, rec_have = 0 WHERE rec_have <= 20"))
{
@@ -258,7 +258,7 @@ public class DailyTaskManager extends AbstractEventManager>
if (Config.TRAINING_CAMP_ENABLE)
{
// Update data for offline players.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM account_gsdata WHERE var = ?"))
{
ps.setString(1, "TRAINING_CAMP_DURATION");
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java
index f635c19883..7101b82852 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java
@@ -46,7 +46,7 @@ public class FactionManager
private void loadAll()
{
_playerFactions.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT charId, faction FROM characters"))
{
@@ -75,7 +75,7 @@ public class FactionManager
return factionId;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT faction FROM characters WHERE charId=?"))
{
ps.setInt(1, id);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/FortManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
index 0fbe44bc6d..56ab9144cf 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
@@ -121,7 +121,7 @@ public final class FortManager implements InstanceListManager
@Override
public void loadInstances()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT id FROM fort ORDER BY id"))
{
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
index 0a5245dafc..4eb6258b05 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
@@ -86,7 +86,7 @@ public final class FortSiegeManager
}
boolean register = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clan_id FROM fortsiege_clans where clan_id=? and fort_id=?"))
{
ps.setInt(1, clan.getId());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
index e9f6bb3475..044d74609a 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
@@ -56,7 +56,7 @@ public final class GlobalVariablesManager extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery(SELECT_QUERY))
{
@@ -87,7 +87,7 @@ public final class GlobalVariablesManager extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement del = con.createStatement();
PreparedStatement st = con.prepareStatement(INSERT_QUERY))
{
@@ -119,7 +119,7 @@ public final class GlobalVariablesManager extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement del = con.createStatement())
{
del.execute(DELETE_QUERY);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
index 7102530261..e46a1599e4 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
@@ -62,7 +62,7 @@ public final class GrandBossManager implements IStorable
private void init()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT * from grandboss_data ORDER BY boss_id"))
{
@@ -154,7 +154,7 @@ public final class GrandBossManager implements IStorable
@Override
public boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
for (Entry e : _storedInfo.entrySet())
{
@@ -206,7 +206,7 @@ public final class GrandBossManager implements IStorable
private void updateDb(int bossId, boolean statusOnly)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final L2GrandBossInstance boss = _bosses.get(bossId);
final StatsSet info = _storedInfo.get(bossId);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java
index 0939f2cf18..4a0efbc831 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java
@@ -498,7 +498,7 @@ public final class InstanceManager implements IGameXmlReader
*/
private void restoreInstanceTimes()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT * FROM character_instance_time ORDER BY charId"))
{
@@ -550,7 +550,7 @@ public final class InstanceManager implements IGameXmlReader
// Remove them
if (!invalidPenalty.isEmpty())
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_INSTANCE_TIME))
{
for (Integer id : invalidPenalty)
@@ -615,7 +615,7 @@ public final class InstanceManager implements IGameXmlReader
*/
public void deleteInstanceTime(L2PcInstance player, int id)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_INSTANCE_TIME))
{
ps.setInt(1, player.getObjectId());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java
index e0599ea3fe..eb105b45f3 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java
@@ -55,7 +55,7 @@ public final class ItemAuctionManager implements IGameXmlReader
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery("SELECT auctionId FROM item_auction ORDER BY auctionId DESC LIMIT 0, 1"))
{
@@ -134,7 +134,7 @@ public final class ItemAuctionManager implements IGameXmlReader
public static void deleteAuction(int auctionId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement statement = con.prepareStatement("DELETE FROM item_auction WHERE auctionId=?"))
{
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
index fba190d620..5bbbecc082 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
@@ -80,7 +80,7 @@ public final class ItemsOnGroundManager implements Runnable
str = "UPDATE itemsonground SET drop_time = ? WHERE drop_time = -1";
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(str))
{
ps.setLong(1, System.currentTimeMillis());
@@ -93,7 +93,7 @@ public final class ItemsOnGroundManager implements Runnable
}
// Add items to world
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable FROM itemsonground"))
{
int count = 0;
@@ -178,7 +178,7 @@ public final class ItemsOnGroundManager implements Runnable
public void emptyTable()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("DELETE FROM itemsonground");
@@ -204,7 +204,7 @@ public final class ItemsOnGroundManager implements Runnable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO itemsonground(object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable) VALUES(?,?,?,?,?,?,?,?,?)"))
{
for (L2ItemInstance item : _items)
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/MailManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/MailManager.java
index 0b4c7601cb..fbc14a23e6 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/MailManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/MailManager.java
@@ -57,7 +57,7 @@ public final class MailManager
private void load()
{
int count = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT * FROM messages ORDER BY expiration"))
{
@@ -192,7 +192,7 @@ public final class MailManager
public void sendMessage(Message msg)
{
_messages.put(msg.getId(), msg);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = Message.getStatement(msg, con))
{
ps.execute();
@@ -214,7 +214,7 @@ public final class MailManager
public final void markAsReadInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isUnread = 'false' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -228,7 +228,7 @@ public final class MailManager
public final void markAsDeletedBySenderInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isDeletedBySender = 'true' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -242,7 +242,7 @@ public final class MailManager
public final void markAsDeletedByReceiverInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isDeletedByReceiver = 'true' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -256,7 +256,7 @@ public final class MailManager
public final void removeAttachmentsInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET hasAttachments = 'false' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -270,7 +270,7 @@ public final class MailManager
public final void deleteMessageInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM messages WHERE messageId = ?"))
{
ps.setInt(1, msgId);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java
index f47cf3f813..82a7f2288b 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java
@@ -54,7 +54,7 @@ public class MentorManager
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery("SELECT * FROM character_mentees"))
{
@@ -76,7 +76,7 @@ public class MentorManager
*/
public void deleteMentee(int mentorId, int menteeId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_mentees WHERE mentorId = ? AND charId = ?"))
{
statement.setInt(1, mentorId);
@@ -95,7 +95,7 @@ public class MentorManager
*/
public void deleteMentor(int mentorId, int menteeId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_mentees WHERE mentorId = ? AND charId = ?"))
{
statement.setInt(1, mentorId);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
index a29ed155fc..c03a9a8aae 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
@@ -128,7 +128,7 @@ public class PremiumManager
private void loadPremiumData(String accountName)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stmt = con.prepareStatement(LOAD_SQL))
{
stmt.setString(1, accountName);
@@ -160,7 +160,7 @@ public class PremiumManager
long newPremiumExpiration = oldPremiumExpiration + addTime;
// UPDATE DATABASE
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stmt = con.prepareStatement(UPDATE_SQL))
{
stmt.setLong(1, newPremiumExpiration);
@@ -205,7 +205,7 @@ public class PremiumManager
premiumData.remove(accountName);
// UPDATE DATABASE
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stmt = con.prepareStatement(DELETE_SQL))
{
stmt.setString(1, accountName);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java
index 001e262042..7438bf62f8 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java
@@ -56,7 +56,7 @@ public final class PunishmentManager
int expired = 0;
// Load punishments.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery("SELECT * FROM punishments"))
{
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
index b99c5e77d5..fe296e2e53 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
@@ -57,7 +57,7 @@ public final class SiegeGuardManager
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
ResultSet rs = con.createStatement().executeQuery("SELECT * FROM castle_siege_guards Where isHired = 1"))
{
while (rs.next())
@@ -158,7 +158,7 @@ public final class SiegeGuardManager
final SiegeGuardHolder holder = getSiegeGuardByItem(castle.getResidenceId(), itemId);
if (holder != null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("Insert Into castle_siege_guards (castleId, npcId, x, y, z, heading, respawnDelay, isHired) Values (?, ?, ?, ?, ?, ?, ?, ?)"))
{
statement.setInt(1, castle.getResidenceId());
@@ -249,7 +249,7 @@ public final class SiegeGuardManager
*/
private void loadSiegeGuard(Castle castle)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_siege_guards Where castleId = ? And isHired = ?"))
{
ps.setInt(1, castle.getResidenceId());
@@ -283,7 +283,7 @@ public final class SiegeGuardManager
*/
public void removeSiegeGuard(int npcId, IPositionable pos)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("Delete From castle_siege_guards Where npcId = ? And x = ? AND y = ? AND z = ? AND isHired = 1"))
{
ps.setInt(1, npcId);
@@ -304,7 +304,7 @@ public final class SiegeGuardManager
*/
public void removeSiegeGuards(Castle castle)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("Delete From castle_siege_guards Where castleId = ? And isHired = 1"))
{
ps.setInt(1, castle.getResidenceId());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
index 38d9a81244..d5b2c9dc80 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
@@ -88,7 +88,7 @@ public final class SiegeManager
}
boolean register = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT clan_id FROM siege_clans where clan_id=? and castle_id=?"))
{
statement.setInt(1, clan.getId());
@@ -275,7 +275,7 @@ public final class SiegeManager
private void loadTrapUpgrade(int castleId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_trapupgrade WHERE castleId=?"))
{
ps.setInt(1, castleId);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/BlockList.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/BlockList.java
index f34f2aa666..9498d19d95 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/BlockList.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/BlockList.java
@@ -71,7 +71,7 @@ public class BlockList
private static List loadList(int ObjId)
{
final List list = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=? AND relation=1"))
{
statement.setInt(1, ObjId);
@@ -98,7 +98,7 @@ public class BlockList
private void updateInDB(int targetId, boolean state)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (state) // add
{
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/CursedWeapon.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/CursedWeapon.java
index 2265d6876c..e767a0de19 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/CursedWeapon.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/CursedWeapon.java
@@ -136,7 +136,7 @@ public class CursedWeapon implements INamable
// Remove from Db
LOGGER.info(_name + " being removed offline.");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement del = con.prepareStatement("DELETE FROM items WHERE owner_id=? AND item_id=?");
PreparedStatement ps = con.prepareStatement("UPDATE characters SET reputation=?, pkkills=? WHERE charId=?"))
{
@@ -471,7 +471,7 @@ public class CursedWeapon implements INamable
public void saveData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement del = con.prepareStatement("DELETE FROM cursed_weapons WHERE itemId = ?");
PreparedStatement ps = con.prepareStatement("INSERT INTO cursed_weapons (itemId, charId, playerReputation, playerPkKills, nbKills, endTime) VALUES (?, ?, ?, ?, ?, ?)"))
{
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2Clan.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2Clan.java
index 7733a32091..9454ec2cda 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2Clan.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2Clan.java
@@ -266,7 +266,7 @@ public class L2Clan implements IIdentifiable, INamable
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET clan_privs = ? WHERE charId = ?"))
{
ps.setInt(1, 0);
@@ -306,7 +306,7 @@ public class L2Clan implements IIdentifiable, INamable
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET clan_privs = ? WHERE charId = ?"))
{
ps.setInt(1, EnumIntBitmask.getAllBitmask(ClanPrivilege.class));
@@ -883,7 +883,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateBloodAllianceCountInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET blood_alliance_count=? WHERE clan_id=?"))
{
ps.setInt(1, _bloodAllianceCount);
@@ -927,7 +927,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateBloodOathCountInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET blood_oath_count=? WHERE clan_id=?"))
{
ps.setInt(1, _bloodOathCount);
@@ -943,7 +943,7 @@ public class L2Clan implements IIdentifiable, INamable
public void updateInDB()
{
// Update reputation
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET reputation_score=? WHERE clan_id=?"))
{
ps.setInt(1, _reputationScore);
@@ -978,7 +978,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateClanInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET leader_id=?,ally_id=?,ally_name=?,reputation_score=?,ally_penalty_expiry_time=?,ally_penalty_type=?,char_penalty_expiry_time=?,dissolving_expiry_time=?,new_leader_id=? WHERE clan_id=?"))
{
ps.setInt(1, getLeaderId());
@@ -1016,7 +1016,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void store()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_CLAN_DATA))
{
ps.setInt(1, _clanId);
@@ -1047,7 +1047,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
private void removeMemberInDatabase(L2ClanMember member, long clanJoinExpiryTime, long clanCreateExpiryTime)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("UPDATE characters SET clanid=0, title=?, clan_join_expiry_time=?, clan_create_expiry_time=?, clan_privs=0, wantspeace=0, subpledge=0, lvl_joined_academy=0, apprentice=0, sponsor=0 WHERE charId=?");
PreparedStatement ps2 = con.prepareStatement("UPDATE characters SET apprentice=0 WHERE apprentice=?");
PreparedStatement ps3 = con.prepareStatement("UPDATE characters SET sponsor=0 WHERE sponsor=?"))
@@ -1072,7 +1072,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_CLAN_DATA))
{
ps.setInt(1, _clanId);
@@ -1147,7 +1147,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreNotice()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT enabled,notice FROM clan_notices WHERE clan_id=?"))
{
ps.setInt(1, _clanId);
@@ -1178,7 +1178,7 @@ public class L2Clan implements IIdentifiable, INamable
notice = notice.substring(0, MAX_NOTICE_LENGTH - 1);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_notices (clan_id,notice,enabled) values (?,?,?) ON DUPLICATE KEY UPDATE notice=?,enabled=?"))
{
ps.setInt(1, _clanId);
@@ -1237,7 +1237,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreSkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT skill_id,skill_level,sub_pledge_id FROM clan_skills WHERE clan_id=?"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -1360,7 +1360,7 @@ public class L2Clan implements IIdentifiable, INamable
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (oldSkill != null)
{
@@ -1770,7 +1770,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreSubPledges()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT sub_pledge_id,name,leader_id FROM clan_subpledges WHERE clan_id=?"))
{
// Retrieve all subpledges of this clan from the database
@@ -1870,7 +1870,7 @@ public class L2Clan implements IIdentifiable, INamable
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_subpledges (clan_id,sub_pledge_id,name,leader_id) values (?,?,?,?)"))
{
ps.setInt(1, _clanId);
@@ -1953,7 +1953,7 @@ public class L2Clan implements IIdentifiable, INamable
public void updateSubPledgeInDB(int pledgeType)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_subpledges SET leader_id=?, name=? WHERE clan_id=? AND sub_pledge_id=?"))
{
ps.setInt(1, getSubPledge(pledgeType).getLeaderId());
@@ -1970,7 +1970,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreRankPrivs()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT privs,rank,party FROM clan_privs WHERE clan_id=?"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -2019,7 +2019,7 @@ public class L2Clan implements IIdentifiable, INamable
{
_privs.get(rank).setPrivs(privs);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_privs (clan_id,rank,party,privs) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE privs = ?"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -2055,7 +2055,7 @@ public class L2Clan implements IIdentifiable, INamable
{
_privs.put(rank, new RankPrivs(rank, 0, privs));
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_privs (clan_id,rank,party,privs) VALUES (?,?,?,?)"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -2174,7 +2174,7 @@ public class L2Clan implements IIdentifiable, INamable
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET auction_bid_at=? WHERE clan_id=?"))
{
ps.setInt(1, id);
@@ -2717,7 +2717,7 @@ public class L2Clan implements IIdentifiable, INamable
public void changeLevel(int level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET clan_level = ? WHERE clan_id = ?"))
{
ps.setInt(1, level);
@@ -2763,7 +2763,7 @@ public class L2Clan implements IIdentifiable, INamable
setCrestId(crestId);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET crest_id = ? WHERE clan_id = ?"))
{
ps.setInt(1, crestId);
@@ -2800,7 +2800,7 @@ public class L2Clan implements IIdentifiable, INamable
allyId = _allyId;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(sqlStatement))
{
ps.setInt(1, crestId);
@@ -2846,7 +2846,7 @@ public class L2Clan implements IIdentifiable, INamable
setCrestLargeId(crestId);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET crest_large_id = ? WHERE clan_id = ?"))
{
ps.setInt(1, crestId);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2ClanMember.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2ClanMember.java
index 1ae5225355..8655fe5918 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2ClanMember.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2ClanMember.java
@@ -244,7 +244,7 @@ public class L2ClanMember
*/
public void updatePledgeType()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET subpledge=? WHERE charId=?"))
{
ps.setLong(1, _pledgeType);
@@ -289,7 +289,7 @@ public class L2ClanMember
*/
public void updatePowerGrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET power_grade=? WHERE charId=?"))
{
ps.setLong(1, _powerGrade);
@@ -800,7 +800,7 @@ public class L2ClanMember
*/
public void saveApprenticeAndSponsor(int apprentice, int sponsor)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET apprentice=?,sponsor=? WHERE charId=?"))
{
ps.setInt(1, apprentice);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2ContactList.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2ContactList.java
index ea5f1f9d5d..5b5f5ab2bc 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2ContactList.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2ContactList.java
@@ -58,7 +58,7 @@ public class L2ContactList
{
_contacts.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY_LOAD))
{
statement.setInt(1, activeChar.getObjectId());
@@ -124,7 +124,7 @@ public class L2ContactList
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY_ADD))
{
statement.setInt(1, activeChar.getObjectId());
@@ -161,7 +161,7 @@ public class L2ContactList
_contacts.remove(name);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY_REMOVE))
{
statement.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2Mentee.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2Mentee.java
index 5c086b9d83..5414107ac4 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2Mentee.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/L2Mentee.java
@@ -49,7 +49,7 @@ public class L2Mentee
final L2PcInstance player = getPlayerInstance();
if (player == null) // Only if player is offline
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT char_name, level, base_class FROM characters WHERE charId = ?"))
{
statement.setInt(1, _objectId);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/MacroList.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/MacroList.java
index 577b101249..176fa12d48 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/MacroList.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/MacroList.java
@@ -124,7 +124,7 @@ public class MacroList implements IRestorable
private void registerMacroInDb(Macro macro)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO character_macroses (charId,id,icon,name,descr,acronym,commands) values(?,?,?,?,?,?,?)"))
{
ps.setInt(1, _owner.getObjectId());
@@ -160,7 +160,7 @@ public class MacroList implements IRestorable
private void deleteMacroFromDb(Macro macro)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_macroses WHERE charId=? AND id=?"))
{
ps.setInt(1, _owner.getObjectId());
@@ -177,7 +177,7 @@ public class MacroList implements IRestorable
public boolean restoreMe()
{
_macroses.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT charId, id, icon, name, descr, acronym, commands FROM character_macroses WHERE charId=?"))
{
ps.setInt(1, _owner.getObjectId());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/ShortCuts.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/ShortCuts.java
index 81e2c6f902..cbb856704d 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/ShortCuts.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/ShortCuts.java
@@ -85,7 +85,7 @@ public class ShortCuts implements IRestorable
deleteShortCutFromDb(oldShortCut);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("REPLACE INTO character_shortcuts (charId,slot,page,type,shortcut_id,level,sub_level,class_index) values(?,?,?,?,?,?,?,?)"))
{
statement.setInt(1, _owner.getObjectId());
@@ -154,7 +154,7 @@ public class ShortCuts implements IRestorable
*/
private void deleteShortCutFromDb(Shortcut shortcut)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=? AND slot=? AND page=? AND class_index=?"))
{
statement.setInt(1, _owner.getObjectId());
@@ -173,7 +173,7 @@ public class ShortCuts implements IRestorable
public boolean restoreMe()
{
_shortCuts.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT charId, slot, page, type, shortcut_id, level, sub_level FROM character_shortcuts WHERE charId=? AND class_index=?"))
{
statement.setInt(1, _owner.getObjectId());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
index 9215050176..c8a3994c0d 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
@@ -1362,7 +1362,7 @@ public final class L2PcInstance extends L2Playable
private void insertNewRecipeData(int recipeId, boolean isDwarf)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_recipebook (charId, id, classIndex, type) values(?,?,?,?)"))
{
statement.setInt(1, getObjectId());
@@ -1379,7 +1379,7 @@ public final class L2PcInstance extends L2Playable
private void deleteRecipeData(int recipeId, boolean isDwarf)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_recipebook WHERE charId=? AND id=? AND classIndex=?"))
{
statement.setInt(1, getObjectId());
@@ -6340,7 +6340,7 @@ public final class L2PcInstance extends L2Playable
if (updateInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_CHARACTER_ACCESS))
{
ps.setInt(1, accessLevel.getLevel());
@@ -6459,7 +6459,7 @@ public final class L2PcInstance extends L2Playable
*/
public void updateOnlineStatus()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE characters SET online=?, lastAccess=? WHERE charId=?"))
{
statement.setInt(1, isOnlineInt());
@@ -6479,7 +6479,7 @@ public final class L2PcInstance extends L2Playable
*/
private boolean createDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_CHARACTER))
{
statement.setString(1, _accountName);
@@ -6543,7 +6543,7 @@ public final class L2PcInstance extends L2Playable
double currentCp = 0;
double currentHp = 0;
double currentMp = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHARACTER))
{
// Retrieve the L2PcInstance from the characters table of the database
@@ -6905,7 +6905,7 @@ public final class L2PcInstance extends L2Playable
*/
private static boolean restoreSubClassData(L2PcInstance player)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_SUBCLASSES))
{
statement.setInt(1, player.getObjectId());
@@ -6996,7 +6996,7 @@ public final class L2PcInstance extends L2Playable
private void restoreRecipeBook(boolean loadCommon)
{
final String sql = loadCommon ? "SELECT id, type, classIndex FROM character_recipebook WHERE charId=?" : "SELECT id FROM character_recipebook WHERE charId=? AND classIndex=? AND type = 1";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(sql))
{
statement.setInt(1, getObjectId());
@@ -7049,7 +7049,7 @@ public final class L2PcInstance extends L2Playable
private void loadPremiumItemList()
{
final String sql = "SELECT itemNum, itemId, itemCount, itemSender FROM character_premium_items WHERE charId=?";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(sql))
{
statement.setInt(1, getObjectId());
@@ -7073,7 +7073,7 @@ public final class L2PcInstance extends L2Playable
public void updatePremiumItem(int itemNum, long newcount)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE character_premium_items SET itemCount=? WHERE charId=? AND itemNum=? "))
{
statement.setLong(1, newcount);
@@ -7089,7 +7089,7 @@ public final class L2PcInstance extends L2Playable
public void deletePremiumItem(int itemNum)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_premium_items WHERE charId=? AND itemNum=? "))
{
statement.setInt(1, getObjectId());
@@ -7142,7 +7142,7 @@ public final class L2PcInstance extends L2Playable
final long exp = getStat().getBaseExp();
final int level = getStat().getBaseLevel();
final long sp = getStat().getBaseSp();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CHARACTER))
{
statement.setInt(1, level);
@@ -7227,7 +7227,7 @@ public final class L2PcInstance extends L2Playable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CHAR_SUBCLASS))
{
for (SubClass subClass : getSubClasses().values())
@@ -7258,7 +7258,7 @@ public final class L2PcInstance extends L2Playable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
{
@@ -7378,7 +7378,7 @@ public final class L2PcInstance extends L2Playable
private void storeItemReuseDelay()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(DELETE_ITEM_REUSE_SAVE);
PreparedStatement ps2 = con.prepareStatement(ADD_ITEM_REUSE_SAVE))
{
@@ -7495,7 +7495,7 @@ public final class L2PcInstance extends L2Playable
final Skill oldSkill = super.removeSkill(skill, true);
if (oldSkill != null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_SKILL_FROM_CHAR))
{
// Remove or update a L2PcInstance skill from the character_skills table of the database
@@ -7538,7 +7538,7 @@ public final class L2PcInstance extends L2Playable
private void storeSkill(Skill newSkill, Skill oldSkill, int newClassIndex)
{
final int classIndex = (newClassIndex > -1) ? newClassIndex : _classIndex;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if ((oldSkill != null) && (newSkill != null))
{
@@ -7588,7 +7588,7 @@ public final class L2PcInstance extends L2Playable
}
final int classIndex = (newClassIndex > -1) ? newClassIndex : _classIndex;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_NEW_SKILLS))
{
con.setAutoCommit(false);
@@ -7615,7 +7615,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restoreSkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -7667,7 +7667,7 @@ public final class L2PcInstance extends L2Playable
@Override
public void restoreEffects()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_SKILL_SAVE))
{
statement.setInt(1, getObjectId());
@@ -7724,7 +7724,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restoreItemReuse()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_ITEM_REUSE_SAVE);
PreparedStatement delete = con.prepareStatement(DELETE_ITEM_REUSE_SAVE))
{
@@ -7795,7 +7795,7 @@ public final class L2PcInstance extends L2Playable
_henna[i - 1] = null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_HENNAS))
{
statement.setInt(1, getObjectId());
@@ -7903,7 +7903,7 @@ public final class L2PcInstance extends L2Playable
_henna[slot - 1] = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_CHAR_HENNA))
{
statement.setInt(1, getObjectId());
@@ -8001,7 +8001,7 @@ public final class L2PcInstance extends L2Playable
// Calculate Henna modifiers of this L2PcInstance
recalcHennaStats();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(ADD_CHAR_HENNA))
{
statement.setInt(1, getObjectId());
@@ -9642,7 +9642,7 @@ public final class L2PcInstance extends L2Playable
newClass.setLevel(Config.BASE_DUALCLASS_LEVEL);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(ADD_CHAR_SUBCLASS))
{
// Store the basic info about this new sub-class.
@@ -9742,7 +9742,7 @@ public final class L2PcInstance extends L2Playable
// Remove after stats are recalculated.
getSubClasses().remove(classIndex);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
@@ -11969,7 +11969,7 @@ public final class L2PcInstance extends L2Playable
{
String req;
req = "UPDATE pets SET fed=? WHERE item_obj_id = ?";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(req))
{
statement.setInt(1, _curFeed);
@@ -12096,7 +12096,7 @@ public final class L2PcInstance extends L2Playable
bookmark.setTag(tag);
bookmark.setName(name);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_TP_BOOKMARK))
{
statement.setInt(1, icon);
@@ -12119,7 +12119,7 @@ public final class L2PcInstance extends L2Playable
{
if (_tpbookmarks.remove(id) != null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_TP_BOOKMARK))
{
statement.setInt(1, getObjectId());
@@ -12262,7 +12262,7 @@ public final class L2PcInstance extends L2Playable
sm.addItemName(20033);
sendPacket(sm);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_TP_BOOKMARK))
{
statement.setInt(1, getObjectId());
@@ -12284,7 +12284,7 @@ public final class L2PcInstance extends L2Playable
public void restoreTeleportBookmark()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_TP_BOOKMARK))
{
statement.setInt(1, getObjectId());
@@ -12496,7 +12496,7 @@ public final class L2PcInstance extends L2Playable
_friendList.clear();
final String sqlQuery = "SELECT friendId FROM character_friends WHERE charId=? AND relation=0";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(sqlQuery))
{
statement.setInt(1, getObjectId());
@@ -12586,7 +12586,7 @@ public final class L2PcInstance extends L2Playable
{
if (hasManufactureShop())
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement st = con.prepareStatement(DELETE_CHAR_RECIPE_SHOP))
{
@@ -12621,7 +12621,7 @@ public final class L2PcInstance extends L2Playable
{
final Map manufactureItems = new HashMap<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_RECIPE_SHOP))
{
statement.setInt(1, getObjectId());
@@ -13041,7 +13041,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restorePetInventoryItems()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT object_id FROM `items` WHERE `owner_id`=? AND (`loc`='PET' OR `loc`='PET_EQUIP') LIMIT 1;"))
{
statement.setInt(1, getObjectId());
@@ -13081,7 +13081,7 @@ public final class L2PcInstance extends L2Playable
*/
private void loadRecommendations()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT rec_have, rec_left FROM character_reco_bonus WHERE charId = ?"))
{
statement.setInt(1, getObjectId());
@@ -13105,7 +13105,7 @@ public final class L2PcInstance extends L2Playable
*/
public void storeRecommendations()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO character_reco_bonus (charId,rec_have,rec_left,time_left) VALUES (?,?,?,?)"))
{
ps.setInt(1, getObjectId());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
index c5b882a533..2a22ce6fa1 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
@@ -788,7 +788,7 @@ public class L2PetInstance extends L2Summon
}
// pet control item no longer exists, delete the pet from the db
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id = ?"))
{
statement.setInt(1, _controlObjectId);
@@ -846,7 +846,7 @@ public class L2PetInstance extends L2Summon
private static L2PetInstance restore(L2ItemInstance control, L2NpcTemplate template, L2PcInstance owner)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT item_obj_id, name, level, curHp, curMp, exp, sp, fed FROM pets WHERE item_obj_id=?"))
{
L2PetInstance pet;
@@ -942,7 +942,7 @@ public class L2PetInstance extends L2Summon
req = "UPDATE pets SET name=?,level=?,curHp=?,curMp=?,exp=?,sp=?,fed=?,ownerId=?,restore=? WHERE item_obj_id = ?";
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(req))
{
statement.setString(1, getName());
@@ -992,7 +992,7 @@ public class L2PetInstance extends L2Summon
// Clear list for overwrite
SummonEffectsTable.getInstance().getPetEffects().getOrDefault(getControlObjectId(), Collections.emptyList()).clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement ps2 = con.prepareStatement(ADD_SKILL_SAVE))
{
@@ -1067,7 +1067,7 @@ public class L2PetInstance extends L2Summon
@Override
public void restoreEffects()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(RESTORE_SKILL_SAVE);
PreparedStatement ps2 = con.prepareStatement(DELETE_SKILL_SAVE))
{
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java
index 320505de11..8cbf9119b6 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java
@@ -288,7 +288,7 @@ public class L2ServitorInstance extends L2Summon implements Runnable
SummonEffectsTable.getInstance().getServitorEffects(getOwner()).getOrDefault(getReferenceSkill(), Collections.emptyList()).clear();
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_SKILL_SAVE))
{
// Delete all current stored effects for summon to avoid dupe
@@ -389,7 +389,7 @@ public class L2ServitorInstance extends L2Summon implements Runnable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (!SummonEffectsTable.getInstance().getServitorEffectsOwner().containsKey(getOwner().getObjectId()) || !SummonEffectsTable.getInstance().getServitorEffectsOwner().get(getOwner().getObjectId()).containsKey(getOwner().getClassIndex()) || !SummonEffectsTable.getInstance().getServitorEffects(getOwner()).containsKey(getReferenceSkill()))
{
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/announce/Announcement.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/announce/Announcement.java
index 4e5aa84b0f..a7117539ad 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/announce/Announcement.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/announce/Announcement.java
@@ -108,7 +108,7 @@ public class Announcement implements IAnnouncement
@Override
public boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
{
ps.setInt(1, _type.ordinal());
@@ -134,7 +134,7 @@ public class Announcement implements IAnnouncement
@Override
public boolean updateMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_QUERY))
{
ps.setInt(1, _type.ordinal());
@@ -154,7 +154,7 @@ public class Announcement implements IAnnouncement
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_QUERY))
{
ps.setInt(1, _id);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java
index 1adc7b039f..21eb44294e 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java
@@ -94,7 +94,7 @@ public final class AutoAnnouncement extends Announcement implements Runnable
@Override
public boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
{
st.setInt(1, getType().ordinal());
@@ -123,7 +123,7 @@ public final class AutoAnnouncement extends Announcement implements Runnable
@Override
public boolean updateMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(UPDATE_QUERY))
{
st.setInt(1, getType().ordinal());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/buylist/Product.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/buylist/Product.java
index 8360f7712c..639a9bfa1a 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/buylist/Product.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/buylist/Product.java
@@ -157,7 +157,7 @@ public final class Product
private void save()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO `buylists`(`buylist_id`, `item_id`, `count`, `next_restock_time`) VALUES(?, ?, ?, ?) ON DUPLICATE KEY UPDATE `count` = ?, `next_restock_time` = ?"))
{
statement.setInt(1, _buyListId);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java
index 757b5512d0..5d970e7abd 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java
@@ -58,7 +58,7 @@ public class ClanHallAuction
private final void loadBidder()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(LOAD_CLANHALL_BIDDERS))
{
ps.setInt(1, _clanHallId);
@@ -102,7 +102,7 @@ public class ClanHallAuction
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_CLANHALL_BIDDER))
{
ps.setInt(1, _clanHallId);
@@ -121,7 +121,7 @@ public class ClanHallAuction
public void removeBid(L2Clan clan)
{
getBids().remove(clan.getId());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_CLANHALL_BIDDER))
{
ps.setInt(1, clan.getId());
@@ -170,7 +170,7 @@ public class ClanHallAuction
clanHall.setOwner(highestBidder.getClan());
getBids().clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_CLANHALL_BIDDERS))
{
ps.setInt(1, _clanHallId);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Castle.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Castle.java
index 2f1da41c76..88d3ad7201 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Castle.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Castle.java
@@ -218,7 +218,7 @@ public final class Castle extends AbstractResidence
public void dbSave()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_functions (castle_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)"))
{
ps.setInt(1, getResidenceId());
@@ -360,7 +360,7 @@ public final class Castle extends AbstractResidence
_treasury += amount;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET treasury = ? WHERE id = ?"))
{
ps.setLong(1, _treasury);
@@ -643,7 +643,7 @@ public final class Castle extends AbstractResidence
@Override
protected void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("SELECT * FROM castle WHERE id = ?");
PreparedStatement ps2 = con.prepareStatement("SELECT clan_id FROM clan_data WHERE hasCastle = ?"))
{
@@ -689,7 +689,7 @@ public final class Castle extends AbstractResidence
/** Load All Functions */
private void loadFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_functions WHERE castle_id = ?"))
{
ps.setInt(1, getResidenceId());
@@ -714,7 +714,7 @@ public final class Castle extends AbstractResidence
public void removeFunction(int functionType)
{
_function.remove(functionType);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_functions WHERE castle_id=? AND type=?"))
{
ps.setInt(1, getResidenceId());
@@ -786,7 +786,7 @@ public final class Castle extends AbstractResidence
// This method loads castle door upgrade data from database
private void loadDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_doorupgrade WHERE castleId=?"))
{
ps.setInt(1, getResidenceId());
@@ -812,7 +812,7 @@ public final class Castle extends AbstractResidence
door.setCurrentHp(door.getCurrentHp());
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_doorupgrade WHERE castleId=?"))
{
ps.setInt(1, getResidenceId());
@@ -837,7 +837,7 @@ public final class Castle extends AbstractResidence
if (save)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_doorupgrade (doorId, ratio, castleId) values (?,?,?)"))
{
ps.setInt(1, doorId);
@@ -864,7 +864,7 @@ public final class Castle extends AbstractResidence
CastleManorManager.getInstance().resetManorData(getResidenceId());
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Need to remove has castle flag from clan_data, should be checked from castle table.
try (PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET hasCastle = 0 WHERE hasCastle = ?"))
@@ -1032,7 +1032,7 @@ public final class Castle extends AbstractResidence
public void updateShowNpcCrest()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET showNpcCrest = ? WHERE id = ?"))
{
ps.setString(1, String.valueOf(_showNpcCrest));
@@ -1076,7 +1076,7 @@ public final class Castle extends AbstractResidence
{
_ticketBuyCount = count;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET ticketBuyCount = ? WHERE id = ?"))
{
ps.setInt(1, _ticketBuyCount);
@@ -1099,7 +1099,7 @@ public final class Castle extends AbstractResidence
{
if (save)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_trapupgrade (castleId, towerIndex, level) values (?,?,?)"))
{
ps.setInt(1, getResidenceId());
@@ -1126,7 +1126,7 @@ public final class Castle extends AbstractResidence
ts.setUpgradeLevel(0);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_trapupgrade WHERE castleId=?"))
{
ps.setInt(1, getResidenceId());
@@ -1209,7 +1209,7 @@ public final class Castle extends AbstractResidence
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET side = ? WHERE id = ?"))
{
ps.setString(1, side.toString());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/ClanHall.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
index 6fc9b45046..79906bc875 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
@@ -100,7 +100,7 @@ public final class ClanHall extends AbstractResidence
@Override
protected void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement loadStatement = con.prepareStatement(LOAD_CLANHALL);
PreparedStatement insertStatement = con.prepareStatement(INSERT_CLANHALL))
{
@@ -133,7 +133,7 @@ public final class ClanHall extends AbstractResidence
public void updateDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CLANHALL))
{
statement.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Couple.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Couple.java
index c40e7d454a..45294842ce 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Couple.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Couple.java
@@ -45,7 +45,7 @@ public class Couple
{
_Id = coupleId;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM mods_wedding WHERE id = ?"))
{
ps.setInt(1, _Id);
@@ -85,7 +85,7 @@ public class Couple
_weddingDate = Calendar.getInstance();
_weddingDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
{
_Id = IdFactory.getInstance().getNextId();
@@ -105,7 +105,7 @@ public class Couple
public void marry()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE mods_wedding set married = ?, weddingDate = ? where id = ?"))
{
ps.setBoolean(1, true);
@@ -123,7 +123,7 @@ public class Couple
public void divorce()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM mods_wedding WHERE id=?"))
{
ps.setInt(1, _Id);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Fort.java
index e6262fdc29..3b29461e3a 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Fort.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Fort.java
@@ -214,7 +214,7 @@ public final class Fort extends AbstractResidence
public void dbSave()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO fort_functions (fort_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)"))
{
ps.setInt(1, getResidenceId());
@@ -487,7 +487,7 @@ public final class Fort extends AbstractResidence
public void saveFortVariables()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET supplyLvL=? WHERE id = ?"))
{
ps.setInt(1, _supplyLvL);
@@ -552,7 +552,7 @@ public final class Fort extends AbstractResidence
@Override
protected void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort WHERE id = ?"))
{
ps.setInt(1, getResidenceId());
@@ -613,7 +613,7 @@ public final class Fort extends AbstractResidence
/** Load All Functions */
private void loadFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_functions WHERE fort_id = ?"))
{
ps.setInt(1, getResidenceId());
@@ -638,7 +638,7 @@ public final class Fort extends AbstractResidence
public void removeFunction(int functionType)
{
_function.remove(functionType);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM fort_functions WHERE fort_id=? AND type=?"))
{
ps.setInt(1, getResidenceId());
@@ -730,7 +730,7 @@ public final class Fort extends AbstractResidence
// This method loads fort door upgrade data from database
private void loadDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_doorupgrade WHERE fortId = ?"))
{
ps.setInt(1, getResidenceId());
@@ -750,7 +750,7 @@ public final class Fort extends AbstractResidence
private void removeDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM fort_doorupgrade WHERE fortId = ?"))
{
ps.setInt(1, getResidenceId());
@@ -764,7 +764,7 @@ public final class Fort extends AbstractResidence
private void saveDoorUpgrade(int doorId, int hp, int pDef, int mDef)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO fort_doorupgrade (doorId, hp, pDef, mDef) VALUES (?,?,?,?)"))
{
ps.setInt(1, doorId);
@@ -793,7 +793,7 @@ public final class Fort extends AbstractResidence
_lastOwnedTime.setTimeInMillis(0);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET owner=?,lastOwnedTime=?,state=?,castleId=? WHERE id = ?"))
{
ps.setInt(1, clanId);
@@ -998,7 +998,7 @@ public final class Fort extends AbstractResidence
{
_state = state;
_castleId = castleId;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET state=?,castleId=? WHERE id = ?"))
{
ps.setInt(1, _state);
@@ -1130,7 +1130,7 @@ public final class Fort extends AbstractResidence
private void initNpcs()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_spawnlist WHERE fortId = ? AND spawnType = ?"))
{
ps.setInt(1, getResidenceId());
@@ -1159,7 +1159,7 @@ public final class Fort extends AbstractResidence
private void initSiegeNpcs()
{
_siegeNpcs.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, npcId, x, y, z, heading FROM fort_spawnlist WHERE fortId = ? AND spawnType = ? ORDER BY id"))
{
ps.setInt(1, getResidenceId());
@@ -1186,7 +1186,7 @@ public final class Fort extends AbstractResidence
private void initNpcCommanders()
{
_npcCommanders.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, npcId, x, y, z, heading FROM fort_spawnlist WHERE fortId = ? AND spawnType = ? ORDER BY id"))
{
ps.setInt(1, getResidenceId());
@@ -1216,7 +1216,7 @@ public final class Fort extends AbstractResidence
_specialEnvoys.clear();
_envoyCastles.clear();
_availableCastles.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, npcId, x, y, z, heading, castleId FROM fort_spawnlist WHERE fortId = ? AND spawnType = ? ORDER BY id"))
{
ps.setInt(1, getResidenceId());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/FortSiege.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/FortSiege.java
index ffba04e6c3..d558045fab 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/FortSiege.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/FortSiege.java
@@ -501,7 +501,7 @@ public class FortSiege implements Siegable
/** Clear all registered siege clans from database for fort */
public void clearSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM fortsiege_clans WHERE fort_id=?"))
{
ps.setInt(1, _fort.getResidenceId());
@@ -785,7 +785,7 @@ public class FortSiege implements Siegable
private void removeSiegeClan(int clanId)
{
final String query = (clanId != 0) ? DELETE_FORT_SIEGECLANS_BY_CLAN_ID : DELETE_FORT_SIEGECLANS;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(query))
{
statement.setInt(1, _fort.getResidenceId());
@@ -999,7 +999,7 @@ public class FortSiege implements Siegable
private void loadSiegeClan()
{
_attackerClans.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clan_id FROM fortsiege_clans WHERE fort_id=?"))
{
ps.setInt(1, _fort.getResidenceId());
@@ -1057,7 +1057,7 @@ public class FortSiege implements Siegable
/** Save siege date to database. */
private void saveSiegeDate()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET siegeDate = ? WHERE id = ?"))
{
ps.setLong(1, _fort.getSiegeDate().getTimeInMillis());
@@ -1081,7 +1081,7 @@ public class FortSiege implements Siegable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO fortsiege_clans (clan_id,fort_id) values (?,?)"))
{
statement.setInt(1, clan.getId());
@@ -1146,7 +1146,7 @@ public class FortSiege implements Siegable
public void loadSiegeGuard()
{
_siegeGuards.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT npcId, x, y, z, heading, respawnDelay FROM fort_siege_guards WHERE fortId = ?"))
{
final int fortId = _fort.getResidenceId();
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Hero.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Hero.java
index 924ecead2f..27be59aa41 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Hero.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Hero.java
@@ -114,7 +114,7 @@ public class Hero
_herodiary.clear();
_heroMessage.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s1 = con.createStatement();
ResultSet rset = s1.executeQuery(GET_HEROES);
PreparedStatement ps = con.prepareStatement(GET_CLAN_ALLY);
@@ -211,7 +211,7 @@ public class Hero
*/
public void loadMessage(int charId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT message FROM heroes WHERE charId=?"))
{
statement.setInt(1, charId);
@@ -233,7 +233,7 @@ public class Hero
{
final List _diary = new CopyOnWriteArrayList<>();
int diaryentries = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM heroes_diary WHERE charId=? ORDER BY time ASC"))
{
statement.setInt(1, charId);
@@ -300,7 +300,7 @@ public class Hero
int _losses = 0;
int _draws = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM olympiad_fights WHERE (charOneId=? OR charTwoId=?) AND start ORDER BY start ASC"))
{
statement.setInt(1, charId);
@@ -699,7 +699,7 @@ public class Hero
public void updateHeroes(boolean setDefault)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (setDefault)
{
@@ -841,7 +841,7 @@ public class Hero
public void setDiaryData(int charId, int action, int param)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO heroes_diary (charId, time, action, param) values(?,?,?,?)"))
{
statement.setInt(1, charId);
@@ -877,7 +877,7 @@ public class Hero
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE heroes SET message=? WHERE charId=?;"))
{
statement.setString(1, _heroMessage.get(charId));
@@ -892,7 +892,7 @@ public class Hero
private void deleteItemsInDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_ITEMS))
{
statement.execute();
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Siege.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Siege.java
index d4cb96aabf..f20c39da7f 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Siege.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/entity/Siege.java
@@ -760,7 +760,7 @@ public class Siege implements Siegable
/** Clear all registered siege clans from database for castle */
public void clearSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=?"))
{
statement.setInt(1, _castle.getResidenceId());
@@ -788,7 +788,7 @@ public class Siege implements Siegable
/** Clear all siege clans waiting for approval from database for castle */
public void clearSiegeWaitingClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=? and type = 2"))
{
statement.setInt(1, _castle.getResidenceId());
@@ -972,7 +972,7 @@ public class Siege implements Siegable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=? and clan_id=?"))
{
statement.setInt(1, _castle.getResidenceId());
@@ -1238,7 +1238,7 @@ public class Siege implements Siegable
private void loadSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT clan_id,type FROM siege_clans where castle_id=?"))
{
getAttackerClans().clear();
@@ -1349,7 +1349,7 @@ public class Siege implements Siegable
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castle), 1000);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE castle SET siegeDate = ?, regTimeEnd = ?, regTimeOver = ? WHERE id = ?"))
{
statement.setLong(1, _castle.getSiegeDate().getTimeInMillis());
@@ -1378,7 +1378,7 @@ public class Siege implements Siegable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if ((typeId == DEFENDER) || (typeId == DEFENDER_NOT_APPROVED) || (typeId == OWNER))
{
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java
index ac490ba86d..f23e511ede 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java
@@ -138,7 +138,7 @@ public class EventScheduler
public boolean updateLastRun()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO event_schedulers (eventName, schedulerName, lastRun) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE eventName = ?, schedulerName = ?, lastRun = ?"))
{
ps.setString(1, _eventManager.getName());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java
index 3185dae127..fc59ec7842 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java
@@ -52,7 +52,7 @@ public class HaventRunConditionalScheduler implements IConditionalEventScheduler
throw new NullPointerException("Scheduler not found: " + _name);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT lastRun FROM event_schedulers WHERE eventName = ? AND schedulerName = ?"))
{
ps.setString(1, _eventManager.getName());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/instancezone/Instance.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/instancezone/Instance.java
index 053ffa54cf..ccef54aad0 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/instancezone/Instance.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/instancezone/Instance.java
@@ -815,7 +815,7 @@ public final class Instance implements IIdentifiable, INamable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT IGNORE INTO character_instance_time (charId,instanceId,time) VALUES (?,?,?)"))
{
// Save to database
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java
index 8a3ac20ed4..4865f4c0b2 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java
@@ -191,7 +191,7 @@ public final class ItemAuction
public final void storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO item_auction (auctionId,instanceId,auctionItemId,startingTime,endingTime,auctionStateId) VALUES (?,?,?,?,?,?) ON DUPLICATE KEY UPDATE auctionStateId=?"))
{
statement.setInt(1, _auctionId);
@@ -225,7 +225,7 @@ public final class ItemAuction
final void updatePlayerBidInternal(ItemAuctionBid bid, boolean delete)
{
final String query = delete ? DELETE_ITEM_AUCTION_BID : INSERT_ITEM_AUCTION_BID;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(query))
{
ps.setInt(1, _auctionId);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java
index ec5eb4074e..d388e90796 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java
@@ -161,7 +161,7 @@ public final class ItemAuctionInstance
throw new IllegalArgumentException("No items defined");
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_AUCTION_ID_BY_INSTANCE_ID))
{
ps.setInt(1, _instanceId);
@@ -533,7 +533,7 @@ public final class ItemAuctionInstance
private ItemAuction loadAuction(int auctionId) throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
int auctionItemId = 0;
long startingTime = 0;
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java
index 6d4f0037f6..349a8c84ae 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java
@@ -1813,7 +1813,7 @@ public abstract class Inventory extends ItemContainer
@Override
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM items WHERE owner_id=? AND (loc=? OR loc=?) ORDER BY loc_data"))
{
ps.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java
index 1501c166e8..9a71ec3c76 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java
@@ -673,7 +673,7 @@ public abstract class ItemContainer
*/
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM items WHERE owner_id=? AND (loc=?)"))
{
ps.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java
index 9e94b591e8..09cbc47e3b 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java
@@ -112,7 +112,7 @@ public class Mail extends ItemContainer
@Override
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM items WHERE owner_id=? AND loc=? AND loc_data=?"))
{
statement.setInt(1, _ownerId);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java
index 9228d151c2..a3a85dfeba 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java
@@ -738,7 +738,7 @@ public class PcInventory extends Inventory
public static int[][] restoreVisibleInventory(int objectId)
{
final int[][] paperdoll = new int[33][4];
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement2 = con.prepareStatement("SELECT object_id,item_id,loc_data,enchant_level FROM items WHERE owner_id=? AND loc='PAPERDOLL'"))
{
statement2.setInt(1, objectId);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java
index 4b3cd1f785..37575f09ea 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java
@@ -983,7 +983,7 @@ public final class L2ItemInstance extends L2Object
final VariationInstance augment = _augmentation;
_augmentation = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_variations WHERE itemId = ?"))
{
ps.setInt(1, getObjectId());
@@ -1000,7 +1000,7 @@ public final class L2ItemInstance extends L2Object
public void restoreAttributes()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("SELECT mineralId,option1,option2 FROM item_variations WHERE itemId=?");
PreparedStatement ps2 = con.prepareStatement("SELECT elemType,elemValue FROM item_elementals WHERE itemId=?"))
{
@@ -1041,7 +1041,7 @@ public final class L2ItemInstance extends L2Object
public void updateItemOptions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
updateItemOptions(con);
}
@@ -1069,7 +1069,7 @@ public final class L2ItemInstance extends L2Object
public void updateItemElementals()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
updateItemElements(con);
}
@@ -1231,7 +1231,7 @@ public final class L2ItemInstance extends L2Object
_elementals.remove(type);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_elementals WHERE itemId = ? AND elemType = ?"))
{
ps.setInt(1, getObjectId());
@@ -1256,7 +1256,7 @@ public final class L2ItemInstance extends L2Object
_elementals.clear();
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_elementals WHERE itemId = ?"))
{
ps.setInt(1, getObjectId());
@@ -1588,7 +1588,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE items SET owner_id=?,count=?,loc=?,loc_data=?,enchant_level=?,custom_type1=?,custom_type2=?,mana_left=?,time=? WHERE object_id = ?"))
{
ps.setInt(1, _ownerId);
@@ -1621,7 +1621,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO items (owner_id,item_id,count,loc,loc_data,enchant_level,object_id,custom_type1,custom_type2,mana_left,time) VALUES (?,?,?,?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, _ownerId);
@@ -1669,7 +1669,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM items WHERE object_id = ?"))
{
@@ -2161,7 +2161,7 @@ public final class L2ItemInstance extends L2Object
private void removeSpecialAbility(EnsoulOption option)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_special_abilities WHERE objectId = ? AND optionId = ?"))
{
ps.setInt(1, getObjectId());
@@ -2215,7 +2215,7 @@ public final class L2ItemInstance extends L2Object
private void restoreSpecialAbilities()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM item_special_abilities WHERE objectId = ? ORDER BY position"))
{
ps.setInt(1, getObjectId());
@@ -2242,7 +2242,7 @@ public final class L2ItemInstance extends L2Object
public void updateSpecialAbilities()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
updateSpecialAbilities(con);
}
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java
index 44b0ac9c43..1ad8f4c201 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java
@@ -142,7 +142,7 @@ public class Olympiad extends ListenersContainer
{
_nobles.clear();
boolean loaded = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_LOAD_DATA);
ResultSet rset = statement.executeQuery())
{
@@ -221,7 +221,7 @@ public class Olympiad extends ListenersContainer
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_LOAD_NOBLES);
ResultSet rset = statement.executeQuery())
{
@@ -295,7 +295,7 @@ public class Olympiad extends ListenersContainer
{
_noblesRank.clear();
final Map tmpPlace = new HashMap<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(GET_ALL_CLASSIFIED_NOBLESS);
ResultSet rset = statement.executeQuery())
{
@@ -806,7 +806,7 @@ public class Olympiad extends ListenersContainer
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
for (Entry entry : _nobles.entrySet())
{
@@ -878,7 +878,7 @@ public class Olympiad extends ListenersContainer
{
saveNobleData();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_SAVE_DATA))
{
statement.setInt(1, _currentCycle);
@@ -919,7 +919,7 @@ public class Olympiad extends ListenersContainer
protected void updateMonthlyData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(OLYMPIAD_MONTH_CLEAR);
PreparedStatement ps2 = con.prepareStatement(OLYMPIAD_MONTH_CREATE))
{
@@ -963,7 +963,7 @@ public class Olympiad extends ListenersContainer
final List heroesToBe = new LinkedList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_GET_HEROS))
{
StatsSet hero;
@@ -998,7 +998,7 @@ public class Olympiad extends ListenersContainer
{
final List names = new ArrayList<>();
final String query = Config.ALT_OLY_SHOW_MONTHLY_WINNERS ? ((classId == 132) ? GET_EACH_CLASS_LEADER_SOULHOUND : GET_EACH_CLASS_LEADER) : ((classId == 132) ? GET_EACH_CLASS_LEADER_CURRENT_SOULHOUND : GET_EACH_CLASS_LEADER_CURRENT);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(query))
{
ps.setInt(1, classId);
@@ -1108,7 +1108,7 @@ public class Olympiad extends ListenersContainer
public int getLastNobleOlympiadPoints(int objId)
{
int result = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT olympiad_points FROM olympiad_nobles_eom WHERE charId = ?"))
{
ps.setInt(1, objId);
@@ -1252,7 +1252,7 @@ public class Olympiad extends ListenersContainer
protected void deleteNobles()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_DELETE_ALL))
{
statement.execute();
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java
index 9249ca2223..2824298209 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java
@@ -743,7 +743,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
protected static void saveResults(Participant one, Participant two, int winner, long startTime, long fightTime, CompetitionType type)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO olympiad_fights (charOneId, charTwoId, charOneClass, charTwoClass, winner, start, time, classed) values(?,?,?,?,?,?,?,?)"))
{
statement.setInt(1, one.getObjectId());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java
index d73e56cbe8..c805ee421d 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java
@@ -185,7 +185,7 @@ public class PunishmentTask implements Runnable
{
if (!_isStored)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
{
st.setString(1, _key);
@@ -224,7 +224,7 @@ public class PunishmentTask implements Runnable
{
if (_isStored)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(UPDATE_QUERY))
{
st.setLong(1, System.currentTimeMillis());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java
index 248d5997e4..0dea776f93 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java
@@ -409,7 +409,7 @@ public class LongTimeEvent extends Quest
}
}
// Update database
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM items WHERE item_id=?"))
{
statement.setInt(1, itemId);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/quest/Quest.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/quest/Quest.java
index 6e59c7d3d7..dc92061a99 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/quest/Quest.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/quest/Quest.java
@@ -1592,7 +1592,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void playerEnter(L2PcInstance player)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement invalidQuestData = con.prepareStatement("DELETE FROM character_quests WHERE charId = ? AND name = ?");
PreparedStatement invalidQuestDataVar = con.prepareStatement("DELETE FROM character_quests WHERE charId = ? AND name = ? AND var = ?");
PreparedStatement ps1 = con.prepareStatement("SELECT name, value FROM character_quests WHERE charId = ? AND var = ?"))
@@ -1674,7 +1674,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void createQuestVarInDb(QuestState qs, String var, String value)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_quests (charId,name,var,value) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE value=?"))
{
statement.setInt(1, qs.getPlayer().getObjectId());
@@ -1698,7 +1698,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void updateQuestVarInDb(QuestState qs, String var, String value)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE character_quests SET value=? WHERE charId=? AND name=? AND var = ?"))
{
statement.setString(1, value);
@@ -1720,7 +1720,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void deleteQuestVarInDb(QuestState qs, String var)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_quests WHERE charId=? AND name=? AND var=?"))
{
statement.setInt(1, qs.getPlayer().getObjectId());
@@ -1741,7 +1741,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void deleteQuestInDb(QuestState qs, boolean repeatable)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(repeatable ? QUEST_DELETE_FROM_CHAR_QUERY : QUEST_DELETE_FROM_CHAR_QUERY_NON_REPEATABLE_QUERY))
{
ps.setInt(1, qs.getPlayer().getObjectId());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java
index 11c78a1a47..9af2be9039 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java
@@ -126,7 +126,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
protected void initFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM residence_functions WHERE residenceId = ?"))
{
ps.setInt(1, _residenceId);
@@ -164,7 +164,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
public void addFunction(ResidenceFunction func)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO residence_functions (id, level, expiration, residenceId) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE level = ?, expiration = ?"))
{
ps.setInt(1, func.getId());
@@ -196,7 +196,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
public void removeFunction(ResidenceFunction func)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM residence_functions WHERE residenceId = ? and id = ?"))
{
ps.setInt(1, _residenceId);
@@ -219,7 +219,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
public void removeFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM residence_functions WHERE residenceId = ?"))
{
ps.setInt(1, _residenceId);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
index 8b91fc77d2..53958bcf5c 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
@@ -50,7 +50,7 @@ public class AccountVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setString(1, _accountName);
@@ -83,7 +83,7 @@ public class AccountVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -120,7 +120,7 @@ public class AccountVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java
index 50fcf2ab6f..5af41a23af 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java
@@ -50,7 +50,7 @@ public class ClanVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setInt(1, _objectId);
@@ -83,7 +83,7 @@ public class ClanVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -120,7 +120,7 @@ public class ClanVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java
index c7ba2ff071..048b15a86e 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java
@@ -55,7 +55,7 @@ public class ItemVariables extends AbstractVariables
public static boolean hasVariables(int objectId)
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_COUNT))
{
st.setInt(1, objectId);
@@ -79,7 +79,7 @@ public class ItemVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setInt(1, _objectId);
@@ -112,7 +112,7 @@ public class ItemVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -149,7 +149,7 @@ public class ItemVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
index 85508e687b..c677c68971 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
@@ -76,7 +76,7 @@ public class PlayerVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setInt(1, _objectId);
@@ -109,7 +109,7 @@ public class PlayerVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -146,7 +146,7 @@ public class PlayerVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/L2GameClient.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/L2GameClient.java
index f1e975876e..fd5baeb233 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/L2GameClient.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/L2GameClient.java
@@ -329,7 +329,7 @@ public final class L2GameClient extends ChannelInboundHandler
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps2 = con.prepareStatement("UPDATE characters SET deletetime=? WHERE charId=?"))
{
ps2.setLong(1, System.currentTimeMillis() + (Config.DELETE_DAYS * 86400000)); // 24*60*60*1000 = 86400000
@@ -354,7 +354,7 @@ public final class L2GameClient extends ChannelInboundHandler
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE characters SET deletetime=0 WHERE charId=?"))
{
statement.setInt(1, objectId);
@@ -377,7 +377,7 @@ public final class L2GameClient extends ChannelInboundHandler
CharNameTable.getInstance().removeName(objid);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM character_contacts WHERE charId=? OR contactId=?"))
{
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
index 297edda360..afcc3fcbb0 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
@@ -164,7 +164,7 @@ public final class RequestDestroyItem implements IClientIncomingPacket
pet.unSummon(activeChar);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
{
statement.setInt(1, _objectId);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java
index 29ab10a108..a9c8dadb8a 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java
@@ -62,7 +62,7 @@ public class RequestPetitionFeedback implements IClientIncomingPacket
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_FEEDBACK))
{
statement.setString(1, player.getName());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java
index a2d7c3bba4..537d7f2618 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java
@@ -73,7 +73,7 @@ public final class RequestAnswerFriendInvite implements IClientIncomingPacket
if (_response == 1)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_friends (charId, friendId) VALUES (?, ?), (?, ?)"))
{
statement.setInt(1, requestor.getObjectId());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java
index 03435f7f4d..bfe07c3aed 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java
@@ -75,7 +75,7 @@ public final class RequestFriendDel implements IClientIncomingPacket
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_friends WHERE (charId=? AND friendId=?) OR (charId=? AND friendId=?)"))
{
statement.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java
index 94715a15c1..27668b0d62 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java
@@ -74,7 +74,7 @@ public class ConfirmMenteeAdd implements IClientIncomingPacket
}
else if (validate(mentor, mentee))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_mentees (charId, mentorId) VALUES (?, ?)"))
{
statement.setInt(1, mentee.getObjectId());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java
index 91ada4fbba..002abfa04d 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java
@@ -226,7 +226,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
CharSelectInfoPackage charInfopackage;
final List characterList = new LinkedList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM characters WHERE account_name=? ORDER BY createDate"))
{
statement.setString(1, loginName);
@@ -259,7 +259,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
private static void loadCharacterSubclassInfo(CharSelectInfoPackage charInfopackage, int ObjectId, int activeClassId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT exp, sp, level, vitality_points FROM character_subclasses WHERE charId=? AND class_id=? ORDER BY charId"))
{
statement.setInt(1, ObjectId);
@@ -369,7 +369,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
if (weaponObjId > 0)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT mineralId,option1,option2 FROM item_variations WHERE itemId=?"))
{
statement.setInt(1, weaponObjId);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java
index 14cd41a31e..ebb3f90088 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java
@@ -70,7 +70,7 @@ public class FriendList implements IClientOutgoingPacket
if (player1 == null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT char_name, online, classid, level FROM characters WHERE charId = ?"))
{
statement.setInt(1, objId);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java
index 8344576a3e..8876431ff9 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java
@@ -72,7 +72,7 @@ public class SecondaryPasswordAuth
private void loadPassword()
{
String var, value = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SELECT_PASSWORD))
{
statement.setString(1, _activeClient.getAccountName());
@@ -117,7 +117,7 @@ public class SecondaryPasswordAuth
password = cryptPassword(password);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_PASSWORD))
{
statement.setString(1, _activeClient.getAccountName());
@@ -136,7 +136,7 @@ public class SecondaryPasswordAuth
public boolean insertWrongAttempt(int attempts)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_ATTEMPT))
{
statement.setString(1, _activeClient.getAccountName());
@@ -175,7 +175,7 @@ public class SecondaryPasswordAuth
newPassword = cryptPassword(newPassword);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_PASSWORD))
{
statement.setString(1, newPassword);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
index ca0cef4b3b..a78d28bdc9 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
@@ -95,7 +95,7 @@ public final class TaskManager
{
task.onTimeElapsed(this);
lastActivation = System.currentTimeMillis();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[1]))
{
statement.setLong(1, lastActivation);
@@ -182,7 +182,7 @@ public final class TaskManager
private void startAllTasks()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[0]);
ResultSet rset = statement.executeQuery())
{
@@ -314,7 +314,7 @@ public final class TaskManager
private static boolean addUniqueTask(String task, TaskTypes type, String param1, String param2, String param3, long lastActivation)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(SQL_STATEMENTS[2]))
{
ps1.setString(1, task);
@@ -350,7 +350,7 @@ public final class TaskManager
private static boolean addTask(String task, TaskTypes type, String param1, String param2, String param3, long lastActivation)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[3]))
{
statement.setString(1, task);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java
index 5e3e35c6a9..e81b95cba3 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java
@@ -76,7 +76,7 @@ public class TaskBirthday extends Task
private void checkBirthday(int year, int month, int day)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY))
{
statement.setString(1, "%-" + getNum(month + 1) + "-" + getNum(day));
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/Evolve.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/Evolve.java
index 66a22f62fd..f87e33ed8d 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/Evolve.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/gameserver/util/Evolve.java
@@ -248,7 +248,7 @@ public final class Evolve
}
// pet control item no longer exists, delete the pet from the db
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
{
ps.setInt(1, removedItem.getObjectId());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/loginserver/GameServerTable.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/loginserver/GameServerTable.java
index 1a0713b155..2410f6ede8 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/loginserver/GameServerTable.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/loginserver/GameServerTable.java
@@ -115,7 +115,7 @@ public final class GameServerTable implements IGameXmlReader
*/
private void loadRegisteredGameServers()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT * FROM gameservers"))
{
@@ -222,7 +222,7 @@ public final class GameServerTable implements IGameXmlReader
public void registerServerOnDB(byte[] hexId, int id, String externalHost)
{
register(id, new GameServerInfo(id, hexId));
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO gameservers (hexid,server_id,host) values (?,?,?)"))
{
ps.setString(1, hexToString(hexId));
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/loginserver/LoginController.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/loginserver/LoginController.java
index a896c7fd7a..fbee48fc33 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/loginserver/LoginController.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/loginserver/LoginController.java
@@ -176,7 +176,7 @@ public class LoginController
final byte[] raw = password.getBytes(StandardCharsets.UTF_8);
final String hashBase64 = Base64.getEncoder().encodeToString(md.digest(raw));
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(USER_INFO_SELECT))
{
ps.setString(1, Long.toString(System.currentTimeMillis()));
@@ -206,7 +206,7 @@ public class LoginController
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(AUTOCREATE_ACCOUNTS_INSERT))
{
ps.setString(1, login);
@@ -405,7 +405,7 @@ public class LoginController
if (loginOk && (client.getLastServer() != serverId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_LAST_SERVER_UPDATE))
{
ps.setInt(1, serverId);
@@ -424,7 +424,7 @@ public class LoginController
public void setAccountAccessLevel(String account, int banLevel)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_ACCESS_LEVEL_UPDATE))
{
ps.setInt(1, banLevel);
@@ -439,7 +439,7 @@ public class LoginController
public void setAccountLastTracert(String account, String pcIp, String hop1, String hop2, String hop3, String hop4)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_IPS_UPDATE))
{
ps.setString(1, pcIp);
@@ -499,7 +499,7 @@ public class LoginController
{
final List ipWhiteList = new ArrayList<>();
final List ipBlackList = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_IPAUTH_SELECT))
{
ps.setString(1, info.getLogin());
@@ -545,7 +545,7 @@ public class LoginController
client.setAccessLevel(info.getAccessLevel());
client.setLastServer(info.getLastServer());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_INFO_UPDATE))
{
ps.setLong(1, System.currentTimeMillis());
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/loginserver/LoginServer.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/loginserver/LoginServer.java
index 39377afee3..d598992bdf 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/loginserver/LoginServer.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/loginserver/LoginServer.java
@@ -89,7 +89,7 @@ public final class LoginServer
Config.load();
// Prepare Database
- DatabaseFactory.getInstance();
+ DatabaseFactory.init();
try
{
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java
index 69ba99271d..6c73dea27a 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java
@@ -78,7 +78,7 @@ public class ChangePassword extends BaseRecievePacket
int passUpdated = 0;
// SQL connection
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT password FROM accounts WHERE login=?"))
{
ps.setString(1, accountName);
@@ -95,7 +95,7 @@ public class ChangePassword extends BaseRecievePacket
{
final byte[] password = md.digest(newpass.getBytes("UTF-8"));
// SQL connection
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE accounts SET password=? WHERE login=?"))
{
ps.setString(1, Base64.getEncoder().encodeToString(password));
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java
index f9a24a80d8..785946a687 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java
@@ -58,7 +58,7 @@ public class RequestTempBan extends BaseRecievePacket
private void banUser()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO account_data VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE value=?"))
{
ps.setString(1, _accountName);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
index 59b0e01835..4fb705c8b1 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
@@ -43,6 +43,7 @@ public class SQLAccountManager
{
Server.serverMode = Server.MODE_LOGINSERVER;
Config.load();
+ DatabaseFactory.init();
try (Scanner _scn = new Scanner(System.in))
{
@@ -166,7 +167,7 @@ public class SQLAccountManager
}
q = q.concat(" ORDER BY login ASC");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(q);
ResultSet rset = ps.executeQuery())
{
@@ -187,7 +188,7 @@ public class SQLAccountManager
private static void addOrUpdateAccount(String account, String password, String level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE accounts(login, password, accessLevel) VALUES (?, ?, ?)"))
{
final MessageDigest md = MessageDigest.getInstance("SHA");
@@ -213,7 +214,7 @@ public class SQLAccountManager
private static void changeAccountLevel(String account, String level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE accounts SET accessLevel = ? WHERE login = ?"))
{
ps.setString(1, level);
@@ -236,7 +237,7 @@ public class SQLAccountManager
private static void deleteAccount(String account)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM accounts WHERE login = ?"))
{
ps.setString(1, account);
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java
index 4ac531c664..fd25fddae4 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java
@@ -34,7 +34,7 @@ public class DBInstallerConsole implements DBOutputInterface
public DBInstallerConsole(String db, String dir) throws Exception
{
- System.out.println("Welcome to L2J DataBase installer");
+ System.out.println("Welcome to DataBase installer");
final Preferences prop = Preferences.userRoot();
RunTasks rt = null;
try (Scanner scn = new Scanner(new CloseShieldedInputStream(System.in)))
diff --git a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
index c90c8127a6..8e5a6bde49 100644
--- a/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
+++ b/L2J_Mobius_4.0_GrandCrusade/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
@@ -187,6 +187,7 @@ public abstract class BaseGameServerRegister
Server.serverMode = Server.MODE_LOGINSERVER;
Config.load();
+ DatabaseFactory.init();
GameServerTable.getInstance();
_loaded = true;
@@ -215,7 +216,7 @@ public abstract class BaseGameServerRegister
*/
public static void unregisterGameServer(int id) throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM gameservers WHERE server_id = ?"))
{
@@ -231,7 +232,7 @@ public abstract class BaseGameServerRegister
*/
public static void unregisterAllGameServers() throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("DELETE FROM gameservers");
diff --git a/L2J_Mobius_4.0_GrandCrusade/launcher/Gameserver.launch b/L2J_Mobius_4.0_GrandCrusade/launcher/Gameserver.launch
index 8ec610d394..4bfb363aa9 100644
--- a/L2J_Mobius_4.0_GrandCrusade/launcher/Gameserver.launch
+++ b/L2J_Mobius_4.0_GrandCrusade/launcher/Gameserver.launch
@@ -7,12 +7,13 @@
-
+
+
diff --git a/L2J_Mobius_4.0_GrandCrusade/launcher/Loginserver.launch b/L2J_Mobius_4.0_GrandCrusade/launcher/Loginserver.launch
index 61db7f13be..dbb98f4b85 100644
--- a/L2J_Mobius_4.0_GrandCrusade/launcher/Loginserver.launch
+++ b/L2J_Mobius_4.0_GrandCrusade/launcher/Loginserver.launch
@@ -7,7 +7,7 @@
-
+
@@ -15,5 +15,6 @@
+
diff --git a/L2J_Mobius_C6_Interlude/.classpath b/L2J_Mobius_C6_Interlude/.classpath
index c918b0691a..c6a865e410 100644
--- a/L2J_Mobius_C6_Interlude/.classpath
+++ b/L2J_Mobius_C6_Interlude/.classpath
@@ -1,13 +1,14 @@
-
+
-
+
+
diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/ai/bosses/VanHalter.java b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/ai/bosses/VanHalter.java
index 326992257c..070dbfdf73 100644
--- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/ai/bosses/VanHalter.java
+++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/ai/bosses/VanHalter.java
@@ -297,7 +297,7 @@ public class VanHalter extends Quest
{
_royalGuardSpawn.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay FROM vanhalter_spawnlist Where npc_templateid between ? and ? ORDER BY id");
statement.setInt(1, 22175);
@@ -372,7 +372,7 @@ public class VanHalter extends Quest
{
_triolRevelationSpawn.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay FROM vanhalter_spawnlist Where npc_templateid between ? and ? ORDER BY id");
statement.setInt(1, 32058);
@@ -451,7 +451,7 @@ public class VanHalter extends Quest
{
_royalGuardCaptainSpawn.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay FROM vanhalter_spawnlist Where npc_templateid = ? ORDER BY id");
statement.setInt(1, 22188);
@@ -526,7 +526,7 @@ public class VanHalter extends Quest
{
_royalGuardHelperSpawn.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay FROM vanhalter_spawnlist Where npc_templateid = ? ORDER BY id");
statement.setInt(1, 22191);
@@ -594,7 +594,7 @@ public class VanHalter extends Quest
{
_guardOfAltarSpawn.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay FROM vanhalter_spawnlist Where npc_templateid = ? ORDER BY id");
statement.setInt(1, 32051);
@@ -668,7 +668,7 @@ public class VanHalter extends Quest
{
_vanHalterSpawn = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay FROM vanhalter_spawnlist Where npc_templateid = ? ORDER BY id");
statement.setInt(1, 29062);
@@ -733,7 +733,7 @@ public class VanHalter extends Quest
{
_ritualOfferingSpawn = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay FROM vanhalter_spawnlist Where npc_templateid = ? ORDER BY id");
statement.setInt(1, 32038);
@@ -799,7 +799,7 @@ public class VanHalter extends Quest
{
_ritualSacrificeSpawn = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay FROM vanhalter_spawnlist Where npc_templateid = ? ORDER BY id");
statement.setInt(1, 22195);
diff --git a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/503_PursuitClanAmbition/__init__.py b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/503_PursuitClanAmbition/__init__.py
index 64cf8766f6..9daf3c318f 100644
--- a/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/503_PursuitClanAmbition/__init__.py
+++ b/L2J_Mobius_C6_Interlude/dist/game/data/scripts/quests/503_PursuitClanAmbition/__init__.py
@@ -62,7 +62,7 @@ DROPLIST = {
def suscribe_members(st) :
clan=st.getPlayer().getClan().getClanId()
- con=DatabaseFactory.getInstance().getConnection()
+ con=DatabaseFactory.getConnection()
offline=con.prepareStatement("SELECT obj_Id FROM characters WHERE clanid=? AND online=0")
offline.setInt(1, clan)
rs=offline.executeQuery()
@@ -86,7 +86,7 @@ def suscribe_members(st) :
def offlineMemberExit(st) :
clan=st.getPlayer().getClan().getClanId()
- con=DatabaseFactory.getInstance().getConnection()
+ con=DatabaseFactory.getConnection()
offline=con.prepareStatement("DELETE FROM character_quests WHERE name = ? and char_id IN (SELECT obj_id FROM characters WHERE clanId =? AND online=0")
offline.setString(1, qn)
offline.setInt(2, clan)
@@ -110,7 +110,7 @@ def getLeaderVar(st, var) :
except :
pass
leaderId=st.getPlayer().getClan().getLeaderId()
- con=DatabaseFactory.getInstance().getConnection()
+ con=DatabaseFactory.getConnection()
offline=con.prepareStatement("SELECT value FROM character_quests WHERE char_id=? AND var=? AND name=?")
offline.setInt(1, leaderId)
offline.setString(2, var)
@@ -140,7 +140,7 @@ def setLeaderVar(st, var, value) :
leader.getQuestState(qn).set(var,value)
else :
leaderId=st.getPlayer().getClan().getLeaderId()
- con=DatabaseFactory.getInstance().getConnection()
+ con=DatabaseFactory.getConnection()
offline=con.prepareStatement("UPDATE character_quests SET value=? WHERE char_id=? AND var=? AND name=?")
offline.setString(1, value)
offline.setInt(2, leaderId)
diff --git a/L2J_Mobius_C6_Interlude/dist/game/java.cfg b/L2J_Mobius_C6_Interlude/dist/game/java.cfg
index 38fa2539e6..e2f6f2d9c2 100644
--- a/L2J_Mobius_C6_Interlude/dist/game/java.cfg
+++ b/L2J_Mobius_C6_Interlude/dist/game/java.cfg
@@ -1 +1 @@
--server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseParNewGC -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
\ No newline at end of file
+-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=error -XX:+AggressiveOpts -Xnoclassgc -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:+UseParNewGC -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
\ No newline at end of file
diff --git a/L2J_Mobius_C6_Interlude/dist/libs/HikariCP-3.2.0.jar b/L2J_Mobius_C6_Interlude/dist/libs/HikariCP-3.2.0.jar
new file mode 100644
index 0000000000..a030a7f8dc
Binary files /dev/null and b/L2J_Mobius_C6_Interlude/dist/libs/HikariCP-3.2.0.jar differ
diff --git a/L2J_Mobius_C6_Interlude/dist/libs/c3p0-0.9.5.2.jar b/L2J_Mobius_C6_Interlude/dist/libs/c3p0-0.9.5.2.jar
deleted file mode 100644
index 579cedd980..0000000000
Binary files a/L2J_Mobius_C6_Interlude/dist/libs/c3p0-0.9.5.2.jar and /dev/null differ
diff --git a/L2J_Mobius_C6_Interlude/dist/libs/mchange-commons-java-0.2.12.jar b/L2J_Mobius_C6_Interlude/dist/libs/mchange-commons-java-0.2.12.jar
deleted file mode 100644
index af11054860..0000000000
Binary files a/L2J_Mobius_C6_Interlude/dist/libs/mchange-commons-java-0.2.12.jar and /dev/null differ
diff --git a/L2J_Mobius_C6_Interlude/dist/libs/slf4j-api-1.7.25.jar b/L2J_Mobius_C6_Interlude/dist/libs/slf4j-api-1.7.25.jar
new file mode 100644
index 0000000000..7e62f1336d
Binary files /dev/null and b/L2J_Mobius_C6_Interlude/dist/libs/slf4j-api-1.7.25.jar differ
diff --git a/L2J_Mobius_C6_Interlude/dist/libs/slf4j-simple-1.7.25.jar b/L2J_Mobius_C6_Interlude/dist/libs/slf4j-simple-1.7.25.jar
new file mode 100644
index 0000000000..b29ca12719
Binary files /dev/null and b/L2J_Mobius_C6_Interlude/dist/libs/slf4j-simple-1.7.25.jar differ
diff --git a/L2J_Mobius_C6_Interlude/dist/login/java.cfg b/L2J_Mobius_C6_Interlude/dist/login/java.cfg
index 00ae5b3a66..bda4cdd24d 100644
--- a/L2J_Mobius_C6_Interlude/dist/login/java.cfg
+++ b/L2J_Mobius_C6_Interlude/dist/login/java.cfg
@@ -1 +1 @@
--server -Xms128m -Xmx256m
\ No newline at end of file
+-server -Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=error -Xms128m -Xmx256m
\ No newline at end of file
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/commons/database/DatabaseFactory.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/commons/database/DatabaseFactory.java
index 44ba2fad76..dd481d2fd0 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/commons/database/DatabaseFactory.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/commons/database/DatabaseFactory.java
@@ -16,117 +16,68 @@
*/
package com.l2jmobius.commons.database;
-import java.beans.PropertyVetoException;
import java.sql.Connection;
-import java.sql.SQLException;
import java.util.logging.Logger;
import com.l2jmobius.Config;
-import com.mchange.v2.c3p0.ComboPooledDataSource;
+import com.zaxxer.hikari.HikariDataSource;
/**
- * Database Factory implementation.
- * @author Zoey76
+ * @author Mobius
*/
public class DatabaseFactory
{
private static final Logger LOGGER = Logger.getLogger(DatabaseFactory.class.getName());
- private final ComboPooledDataSource _dataSource;
+ private static final HikariDataSource _hds = new HikariDataSource();
- public DatabaseFactory()
+ public static void init()
{
- if (Config.DATABASE_MAX_CONNECTIONS < 2)
- {
- Config.DATABASE_MAX_CONNECTIONS = 2;
- LOGGER.warning("A minimum of 2 connections are required.");
- }
-
- _dataSource = new ComboPooledDataSource();
- _dataSource.setAutoCommitOnClose(true);
-
- _dataSource.setInitialPoolSize(10);
- _dataSource.setMinPoolSize(10);
- _dataSource.setMaxPoolSize(Math.max(10, Config.DATABASE_MAX_CONNECTIONS));
-
- _dataSource.setAcquireRetryAttempts(0); // try to obtain connections indefinitely (0 = never quit)
- _dataSource.setAcquireRetryDelay(500); // 500 milliseconds wait before try to acquire connection again
- _dataSource.setCheckoutTimeout(0); // 0 = wait indefinitely for new connection if pool is exhausted
- _dataSource.setAcquireIncrement(5); // if pool is exhausted, get 5 more connections at a time cause there is
- // a "long" delay on acquire connection so taking more than one connection at once will make connection pooling more effective.
-
- // testing OnCheckin used with IdleConnectionTestPeriod is faster than testing on checkout
- _dataSource.setIdleConnectionTestPeriod(3600); // test idle connection every 60 sec
- _dataSource.setMaxIdleTime(Config.DATABASE_MAX_IDLE_TIME); // 0 = idle connections never expire
- // *THANKS* to connection testing configured above but I prefer to disconnect all connections not used for more than 1 hour
-
- // enables statement caching, there is a "semi-bug" in c3p0 0.9.0 but in 0.9.0.2 and later it's fixed
- _dataSource.setMaxStatementsPerConnection(100);
-
- _dataSource.setBreakAfterAcquireFailure(false); // never fail if any way possible setting this to true will make c3p0 "crash"
- // and refuse to work till restart thus making acquire errors "FATAL" ... we don't want that it should be possible to recover
+ _hds.setDriverClassName(Config.DATABASE_DRIVER);
+ _hds.setJdbcUrl(Config.DATABASE_URL);
+ _hds.setUsername(Config.DATABASE_LOGIN);
+ _hds.setPassword(Config.DATABASE_PASSWORD);
+ _hds.setMaximumPoolSize(Config.DATABASE_MAX_CONNECTIONS);
+ _hds.setIdleTimeout(Config.DATABASE_MAX_IDLE_TIME);
+ // Test if connection is valid.
try
{
- _dataSource.setDriverClass(Config.DATABASE_DRIVER);
+ _hds.getConnection().close();
+ LOGGER.info("Database: Initialized.");
}
- catch (PropertyVetoException e)
+ catch (Exception e)
{
e.printStackTrace();
}
- _dataSource.setJdbcUrl(Config.DATABASE_URL);
- _dataSource.setUser(Config.DATABASE_LOGIN);
- _dataSource.setPassword(Config.DATABASE_PASSWORD);
-
- /* Test the connection */
- try
- {
- _dataSource.getConnection().close();
- }
- catch (SQLException e)
- {
- e.printStackTrace();
- }
-
- LOGGER.info("Database: Initialized.");
}
- public Connection getConnection()
+ public static Connection getConnection()
{
Connection con = null;
while (con == null)
{
try
{
- con = _dataSource.getConnection();
+ con = _hds.getConnection();
}
- catch (SQLException e)
+ catch (Exception e)
{
- LOGGER.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage());
+ LOGGER.severe("DatabaseFactory: Cound not get a connection. " + e);
}
}
return con;
}
- public void close()
+ public static void close()
{
try
{
- _dataSource.close();
+ _hds.close();
}
catch (Exception e)
{
- LOGGER.info(e.getMessage());
+ LOGGER.severe("DatabaseFactory: There was a problem closing the data source. " + e);
}
}
-
- public static DatabaseFactory getInstance()
- {
- return SingletonHolder.INSTANCE;
- }
-
- private static class SingletonHolder
- {
- protected static final DatabaseFactory INSTANCE = new DatabaseFactory();
- }
}
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/GameServer.java
index b61b44c72c..2cfb3853fb 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/GameServer.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/GameServer.java
@@ -184,7 +184,7 @@ public class GameServer
Config.load();
Util.printSection("Database");
- DatabaseFactory.getInstance();
+ DatabaseFactory.init();
Util.printSection("ThreadPool");
ThreadPool.init();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/Shutdown.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/Shutdown.java
index 598bd901ed..807635e8b1 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/Shutdown.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/Shutdown.java
@@ -357,7 +357,7 @@ public class Shutdown extends Thread
// commit data, last chance
try
{
- DatabaseFactory.getInstance().close();
+ DatabaseFactory.close();
}
catch (Throwable t)
{
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/TradeController.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/TradeController.java
index 2abc3ea0b5..0500e1c894 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/TradeController.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/TradeController.java
@@ -175,7 +175,7 @@ public class TradeController
int dummyItemCount = 0;
boolean LimitedItem = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement1 = con.prepareStatement("SELECT * FROM merchant_shopids");
@@ -355,7 +355,7 @@ public class TradeController
*/
if (Config.CUSTOM_MERCHANT_TABLES)// Custom merchat Tabels
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final int initialSize = _lists.size();
@@ -614,7 +614,7 @@ public class TradeController
protected void dataTimerSave(int time)
{
final long timerSave = System.currentTimeMillis() + (time * 60 * 60 * 1000);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("UPDATE merchant_buylists SET savetimer =? WHERE time =?");
statement.setLong(1, timerSave);
@@ -638,7 +638,7 @@ public class TradeController
}
PreparedStatement statement;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
for (L2TradeList list : _listsTaskItem.values())
{
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/cache/CrestCache.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/cache/CrestCache.java
index 91f6159664..e83d510c1d 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/cache/CrestCache.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/cache/CrestCache.java
@@ -167,7 +167,7 @@ public class CrestCache
file.renameTo(new File(Config.DATAPACK_ROOT, "data/crests/Crest_" + newId + ".bmp"));
LOGGER.info("Renamed Clan crest to new format: Crest_" + newId + ".bmp");
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET crest_id = ? WHERE clan_id = ?");
statement.setInt(1, newId);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
index e889ddc211..53c8adc70b 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
@@ -95,7 +95,7 @@ public class Forum
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT * FROM forums WHERE forum_id=?");
statement.setInt(1, _forumId);
@@ -119,7 +119,7 @@ public class Forum
LOGGER.warning("Data error on Forum " + _forumId + " : " + e);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT * FROM topic WHERE topic_forum_id=? ORDER BY topic_id DESC");
statement.setInt(1, _forumId);
@@ -146,7 +146,7 @@ public class Forum
private void getChildren()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT forum_id FROM forums WHERE forum_parent=?");
statement.setInt(1, _forumId);
@@ -226,7 +226,7 @@ public class Forum
public void insertIntoDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("INSERT INTO forums (forum_id,forum_name,forum_parent,forum_post,forum_type,forum_perm,forum_owner_id) values (?,?,?,?,?,?,?)");
statement.setInt(1, _forumId);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
index f7e2302262..792423eb6c 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
@@ -71,7 +71,7 @@ public class Post
public void insertindb(CPost cp)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)");
statement.setInt(1, cp.postId);
@@ -112,7 +112,7 @@ public class Post
public void deleteMe(Topic t)
{
PostBBSManager.getInstance().delPostByTopic(t);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("DELETE FROM posts WHERE post_forum_id=? AND post_topic_id=?");
statement.setInt(1, t.getForumID());
@@ -128,7 +128,7 @@ public class Post
private void load(Topic t)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT * FROM posts WHERE post_forum_id=? AND post_topic_id=? ORDER BY post_id ASC");
statement.setInt(1, t.getForumID());
@@ -157,7 +157,7 @@ public class Post
public void updateText(int i)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
CPost cp = getCPost(i);
PreparedStatement statement = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?");
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
index a4ba30aa4e..1dd4d68cd9 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
@@ -69,7 +69,7 @@ public class Topic
private void insertIntoDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("INSERT INTO topic (topic_id,topic_forum_id,topic_name,topic_date,topic_ownername,topic_ownerid,topic_type,topic_reply) values (?,?,?,?,?,?,?,?)");
statement.setInt(1, _id);
@@ -125,7 +125,7 @@ public class Topic
TopicBBSManager.getInstance().delTopic(this);
f.rmTopicByID(_id);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("DELETE FROM topic WHERE topic_id=? AND topic_forum_id=?");
statement.setInt(1, _id);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/Manager/FavoriteBBSManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/Manager/FavoriteBBSManager.java
index 68dbfb1689..a724b767cd 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/Manager/FavoriteBBSManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/Manager/FavoriteBBSManager.java
@@ -56,7 +56,7 @@ public class FavoriteBBSManager extends BaseBBSManager
// Load Favorite links
final String list = HtmCache.getInstance().getHtm(CB_PATH + "favorite_list.html");
final StringBuilder sb = new StringBuilder();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_FAVORITES))
{
ps.setInt(1, activeChar.getObjectId());
@@ -93,7 +93,7 @@ public class FavoriteBBSManager extends BaseBBSManager
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_FAVORITE))
{
ps.setInt(1, activeChar.getObjectId());
@@ -118,7 +118,7 @@ public class FavoriteBBSManager extends BaseBBSManager
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_FAVORITE))
{
ps.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
index 47aaba4667..0e67d1b5c0 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
@@ -39,7 +39,7 @@ public class ForumsBBSManager extends BaseBBSManager
{
_table = new CopyOnWriteArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT forum_id FROM forums WHERE forum_type=0");
ResultSet result = statement.executeQuery();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/Manager/FriendsBBSManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/Manager/FriendsBBSManager.java
index 78d4c3b38d..a2e0b64c94 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/Manager/FriendsBBSManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/Manager/FriendsBBSManager.java
@@ -79,7 +79,7 @@ public class FriendsBBSManager extends BaseBBSManager
}
else if (action.equals("delall"))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("DELETE FROM character_friends WHERE char_id = ? OR friend_id = ?");
statement.setInt(1, activeChar.getObjectId());
@@ -117,7 +117,7 @@ public class FriendsBBSManager extends BaseBBSManager
}
else if (action.equals("del"))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
for (int friendId : activeChar.getSelectedFriendList())
{
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/Manager/MailBBSManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/Manager/MailBBSManager.java
index 55feaf3d03..78420d54e3 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/Manager/MailBBSManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/communitybbs/Manager/MailBBSManager.java
@@ -223,7 +223,7 @@ public class MailBBSManager extends BaseBBSManager
private void initId()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(SELECT_LAST_ID);
ResultSet result = statement.executeQuery();
@@ -255,7 +255,7 @@ public class MailBBSManager extends BaseBBSManager
if (_letters == null)
{
_letters = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(SELECT_CHAR_MAILS);
statement.setInt(1, objId);
@@ -570,7 +570,7 @@ public class MailBBSManager extends BaseBBSManager
// Edit message.
message = message.replaceAll("\n", "");
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Get the current time under timestamp format.
final Timestamp time = new Timestamp(currentDate);
@@ -758,7 +758,7 @@ public class MailBBSManager extends BaseBBSManager
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(DELETE_MAIL);
statement.setInt(1, letterId);
@@ -775,7 +775,7 @@ public class MailBBSManager extends BaseBBSManager
{
getLetter(activeChar, letterId).unread = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(MARK_MAIL_READ);
statement.setInt(1, 0);
@@ -793,7 +793,7 @@ public class MailBBSManager extends BaseBBSManager
{
getLetter(activeChar, letterId).location = location;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(SET_LETTER_LOC);
statement.setString(1, location.toString().toLowerCase());
@@ -816,7 +816,7 @@ public class MailBBSManager extends BaseBBSManager
private static boolean isGM(int charId)
{
boolean isGM = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT accesslevel FROM characters WHERE obj_Id = ?");
statement.setInt(1, charId);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/BufferTable.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/BufferTable.java
index 5565934576..75d21272c1 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/BufferTable.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/BufferTable.java
@@ -59,7 +59,7 @@ public class BufferTable
{
int count = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement st = con.prepareStatement(LOAD_SCHEMES);
ResultSet rs = st.executeQuery();
@@ -136,7 +136,7 @@ public class BufferTable
public void saveSchemes()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Delete all entries from database.
PreparedStatement st = con.prepareStatement(DELETE_SCHEMES);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/OfflineTradeTable.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/OfflineTradeTable.java
index 903b34f894..89c00fa8f0 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/OfflineTradeTable.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/OfflineTradeTable.java
@@ -56,7 +56,7 @@ public class OfflineTradeTable
// of store of normal sellers/buyers also if not in offline mode
public static void storeOffliners()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement stm = con.prepareStatement(CLEAR_OFFLINE_TABLE);
stm.execute();
@@ -174,7 +174,7 @@ public class OfflineTradeTable
{
LOGGER.info("Loading offline traders...");
int nTraders = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement stm = con.prepareStatement(LOAD_OFFLINE_STATUS);
final ResultSet rs = stm.executeQuery();
@@ -305,7 +305,7 @@ public class OfflineTradeTable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement stm = con.prepareStatement(DELETE_OFFLINE_TABLE_ALL_ITEMS);
stm.setInt(1, pc.getObjectId());
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/AccessLevels.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/AccessLevels.java
index a28c1fec0b..d28d6494da 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/AccessLevels.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/AccessLevels.java
@@ -69,7 +69,7 @@ public class AccessLevels
_masterAccessLevel = new AccessLevel(Config.MASTERACCESS_LEVEL, "Master Access", Config.MASTERACCESS_NAME_COLOR, Config.MASTERACCESS_TITLE_COLOR, true, true, true, true, true, true, true, true, true, true, true);
_userAccessLevel = new AccessLevel(Config.USERACCESS_LEVEL, "User", Integer.decode("0xFFFFFF"), Integer.decode("0xFFFFFF"), false, false, false, true, false, true, true, true, true, true, false);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement stmt = con.prepareStatement("SELECT * FROM `access_levels` ORDER BY `accessLevel` DESC");
final ResultSet rset = stmt.executeQuery();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/AdminCommandAccessRights.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/AdminCommandAccessRights.java
index 5f33561659..60152fdfdf 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/AdminCommandAccessRights.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/AdminCommandAccessRights.java
@@ -53,7 +53,7 @@ public class AdminCommandAccessRights
*/
private AdminCommandAccessRights()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement stmt = con.prepareStatement("SELECT * FROM admin_command_access_rights");
final ResultSet rset = stmt.executeQuery();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/ArmorSetsTable.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/ArmorSetsTable.java
index 22150de484..38158500ac 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/ArmorSetsTable.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/ArmorSetsTable.java
@@ -53,7 +53,7 @@ public class ArmorSetsTable
private void loadData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT id, chest, legs, head, gloves, feet, skill_id, shield, shield_skill_id, enchant6skill FROM armorsets");
final ResultSet rset = statement.executeQuery();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/CharNameTable.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/CharNameTable.java
index e2e45e9708..8d62e62cc5 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/CharNameTable.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/CharNameTable.java
@@ -42,7 +42,7 @@ public class CharNameTable
public synchronized boolean doesCharNameExist(String name)
{
boolean result = true;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT account_name FROM characters WHERE char_name=?");
statement.setString(1, name);
@@ -63,7 +63,7 @@ public class CharNameTable
{
String name = "";
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT char_name FROM characters WHERE obj_Id=?");
statement.setInt(1, objId);
@@ -90,7 +90,7 @@ public class CharNameTable
{
int id = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT obj_Id FROM characters WHERE char_name=?");
statement.setString(1, name);
@@ -117,7 +117,7 @@ public class CharNameTable
{
int accessLevel = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT accesslevel FROM characters WHERE obj_Id=?");
statement.setInt(1, objId);
@@ -144,7 +144,7 @@ public class CharNameTable
{
int number = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT COUNT(char_name) FROM characters WHERE account_name=?");
statement.setString(1, account);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/CharTemplateTable.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/CharTemplateTable.java
index 311b6735b8..5c03b2f732 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/CharTemplateTable.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/CharTemplateTable.java
@@ -176,7 +176,7 @@ public class CharTemplateTable
private CharTemplateTable()
{
_templates = new HashMap<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT * FROM class_list, char_templates, lvlupgain WHERE class_list.id = char_templates.classId AND class_list.id = lvlupgain.classId ORDER BY class_list.id");
ResultSet rset = statement.executeQuery();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/ClanTable.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/ClanTable.java
index a374d0bbdf..d357ef2c09 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/ClanTable.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/ClanTable.java
@@ -112,7 +112,7 @@ public class ClanTable
{
_clans = new HashMap<>();
L2Clan clan;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT * FROM clan_data");
final ResultSet result = statement.executeQuery();
@@ -355,7 +355,7 @@ public class ClanTable
_clans.remove(clanId);
IdFactory.getInstance().releaseId(clanId);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("DELETE FROM clan_data WHERE clan_id=?");
statement.setInt(1, clanId);
@@ -462,7 +462,7 @@ public class ClanTable
clan1.broadcastClanStatus();
clan2.broadcastClanStatus();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("REPLACE INTO clan_wars (clan1, clan2, wantspeace1, wantspeace2) VALUES(?,?,?,?)");
statement.setInt(1, clanId1);
@@ -514,7 +514,7 @@ public class ClanTable
// player.getPlayerInstance().setWantsPeace(0);
// }
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("DELETE FROM clan_wars WHERE clan1=? AND clan2=?");
statement.setInt(1, clanId1);
@@ -570,7 +570,7 @@ public class ClanTable
private void restorewars()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT clan1, clan2, wantspeace1, wantspeace2 FROM clan_wars");
final ResultSet rset = statement.executeQuery();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/CustomArmorSetsTable.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/CustomArmorSetsTable.java
index f1d6239bd7..63487ab55a 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/CustomArmorSetsTable.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/CustomArmorSetsTable.java
@@ -43,7 +43,7 @@ public final class CustomArmorSetsTable
public CustomArmorSetsTable()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT chest, legs, head, gloves, feet, skill_id, shield, shield_skill_id, enchant6skill FROM custom_armorsets");
final ResultSet rset = statement.executeQuery();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/HelperBuffTable.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/HelperBuffTable.java
index a77218a4e8..3aef7da04f 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/HelperBuffTable.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/HelperBuffTable.java
@@ -86,7 +86,7 @@ public class HelperBuffTable
*/
private void restoreHelperBuffData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT * FROM helper_buff_list");
final ResultSet helperbuffdata = statement.executeQuery();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/HennaTreeTable.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/HennaTreeTable.java
index c3b26b8c2d..f4c597de19 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/HennaTreeTable.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/HennaTreeTable.java
@@ -55,7 +55,7 @@ public class HennaTreeTable
int classId = 0;
int count = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT class_name, id, parent_id FROM class_list ORDER BY id");
final ResultSet classlist = statement.executeQuery();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/L2PetDataTable.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/L2PetDataTable.java
index f066ba891c..497631e2da 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/L2PetDataTable.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/L2PetDataTable.java
@@ -52,7 +52,7 @@ public class L2PetDataTable
public void loadPetsData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT typeID, level, expMax, hpMax, mpMax, patk, pdef, matk, mdef, acc, evasion, crit, speed, atk_speed, cast_speed, feedMax, feedbattle, feednormal, loadMax, hpregen, mpregen, owner_exp_taken FROM pets_stats");
final ResultSet rset = statement.executeQuery();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/LevelUpData.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/LevelUpData.java
index 0eeaa0772e..ab5aa8b1ef 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/LevelUpData.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/LevelUpData.java
@@ -66,7 +66,7 @@ public class LevelUpData
private LevelUpData()
{
lvlTable = new HashMap<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement(SELECT_ALL);
final ResultSet rset = statement.executeQuery();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/NpcTable.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/NpcTable.java
index e8c3579242..96703f13a1 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/NpcTable.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/NpcTable.java
@@ -71,7 +71,7 @@ public class NpcTable
private void restoreNpcData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT * FROM npc");
final ResultSet npcdata = statement.executeQuery();
@@ -86,7 +86,7 @@ public class NpcTable
if (Config.CUSTOM_NPC_TABLE)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT * FROM custom_npc");
final ResultSet npcdata = statement.executeQuery();
@@ -100,7 +100,7 @@ public class NpcTable
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT npcid, skillid, level FROM npcskills");
final ResultSet npcskills = statement.executeQuery();
@@ -146,7 +146,7 @@ public class NpcTable
if (Config.CUSTOM_DROPLIST_TABLE)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT * FROM custom_droplist ORDER BY mobId, chance DESC");
final ResultSet dropData = statement.executeQuery();
@@ -186,7 +186,7 @@ public class NpcTable
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT * FROM droplist ORDER BY mobId, chance DESC");
final ResultSet dropData = statement.executeQuery();
@@ -225,7 +225,7 @@ public class NpcTable
LOGGER.warning("NPCTable: Error reading NPC drop data." + e);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT * FROM skill_learn");
final ResultSet learndata = statement.executeQuery();
@@ -259,7 +259,7 @@ public class NpcTable
LOGGER.warning("NPCTable: Error reading NPC trainer data." + e);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT * FROM minions");
final ResultSet minionData = statement.executeQuery();
@@ -554,7 +554,7 @@ public class NpcTable
public void reloadNpc(int id)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// save a copy of the old data
final L2NpcTemplate old = getTemplate(id);
@@ -628,7 +628,7 @@ public class NpcTable
public void saveNpc(StatsSet npc)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final Map set = npc.getSet();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/PetNameTable.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/PetNameTable.java
index a998884c99..6c3d5cb3bf 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/PetNameTable.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/PetNameTable.java
@@ -47,7 +47,7 @@ public class PetNameTable
public boolean doesPetNameExist(String name, int petNpcId)
{
boolean result = true;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT name FROM pets p, items i WHERE p.item_obj_id = i.object_id AND name=? AND i.item_id IN (?)");
statement.setString(1, name);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/SkillSpellbookTable.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/SkillSpellbookTable.java
index 5f0d61f222..ac29b0d67a 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/SkillSpellbookTable.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/SkillSpellbookTable.java
@@ -49,7 +49,7 @@ public class SkillSpellbookTable
private SkillSpellbookTable()
{
skillSpellbooks = new HashMap<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT skill_id, item_id FROM skill_spellbooks");
final ResultSet spbooks = statement.executeQuery();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/SkillTreeTable.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/SkillTreeTable.java
index e14e42f1ac..7531e80cd2 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/SkillTreeTable.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/SkillTreeTable.java
@@ -57,7 +57,7 @@ public class SkillTreeTable
int classId = 0;
int count = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT * FROM class_list ORDER BY id");
final ResultSet classlist = statement.executeQuery();
@@ -122,7 +122,7 @@ public class SkillTreeTable
int count2 = 0;
int count3 = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
_fishingSkillTrees = new ArrayList<>();
_expandDwarfCraftSkillTrees = new ArrayList<>();
@@ -172,7 +172,7 @@ public class SkillTreeTable
}
int count4 = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
_enchantSkillTrees = new ArrayList<>();
@@ -215,7 +215,7 @@ public class SkillTreeTable
}
int count5 = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
_pledgeSkillTrees = new ArrayList<>();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/SpawnTable.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/SpawnTable.java
index 459a0ddc23..3e7a83b394 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/SpawnTable.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/SpawnTable.java
@@ -68,7 +68,7 @@ public class SpawnTable
private void fillSpawnTable()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
@@ -173,7 +173,7 @@ public class SpawnTable
// -------------------------------Custom Spawnlist----------------------------//
if (Config.CUSTOM_SPAWNLIST_TABLE)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement;
@@ -284,7 +284,7 @@ public class SpawnTable
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("INSERT INTO " + (spawn.isCustom() ? "custom_spawnlist" : "spawnlist") + "(id,count,npc_templateid,locx,locy,locz,heading,respawn_delay,loc_id) values(?,?,?,?,?,?,?,?,?)");
statement.setInt(1, spawn.getId());
@@ -317,7 +317,7 @@ public class SpawnTable
{
if (Config.DELETE_GMSPAWN_ON_CUSTOM)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("Replace into custom_notspawned VALUES (?,?)");
statement.setInt(1, spawn.getId());
@@ -332,7 +332,7 @@ public class SpawnTable
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("DELETE FROM " + (spawn.isCustom() ? "custom_spawnlist" : "spawnlist") + " WHERE id=?");
statement.setInt(1, spawn.getId());
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/TeleportLocationTable.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/TeleportLocationTable.java
index 59a846e730..422d4356d3 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/TeleportLocationTable.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/TeleportLocationTable.java
@@ -58,7 +58,7 @@ public class TeleportLocationTable
{
teleports = new HashMap<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT Description, id, loc_x, loc_y, loc_z, price, fornoble FROM teleport");
final ResultSet rset = statement.executeQuery();
@@ -90,7 +90,7 @@ public class TeleportLocationTable
if (Config.CUSTOM_TELEPORT_TABLE)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT Description, id, loc_x, loc_y, loc_z, price, fornoble FROM custom_teleport");
final ResultSet rset = statement.executeQuery();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/TerritoryTable.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/TerritoryTable.java
index 649f3e529a..2470d43595 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/TerritoryTable.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/TerritoryTable.java
@@ -57,7 +57,7 @@ public class TerritoryTable
public void reload_data()
{
_territory.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT loc_id, loc_x, loc_y, loc_zmin, loc_zmax, proc FROM `locations`");
final ResultSet rset = statement.executeQuery();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/TradeListTable.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/TradeListTable.java
index fc55978d08..22c5488240 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/TradeListTable.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/sql/TradeListTable.java
@@ -80,7 +80,7 @@ public class TradeListTable
private void load(boolean custom)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement1 = con.prepareStatement("SELECT shop_id,npc_id FROM " + (custom ? "custom_merchant_shopids" : "merchant_shopids"));
final ResultSet rset1 = statement1.executeQuery();
@@ -266,7 +266,7 @@ public class TradeListTable
{
final long timerSave = System.currentTimeMillis() + (time * 3600000); // 60*60*1000
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE merchant_buylists SET savetimer =? WHERE time =?");
statement.setLong(1, timerSave);
@@ -288,7 +288,7 @@ public class TradeListTable
}
int listId;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/xml/ItemTable.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/xml/ItemTable.java
index 592dd0f3f8..b42be24b34 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/xml/ItemTable.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/xml/ItemTable.java
@@ -319,7 +319,7 @@ public class ItemTable
// if it's a pet control item, delete the pet as well
if (L2PetDataTable.isPetItem(item.getItemId()))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?");
statement.setInt(1, item.getObjectId());
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/xml/ZoneData.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/xml/ZoneData.java
index a654a3a296..aceb932115 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/xml/ZoneData.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/datatables/xml/ZoneData.java
@@ -123,7 +123,7 @@ public class ZoneData
boolean done = false;
// Load the zone xml
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setValidating(false);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/AutoAnnouncementHandler.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/AutoAnnouncementHandler.java
index a0a034330f..810cda4aa9 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/AutoAnnouncementHandler.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/AutoAnnouncementHandler.java
@@ -54,7 +54,7 @@ public class AutoAnnouncementHandler
PreparedStatement statement = null;
ResultSet rs = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
statement = con.prepareStatement("SELECT * FROM auto_announcements ORDER BY id");
rs = statement.executeQuery();
@@ -169,7 +169,7 @@ public class AutoAnnouncementHandler
{
final int nextId = nextAutoAnnouncmentId();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("INSERT INTO auto_announcements (id,announcement,delay) VALUES (?,?,?)");
statement.setInt(1, nextId);
@@ -195,7 +195,7 @@ public class AutoAnnouncementHandler
PreparedStatement statement = null;
ResultSet rs = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
statement = con.prepareStatement("SELECT id FROM auto_announcements ORDER BY id");
rs = statement.executeQuery();
@@ -265,7 +265,7 @@ public class AutoAnnouncementHandler
{
final AutoAnnouncementInstance announcementInst = _registeredAnnouncements.get(id);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("DELETE FROM auto_announcements WHERE id=?");
statement.setInt(1, announcementInst.getDefaultId());
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/AutoChatHandler.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/AutoChatHandler.java
index 5312ca9ecc..031c0b621e 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/AutoChatHandler.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/AutoChatHandler.java
@@ -64,7 +64,7 @@ public class AutoChatHandler implements SpawnListener
{
int numLoaded = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT * FROM auto_chat ORDER BY groupId ASC");
final ResultSet rs = statement.executeQuery();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminAio.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminAio.java
index 455dabff4c..fcf9c0374c 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminAio.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminAio.java
@@ -176,7 +176,7 @@ public class AdminAio implements IAdminCommandHandler
_player.setEndTime("aio", days);
_player.getStat().addExp(_player.getStat().getExpForLevel(81));
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET aio=1, aio_end=? WHERE obj_id=?");
statement.setLong(1, _player.getAioEndTime());
@@ -223,7 +223,7 @@ public class AdminAio implements IAdminCommandHandler
_player.setAio(false);
_player.setAioEndTime(0);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET Aio=0, Aio_end=0 WHERE obj_id=?");
statement.setInt(1, _player.getObjectId());
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminBan.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminBan.java
index 24629e9306..094613077a 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminBan.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminBan.java
@@ -303,7 +303,7 @@ public class AdminBan implements IAdminCommandHandler
value = 0;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET punish_level=?, punish_timer=? WHERE char_name=?");
statement.setInt(1, level);
@@ -339,7 +339,7 @@ public class AdminBan implements IAdminCommandHandler
private void jailOfflinePlayer(L2PcInstance activeChar, String name, int delay)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=?, punish_level=?, punish_timer=? WHERE char_name=?");
statement.setInt(1, -114356);
@@ -374,7 +374,7 @@ public class AdminBan implements IAdminCommandHandler
private void unjailOfflinePlayer(L2PcInstance activeChar, String name)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=?, punish_level=?, punish_timer=? WHERE char_name=?");
statement.setInt(1, 17836);
@@ -439,7 +439,7 @@ public class AdminBan implements IAdminCommandHandler
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET accesslevel=? WHERE char_name=?");
statement.setInt(1, lvl);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminDonator.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminDonator.java
index 6b86c9d178..f076555f88 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminDonator.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminDonator.java
@@ -136,7 +136,7 @@ public class AdminDonator implements IAdminCommandHandler
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement stmt = con.prepareStatement(newDonator ? INSERT_DATA : DEL_DATA);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminEditNpc.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminEditNpc.java
index 604f8a9624..8a66b8459a 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminEditNpc.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminEditNpc.java
@@ -795,7 +795,7 @@ public class AdminEditNpc implements IAdminCommandHandler
private void storeTradeList(int itemID, int price, int tradeListID, int order)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement stmt = con.prepareStatement("INSERT INTO merchant_buylists (`item_id`,`price`,`shop_id`,`order`) values (" + itemID + "," + price + "," + tradeListID + "," + order + ")");
stmt.execute();
@@ -809,7 +809,7 @@ public class AdminEditNpc implements IAdminCommandHandler
private void updateTradeList(int itemID, int price, int tradeListID, int order)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement stmt = con.prepareStatement("UPDATE merchant_buylists SET `price`='" + price + "' WHERE `shop_id`='" + tradeListID + "' AND `order`='" + order + "'");
stmt.execute();
@@ -823,7 +823,7 @@ public class AdminEditNpc implements IAdminCommandHandler
private void deleteTradeList(int tradeListID, int order)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement stmt = con.prepareStatement("DELETE FROM merchant_buylists WHERE `shop_id`='" + tradeListID + "' AND `order`='" + order + "'");
stmt.execute();
@@ -838,7 +838,7 @@ public class AdminEditNpc implements IAdminCommandHandler
private int findOrderTradeList(int itemID, int price, int tradeListID)
{
int order = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement stmt = con.prepareStatement("SELECT * FROM merchant_buylists WHERE `shop_id`='" + tradeListID + "' AND `item_id` ='" + itemID + "' AND `price` = '" + price + "'");
ResultSet rs = stmt.executeQuery();
@@ -1243,7 +1243,7 @@ public class AdminEditNpc implements IAdminCommandHandler
private void showEditDropData(L2PcInstance activeChar, int npcId, int itemId, int category)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT mobId, itemId, min, max, category, chance FROM droplist WHERE mobId=" + npcId + " AND itemId=" + itemId + " AND category=" + category);
ResultSet dropData = statement.executeQuery();
@@ -1307,7 +1307,7 @@ public class AdminEditNpc implements IAdminCommandHandler
private void updateDropData(L2PcInstance activeChar, int npcId, int itemId, int min, int max, int category, int chance)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("UPDATE droplist SET min=?, max=?, chance=? WHERE mobId=? AND itemId=? AND category=?");
statement.setInt(1, min);
@@ -1361,7 +1361,7 @@ public class AdminEditNpc implements IAdminCommandHandler
private void addDropData(L2PcInstance activeChar, int npcId, int itemId, int min, int max, int category, int chance)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("INSERT INTO droplist(mobId, itemId, min, max, category, chance) values(?,?,?,?,?,?)");
statement.setInt(1, npcId);
@@ -1392,7 +1392,7 @@ public class AdminEditNpc implements IAdminCommandHandler
private void deleteDropData(L2PcInstance activeChar, int npcId, int itemId, int category)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (npcId > 0)
{
@@ -1433,7 +1433,7 @@ public class AdminEditNpc implements IAdminCommandHandler
npcData.clearAllDropData();
// get the drops
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
L2DropData dropData = null;
@@ -1556,7 +1556,7 @@ public class AdminEditNpc implements IAdminCommandHandler
private void showNpcSkillEdit(L2PcInstance activeChar, int npcId, int skillId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT npcid, skillid, level FROM npcskills WHERE npcid=" + npcId + " AND skillid=" + skillId);
final ResultSet skillData = statement.executeQuery();
@@ -1611,7 +1611,7 @@ public class AdminEditNpc implements IAdminCommandHandler
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE npcskills SET level=? WHERE npcid=? AND skillid=?");
statement.setInt(1, level);
@@ -1682,7 +1682,7 @@ public class AdminEditNpc implements IAdminCommandHandler
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("INSERT INTO npcskills(npcid, skillid, level) values(?,?,?)");
statement.setInt(1, npcId);
@@ -1710,7 +1710,7 @@ public class AdminEditNpc implements IAdminCommandHandler
private void deleteNpcSkillData(L2PcInstance activeChar, int npcId, int skillId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (npcId > 0)
{
@@ -1739,7 +1739,7 @@ public class AdminEditNpc implements IAdminCommandHandler
private void reLoadNpcSkillList(int npcId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final L2NpcTemplate npcData = NpcTable.getInstance().getTemplate(npcId);
npcData.getSkills().clear();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminMenu.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminMenu.java
index 873884ce53..562aaa2b4d 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminMenu.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminMenu.java
@@ -340,7 +340,7 @@ public class AdminMenu implements IAdminCommandHandler
private void setAccountAccessLevel(String player, L2PcInstance activeChar, int banLevel)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
String stmt = "SELECT account_name FROM characters WHERE char_name = ?";
PreparedStatement statement = con.prepareStatement(stmt);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminNoble.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminNoble.java
index a0d154ee77..eea2693a85 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminNoble.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminNoble.java
@@ -125,7 +125,7 @@ public class AdminNoble implements IAdminCommandHandler
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement stmt = con.prepareStatement(newNoble ? INSERT_DATA : DEL_DATA);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminRepairChar.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminRepairChar.java
index 5da938df48..4850855497 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminRepairChar.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminRepairChar.java
@@ -69,7 +69,7 @@ public class AdminRepairChar implements IAdminCommandHandler
}
String cmd = "UPDATE characters SET x=-84318, y=244579, z=-3730 WHERE char_name=?";
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(cmd);
statement.setString(1, parts[1]);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminWalker.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminWalker.java
index ad8d2af914..0998a90297 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminWalker.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/admincommandhandlers/AdminWalker.java
@@ -69,7 +69,7 @@ public class AdminWalker implements IAdminCommandHandler
{
_npcid = Integer.parseInt(parts[1]);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT `route_id` FROM `walker_routes` WHERE `npc_id` = " + _npcid + ";");
final ResultSet rset = statement.executeQuery();
@@ -151,7 +151,7 @@ public class AdminWalker implements IAdminCommandHandler
private void setPoint(int x, int y, int z)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/itemhandlers/HeroCustomItem.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/itemhandlers/HeroCustomItem.java
index 1d6d306b94..903937692d 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/itemhandlers/HeroCustomItem.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/itemhandlers/HeroCustomItem.java
@@ -86,7 +86,7 @@ public class HeroCustomItem implements IItemHandler
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement stmt = con.prepareStatement(INSERT_DATA);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/usercommandhandlers/ClanWarsList.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/usercommandhandlers/ClanWarsList.java
index 880066e89c..a276e81eb1 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/usercommandhandlers/ClanWarsList.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/usercommandhandlers/ClanWarsList.java
@@ -61,7 +61,7 @@ public class ClanWarsList implements IUserCommandHandler
}
SystemMessage sm;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/voicedcommandhandlers/Repair.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/voicedcommandhandlers/Repair.java
index fdc5ca8f5a..6fc58f53c9 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/voicedcommandhandlers/Repair.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/voicedcommandhandlers/Repair.java
@@ -76,7 +76,7 @@ public class Repair implements IVoicedCommandHandler, ICustomByPassHandler
{
String result = "";
final String repCharAcc = activeChar.getAccountName();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT char_name FROM characters WHERE account_name=?");
statement.setString(1, repCharAcc);
@@ -104,7 +104,7 @@ public class Repair implements IVoicedCommandHandler, ICustomByPassHandler
{
boolean result = false;
String repCharAcc = "";
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT account_name FROM characters WHERE char_name=?");
statement.setString(1, repairChar);
@@ -133,7 +133,7 @@ public class Repair implements IVoicedCommandHandler, ICustomByPassHandler
boolean result = false;
int accessLevel = 0;
int repCharJail = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT accesslevel,punish_level FROM characters WHERE char_name=?");
statement.setString(1, repairChar);
@@ -162,7 +162,7 @@ public class Repair implements IVoicedCommandHandler, ICustomByPassHandler
{
boolean result = false;
int repCharKarma = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT karma FROM characters WHERE char_name=?");
statement.setString(1, repairChar);
@@ -198,7 +198,7 @@ public class Repair implements IVoicedCommandHandler, ICustomByPassHandler
private void repairBadCharacter(String charName)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
statement = con.prepareStatement("SELECT obj_Id FROM characters WHERE char_name=?");
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/voicedcommandhandlers/Wedding.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/voicedcommandhandlers/Wedding.java
index d2df0c0294..74463ef152 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/voicedcommandhandlers/Wedding.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/handler/voicedcommandhandlers/Wedding.java
@@ -220,7 +220,7 @@ public class Wedding implements IVoicedCommandHandler
// check if target has player on friendlist
/*
- * boolean FoundOnFriendList = false; int objectId; Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(false); PreparedStatement statement; statement = con.prepareStatement("SELECT friend_id FROM character_friends WHERE char_id=?"); statement.setInt(1,
+ * boolean FoundOnFriendList = false; int objectId; Connection con = null; try { con = L2DatabaseFactory.getConnection(false); PreparedStatement statement; statement = con.prepareStatement("SELECT friend_id FROM character_friends WHERE char_id=?"); statement.setInt(1,
* ptarget.getObjectId()); ResultSet rset = statement.executeQuery(); while(rset.next()) { objectId = rset.getInt("friend_id"); if(objectId == activeChar.getObjectId()) { FoundOnFriendList = true; } } } catch(Exception e) { if(Config.ENABLE_ALL_EXCEPTIONS) e.printStackTrace();
* LOGGER.warning( "could not read friend data:" + e); } finally { CloseUtil.close(con); con = null; }
*/
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/idfactory/CompactionIDFactory.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/idfactory/CompactionIDFactory.java
index 621cdc08eb..8cb70373d2 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/idfactory/CompactionIDFactory.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/idfactory/CompactionIDFactory.java
@@ -42,7 +42,7 @@ public class CompactionIDFactory extends IdFactory
_curOID = FIRST_OID;
_freeSize = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final int[] tmp_obj_ids = extractUsedObjectIDTable();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
index 81b50fd170..002c035117 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -128,7 +128,7 @@ public abstract class IdFactory
*/
private void setAllCharacterOffline()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final Statement s2 = con.createStatement();
s2.executeUpdate("update characters set online=0");
@@ -146,7 +146,7 @@ public abstract class IdFactory
*/
private void cleanUpDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
int cleanCount = 0;
final Statement stmt = con.createStatement();
@@ -202,7 +202,7 @@ public abstract class IdFactory
*/
protected int[] extractUsedObjectIDTable() throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// create a temporary table
final Statement s = con.createStatement();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
index ea26132075..2376abad11 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
@@ -46,7 +46,7 @@ public class StackIDFactory extends IdFactory
_curOID = FIRST_OID;
_tempOID = FIRST_OID;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final int[] tmp_obj_ids = extractUsedObjectIDTable();
if (tmp_obj_ids.length > 0)
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/AuctionManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/AuctionManager.java
index 2e917f4f8c..ef91651aec 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/AuctionManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/AuctionManager.java
@@ -132,7 +132,7 @@ public class AuctionManager
private final void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
ResultSet rs;
@@ -208,7 +208,7 @@ public class AuctionManager
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
statement = con.prepareStatement("INSERT INTO `auction` VALUES " + ITEM_INIT_DATA[i]);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/AutoSaveManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/AutoSaveManager.java
index 781bdfbb42..fa46b1e021 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/AutoSaveManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/AutoSaveManager.java
@@ -162,7 +162,7 @@ public class AutoSaveManager
/*
* Perform the clean here instead of every time that the skills are saved in order to do it in once step because if skill have 0 reuse delay doesn't affect the game, just makes the table grows bigger
*/
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
statement = con.prepareStatement("DELETE FROM character_skills_save WHERE reuse_delay=0 && restore_type=1");
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
index 2cc379139b..5577d07bb0 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
@@ -104,7 +104,7 @@ public class CastleManager
private final void load()
{
LOGGER.info("Initializing CastleManager");
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("Select id from castle order by id");
final ResultSet rs = statement.executeQuery();
@@ -351,7 +351,7 @@ public class CastleManager
}
// else offline-player circlet removal
PreparedStatement statement = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
statement = con.prepareStatement("DELETE FROM items WHERE owner_id = ? and item_id = ?");
statement.setInt(1, member.getObjectId());
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
index 35352d27b4..77654347c6 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
@@ -196,7 +196,7 @@ public class CastleManorManager
{
ResultSet rs = null;
PreparedStatement statement = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
for (Castle castle : CastleManager.getInstance().getCastles())
{
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/ClanHallManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/ClanHallManager.java
index e7860b0922..19ead17fce 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/ClanHallManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/ClanHallManager.java
@@ -64,7 +64,7 @@ public class ClanHallManager
private final void load()
{
LOGGER.info("Initializing ClanHallManager");
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
int id, ownerId, lease, grade = 0;
String Name, Desc, Location;
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/CoupleManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/CoupleManager.java
index 02a616c765..c05c7d0af3 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/CoupleManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/CoupleManager.java
@@ -63,7 +63,7 @@ public class CoupleManager
// Method - Private
private final void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
ResultSet rs;
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
index aa331c32e6..2a238a160d 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
@@ -186,7 +186,7 @@ public class CursedWeaponsManager
private final void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT itemId, playerId, playerKarma, playerPkKills, nbKills, endTime FROM cursed_weapons");
ResultSet rset = statement.executeQuery();
@@ -223,7 +223,7 @@ public class CursedWeaponsManager
private final void controlPlayers()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = null;
ResultSet rset = null;
@@ -411,7 +411,7 @@ public class CursedWeaponsManager
public static void removeFromDb(int itemId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("DELETE FROM cursed_weapons WHERE itemId = ?");
statement.setInt(1, itemId);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/CustomNpcInstanceManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/CustomNpcInstanceManager.java
index 89c5d96f98..8853037425 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/CustomNpcInstanceManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/CustomNpcInstanceManager.java
@@ -103,7 +103,7 @@ public final class CustomNpcInstanceManager
"SELECT spawn,template,name,title,class_id,female,hair_style,hair_color,face,name_color,title_color, noble,hero,pvp,karma,wpn_enchant,right_hand,left_hand,gloves,chest,legs,feet,hair,hair2, pledge,cw_level,clan_id,ally_id,clan_crest,ally_crest,rnd_class,rnd_appearance,rnd_weapon,rnd_armor,max_rnd_enchant FROM npc_to_pc_polymorph",
};
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
int count = 0;
for (String selectQuery : SQL_ITEM_SELECTS)
@@ -286,7 +286,7 @@ public final class CustomNpcInstanceManager
{
String Query = "REPLACE INTO npc_to_pc_polymorph VALUES spawn,template,name,title,class_id,female,hair_style,hair_color,face,name_color,title_color, noble,hero,pvp,karma,wpn_enchant,right_hand,left_hand,gloves,chest,legs,feet,hair,hair2, pledge,cw_level,clan_id,ally_id,clan_crest,ally_crest,rnd_class,rnd_appearance,rnd_weapon,rnd_armor,max_rnd_enchant FROM npc_to_pc_polymorph";
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(Query);
ResultSet rset = statement.executeQuery();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/DimensionalRiftManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/DimensionalRiftManager.java
index e79cf96714..d21b8cba53 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/DimensionalRiftManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/DimensionalRiftManager.java
@@ -110,7 +110,7 @@ public class DimensionalRiftManager
private void loadRooms()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement s = con.prepareStatement("SELECT * FROM dimensional_rift");
ResultSet rs = s.executeQuery();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/FishingChampionshipManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/FishingChampionshipManager.java
index c5e3ef6948..7b41ce110f 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/FishingChampionshipManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/FishingChampionshipManager.java
@@ -87,7 +87,7 @@ public class FishingChampionshipManager
{
_enddate = GlobalVariablesManager.getInstance().getLong("fishChampionshipEnd", 0);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(SELECT);
ResultSet rs = statement.executeQuery();
@@ -367,7 +367,7 @@ public class FishingChampionshipManager
{
GlobalVariablesManager.getInstance().set("fishChampionshipEnd", _enddate);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(DELETE);
statement.execute();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/FortManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
index 525d735047..2cba406f8c 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
@@ -87,7 +87,7 @@ public class FortManager
// Method - Private
private final void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
ResultSet rs;
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/FortSiegeGuardManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/FortSiegeGuardManager.java
index 8f2ecfff00..21b35de0bb 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/FortSiegeGuardManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/FortSiegeGuardManager.java
@@ -121,7 +121,7 @@ public class FortSiegeGuardManager
*/
public void removeMerc(int npcId, int x, int y, int z)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("Delete From fort_siege_guards Where npcId = ? And x = ? AND y = ? AND z = ? AND isHired = 1");
statement.setInt(1, npcId);
@@ -143,7 +143,7 @@ public class FortSiegeGuardManager
*/
public void removeMercs()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("Delete From fort_siege_guards Where fortId = ? And isHired = 1");
statement.setInt(1, _fort.getFortId());
@@ -207,7 +207,7 @@ public class FortSiegeGuardManager
*/
private void loadSiegeGuard()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT * FROM fort_siege_guards Where fortId = ? ");
statement.setInt(1, _fort.getFortId());
@@ -258,7 +258,7 @@ public class FortSiegeGuardManager
*/
private void saveSiegeGuard(int x, int y, int z, int heading, int npcId, int isHire)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("Insert Into fort_siege_guards (fortId, npcId, x, y, z, heading, respawnDelay, isHired) Values (?, ?, ?, ?, ?, ?, ?, ?)");
statement.setInt(1, _fort.getFortId());
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
index 7a80290a85..8038f75223 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
@@ -144,7 +144,7 @@ public class FortSiegeManager
}
boolean register = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT clan_id FROM fortsiege_clans where clan_id=? and fort_id=?");
statement.setInt(1, clan.getClanId());
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/FourSepulchersManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/FourSepulchersManager.java
index 7a792365fc..da79cc3ee1 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/FourSepulchersManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/FourSepulchersManager.java
@@ -567,7 +567,7 @@ public class FourSepulchersManager extends GrandBossManager
{
_mysteriousBoxSpawns.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY id");
statement.setInt(1, 0);
@@ -651,7 +651,7 @@ public class FourSepulchersManager extends GrandBossManager
_physicalMonsters.clear();
int loaded = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement1 = con.prepareStatement("SELECT Distinct key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY key_npc_id");
statement1.setInt(1, 1);
@@ -716,7 +716,7 @@ public class FourSepulchersManager extends GrandBossManager
_magicalMonsters.clear();
int loaded = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement1 = con.prepareStatement("SELECT Distinct key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY key_npc_id");
statement1.setInt(1, 2);
@@ -782,7 +782,7 @@ public class FourSepulchersManager extends GrandBossManager
_archonSpawned.clear();
int loaded = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement1 = con.prepareStatement("SELECT Distinct key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY key_npc_id");
statement1.setInt(1, 5);
@@ -848,7 +848,7 @@ public class FourSepulchersManager extends GrandBossManager
_emperorsGraveNpcs.clear();
int loaded = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement1 = con.prepareStatement("SELECT Distinct key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY key_npc_id");
statement1.setInt(1, 6);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
index 63cb74f74e..3de347722e 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
@@ -50,7 +50,7 @@ public final class GlobalVariablesManager extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery(SELECT_QUERY))
{
@@ -81,7 +81,7 @@ public final class GlobalVariablesManager extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement del = con.createStatement();
PreparedStatement st = con.prepareStatement(INSERT_QUERY))
{
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
index f6f983a278..2cbc8c9937 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
@@ -93,7 +93,7 @@ public class GrandBossManager
_bosses = new ConcurrentHashMap<>();
_storedInfo = new ConcurrentHashMap<>();
_bossStatus = new ConcurrentHashMap<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT * from grandboss_data ORDER BY boss_id");
final ResultSet rset = statement.executeQuery();
@@ -152,7 +152,7 @@ public class GrandBossManager
zones.put(zone.getId(), new CopyOnWriteArrayList());
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT * from grandboss_list ORDER BY player_id");
final ResultSet rset = statement.executeQuery();
@@ -287,7 +287,7 @@ public class GrandBossManager
private void fastStoreToDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
for (Integer bossId : _storedInfo.keySet())
{
@@ -333,7 +333,7 @@ public class GrandBossManager
private void storeToDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement delete = con.prepareStatement(DELETE_GRAND_BOSS_LIST);
delete.executeUpdate();
@@ -406,7 +406,7 @@ public class GrandBossManager
private void updateDb(int bossId, boolean statusOnly)
{
PreparedStatement statement = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final L2GrandBossInstance boss = _bosses.get(bossId);
final StatsSet info = _storedInfo.get(bossId);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
index 083b26bc54..eee8f1fb4a 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
@@ -83,7 +83,7 @@ public class ItemsOnGroundManager
// if DestroyPlayerDroppedItem was previously false, items curently protected will be added to ItemsAutoDestroy
if (Config.DESTROY_DROPPED_PLAYER_ITEM)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
String str = null;
if (!Config.DESTROY_EQUIPABLE_PLAYER_ITEM)
@@ -108,7 +108,7 @@ public class ItemsOnGroundManager
}
// Add items to world
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
Statement s = con.createStatement();
ResultSet result;
@@ -218,7 +218,7 @@ public class ItemsOnGroundManager
public void emptyTable()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement del = con.prepareStatement("delete from itemsonground");
del.execute();
@@ -255,7 +255,7 @@ public class ItemsOnGroundManager
continue; // Cursed Items not saved to ground, prevent double save
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("insert into itemsonground(object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable) values(?,?,?,?,?,?,?,?,?)");
statement.setInt(1, item.getObjectId());
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/MercTicketManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/MercTicketManager.java
index ad4968bd75..314fcb385b 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/MercTicketManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/MercTicketManager.java
@@ -688,7 +688,7 @@ public class MercTicketManager
private final void load()
{
// load merc tickets into the world
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
ResultSet rs;
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/RaidBossPointsManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/RaidBossPointsManager.java
index 930d8cfa16..85c21bbeac 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/RaidBossPointsManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/RaidBossPointsManager.java
@@ -46,7 +46,7 @@ public class RaidBossPointsManager
{
_list = new HashMap<>();
final List _chars = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT * FROM `character_raid_points`");
ResultSet rset = statement.executeQuery();
@@ -83,7 +83,7 @@ public class RaidBossPointsManager
public static final void updatePointsInDB(L2PcInstance player, int raidId, int points)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
statement = con.prepareStatement("REPLACE INTO character_raid_points (`charId`,`boss_id`,`points`) VALUES (?,?,?)");
@@ -154,7 +154,7 @@ public class RaidBossPointsManager
public static final void cleanUp()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
statement = con.prepareStatement("DELETE from character_raid_points WHERE charId > 0");
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/RaidBossSpawnManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/RaidBossSpawnManager.java
index 5a58f348d1..eb8c3f7174 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/RaidBossSpawnManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/RaidBossSpawnManager.java
@@ -79,7 +79,7 @@ public class RaidBossSpawnManager
_storedInfo.clear();
_schedules.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rset = s.executeQuery("SELECT * FROM raidboss_spawnlist ORDER BY boss_id"))
{
@@ -283,7 +283,7 @@ public class RaidBossSpawnManager
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO raidboss_spawnlist (boss_id,amount,loc_x,loc_y,loc_z,heading,respawn_time,currentHp,currentMp) VALUES(?,?,?,?,?,?,?,?,?)"))
{
statement.setInt(1, spawnDat.getNpcId());
@@ -343,7 +343,7 @@ public class RaidBossSpawnManager
if (updateDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM raidboss_spawnlist WHERE boss_id=?"))
{
ps.setInt(1, bossId);
@@ -362,7 +362,7 @@ public class RaidBossSpawnManager
*/
void updateDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE raidboss_spawnlist SET respawn_time = ?, currentHP = ?, currentMP = ? WHERE boss_id = ?"))
{
for (Integer bossId : _storedInfo.keySet())
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
index 1326e1b3da..281d7553c8 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
@@ -117,7 +117,7 @@ public class SiegeGuardManager
*/
public void removeMerc(int npcId, int x, int y, int z)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("Delete From castle_siege_guards Where npcId = ? And x = ? AND y = ? AND z = ? AND isHired = 1");
statement.setInt(1, npcId);
@@ -139,7 +139,7 @@ public class SiegeGuardManager
*/
public void removeMercs()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("Delete From castle_siege_guards Where castleId = ? And isHired = 1");
statement.setInt(1, _castle.getCastleId());
@@ -196,7 +196,7 @@ public class SiegeGuardManager
*/
private void loadSiegeGuard()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT * FROM castle_siege_guards Where castleId = ? And isHired = ?");
statement.setInt(1, _castle.getCastleId());
@@ -255,7 +255,7 @@ public class SiegeGuardManager
*/
private void saveSiegeGuard(int x, int y, int z, int heading, int npcId, int isHire)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("Insert Into castle_siege_guards (castleId, npcId, x, y, z, heading, respawnDelay, isHired) Values (?, ?, ?, ?, ?, ?, ?, ?)");
statement.setInt(1, _castle.getCastleId());
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
index 0258acb06a..11d32d847d 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
@@ -166,7 +166,7 @@ public class SiegeManager
boolean register = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT clan_id FROM siege_clans where clan_id=? and castle_id=?");
statement.setInt(1, clan.getClanId());
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/BlockList.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/BlockList.java
index 33879aaf67..2be6d934a7 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/BlockList.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/BlockList.java
@@ -70,7 +70,7 @@ public class BlockList
{
List list = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT friend_id FROM character_friends WHERE char_id = ? AND relation = 1");
statement.setInt(1, ObjId);
@@ -100,7 +100,7 @@ public class BlockList
private void updateInDB(int targetId, boolean state)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/CursedWeapon.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/CursedWeapon.java
index 981cff77cd..c8c1b06bd2 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/CursedWeapon.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/CursedWeapon.java
@@ -114,7 +114,7 @@ public class CursedWeapon
// Remove from Db
LOGGER.info(_name + " being removed offline.");
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Delete the item
PreparedStatement statement = con.prepareStatement("DELETE FROM items WHERE owner_id=? AND item_id=?");
@@ -470,7 +470,7 @@ public class CursedWeapon
LOGGER.info("CursedWeapon: Saving data to disk.");
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Delete previous datas
PreparedStatement statement = con.prepareStatement("DELETE FROM cursed_weapons WHERE itemId = ?");
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/Inventory.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/Inventory.java
index 280ef57082..9c9edca334 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/Inventory.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/Inventory.java
@@ -1630,7 +1630,7 @@ public abstract class Inventory extends ItemContainer
@Override
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT object_id FROM items WHERE owner_id=? AND (loc=? OR loc=?) ORDER BY object_id DESC");
statement.setInt(1, getOwner().getObjectId());
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/ItemContainer.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/ItemContainer.java
index 414ed8707a..b5266037e1 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/ItemContainer.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/ItemContainer.java
@@ -659,7 +659,7 @@ public abstract class ItemContainer
final int ownerid = getOwnerId();
final String baseLocation = getBaseLocation().name();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT object_id FROM items WHERE owner_id=? AND (loc=?) ORDER BY object_id DESC");
statement.setInt(1, ownerid);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/L2Augmentation.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/L2Augmentation.java
index 50cdf85649..4c26078b68 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/L2Augmentation.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/L2Augmentation.java
@@ -121,7 +121,7 @@ public final class L2Augmentation
private void saveAugmentationData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("INSERT INTO augmentations (item_id,attributes,skill,level) VALUES (?,?,?,?)");
statement.setInt(1, _item.getObjectId());
@@ -155,7 +155,7 @@ public final class L2Augmentation
}
// delete the augmentation from the database
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("DELETE FROM augmentations WHERE item_id=?");
statement.setInt(1, _item.getObjectId());
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/L2Clan.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/L2Clan.java
index 368febba26..35df84a3f8 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/L2Clan.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/L2Clan.java
@@ -759,7 +759,7 @@ public class L2Clan
public void updateClanInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET leader_id=?,ally_id=?,ally_name=?,reputation_score=?,ally_penalty_expiry_time=?,ally_penalty_type=?,char_penalty_expiry_time=?,dissolving_expiry_time=? WHERE clan_id=?");
statement.setInt(1, getLeaderId());
@@ -787,7 +787,7 @@ public class L2Clan
public void store()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("INSERT INTO clan_data (clan_id,clan_name,clan_level,hasCastle,ally_id,ally_name,leader_id,crest_id,crest_large_id,ally_crest_id) values (?,?,?,?,?,?,?,?,?,?)");
statement.setInt(1, _clanId);
@@ -816,7 +816,7 @@ public class L2Clan
private void removeMemberInDatabase(L2ClanMember member, long clanJoinExpiryTime, long clanCreateExpiryTime)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("UPDATE characters SET clanid=0, title=?, clan_join_expiry_time=?, clan_create_expiry_time=?, clan_privs=0, wantspeace=0, subpledge=0, lvl_joined_academy=0, apprentice=0, sponsor=0 WHERE obj_Id=?");
statement.setString(1, "");
@@ -849,7 +849,7 @@ public class L2Clan
private void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
L2ClanMember member;
@@ -953,7 +953,7 @@ public class L2Clan
notice = notice.substring(0, MAX_NOTICE_LENGTH - 1);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET enabled=?,notice=? WHERE clan_id=?");
statement.setString(1, (enabled) ? "true" : "false");
@@ -1020,7 +1020,7 @@ public class L2Clan
intro = intro.substring(0, MAX_INTRODUCTION_LENGTH - 1);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET introduction=? WHERE clan_id=?");
statement.setString(1, intro);
@@ -1039,7 +1039,7 @@ public class L2Clan
private void restoreSkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT skill_id,skill_level FROM clan_skills WHERE clan_id=?");
statement.setInt(1, _clanId);
@@ -1116,7 +1116,7 @@ public class L2Clan
PreparedStatement statement;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (oldSkill != null)
{
@@ -1512,7 +1512,7 @@ public class L2Clan
private void restoreSubPledges()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT sub_pledge_id,name,leader_name FROM clan_subpledges WHERE clan_id=?");
statement.setInt(1, _clanId);
@@ -1623,7 +1623,7 @@ public class L2Clan
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("INSERT INTO clan_subpledges (clan_id,sub_pledge_id,name,leader_name) values (?,?,?,?)");
statement.setInt(1, _clanId);
@@ -1712,7 +1712,7 @@ public class L2Clan
public void updateSubPledgeInDB(int pledgeType)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("UPDATE clan_subpledges SET leader_name=?, name=? WHERE clan_id=? AND sub_pledge_id=?");
statement.setString(1, getSubPledge(pledgeType).getLeaderName());
@@ -1736,7 +1736,7 @@ public class L2Clan
private void restoreRankPrivs()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT privs,rank,party FROM clan_privs WHERE clan_id=?");
statement.setInt(1, _clanId);
@@ -1792,7 +1792,7 @@ public class L2Clan
{
_privs.get(rank).setPrivs(privs);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("INSERT INTO clan_privs (clan_id,rank,party,privs) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE privs = ?");
statement.setInt(1, _clanId);
@@ -1829,7 +1829,7 @@ public class L2Clan
{
_privs.put(rank, new RankPrivs(rank, 0, privs));
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("INSERT INTO clan_privs (clan_id,rank,party,privs) VALUES (?,?,?,?)");
statement.setInt(1, _clanId);
@@ -1960,7 +1960,7 @@ public class L2Clan
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET auction_bid_at=? WHERE clan_id=?");
statement.setInt(1, id);
@@ -2521,7 +2521,7 @@ public class L2Clan
public void changeLevel(int level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET clan_level = ? WHERE clan_id = ?");
statement.setInt(1, level);
@@ -2567,7 +2567,7 @@ public class L2Clan
public void setAllyCrest(int crestId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
setAllyCrestId(crestId);
PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET ally_crest_id = ? WHERE clan_id = ?");
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/L2ClanMember.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/L2ClanMember.java
index 91a47bef6e..87f8d1694c 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/L2ClanMember.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/L2ClanMember.java
@@ -213,7 +213,7 @@ public class L2ClanMember
public void updatePledgeType()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("UPDATE characters SET subpledge=? WHERE obj_id=?");
statement.setLong(1, _pledgeType);
@@ -260,7 +260,7 @@ public class L2ClanMember
*/
public void updatePowerGrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET power_grade=? WHERE obj_id=?");
statement.setLong(1, _powerGrade);
@@ -545,7 +545,7 @@ public class L2ClanMember
public void saveApprenticeAndSponsor(int apprentice, int sponsor)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("UPDATE characters SET apprentice=?,sponsor=? WHERE obj_Id=?");
statement.setInt(1, apprentice);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/L2TradeList.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/L2TradeList.java
index 79801bf91e..2174b0fc56 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/L2TradeList.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/L2TradeList.java
@@ -292,7 +292,7 @@ public class L2TradeList
* update.addModifiedItem(playerItem); } else { L2World world = L2World.getInstance(); world.removeObject(playerItem); update.addRemovedItem(playerItem); world = null; } player.sendPacket(update); update = null; update = new InventoryUpdate(); if(recieverItem.getLastChange() ==
* L2ItemInstance.MODIFIED) { update.addModifiedItem(recieverItem); } else { update.addNewItem(recieverItem); } reciever.sendPacket(update); } // weight status update both player and reciever StatusUpdate su = new StatusUpdate(player.getObjectId()); su.addAttribute(StatusUpdate.CUR_LOAD,
* player.getCurrentLoad()); player.sendPacket(su); su = null; su = new StatusUpdate(reciever.getObjectId()); su.addAttribute(StatusUpdate.CUR_LOAD, reciever.getCurrentLoad()); reciever.sendPacket(su); su = null; playersInv = null; recieverInv = null; playerItem = null; recieverItem = null; temp
- * = null; newitem = null; update = null; itemTable = null; } private void changePetItemObjectId(int oldObjectId, int newObjectId) { Connection con = null; try { con = L2DatabaseFactory.getInstance().getConnection(false); PreparedStatement statement =
+ * = null; newitem = null; update = null; itemTable = null; } private void changePetItemObjectId(int oldObjectId, int newObjectId) { Connection con = null; try { con = L2DatabaseFactory.getConnection(false); PreparedStatement statement =
* con.prepareStatement("UPDATE pets SET item_obj_id = ? WHERE item_obj_id = ?"); statement.setInt(1, newObjectId); statement.setInt(2, oldObjectId); statement.executeUpdate(); DatabaseUtils.close(statement); statement = null; } catch(Exception e) {
* LOGGER.warning("could not change pet item object id: " + e); } finally { CloseUtil.close(con); con = null; } }
*/
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/MacroList.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/MacroList.java
index 1c02d2c1b1..8252540eab 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/MacroList.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/MacroList.java
@@ -139,7 +139,7 @@ public class MacroList
private void registerMacroInDb(L2Macro macro)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("INSERT INTO character_macroses (char_obj_id,id,icon,name,descr,acronym,commands) values(?,?,?,?,?,?,?)");
statement.setInt(1, _owner.getObjectId());
@@ -192,7 +192,7 @@ public class MacroList
*/
private void deleteMacroFromDb(L2Macro macro)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("DELETE FROM character_macroses WHERE char_obj_id=? AND id=?");
statement.setInt(1, _owner.getObjectId());
@@ -209,7 +209,7 @@ public class MacroList
public void restore()
{
_macroses.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT char_obj_id, id, icon, name, descr, acronym, commands FROM character_macroses WHERE char_obj_id=?");
statement.setInt(1, _owner.getObjectId());
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/PcInventory.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/PcInventory.java
index 322f2896c4..20db5f6b82 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/PcInventory.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/PcInventory.java
@@ -670,7 +670,7 @@ public class PcInventory extends Inventory
public static int[][] restoreVisibleInventory(int objectId)
{
final int[][] paperdoll = new int[0x12][3];
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement2 = con.prepareStatement("SELECT object_id,item_id,loc_data,enchant_level FROM items WHERE owner_id=? AND loc='PAPERDOLL'");
statement2.setInt(1, objectId);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/ShortCuts.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/ShortCuts.java
index 7e45a1d555..0d2b7b7083 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/ShortCuts.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/ShortCuts.java
@@ -80,7 +80,7 @@ public class ShortCuts
deleteShortCutFromDb(oldShortCut);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("REPLACE INTO character_shortcuts (char_obj_id,slot,page,type,shortcut_id,level,class_index) values(?,?,?,?,?,?,?)");
statement.setInt(1, _owner.getObjectId());
@@ -157,7 +157,7 @@ public class ShortCuts
*/
private void deleteShortCutFromDb(L2ShortCut shortcut)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE char_obj_id=? AND slot=? AND page=? AND class_index=?");
statement.setInt(1, _owner.getObjectId());
@@ -176,7 +176,7 @@ public class ShortCuts
public void restore()
{
_shortCuts.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT char_obj_id, slot, page, type, shortcut_id, level FROM character_shortcuts WHERE char_obj_id=? AND class_index=?");
statement.setInt(1, _owner.getObjectId());
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2BoxInstance.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2BoxInstance.java
index b0e818a3ed..92c06619f9 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2BoxInstance.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2BoxInstance.java
@@ -177,7 +177,7 @@ public class L2BoxInstance extends L2NpcInstance
public boolean hasAccess(String player)
{
boolean result = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement st = con.prepareStatement("SELECT spawn, charname FROM boxaccess WHERE charname=? AND spawn=?");
st.setString(1, player);
@@ -202,7 +202,7 @@ public class L2BoxInstance extends L2NpcInstance
public List getAccess()
{
final List acl = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement st = con.prepareStatement(LIST_GRANT);
st.setInt(1, getSpawn().getId());
@@ -225,7 +225,7 @@ public class L2BoxInstance extends L2NpcInstance
public boolean grantAccess(String player, boolean what)
{
boolean result = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
String _query;
if (what)
@@ -387,7 +387,7 @@ public class L2BoxInstance extends L2NpcInstance
private Set getItems(String drawer)
{
final Set it = new HashSet<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT id, spawn, npcid, drawer, itemid, name, count, enchant FROM boxes where spawn=? and npcid=? and drawer=?");
statement.setInt(1, getSpawn().getId());
@@ -415,7 +415,7 @@ public class L2BoxInstance extends L2NpcInstance
* Integer.parseInt(part[0].substring(1)); int count = Integer.parseInt(part[1]); if (count <= 0) continue; int realCount = player.getInventory().getItemByItemId(id).getCount(); if (count < realCount) realCount = count; L2ItemInstance item = player.getInventory().destroyItemByItemId("Box",
* id, realCount, player, this); // other than previous l2j, destroyItemByItemId does not return the count destroyed // and we cannot just use the returned item as we cannot change the count L2ItemInstance newItem = ItemTable.getInstance().createItem(id); newItem.setCount(realCount);
* newItem.setEnchantLevel(item.getEnchantLevel()); putItemInBox(player, drawername, newItem); } catch (Exception e) { LOGGER.fine("putInBox "+command+" failed: "+e); } } } private void putItemInBox(L2PcInstance player, String drawer, L2ItemInstance item) { String charname =
- * player.getName(); java.sql.Connection con = null; int foundId = 0; int foundCount = 0; try { con = L2DatabaseFactory.getInstance().getConnection(false); if (item.isStackable()) { PreparedStatement st2 =
+ * player.getName(); java.sql.Connection con = null; int foundId = 0; int foundCount = 0; try { con = L2DatabaseFactory.getConnection(false); if (item.isStackable()) { PreparedStatement st2 =
* con.prepareStatement("SELECT id,count FROM boxes where spawn=? and npcid=? and drawer=? and itemid=?"); st2.setInt(1, getSpawn().getId()); st2.setInt(2, getNpcId()); st2.setString(3, drawer); st2.setInt(4, item.getItemId()); ResultSet rs = st2.executeQuery(); if (rs.next()) { foundId =
* rs.getInt("id"); foundCount = rs.getInt("count"); } rs.close(); st2.close(); } if (foundCount == 0) { PreparedStatement statement = con.prepareStatement("INSERT INTO boxes (spawn,npcid,drawer,itemid,name,count,enchant) VALUES(?,?,?,?,?,?,?)"); statement.setInt(1, getSpawn().getId());
* statement.setInt(2, getNpcId()); statement.setString(3, drawer); statement.setInt(4, item.getItemId()); statement.setString(5, item.getItem().getName()); statement.setInt(6, item.getCount()); statement.setInt(7, item.getEnchantLevel()); statement.execute(); statement.close(); } else {
@@ -429,7 +429,7 @@ public class L2BoxInstance extends L2NpcInstance
* NOTE: Item storing in box is currently not implemented String[] cmd = command.split(","); if (cmd.length<=1) return; String drawername = cmd[0]; L2BoxItem bi = null; for (int i = 1; i < cmd.length; i++) { String[] part = cmd[i].split(" "); if (part == null || part.length < 2) continue;
* try { int id = Integer.parseInt(part[0].substring(1)); int count = Integer.parseInt(part[1]); if (count <= 0) continue; L2ItemInstance item = ItemTable.getInstance().createItem(id); item.setCount(count); bi = takeItemOutBox(player, drawername, item); if (bi.count > 0) {
* item.setCount(bi.count); item.setEnchantLevel(bi.enchant); player.getInventory().addItem("Box", item, player, this); } } catch (Exception e) { LOGGER.fine("takeOutBox "+command+" failed: "+e); } } } private L2BoxItem takeItemOutBox(L2PcInstance player, String drawer, L2ItemInstance item)
- * { String charname = player.getName(); java.sql.Connection con = null; L2BoxItem bi = new L2BoxItem(); bi.count = 0; try { con = L2DatabaseFactory.getInstance().getConnection(false); PreparedStatement statement =
+ * { String charname = player.getName(); java.sql.Connection con = null; L2BoxItem bi = new L2BoxItem(); bi.count = 0; try { con = L2DatabaseFactory.getConnection(false); PreparedStatement statement =
* con.prepareStatement("SELECT id,count,enchant FROM boxes WHERE spawn=? AND npcid=? AND drawer=? AND itemid=? AND count>=?"); statement.setInt(1, getSpawn().getId()); statement.setInt(2, getNpcId()); statement.setString(3, drawer); statement.setInt(4, item.getItemId()); statement.setInt(5,
* item.getCount()); ResultSet rs = statement.executeQuery(); while (rs.next()) { if (rs.getInt("count") == item.getCount()) { bi.count = item.getCount(); bi.itemid = item.getItemId(); bi.enchant = rs.getInt("enchant"); PreparedStatement st2 =
* con.prepareStatement("DELETE FROM boxes WHERE id=?"); st2.setInt(1, rs.getInt("id")); st2.execute(); st2.close(); break; } if (rs.getInt("count") > item.getCount()) { bi.count = item.getCount(); bi.itemid = item.getItemId(); bi.enchant = rs.getInt("enchant"); PreparedStatement st2 =
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2ItemInstance.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2ItemInstance.java
index 66389b4d11..f7e9ca3b1d 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2ItemInstance.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2ItemInstance.java
@@ -1167,7 +1167,7 @@ public final class L2ItemInstance extends L2Object
public static L2ItemInstance restoreFromDb(int objectId)
{
L2ItemInstance inst = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT owner_id, object_id, item_id, count, enchant_level, loc, loc_data, price_sell, price_buy, custom_type1, custom_type2, mana_left FROM items WHERE object_id = ?");
statement.setInt(1, objectId);
@@ -1368,7 +1368,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("UPDATE items SET owner_id=?,count=?,loc=?,loc_data=?,enchant_level=?,price_sell=?,price_buy=?,custom_type1=?,custom_type2=?,mana_left=? WHERE object_id = ?");
statement.setInt(1, _ownerId);
@@ -1413,7 +1413,7 @@ public final class L2ItemInstance extends L2Object
assert !_existsInDb && (getObjectId() != 0);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("INSERT INTO items (owner_id,item_id,count,loc,loc_data,enchant_level,price_sell,price_buy,object_id,custom_type1,custom_type2,mana_left) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)");
statement.setInt(1, _ownerId);
@@ -1469,7 +1469,7 @@ public final class L2ItemInstance extends L2Object
_augmentation.deleteAugmentationData();
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("DELETE FROM items WHERE object_id=?");
statement.setInt(1, getObjectId());
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
index ee6a03aaef..7587f4639b 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
@@ -1362,7 +1362,7 @@ public final class L2PcInstance extends L2Playable
public int getVotePoints()
{
int votePoints = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
statement = con.prepareStatement("select votePoints from accounts where login=?");
@@ -1388,7 +1388,7 @@ public final class L2PcInstance extends L2Playable
*/
public void setVotePoints(int points)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
statement = con.prepareStatement("update accounts set votePoints=" + points + " where login='" + _accountName + "'");
@@ -1407,7 +1407,7 @@ public final class L2PcInstance extends L2Playable
public int getVoteTime()
{
int lastVote = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
statement = con.prepareStatement("select lastVote from accounts where login=?");
@@ -2851,7 +2851,7 @@ public final class L2PcInstance extends L2Playable
{
if (Config.ALT_RECOMMEND)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(ADD_CHAR_RECOM);
statement.setInt(1, getObjectId());
@@ -8301,7 +8301,7 @@ public final class L2PcInstance extends L2Playable
String killer = PlayerWhoKilled.getName();
String killed = getName();
int kills = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT kills FROM pkkills WHERE killerId=? AND killedId=?");
statement.setString(1, killer);
@@ -8323,7 +8323,7 @@ public final class L2PcInstance extends L2Playable
{
kills++;
String UPDATE_PKKILLS = "UPDATE pkkills SET kills=? WHERE killerId=? AND killedId=?";
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(UPDATE_PKKILLS);
statement.setInt(1, kills);
@@ -8342,7 +8342,7 @@ public final class L2PcInstance extends L2Playable
else
{
String ADD_PKKILLS = "INSERT INTO pkkills (killerId,killedId,kills) VALUES (?,?,?)";
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(ADD_PKKILLS);
statement.setString(1, killer);
@@ -9779,7 +9779,7 @@ public final class L2PcInstance extends L2Playable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("UPDATE characters SET online=?, lastAccess=? WHERE obj_id=?");
statement.setInt(1, isOnline());
@@ -9799,7 +9799,7 @@ public final class L2PcInstance extends L2Playable
*/
public void updateIsIn7sDungeonStatus()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("UPDATE characters SET isIn7sDungeon=?, lastAccess=? WHERE obj_id=?");
statement.setInt(1, isIn7sDungeon() ? 1 : 0);
@@ -9819,7 +9819,7 @@ public final class L2PcInstance extends L2Playable
*/
public void updateFirstLog()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET first_log=? WHERE obj_id=?");
@@ -9852,7 +9852,7 @@ public final class L2PcInstance extends L2Playable
{
boolean output = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
statement = con.prepareStatement("INSERT INTO characters (account_name,obj_Id,char_name,level,maxHp,curHp,maxCp,curCp,maxMp,curMp,acc,crit,evasion,mAtk,mDef,mSpd,pAtk,pDef,pSpd,runSpd,walkSpd,str,con,dex,_int,men,wit,face,hairStyle,hairColor,sex,movement_multiplier,attack_speed_multiplier,colRad,colHeight,exp,sp,karma,pvpkills,pkkills,clanid,maxload,race,classid,deletetime,cancraft,title,accesslevel,online,isin7sdungeon,clan_privs,wantspeace,base_class,newbie,nobless,power_grade,last_recom_date,name_color,title_color,aio,aio_end) values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)");
@@ -9952,7 +9952,7 @@ public final class L2PcInstance extends L2Playable
double curCp = 0;
double curMp = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement(RESTORE_CHARACTER);
statement.setInt(1, objectId);
@@ -10270,7 +10270,7 @@ public final class L2PcInstance extends L2Playable
*/
private static boolean restoreSubClassData(L2PcInstance player)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_SUBCLASSES);
statement.setInt(1, player.getObjectId());
@@ -10348,7 +10348,7 @@ public final class L2PcInstance extends L2Playable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("DELETE FROM character_recipebook WHERE char_id=?");
statement.setInt(1, getObjectId());
@@ -10388,7 +10388,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restoreRecipeBook()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT id, type FROM character_recipebook WHERE char_id=?");
statement.setInt(1, getObjectId());
@@ -10548,7 +10548,7 @@ public final class L2PcInstance extends L2Playable
*/
private synchronized void storeCharBase()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Get the exp, level, and sp of base class to store in base table
final int currentClassIndex = getClassIndex();
@@ -10668,7 +10668,7 @@ public final class L2PcInstance extends L2Playable
*/
private synchronized void storeCharSub()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
@@ -10704,7 +10704,7 @@ public final class L2PcInstance extends L2Playable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
// Delete all current stored effects for char to avoid dupe
@@ -10884,7 +10884,7 @@ public final class L2PcInstance extends L2Playable
// Remove a skill from the L2Character and its Func objects from calculator set of the L2Character
final L2Skill oldSkill = super.removeSkill(skill);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
@@ -10933,7 +10933,7 @@ public final class L2PcInstance extends L2Playable
classIndex = newClassIndex;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = null;
if ((oldSkill != null) && (newSkill != null))
@@ -11097,7 +11097,7 @@ public final class L2PcInstance extends L2Playable
*/
public synchronized void restoreSkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (!Config.KEEP_SUBCLASS_SKILLS)
{
@@ -11173,7 +11173,7 @@ public final class L2PcInstance extends L2Playable
*/
public void restoreEffects(boolean activateEffects)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
ResultSet rset;
@@ -11288,7 +11288,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restoreHenna()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_HENNAS);
statement.setInt(1, getObjectId());
@@ -11343,7 +11343,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restoreRecom()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_RECOMS);
statement.setInt(1, getObjectId());
@@ -11409,7 +11409,7 @@ public final class L2PcInstance extends L2Playable
L2HennaInstance henna = _henna[slot];
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(DELETE_CHAR_HENNA);
statement.setInt(1, getObjectId());
@@ -11467,7 +11467,7 @@ public final class L2PcInstance extends L2Playable
// Calculate Henna modifiers of this L2PcInstance
recalcHennaStats();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(ADD_CHAR_HENNA);
statement.setInt(1, getObjectId());
@@ -13790,7 +13790,7 @@ public final class L2PcInstance extends L2Playable
final String HERO_COUNT = "SELECT count FROM heroes WHERE char_name=?";
int _count = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(HERO_COUNT);
statement.setString(1, getName());
@@ -14383,7 +14383,7 @@ public final class L2PcInstance extends L2Playable
boolean output = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(ADD_CHAR_SUBCLASS);
statement.setInt(1, getObjectId());
@@ -14468,7 +14468,7 @@ public final class L2PcInstance extends L2Playable
boolean output = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
@@ -15085,7 +15085,7 @@ public final class L2PcInstance extends L2Playable
{
if (Config.ALT_RECOMMEND)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(DELETE_CHAR_RECOMS);
statement.setInt(1, getObjectId());
@@ -16453,7 +16453,7 @@ public final class L2PcInstance extends L2Playable
{
_friendList.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT friend_id FROM character_friends WHERE char_id = ? AND relation = 0");
statement.setInt(1, getObjectId());
@@ -17417,7 +17417,7 @@ public final class L2PcInstance extends L2Playable
int donator = 0;
long hero_end = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(STATUS_DATA_GET);
statement.setInt(1, getObjectId());
@@ -19129,7 +19129,7 @@ public final class L2PcInstance extends L2Playable
{
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET sex=? WHERE obj_Id=?");
statement.setInt(1, player.getAppearance().getSex() ? 1 : 0);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
index a0e659f495..5ec9a1c11d 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
@@ -871,7 +871,7 @@ public class L2PetInstance extends L2Summon
}
// pet control item no longer exists, delete the pet from the db
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?");
statement.setInt(1, _controlItemId);
@@ -977,7 +977,7 @@ public class L2PetInstance extends L2Summon
{
L2PetInstance pet = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (template.type.compareToIgnoreCase("L2BabyPet") == 0)
{
@@ -1048,7 +1048,7 @@ public class L2PetInstance extends L2Summon
req = "UPDATE pets SET name=?,level=?,curHp=?,curMp=?,exp=?,sp=?,karma=?,pkkills=?,fed=? WHERE item_obj_id = ?";
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(req);
statement.setString(1, getName());
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/Auction.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/Auction.java
index ca748f4cd7..191e9d4833 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/Auction.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/Auction.java
@@ -266,7 +266,7 @@ public class Auction
*/
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
ResultSet rs;
@@ -308,7 +308,7 @@ public class Auction
_highestBidderName = "";
_highestBidderMaxBid = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
ResultSet rs;
@@ -373,7 +373,7 @@ public class Auction
*/
private void saveAuctionDate()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("Update auction set endDate = ? where id = ?");
statement.setLong(1, _endDate);
@@ -461,7 +461,7 @@ public class Auction
*/
private void updateInDB(L2PcInstance bidder, int bid)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
@@ -523,7 +523,7 @@ public class Auction
*/
private void removeBids()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
@@ -559,7 +559,7 @@ public class Auction
public void deleteAuctionFromDB()
{
AuctionManager.getInstance().getAuctions().remove(this);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
statement = con.prepareStatement("DELETE FROM auction WHERE itemId=?");
@@ -623,7 +623,7 @@ public class Auction
*/
public synchronized void cancelBid(int bidder)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
@@ -660,7 +660,7 @@ public class Auction
public void confirmAuction()
{
AuctionManager.getInstance().getAuctions().add(this);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
statement = con.prepareStatement("INSERT INTO auction (id, sellerId, sellerName, sellerClanName, itemType, itemId, itemObjectId, itemName, itemQuantity, startingBid, currentBid, endDate) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)");
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/ClanHall.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
index 69fcb6f3e2..16c68e0140 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
@@ -332,7 +332,7 @@ public class ClanHall
*/
public void dbSave(boolean newFunction)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
@@ -728,7 +728,7 @@ public class ClanHall
*/
private void loadFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
ResultSet rs;
@@ -757,7 +757,7 @@ public class ClanHall
public void removeFunction(int functionType)
{
_functions.remove(functionType);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
statement = con.prepareStatement("DELETE FROM clanhall_functions WHERE hall_id=? AND type=?");
@@ -834,7 +834,7 @@ public class ClanHall
*/
public void updateDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
@@ -969,7 +969,7 @@ public class ClanHall
*/
private void loadDoor()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("Select * from castle_door where castleId = ?");
statement.setInt(1, _clanHallId);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/Hero.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/Hero.java
index fb81ab165f..0c59e23e80 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/Hero.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/Hero.java
@@ -87,7 +87,7 @@ public class Hero
{
_heroes = new HashMap<>();
_completeHeroes = new HashMap<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = null;
PreparedStatement statement2 = null;
@@ -379,7 +379,7 @@ public class Hero
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = null;
ResultSet rset = null;
@@ -419,7 +419,7 @@ public class Hero
PreparedStatement statement = null;
PreparedStatement statement2 = null;
ResultSet rset2 = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (setDefault)
{
@@ -502,7 +502,7 @@ public class Hero
private void deleteItemsInDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(DELETE_ITEMS);
statement.execute();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/L2Rebirth.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/L2Rebirth.java
index 75175e2d48..b132ee580e 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/L2Rebirth.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/L2Rebirth.java
@@ -420,7 +420,7 @@ public class L2Rebirth
final int playerId = player.getObjectId();
int rebirthCount = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
ResultSet rset;
PreparedStatement statement = con.prepareStatement("SELECT * FROM `rebirth_manager` WHERE playerId = ?");
@@ -448,7 +448,7 @@ public class L2Rebirth
*/
public void storePlayerBirth(L2PcInstance player)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("INSERT INTO `rebirth_manager` (playerId,rebirthCount) VALUES (?,1)");
statement.setInt(1, player.getObjectId());
@@ -469,7 +469,7 @@ public class L2Rebirth
*/
public void updatePlayerBirth(L2PcInstance player, int newRebirthCount)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final int playerId = player.getObjectId();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/Wedding.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/Wedding.java
index 75008525ad..f963ca2a0f 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/Wedding.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/Wedding.java
@@ -49,7 +49,7 @@ public class Wedding
{
_Id = coupleId;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
ResultSet rs;
@@ -95,7 +95,7 @@ public class Wedding
_weddingDate = Calendar.getInstance();
_weddingDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
@@ -122,7 +122,7 @@ public class Wedding
public void marry(int type)
{
_type = type;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
@@ -147,7 +147,7 @@ public class Wedding
public void divorce()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/event/CTF.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/event/CTF.java
index c3d578dc54..7bd76214c9 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/event/CTF.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/event/CTF.java
@@ -1152,7 +1152,7 @@ public class CTF implements EventTask
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=? WHERE char_name=?");
statement.setInt(1, _npcX);
@@ -1859,7 +1859,7 @@ public class CTF implements EventTask
_maxPlayers = 0;
_intervalBetweenMatches = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
ResultSet rs;
@@ -1941,7 +1941,7 @@ public class CTF implements EventTask
*/
public static void saveData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/event/DM.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/event/DM.java
index 892a868e19..2934400afe 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/event/DM.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/event/DM.java
@@ -1078,7 +1078,7 @@ public class DM implements EventTask
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=? WHERE char_name=?");
statement.setInt(1, _npcX);
@@ -1665,7 +1665,7 @@ public class DM implements EventTask
_playerY = 0;
_playerZ = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
ResultSet rs;
@@ -1710,7 +1710,7 @@ public class DM implements EventTask
*/
public static void saveData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/event/EventPoint.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/event/EventPoint.java
index a2b629063a..957255775b 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/event/EventPoint.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/event/EventPoint.java
@@ -46,7 +46,7 @@ public class EventPoint
private void loadFromDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement st = con.prepareStatement("Select * From char_points where charId = ?");
st.setInt(1, _activeChar.getObjectId());
@@ -67,7 +67,7 @@ public class EventPoint
private void saveToDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement st = con.prepareStatement("Update char_points Set points = ? Where charId = ?");
st.setInt(1, _points);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/event/Lottery.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/event/Lottery.java
index 59eff9e20e..751b4cdde0 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/event/Lottery.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/event/Lottery.java
@@ -95,7 +95,7 @@ public class Lottery
public void increasePrize(int count)
{
_prize += count;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
statement = con.prepareStatement(UPDATE_PRICE);
@@ -132,7 +132,7 @@ public class Lottery
public void run()
{
PreparedStatement statement;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
statement = con.prepareStatement(SELECT_LAST_LOTTERY);
ResultSet rset = statement.executeQuery();
@@ -215,7 +215,7 @@ public class Lottery
ThreadPool.schedule(new stopSellingTickets(), _enddate - System.currentTimeMillis() - (10 * MINUTE));
ThreadPool.schedule(new finishLottery(), _enddate - System.currentTimeMillis());
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
statement = con.prepareStatement(INSERT_LOTTERY);
statement.setInt(1, 1);
@@ -324,7 +324,7 @@ public class Lottery
int count4 = 0;
PreparedStatement statement;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
statement = con.prepareStatement(SELECT_LOTTERY_ITEM);
statement.setInt(1, _number);
@@ -441,7 +441,7 @@ public class Lottery
Announcements.getInstance().announceToAll(sm);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
statement = con.prepareStatement(UPDATE_LOTTERY);
statement.setInt(1, _prize);
@@ -516,7 +516,7 @@ public class Lottery
};
PreparedStatement statement;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
statement = con.prepareStatement(SELECT_LOTTERY_TICKET);
statement.setInt(1, id);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/event/TvT.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/event/TvT.java
index d6c9edbc0f..8c5d7a7fee 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/event/TvT.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/event/TvT.java
@@ -1085,7 +1085,7 @@ public class TvT implements EventTask
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=? WHERE char_name=?");
statement.setInt(1, _npcX);
@@ -1765,7 +1765,7 @@ public class TvT implements EventTask
_maxPlayers = 0;
_intervalBetweenMatchs = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
ResultSet rs;
@@ -1837,7 +1837,7 @@ public class TvT implements EventTask
*/
public static void saveData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/event/VIP.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/event/VIP.java
index 3658980933..7b66463bd9 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/event/VIP.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/event/VIP.java
@@ -149,7 +149,7 @@ public class VIP
public static void setLoc()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT endx,endy,endz FROM VIPinfo WHERE teamID = " + _team);
final ResultSet rset = statement.executeQuery();
@@ -167,7 +167,7 @@ public class VIP
LOGGER.info("Could not check End LOC for team" + _team + " got: " + e.getMessage());
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT startx,starty,startz FROM VIPinfo WHERE teamID = " + _team);
final ResultSet rset = statement.executeQuery();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/olympiad/Olympiad.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/olympiad/Olympiad.java
index a09d0b74be..90ef1d73f8 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/olympiad/Olympiad.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/olympiad/Olympiad.java
@@ -259,7 +259,7 @@ public class Olympiad
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(OLYMPIAD_LOAD_NOBLES);
ResultSet rset = statement.executeQuery();
@@ -288,7 +288,7 @@ public class Olympiad
LOGGER.warning("Olympiad System: Error loading noblesse data from database: " + e);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(OLYMPIAD_LOAD_OLD_NOBLES);
ResultSet rset = statement.executeQuery();
@@ -1141,7 +1141,7 @@ public class Olympiad
}
PreparedStatement statement = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
for (Integer nobleId : _nobles.keySet())
{
@@ -1205,7 +1205,7 @@ public class Olympiad
protected synchronized void saveOldNobleData(int nobleId)
{
PreparedStatement statement = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final StatsSet nobleInfo = _oldnobles.get(nobleId);
@@ -1293,7 +1293,7 @@ public class Olympiad
protected void updateMonthlyData()
{
PreparedStatement statement = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
statement = con.prepareStatement(OLYMPIAD_MONTH_CLEAR);
statement.execute();
@@ -1340,7 +1340,7 @@ public class Olympiad
PreparedStatement statement = null;
ResultSet rset = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
StatsSet hero;
for (int HERO_ID : HERO_IDS)
@@ -1376,7 +1376,7 @@ public class Olympiad
PreparedStatement statement = null;
ResultSet rset = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (Config.ALT_OLY_SHOW_MONTHLY_WINNERS)
{
@@ -1567,7 +1567,7 @@ public class Olympiad
protected void deleteNobles()
{
PreparedStatement statement = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
statement = con.prepareStatement(OLYMPIAD_DELETE_ALL);
statement.execute();
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/sevensigns/SevenSigns.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/sevensigns/SevenSigns.java
index 90667dffdf..c02fb06da2 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/sevensigns/SevenSigns.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/sevensigns/SevenSigns.java
@@ -1025,7 +1025,7 @@ public class SevenSigns
*/
protected void restoreSevenSignsData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT char_obj_id, cabal, seal, red_stones, green_stones, blue_stones, ancient_adena_amount, contribution_score FROM seven_signs");
ResultSet rset = statement.executeQuery();
@@ -1112,7 +1112,7 @@ public class SevenSigns
LOGGER.info("SevenSigns: Saving data to disk.");
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = null;
@@ -1270,7 +1270,7 @@ public class SevenSigns
_signsPlayerData.put(charObjId, currPlayerData);
// Update data in database, as we have a new player signing up.
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
statement = con.prepareStatement("INSERT INTO seven_signs (char_obj_id, cabal, seal) VALUES (?,?,?)");
statement.setInt(1, charObjId);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/sevensigns/SevenSignsFestival.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/sevensigns/SevenSignsFestival.java
index 5348e5d8a1..4385d311d5 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/sevensigns/SevenSignsFestival.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/sevensigns/SevenSignsFestival.java
@@ -3415,7 +3415,7 @@ public class SevenSignsFestival implements SpawnListener
LOGGER.info("SevenSignsFestival: Restoring festival data. Current SS Cycle: " + _signsCycle);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT festivalId, cabal, cycle, date, score, members FROM seven_signs_festival");
ResultSet rset = statement.executeQuery();
@@ -3508,7 +3508,7 @@ public class SevenSignsFestival implements SpawnListener
LOGGER.info("SevenSignsFestival: Saving festival data to disk.");
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = null;
@@ -3651,7 +3651,7 @@ public class SevenSignsFestival implements SpawnListener
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(GET_CLAN_NAME);
statement.setString(1, partyMemberName);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/Castle.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/Castle.java
index d7af016b5f..704c88d38e 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/Castle.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/Castle.java
@@ -228,7 +228,7 @@ public class Castle
_treasury += amount;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("Update castle set treasury = ? where id = ?");
statement.setInt(1, _treasury);
@@ -435,7 +435,7 @@ public class Castle
_taxPercent = taxPercent;
_taxRate = _taxPercent / 100.0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("Update castle set taxPercent = ? where id = ?");
statement.setInt(1, taxPercent);
@@ -515,7 +515,7 @@ public class Castle
// This method loads castle
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
ResultSet rs;
@@ -582,7 +582,7 @@ public class Castle
// This method loads castle door data from database
private void loadDoor()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("Select * from castle_door where castleId = ?");
statement.setInt(1, _castleId);
@@ -611,7 +611,7 @@ public class Castle
// This method loads castle door upgrade data from database
private void loadDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("Select * from castle_doorupgrade where doorId in (Select Id from castle_door where castleId = ?)");
statement.setInt(1, _castleId);
@@ -633,7 +633,7 @@ public class Castle
private void removeDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("delete from castle_doorupgrade where doorId in (select id from castle_door where castleId=?)");
statement.setInt(1, _castleId);
@@ -648,7 +648,7 @@ public class Castle
private void saveDoorUpgrade(int doorId, int hp, int pDef, int mDef)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("INSERT INTO castle_doorupgrade (doorId, hp, pDef, mDef) values (?,?,?,?)");
statement.setInt(1, doorId);
@@ -675,7 +675,7 @@ public class Castle
_ownerId = 0; // Remove owner
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
@@ -896,7 +896,7 @@ public class Castle
public void saveSeedData()
{
PreparedStatement statement;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
statement = con.prepareStatement(CASTLE_MANOR_DELETE_PRODUCTION);
statement.setInt(1, _castleId);
@@ -968,7 +968,7 @@ public class Castle
public void saveSeedData(int period)
{
PreparedStatement statement;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
statement = con.prepareStatement(CASTLE_MANOR_DELETE_PRODUCTION_PERIOD);
statement.setInt(1, _castleId);
@@ -1014,7 +1014,7 @@ public class Castle
public void saveCropData()
{
PreparedStatement statement;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
statement = con.prepareStatement(CASTLE_MANOR_DELETE_PROCURE);
statement.setInt(1, _castleId);
@@ -1085,7 +1085,7 @@ public class Castle
public void saveCropData(int period)
{
PreparedStatement statement;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
statement = con.prepareStatement(CASTLE_MANOR_DELETE_PROCURE_PERIOD);
statement.setInt(1, _castleId);
@@ -1133,7 +1133,7 @@ public class Castle
public void updateCrop(int cropId, int amount, int period)
{
PreparedStatement statement;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
statement = con.prepareStatement(CASTLE_UPDATE_CROP);
statement.setInt(1, amount);
@@ -1152,7 +1152,7 @@ public class Castle
public void updateSeed(int seedId, int amount, int period)
{
PreparedStatement statement;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
statement = con.prepareStatement(CASTLE_UPDATE_SEED);
statement.setInt(1, amount);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/ClanHallSiege.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/ClanHallSiege.java
index 8402022d0b..dd4caeb0bd 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/ClanHallSiege.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/ClanHallSiege.java
@@ -37,7 +37,7 @@ public abstract class ClanHallSiege
public long restoreSiegeDate(int ClanHallId)
{
long res = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT siege_data FROM clanhall_siege WHERE id=?");
statement.setInt(1, ClanHallId);
@@ -72,7 +72,7 @@ public abstract class ClanHallSiege
tmpDate.set(Calendar.SECOND, 0);
setSiegeDate(tmpDate);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE clanhall_siege SET siege_data=? WHERE id = ?");
statement.setLong(1, _siegeDate.getTimeInMillis());
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/Fort.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/Fort.java
index 6c02bb6fbd..939a334509 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/Fort.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/Fort.java
@@ -342,7 +342,7 @@ public class Fort
// This method loads fort
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
ResultSet rs;
@@ -402,7 +402,7 @@ public class Fort
// This method loads fort door data from database
private void loadDoor()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("Select * from fort_door where fortId = ?");
statement.setInt(1, _fortId);
@@ -434,7 +434,7 @@ public class Fort
// This method loads fort door upgrade data from database
private void loadDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("Select * from fort_doorupgrade where doorId in (Select Id from fort_door where fortId = ?)");
statement.setInt(1, _fortId);
@@ -456,7 +456,7 @@ public class Fort
private void removeDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("delete from fort_doorupgrade where doorId in (select id from fort_door where fortId=?)");
statement.setInt(1, _fortId);
@@ -472,7 +472,7 @@ public class Fort
private void saveDoorUpgrade(int doorId, int hp, int pDef, int mDef)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("INSERT INTO fort_doorupgrade (doorId, hp, pDef, mDef) values (?,?,?,?)");
statement.setInt(1, doorId);
@@ -500,7 +500,7 @@ public class Fort
_ownerId = 0; // Remove owner
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/FortSiege.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/FortSiege.java
index 9f658bed49..03f6b97230 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/FortSiege.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/FortSiege.java
@@ -665,7 +665,7 @@ public class FortSiege
*/
public void clearSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("DELETE FROM fortsiege_clans WHERE fort_id=?");
statement.setInt(1, getFort().getFortId());
@@ -703,7 +703,7 @@ public class FortSiege
*/
public void clearSiegeWaitingClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("DELETE FROM fortsiege_clans WHERE fort_id=? and type = 2");
statement.setInt(1, getFort().getFortId());
@@ -990,7 +990,7 @@ public class FortSiege
*/
public void removeSiegeClan(int clanId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
@@ -1245,7 +1245,7 @@ public class FortSiege
/** Load siege clans. */
private void loadSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
getAttackerClans().clear();
getDefenderClans().clear();
@@ -1341,7 +1341,7 @@ public class FortSiege
/** Save siege date to database. */
private void saveSiegeDate()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("Update fort set siegeDate = ? where id = ?");
statement.setLong(1, getFort().getSiegeDate().getTimeInMillis());
@@ -1383,7 +1383,7 @@ public class FortSiege
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
if (!isUpdateRegistration)
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/Siege.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/Siege.java
index 2a12ed4cd7..e1f4aa1c34 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/Siege.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/Siege.java
@@ -840,7 +840,7 @@ public class Siege
*/
public void clearSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=?");
statement.setInt(1, getCastle().getCastleId());
@@ -870,7 +870,7 @@ public class Siege
*/
public void clearSiegeWaitingClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=? and type = 2");
statement.setInt(1, getCastle().getCastleId());
@@ -1144,7 +1144,7 @@ public class Siege
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=? and clan_id=?");
statement.setInt(1, getCastle().getCastleId());
@@ -1427,7 +1427,7 @@ public class Siege
/** Load siege clans. */
private void loadSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
getAttackerClans().clear();
getDefenderClans().clear();
@@ -1552,7 +1552,7 @@ public class Siege
/** Save siege date to database. */
private void saveSiegeDate()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("Update castle set siegeDate = ? where id = ?");
statement.setLong(1, getCastle().getSiegeDate().getTimeInMillis());
@@ -1594,7 +1594,7 @@ public class Siege
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/clanhalls/DevastatedCastle.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/clanhalls/DevastatedCastle.java
index a441eb3143..ae219fbef8 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/clanhalls/DevastatedCastle.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/clanhalls/DevastatedCastle.java
@@ -866,7 +866,7 @@ public class DevastatedCastle
private void update()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/clanhalls/FortressOfResistance.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/clanhalls/FortressOfResistance.java
index f49774a971..c8a724ca87 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/clanhalls/FortressOfResistance.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/entity/siege/clanhalls/FortressOfResistance.java
@@ -363,7 +363,7 @@ public class FortressOfResistance
private void update()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/quest/Quest.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/quest/Quest.java
index efee3586ca..e925f1e253 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/quest/Quest.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/quest/Quest.java
@@ -1150,7 +1150,7 @@ public class Quest extends ManagedScript
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
@@ -1255,7 +1255,7 @@ public class Quest extends ManagedScript
*/
public final void saveGlobalQuestVar(String var, String value)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
statement = con.prepareStatement("REPLACE INTO quest_global_data (quest_name,var,value) VALUES (?,?,?)");
@@ -1280,7 +1280,7 @@ public class Quest extends ManagedScript
public final String loadGlobalQuestVar(String var)
{
String result = "";
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
statement = con.prepareStatement("SELECT value FROM quest_global_data WHERE quest_name = ? AND var = ?");
@@ -1309,7 +1309,7 @@ public class Quest extends ManagedScript
*/
public final void deleteGlobalQuestVar(String var)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
statement = con.prepareStatement("DELETE FROM quest_global_data WHERE quest_name = ? AND var = ?");
@@ -1329,7 +1329,7 @@ public class Quest extends ManagedScript
*/
public final void deleteAllGlobalQuestVars()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
statement = con.prepareStatement("DELETE FROM quest_global_data WHERE quest_name = ?");
@@ -1351,7 +1351,7 @@ public class Quest extends ManagedScript
*/
public static void createQuestVarInDb(QuestState qs, String var, String value)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
statement = con.prepareStatement("INSERT INTO character_quests (char_id,name,var,value) VALUES (?,?,?,?)");
@@ -1389,7 +1389,7 @@ public class Quest extends ManagedScript
*/
public static void updateQuestVarInDb(QuestState qs, String var, String value)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
statement = con.prepareStatement("UPDATE character_quests SET value=? WHERE char_id=? AND name=? AND var = ?");
@@ -1413,7 +1413,7 @@ public class Quest extends ManagedScript
*/
public static void deleteQuestVarInDb(QuestState qs, String var)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
statement = con.prepareStatement("DELETE FROM character_quests WHERE char_id=? AND name=? AND var=?");
@@ -1435,7 +1435,7 @@ public class Quest extends ManagedScript
*/
public static void deleteQuestInDb(QuestState qs)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
statement = con.prepareStatement("DELETE FROM character_quests WHERE char_id=? AND name=?");
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/spawn/AutoSpawn.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/spawn/AutoSpawn.java
index a423afab58..f663df4ca5 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/spawn/AutoSpawn.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/spawn/AutoSpawn.java
@@ -93,7 +93,7 @@ public class AutoSpawn
private void restoreSpawnData()
{
int numLoaded = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = null;
PreparedStatement statement2 = null;
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
index 8524d8e039..ae9d01b04a 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
@@ -50,7 +50,7 @@ public class AccountVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setString(1, _accountName);
@@ -83,7 +83,7 @@ public class AccountVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
index 05a4d09037..80f9cf5e6b 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
@@ -52,7 +52,7 @@ public class PlayerVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setInt(1, _objectId);
@@ -85,7 +85,7 @@ public class PlayerVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/L2GameClient.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/L2GameClient.java
index 4f7f6c8a94..71ac9ec972 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/L2GameClient.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/L2GameClient.java
@@ -277,7 +277,7 @@ public final class L2GameClient extends MMOClient> i
byte answer = -1;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT clanId from characters WHERE obj_Id=?");
statement.setInt(1, objid);
@@ -350,7 +350,7 @@ public final class L2GameClient extends MMOClient> i
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("UPDATE characters SET deletetime=0 WHERE obj_id=?");
statement.setInt(1, objid);
@@ -370,7 +370,7 @@ public final class L2GameClient extends MMOClient> i
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestAnswerFriendInvite.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestAnswerFriendInvite.java
index cf6f8d1349..f7e25fb83d 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestAnswerFriendInvite.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestAnswerFriendInvite.java
@@ -55,7 +55,7 @@ public final class RequestAnswerFriendInvite extends L2GameClientPacket
if (_response == 1)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("INSERT INTO character_friends (char_id, friend_id) VALUES (?,?), (?,?)");
statement.setInt(1, requestor.getObjectId());
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
index 84ba8aad76..90ede898f0 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
@@ -141,7 +141,7 @@ public final class RequestDestroyItem extends L2GameClientPacket
if (L2PetDataTable.isPetItem(itemId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if ((activeChar.getPet() != null) && (activeChar.getPet().getControlItemId() == _objectId))
{
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestExSetPledgeCrestLarge.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestExSetPledgeCrestLarge.java
index 99163d7d3a..8104e7aa95 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestExSetPledgeCrestLarge.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestExSetPledgeCrestLarge.java
@@ -115,7 +115,7 @@ public final class RequestExSetPledgeCrestLarge extends L2GameClientPacket
crestCache.removePledgeCrestLarge(clan.getCrestLargeId());
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET crest_large_id = ? WHERE clan_id = ?");
statement.setInt(1, newId);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestFriendDel.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestFriendDel.java
index 99596d674a..b11a7bd8dc 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestFriendDel.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestFriendDel.java
@@ -56,7 +56,7 @@ public final class RequestFriendDel extends L2GameClientPacket
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("DELETE FROM character_friends WHERE (char_id = ? AND friend_id = ?) OR (char_id = ? AND friend_id = ?)");
statement.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestSetAllyCrest.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestSetAllyCrest.java
index b23785b320..2f0889320e 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestSetAllyCrest.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestSetAllyCrest.java
@@ -93,7 +93,7 @@ public final class RequestSetAllyCrest extends L2GameClientPacket
crestCache.removeAllyCrest(leaderclan.getAllyCrestId());
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET ally_crest_id = ? WHERE ally_id = ?");
statement.setInt(1, newId);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestSetPledgeCrest.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestSetPledgeCrest.java
index df8cf136f8..0d0ef59141 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestSetPledgeCrest.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/clientpackets/RequestSetPledgeCrest.java
@@ -120,7 +120,7 @@ public final class RequestSetPledgeCrest extends L2GameClientPacket
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("UPDATE clan_data SET crest_id = ? WHERE clan_id = ?");
statement.setInt(1, newId);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectInfo.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectInfo.java
index 3c304ec7c4..c16ce5a630 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectInfo.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectInfo.java
@@ -221,7 +221,7 @@ public class CharSelectInfo extends L2GameServerPacket
CharSelectInfoPackage charInfopackage;
final List characterList = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT account_name, obj_Id, char_name, level, maxHp, curHp, maxMp, curMp, acc, crit, evasion, mAtk, mDef, mSpd, pAtk, pDef, pSpd, runSpd, walkSpd, str, con, dex, _int, men, wit, face, hairStyle, hairColor, sex, heading, x, y, z, movement_multiplier, attack_speed_multiplier, colRad, colHeight, exp, sp, karma, pvpkills, pkkills, clanid, maxload, race, classid, deletetime, cancraft, title, rec_have, rec_left, accesslevel, online, char_slot, lastAccess, base_class FROM characters WHERE account_name=?");
statement.setString(1, _loginName);
@@ -250,7 +250,7 @@ public class CharSelectInfo extends L2GameServerPacket
private void loadCharacterSubclassInfo(CharSelectInfoPackage charInfopackage, int ObjectId, int activeClassId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT exp, sp, level FROM character_subclasses WHERE char_obj_id=? && class_id=? ORDER BY char_obj_id");
statement.setInt(1, ObjectId);
@@ -338,7 +338,7 @@ public class CharSelectInfo extends L2GameServerPacket
if (weaponObjId > 0)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT attributes FROM augmentations WHERE item_id=?");
statement.setInt(1, weaponObjId);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
index 4cbc31a643..83a9e0bc21 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
@@ -97,7 +97,7 @@ public final class TaskManager
task.onTimeElapsed(this);
lastActivation = System.currentTimeMillis();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[1]);
statement.setLong(1, lastActivation);
@@ -210,7 +210,7 @@ public final class TaskManager
private void startAllTasks()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[0]);
ResultSet rset = statement.executeQuery();
@@ -346,7 +346,7 @@ public final class TaskManager
{
boolean output = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[2]);
statement.setString(1, task);
@@ -386,7 +386,7 @@ public final class TaskManager
{
boolean output = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[3]);
statement.setString(1, task);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/loginserver/GameServerTable.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/loginserver/GameServerTable.java
index 6090a8967c..bfa0e190f5 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/loginserver/GameServerTable.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/loginserver/GameServerTable.java
@@ -138,7 +138,7 @@ public class GameServerTable
{
PreparedStatement statement = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
int id;
statement = con.prepareStatement("SELECT * FROM gameservers");
@@ -217,7 +217,7 @@ public class GameServerTable
public void registerServerOnDB(byte[] hexId, int id, String externalHost)
{
PreparedStatement statement = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
statement = con.prepareStatement("INSERT INTO gameservers (hexid,server_id,host) values (?,?,?)");
statement.setString(1, hexToString(hexId));
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/loginserver/LoginController.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/loginserver/LoginController.java
index a4639b926a..07ed3cfa6e 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/loginserver/LoginController.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/loginserver/LoginController.java
@@ -487,7 +487,7 @@ public class LoginController
final boolean loginOk = ((gsi.getCurrentPlayerCount() < gsi.getMaxPlayers()) && (gsi.getStatus() != ServerStatus.STATUS_GM_ONLY)) || (access >= 100);
if (loginOk && (client.getLastServer() != serverId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final String stmt = "UPDATE accounts SET lastServer = ? WHERE login = ?";
PreparedStatement statement = con.prepareStatement(stmt);
@@ -508,7 +508,7 @@ public class LoginController
public void setAccountAccessLevel(String account, int banLevel)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final String stmt = "UPDATE accounts SET accessLevel=? WHERE login=?";
PreparedStatement statement = con.prepareStatement(stmt);
@@ -526,7 +526,7 @@ public class LoginController
public boolean isGM(String user)
{
boolean ok = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT accessLevel FROM accounts WHERE login=?");
statement.setString(1, user);
@@ -582,7 +582,7 @@ public class LoginController
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
MessageDigest md = MessageDigest.getInstance("SHA");
final byte[] raw = password.getBytes("UTF-8");
@@ -718,7 +718,7 @@ public class LoginController
{
boolean ok = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement("SELECT accessLevel FROM accounts WHERE login=?");
statement.setString(1, user);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/loginserver/LoginServer.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/loginserver/LoginServer.java
index b65ec0928e..fa159d387d 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/loginserver/LoginServer.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/loginserver/LoginServer.java
@@ -88,7 +88,7 @@ public class LoginServer
Config.load();
// Prepare Database
- DatabaseFactory.getInstance();
+ DatabaseFactory.init();
try
{
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/status/GameStatusThread.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/status/GameStatusThread.java
index 7650257bd4..b00cc46e86 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/status/GameStatusThread.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/status/GameStatusThread.java
@@ -972,7 +972,7 @@ public class GameStatusThread extends Thread
private void jailOfflinePlayer(String name, int delay)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=?, punish_level=?, punish_timer=? WHERE char_name=?");
statement.setInt(1, -114356);
@@ -1007,7 +1007,7 @@ public class GameStatusThread extends Thread
private void unjailOfflinePlayer(String name)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=?, punish_level=?, punish_timer=? WHERE char_name=?");
statement.setInt(1, 17836);
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
index 872cd04989..e08998a69e 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
@@ -49,6 +49,8 @@ public class SQLAccountManager
{
Server.serverMode = Server.MODE_LOGINSERVER;
Config.load();
+ DatabaseFactory.init();
+
while (true)
{
System.out.println("Please choose an option:");
@@ -161,7 +163,7 @@ public class SQLAccountManager
{
int count = 0;
Connection con = null;
- con = DatabaseFactory.getInstance().getConnection();
+ con = DatabaseFactory.getConnection();
String q = "SELECT login, accessLevel FROM accounts ";
if (m.equals("1"))
{
@@ -200,7 +202,7 @@ public class SQLAccountManager
// Add to Base
Connection con = null;
- con = DatabaseFactory.getInstance().getConnection();
+ con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("REPLACE accounts (login, password, accessLevel) VALUES (?,?,?)");
statement.setString(1, account);
statement.setString(2, Base64.getEncoder().encodeToString(newpass));
@@ -213,7 +215,7 @@ public class SQLAccountManager
private static void changeAccountLevel(String account, String level) throws SQLException
{
Connection con = null;
- con = DatabaseFactory.getInstance().getConnection();
+ con = DatabaseFactory.getConnection();
// Check Account Exist
PreparedStatement statement = con.prepareStatement("SELECT COUNT(*) FROM accounts WHERE login=?;");
@@ -248,7 +250,7 @@ public class SQLAccountManager
private static void deleteAccount(String account) throws SQLException
{
Connection con = null;
- con = DatabaseFactory.getInstance().getConnection();
+ con = DatabaseFactory.getConnection();
// Check Account Exist
PreparedStatement statement = con.prepareStatement("SELECT COUNT(*) FROM accounts WHERE login=?;");
diff --git a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
index 7ec499e39f..9795c4fd46 100644
--- a/L2J_Mobius_C6_Interlude/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
+++ b/L2J_Mobius_C6_Interlude/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
@@ -69,7 +69,9 @@ public abstract class BaseGameServerRegister
Server.serverMode = Server.MODE_LOGINSERVER;
Config.load();
+ DatabaseFactory.init();
GameServerTable.getInstance();
+
try
{
GameServerTable.load();
@@ -105,7 +107,7 @@ public abstract class BaseGameServerRegister
*/
public static void unregisterGameServer(int id) throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM gameservers WHERE server_id = ?"))
{
@@ -121,7 +123,7 @@ public abstract class BaseGameServerRegister
*/
public static void unregisterAllGameServers() throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("DELETE FROM gameservers");
diff --git a/L2J_Mobius_C6_Interlude/launcher/Gameserver.launch b/L2J_Mobius_C6_Interlude/launcher/Gameserver.launch
index ecb90b106e..23230ddf1c 100644
--- a/L2J_Mobius_C6_Interlude/launcher/Gameserver.launch
+++ b/L2J_Mobius_C6_Interlude/launcher/Gameserver.launch
@@ -7,12 +7,13 @@
-
+
+
diff --git a/L2J_Mobius_C6_Interlude/launcher/Loginserver.launch b/L2J_Mobius_C6_Interlude/launcher/Loginserver.launch
index 49af8fb783..0866f55bce 100644
--- a/L2J_Mobius_C6_Interlude/launcher/Loginserver.launch
+++ b/L2J_Mobius_C6_Interlude/launcher/Loginserver.launch
@@ -7,7 +7,7 @@
-
+
@@ -15,5 +15,6 @@
+
diff --git a/L2J_Mobius_CT_2.6_HighFive/.classpath b/L2J_Mobius_CT_2.6_HighFive/.classpath
index 0e50693da9..619d354392 100644
--- a/L2J_Mobius_CT_2.6_HighFive/.classpath
+++ b/L2J_Mobius_CT_2.6_HighFive/.classpath
@@ -5,11 +5,12 @@
-
+
-
+
+
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/conquerablehalls/RainbowSpringsChateau/RainbowSpringsChateau.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/conquerablehalls/RainbowSpringsChateau/RainbowSpringsChateau.java
index be7760d9de..ec4ec611b3 100644
--- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/conquerablehalls/RainbowSpringsChateau/RainbowSpringsChateau.java
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/conquerablehalls/RainbowSpringsChateau/RainbowSpringsChateau.java
@@ -842,7 +842,7 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine
private static void updateAttacker(int clanId, long count, boolean remove)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement;
if (remove)
@@ -868,7 +868,7 @@ public final class RainbowSpringsChateau extends ClanHallSiegeEngine
@Override
public void loadAttackers()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT * FROM rainbowsprings_attacker_list");
final ResultSet rset = statement.executeQuery();
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/conquerablehalls/flagwar/FlagWar.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/conquerablehalls/flagwar/FlagWar.java
index 33aa96355c..ed2c0ab80a 100644
--- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/conquerablehalls/flagwar/FlagWar.java
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/conquerablehalls/flagwar/FlagWar.java
@@ -762,7 +762,7 @@ public abstract class FlagWar extends ClanHallSiegeEngine
@Override
public final void loadAttackers()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement(SQL_LOAD_ATTACKERS);
statement.setInt(1, _hall.getId());
@@ -796,7 +796,7 @@ public abstract class FlagWar extends ClanHallSiegeEngine
private final void loadAttackerMembers(int clanId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final ArrayList listInstance = _data.get(clanId).players;
@@ -826,7 +826,7 @@ public abstract class FlagWar extends ClanHallSiegeEngine
private final void saveClan(int clanId, int flag)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement(SQL_SAVE_CLAN);
statement.setInt(1, _hall.getId());
@@ -845,7 +845,7 @@ public abstract class FlagWar extends ClanHallSiegeEngine
private final void saveNpc(int npc, int clanId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement(SQL_SAVE_NPC);
statement.setInt(1, npc);
@@ -862,7 +862,7 @@ public abstract class FlagWar extends ClanHallSiegeEngine
private final void saveMember(int clanId, int objectId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement(SQL_SAVE_ATTACKER);
statement.setInt(1, _hall.getId());
@@ -880,7 +880,7 @@ public abstract class FlagWar extends ClanHallSiegeEngine
private void clearTables()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement stat1 = con.prepareStatement(SQL_CLEAR_CLAN);
stat1.setInt(1, _hall.getId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java
index 8343324c8d..0673b57a3c 100644
--- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java
@@ -76,7 +76,7 @@ public final class AdminChangeAccessLevel implements IAdminCommandHandler
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET accesslevel=? WHERE char_name=?");
statement.setInt(1, lvl);
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
index 5d1fd680fe..89c3caa1b6 100644
--- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
@@ -623,7 +623,7 @@ public class AdminEditChar implements IAdminCommandHandler
if (player == null)
{
- final Connection con = DatabaseFactory.getInstance().getConnection();
+ final Connection con = DatabaseFactory.getConnection();
final PreparedStatement ps = con.prepareStatement("UPDATE characters SET " + (changeCreateExpiryTime ? "clan_create_expiry_time" : "clan_join_expiry_time") + " WHERE char_name=? LIMIT 1");
ps.setString(1, playerName);
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java
index 23f04e0215..cf8e1a36b2 100644
--- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java
@@ -62,7 +62,7 @@ public class AdminRepairChar implements IAdminCommandHandler
}
final String cmd = "UPDATE characters SET x=-84318, y=244579, z=-3730 WHERE char_name=?";
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(cmd);
statement.setString(1, parts[1]);
@@ -87,13 +87,13 @@ public class AdminRepairChar implements IAdminCommandHandler
return;
}
- // connection = DatabaseFactory.getInstance().getConnection();
+ // connection = DatabaseFactory.getConnection();
statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=?");
statement.setInt(1, objId);
statement.execute();
statement.close();
- // connection = DatabaseFactory.getInstance().getConnection();
+ // connection = DatabaseFactory.getConnection();
statement = con.prepareStatement("UPDATE items SET loc=\"INVENTORY\" WHERE owner_id=?");
statement.setInt(1, objId);
statement.execute();
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java
index 3e33265b78..15d8eb338f 100644
--- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java
@@ -172,7 +172,7 @@ public class AdminShowQuests implements IAdminCommandHandler
private static void showQuestMenu(L2PcInstance target, L2PcInstance actor, String[] val)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
ResultSet rs;
PreparedStatement req;
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java
index 84f2d078bf..b4fc1ee3a4 100644
--- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java
@@ -499,7 +499,7 @@ public class AdminTeleport implements IAdminCommandHandler
final int x = activeChar.getX();
final int y = activeChar.getY();
final int z = activeChar.getZ();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=? WHERE char_name=?");
statement.setInt(1, x);
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java
index fdf27688b1..6f3dd4a438 100644
--- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java
@@ -61,7 +61,7 @@ public class FavoriteBoard implements IParseBoardHandler
// Load Favorite links
final String list = HtmCache.getInstance().getHtm(activeChar, "data/html/CommunityBoard/favorite_list.html");
final StringBuilder sb = new StringBuilder();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_FAVORITES))
{
ps.setInt(1, activeChar.getObjectId());
@@ -98,7 +98,7 @@ public class FavoriteBoard implements IParseBoardHandler
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_FAVORITE))
{
ps.setInt(1, activeChar.getObjectId());
@@ -123,7 +123,7 @@ public class FavoriteBoard implements IParseBoardHandler
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_FAVORITE))
{
ps.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/communityboard/HomeBoard.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
index 982c1ad402..8c019f6dd4 100644
--- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
@@ -292,7 +292,7 @@ public final class HomeBoard implements IParseBoardHandler
private static int getFavoriteCount(L2PcInstance player)
{
int count = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(COUNT_FAVORITES))
{
ps.setInt(1, player.getObjectId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
index 5f6ed7b07e..85cc2a5ad1 100644
--- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
@@ -62,7 +62,7 @@ public class ClanWarsList implements IUserCommandHandler
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
String query;
// Attack List
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/voicedcommandhandlers/Wedding.java b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/voicedcommandhandlers/Wedding.java
index ba9ce9528a..6b7b03249b 100644
--- a/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/voicedcommandhandlers/Wedding.java
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/data/scripts/handlers/voicedcommandhandlers/Wedding.java
@@ -211,7 +211,7 @@ public class Wedding implements IVoicedCommandHandler
// check if target has player on friendlist
boolean FoundOnFriendList = false;
int objectId;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=?");
statement.setInt(1, ptarget.getObjectId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/game/java.cfg b/L2J_Mobius_CT_2.6_HighFive/dist/game/java.cfg
index cb4a4dc204..58213e428e 100644
--- a/L2J_Mobius_CT_2.6_HighFive/dist/game/java.cfg
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/game/java.cfg
@@ -1 +1 @@
--server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
\ No newline at end of file
+-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=error -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
\ No newline at end of file
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/libs/HikariCP-3.2.0.jar b/L2J_Mobius_CT_2.6_HighFive/dist/libs/HikariCP-3.2.0.jar
new file mode 100644
index 0000000000..a030a7f8dc
Binary files /dev/null and b/L2J_Mobius_CT_2.6_HighFive/dist/libs/HikariCP-3.2.0.jar differ
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/libs/c3p0-0.9.5.2.jar b/L2J_Mobius_CT_2.6_HighFive/dist/libs/c3p0-0.9.5.2.jar
deleted file mode 100644
index 579cedd980..0000000000
Binary files a/L2J_Mobius_CT_2.6_HighFive/dist/libs/c3p0-0.9.5.2.jar and /dev/null differ
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/libs/mchange-commons-java-0.2.12.jar b/L2J_Mobius_CT_2.6_HighFive/dist/libs/mchange-commons-java-0.2.12.jar
deleted file mode 100644
index af11054860..0000000000
Binary files a/L2J_Mobius_CT_2.6_HighFive/dist/libs/mchange-commons-java-0.2.12.jar and /dev/null differ
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/libs/slf4j-api-1.7.25.jar b/L2J_Mobius_CT_2.6_HighFive/dist/libs/slf4j-api-1.7.25.jar
new file mode 100644
index 0000000000..7e62f1336d
Binary files /dev/null and b/L2J_Mobius_CT_2.6_HighFive/dist/libs/slf4j-api-1.7.25.jar differ
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/libs/slf4j-simple-1.7.25.jar b/L2J_Mobius_CT_2.6_HighFive/dist/libs/slf4j-simple-1.7.25.jar
new file mode 100644
index 0000000000..b29ca12719
Binary files /dev/null and b/L2J_Mobius_CT_2.6_HighFive/dist/libs/slf4j-simple-1.7.25.jar differ
diff --git a/L2J_Mobius_CT_2.6_HighFive/dist/login/java.cfg b/L2J_Mobius_CT_2.6_HighFive/dist/login/java.cfg
index 00ae5b3a66..bda4cdd24d 100644
--- a/L2J_Mobius_CT_2.6_HighFive/dist/login/java.cfg
+++ b/L2J_Mobius_CT_2.6_HighFive/dist/login/java.cfg
@@ -1 +1 @@
--server -Xms128m -Xmx256m
\ No newline at end of file
+-server -Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=error -Xms128m -Xmx256m
\ No newline at end of file
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/commons/database/DatabaseFactory.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/commons/database/DatabaseFactory.java
index 68d02d4171..dd481d2fd0 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/commons/database/DatabaseFactory.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/commons/database/DatabaseFactory.java
@@ -16,122 +16,68 @@
*/
package com.l2jmobius.commons.database;
-import java.beans.PropertyVetoException;
import java.sql.Connection;
-import java.sql.SQLException;
import java.util.logging.Logger;
import com.l2jmobius.Config;
-import com.mchange.v2.c3p0.ComboPooledDataSource;
+import com.zaxxer.hikari.HikariDataSource;
/**
- * Database Factory implementation.
- * @author Zoey76, Mobius
+ * @author Mobius
*/
public class DatabaseFactory
{
private static final Logger LOGGER = Logger.getLogger(DatabaseFactory.class.getName());
- private final ComboPooledDataSource _dataSource;
+ private static final HikariDataSource _hds = new HikariDataSource();
- public DatabaseFactory()
+ public static void init()
{
- if (Config.DATABASE_MAX_CONNECTIONS < 2)
- {
- Config.DATABASE_MAX_CONNECTIONS = 2;
- LOGGER.warning("A minimum of 2 connections are required.");
- }
-
- _dataSource = new ComboPooledDataSource();
- _dataSource.setAutoCommitOnClose(true);
-
- _dataSource.setInitialPoolSize(10);
- _dataSource.setMinPoolSize(10);
- _dataSource.setMaxPoolSize(Math.max(10, Config.DATABASE_MAX_CONNECTIONS));
-
- _dataSource.setAcquireRetryAttempts(0); // try to obtain connections indefinitely (0 = never quit)
- _dataSource.setAcquireRetryDelay(500); // 500 milliseconds wait before try to acquire connection again
- _dataSource.setCheckoutTimeout(0); // 0 = wait indefinitely for new connection if pool is exhausted
- _dataSource.setAcquireIncrement(5); // if pool is exhausted, get 5 more connections at a time cause there is
- // a "long" delay on acquire connection so taking more than one connection at once will make connection pooling more effective.
-
- // this "connection_test_table" is automatically created if not already there
- _dataSource.setAutomaticTestTable("connection_test_table");
- _dataSource.setTestConnectionOnCheckin(false);
-
- // testing OnCheckin used with IdleConnectionTestPeriod is faster than testing on checkout
-
- _dataSource.setIdleConnectionTestPeriod(3600); // test idle connection every 60 sec
- _dataSource.setMaxIdleTime(Config.DATABASE_MAX_IDLE_TIME); // 0 = idle connections never expire
- // *THANKS* to connection testing configured above but I prefer to disconnect all connections not used for more than 1 hour
-
- // enables statement caching, there is a "semi-bug" in c3p0 0.9.0 but in 0.9.0.2 and later it's fixed
- _dataSource.setMaxStatementsPerConnection(100);
-
- _dataSource.setBreakAfterAcquireFailure(false); // never fail if any way possible setting this to true will make c3p0 "crash"
- // and refuse to work till restart thus making acquire errors "FATAL" ... we don't want that it should be possible to recover
+ _hds.setDriverClassName(Config.DATABASE_DRIVER);
+ _hds.setJdbcUrl(Config.DATABASE_URL);
+ _hds.setUsername(Config.DATABASE_LOGIN);
+ _hds.setPassword(Config.DATABASE_PASSWORD);
+ _hds.setMaximumPoolSize(Config.DATABASE_MAX_CONNECTIONS);
+ _hds.setIdleTimeout(Config.DATABASE_MAX_IDLE_TIME);
+ // Test if connection is valid.
try
{
- _dataSource.setDriverClass(Config.DATABASE_DRIVER);
+ _hds.getConnection().close();
+ LOGGER.info("Database: Initialized.");
}
- catch (PropertyVetoException e)
+ catch (Exception e)
{
e.printStackTrace();
}
- _dataSource.setJdbcUrl(Config.DATABASE_URL);
- _dataSource.setUser(Config.DATABASE_LOGIN);
- _dataSource.setPassword(Config.DATABASE_PASSWORD);
-
- /* Test the connection */
- try
- {
- _dataSource.getConnection().close();
- }
- catch (SQLException e)
- {
- e.printStackTrace();
- }
-
- LOGGER.info("Database: Initialized.");
}
- public Connection getConnection()
+ public static Connection getConnection()
{
Connection con = null;
while (con == null)
{
try
{
- con = _dataSource.getConnection();
+ con = _hds.getConnection();
}
- catch (SQLException e)
+ catch (Exception e)
{
- LOGGER.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage());
+ LOGGER.severe("DatabaseFactory: Cound not get a connection. " + e);
}
}
return con;
}
- public void close()
+ public static void close()
{
try
{
- _dataSource.close();
+ _hds.close();
}
catch (Exception e)
{
- LOGGER.info(e.getMessage());
+ LOGGER.severe("DatabaseFactory: There was a problem closing the data source. " + e);
}
}
-
- public static DatabaseFactory getInstance()
- {
- return SingletonHolder.INSTANCE;
- }
-
- private static class SingletonHolder
- {
- protected static final DatabaseFactory INSTANCE = new DatabaseFactory();
- }
}
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/GameServer.java
index c7219f5532..078acd543b 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/GameServer.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/GameServer.java
@@ -192,7 +192,7 @@ public class GameServer
// Initialize config
Config.load();
printSection("Database");
- DatabaseFactory.getInstance();
+ DatabaseFactory.init();
printSection("ThreadPool");
ThreadPool.init();
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/LoginServerThread.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/LoginServerThread.java
index 0a84456b9d..db8d804af6 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/LoginServerThread.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/LoginServerThread.java
@@ -584,7 +584,7 @@ public class LoginServerThread extends Thread
int chars = 0;
final List charToDel = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT deletetime FROM characters WHERE account_name=?"))
{
ps.setString(1, account);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/SevenSigns.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/SevenSigns.java
index 26012674a1..3dc7cfa483 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/SevenSigns.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/SevenSigns.java
@@ -850,7 +850,7 @@ public class SevenSigns
*/
protected void restoreSevenSignsData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (Statement s = con.createStatement();
ResultSet rs = s.executeQuery(LOAD_DATA))
@@ -917,7 +917,7 @@ public class SevenSigns
*/
public void saveSevenSignsData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_PLAYER))
{
for (StatsSet sevenDat : _signsPlayerData.values())
@@ -948,7 +948,7 @@ public class SevenSigns
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_PLAYER))
{
ps.setString(1, sevenDat.getString("cabal"));
@@ -969,7 +969,7 @@ public class SevenSigns
public final void saveSevenSignsStatus()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_STATUS))
{
ps.setInt(1, _currentCycle);
@@ -1056,7 +1056,7 @@ public class SevenSigns
_signsPlayerData.put(objectId, currPlayerData);
// Update data in database, as we have a new player signing up.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_PLAYER))
{
ps.setInt(1, objectId);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/SevenSignsFestival.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/SevenSignsFestival.java
index 4a427bfc2b..dfcbb6ea33 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/SevenSignsFestival.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/SevenSignsFestival.java
@@ -941,7 +941,7 @@ public class SevenSignsFestival implements SpawnListener
*/
protected void restoreFestivalData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT festivalId, cabal, cycle, date, score, members FROM seven_signs_festival"))
{
@@ -989,7 +989,7 @@ public class SevenSignsFestival implements SpawnListener
query.append(' ');
query.append("FROM seven_signs_status WHERE id=0");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(query.toString()))
{
@@ -1015,7 +1015,7 @@ public class SevenSignsFestival implements SpawnListener
*/
public void saveFestivalData(boolean updateSettings)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement psInsert = con.prepareStatement("REPLACE INTO seven_signs_festival (festivalId, cabal, cycle, date, score, members) VALUES (?,?,?,?,?,?)"))
{
for (Map currCycleData : _festivalData.values())
@@ -1118,7 +1118,7 @@ public class SevenSignsFestival implements SpawnListener
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(GET_CLAN_NAME))
{
ps.setString(1, partyMemberName);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/Shutdown.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/Shutdown.java
index 2d0a42792f..158cbe523a 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/Shutdown.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/Shutdown.java
@@ -206,7 +206,7 @@ public class Shutdown extends Thread
// commit data, last chance
try
{
- DatabaseFactory.getInstance().close();
+ DatabaseFactory.close();
LOGGER.info("Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
}
catch (Throwable t)
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
index 22b3179644..0bed1eb052 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
@@ -93,7 +93,7 @@ public class Forum
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM forums WHERE forum_id=?"))
{
ps.setInt(1, _forumId);
@@ -114,7 +114,7 @@ public class Forum
LOGGER.log(Level.WARNING, "Data error on Forum " + _forumId + " : " + e.getMessage(), e);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM topic WHERE topic_forum_id=? ORDER BY topic_id DESC"))
{
ps.setInt(1, _forumId);
@@ -139,7 +139,7 @@ public class Forum
private void getChildren()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT forum_id FROM forums WHERE forum_parent=?"))
{
ps.setInt(1, _forumId);
@@ -217,7 +217,7 @@ public class Forum
public void insertIntoDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO forums (forum_id,forum_name,forum_parent,forum_post,forum_type,forum_perm,forum_owner_id) VALUES (?,?,?,?,?,?,?)"))
{
ps.setInt(1, _forumId);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
index d52e685a05..bf136ef6db 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
@@ -72,7 +72,7 @@ public class Post
private void insertindb(CPost cp)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)"))
{
ps.setInt(1, cp.postId);
@@ -112,7 +112,7 @@ public class Post
public void deleteme(Topic t)
{
PostBBSManager.getInstance().delPostByTopic(t);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM posts WHERE post_forum_id=? AND post_topic_id=?"))
{
ps.setInt(1, t.getForumID());
@@ -130,7 +130,7 @@ public class Post
*/
private void load(Topic t)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM posts WHERE post_forum_id=? AND post_topic_id=? ORDER BY post_id ASC"))
{
ps.setInt(1, t.getForumID());
@@ -162,7 +162,7 @@ public class Post
*/
public void updatetxt(int i)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?"))
{
final CPost cp = getCPost(i);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
index 4d9519ede9..035e03d1b3 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
@@ -71,7 +71,7 @@ public class Topic
private void insertindb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO topic (topic_id,topic_forum_id,topic_name,topic_date,topic_ownername,topic_ownerid,topic_type,topic_reply) values (?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, _id);
@@ -129,7 +129,7 @@ public class Topic
{
TopicBBSManager.getInstance().delTopic(this);
f.rmTopicByID(_id);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM topic WHERE topic_id=? AND topic_forum_id=?"))
{
ps.setInt(1, _id);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
index c58d8f364a..921e146eb0 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
@@ -40,7 +40,7 @@ public class ForumsBBSManager extends BaseBBSManager
protected ForumsBBSManager()
{
_table = new CopyOnWriteArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT forum_id FROM forums WHERE forum_type = 0"))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java
index adc2b28a17..b3b101e521 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java
@@ -52,7 +52,7 @@ public final class AnnouncementsTable
private void load()
{
_announcements.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery("SELECT * FROM announcements"))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java
index d7560d8f7d..8aa21988e0 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java
@@ -99,7 +99,7 @@ public class CharNameTable
int id = -1;
int accessLevel = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT charId,accesslevel FROM characters WHERE char_name=?"))
{
ps.setString(1, name);
@@ -145,7 +145,7 @@ public class CharNameTable
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT char_name,accesslevel FROM characters WHERE charId=?"))
{
ps.setInt(1, id);
@@ -176,7 +176,7 @@ public class CharNameTable
public synchronized boolean doesCharNameExist(String name)
{
boolean result = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT COUNT(*) as count FROM characters WHERE char_name=?"))
{
ps.setString(1, name);
@@ -197,7 +197,7 @@ public class CharNameTable
public int getAccountCharacterCount(String account)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT COUNT(char_name) as count FROM characters WHERE account_name=?"))
{
ps.setString(1, account);
@@ -218,7 +218,7 @@ public class CharNameTable
private void loadAll()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT charId, char_name, accesslevel FROM characters"))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java
index 46f0d1c427..656cfaa3c9 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java
@@ -69,7 +69,7 @@ public class CharSummonTable
{
if (Config.RESTORE_SERVITOR_ON_RECONNECT)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(INIT_SUMMONS))
{
@@ -86,7 +86,7 @@ public class CharSummonTable
if (Config.RESTORE_PET_ON_RECONNECT)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(INIT_PET))
{
@@ -105,7 +105,7 @@ public class CharSummonTable
public void removeServitor(L2PcInstance activeChar)
{
_servitors.remove(activeChar.getObjectId());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(REMOVE_SUMMON))
{
ps.setInt(1, activeChar.getObjectId());
@@ -175,7 +175,7 @@ public class CharSummonTable
public void restoreServitor(L2PcInstance activeChar)
{
final int skillId = _servitors.get(activeChar.getObjectId());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(LOAD_SUMMON))
{
ps.setInt(1, activeChar.getObjectId());
@@ -222,7 +222,7 @@ public class CharSummonTable
_servitors.put(summon.getOwner().getObjectId(), summon.getReferenceSkill());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SAVE_SUMMON))
{
ps.setInt(1, summon.getOwner().getObjectId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java
index ceac41fbe5..0c4a3010e6 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java
@@ -81,7 +81,7 @@ public class ClanTable
L2Clan clan;
// Count the clans
int clanCount = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT clan_id FROM clan_data"))
{
@@ -263,7 +263,7 @@ public class ClanTable
_clans.remove(clanId);
IdFactory.getInstance().releaseId(clanId);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM clan_data WHERE clan_id=?"))
{
@@ -376,7 +376,7 @@ public class ClanTable
clan2.setAttackerClan(clan1);
clan1.broadcastClanStatus();
clan2.broadcastClanStatus();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO clan_wars (clan1, clan2, wantspeace1, wantspeace2) VALUES(?,?,?,?)"))
{
ps.setInt(1, clanId1);
@@ -416,7 +416,7 @@ public class ClanTable
clan1.broadcastClanStatus();
clan2.broadcastClanStatus();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM clan_wars WHERE clan1=? AND clan2=?"))
{
ps.setInt(1, clanId1);
@@ -458,7 +458,7 @@ public class ClanTable
private void restorewars()
{
L2Clan clan1, clan2;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery("SELECT clan1, clan2 FROM clan_wars"))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java
index f90657a886..907f92e5f6 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java
@@ -72,7 +72,7 @@ public final class CrestTable
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
ResultSet rs = statement.executeQuery("SELECT `crest_id`, `data`, `type` FROM `crests` ORDER BY `crest_id` DESC"))
{
@@ -154,7 +154,7 @@ public final class CrestTable
*/
public L2Crest createCrest(byte[] data, CrestType crestType)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO `crests`(`crest_id`, `data`, `type`) VALUES(?, ?, ?)"))
{
final L2Crest crest = new L2Crest(_nextId.getAndIncrement(), data, crestType);
@@ -187,7 +187,7 @@ public final class CrestTable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM `crests` WHERE `crest_id` = ?"))
{
statement.setInt(1, crestId);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java
index e579fe957f..a386cd9a21 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java
@@ -56,7 +56,7 @@ public class OfflineTradersTable
public void storeOffliners()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS);
PreparedStatement stm3 = con.prepareStatement(SAVE_OFFLINE_STATUS);
@@ -173,7 +173,7 @@ public class OfflineTradersTable
{
LOGGER.info(getClass().getSimpleName() + ": Loading offline traders...");
int nTraders = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement stm = con.createStatement();
ResultSet rs = stm.executeQuery(LOAD_OFFLINE_STATUS))
{
@@ -329,7 +329,7 @@ public class OfflineTradersTable
public static synchronized void onTransaction(L2PcInstance trader, boolean finished, boolean firstCall)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_PLAYER);
PreparedStatement stm3 = con.prepareStatement(SAVE_ITEMS);
@@ -453,7 +453,7 @@ public class OfflineTradersTable
{
PlayerCountManager.getInstance().decOfflineTradeCount();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_PLAYER))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java
index 333e0e2289..4013e5e460 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java
@@ -42,7 +42,7 @@ public class PetNameTable
public boolean doesPetNameExist(String name, int petNpcId)
{
boolean result = true;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT name FROM pets p, items i WHERE p.item_obj_id = i.object_id AND name=? AND i.item_id IN (?)"))
{
ps.setString(1, name);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/TeleportLocationTable.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/TeleportLocationTable.java
index d988676113..8b6102f7c9 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/TeleportLocationTable.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/sql/impl/TeleportLocationTable.java
@@ -42,7 +42,7 @@ public class TeleportLocationTable
public void reloadAll()
{
_teleports.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT id, loc_x, loc_y, loc_z, price, fornoble, itemId FROM teleport"))
{
@@ -74,7 +74,7 @@ public class TeleportLocationTable
}
int _cTeleCount = _teleports.size();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT id, loc_x, loc_y, loc_z, price, fornoble, itemId FROM custom_teleport"))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java
index fa8d99133c..30255dfd9b 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java
@@ -67,7 +67,7 @@ public final class BuyListData implements IGameXmlReader
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _buyLists.size() + " BuyLists.");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rs = statement.executeQuery("SELECT * FROM `buylists`"))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/BotReportTable.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/BotReportTable.java
index 9e58991580..e6faf41fdd 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/BotReportTable.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/BotReportTable.java
@@ -112,7 +112,7 @@ public final class BotReportTable
*/
private void loadReportedCharData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery(SQL_LOAD_REPORTED_CHAR_DATA))
{
@@ -181,7 +181,7 @@ public final class BotReportTable
*/
public void saveReportedCharData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
PreparedStatement ps = con.prepareStatement(SQL_INSERT_REPORTED_CHAR_DATA))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/ItemTable.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/ItemTable.java
index 6f197ff9fa..bd6aa4768e 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/ItemTable.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/ItemTable.java
@@ -383,7 +383,7 @@ public class ItemTable
// if it's a pet control item, delete the pet as well
if (item.getItem().isPetItem())
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
{
// Delete the pet in db
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/SchemeBufferTable.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/SchemeBufferTable.java
index 7b47d8fc45..e72715b441 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/SchemeBufferTable.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/datatables/SchemeBufferTable.java
@@ -58,7 +58,7 @@ public class SchemeBufferTable
{
int count = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement st = con.prepareStatement(LOAD_SCHEMES);
ResultSet rs = st.executeQuery();
@@ -135,7 +135,7 @@ public class SchemeBufferTable
public void saveSchemes()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Delete all entries from database.
PreparedStatement st = con.prepareStatement(DELETE_SCHEMES);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
index 8d08a34e04..efcb3001d6 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -133,7 +133,7 @@ public abstract class IdFactory
*/
private void setAllCharacterOffline()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("UPDATE characters SET online = 0");
@@ -150,7 +150,7 @@ public abstract class IdFactory
*/
private void cleanUpDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement stmt = con.createStatement())
{
final long cleanupStart = System.currentTimeMillis();
@@ -261,7 +261,7 @@ public abstract class IdFactory
private void cleanInvalidWeddings()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("DELETE FROM mods_wedding WHERE player1Id NOT IN (SELECT charId FROM characters)");
@@ -276,7 +276,7 @@ public abstract class IdFactory
private void cleanUpTimeStamps()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
int cleanCount = 0;
for (String line : TIMESTAMPS_CLEAN)
@@ -302,7 +302,7 @@ public abstract class IdFactory
protected final Integer[] extractUsedObjectIDTable() throws Exception
{
final List temp = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
String extractUsedObjectIdsQuery = "";
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
index 2e387ea5b7..9114767cd8 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
@@ -42,7 +42,7 @@ public class StackIDFactory extends IdFactory
_curOID = FIRST_OID;
_tempOID = FIRST_OID;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// con.createStatement().execute("drop table if exists tmp_obj_id");
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java
index 27e559e0ec..051d5ada45 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java
@@ -163,7 +163,7 @@ public class AirShipManager
final StatsSet info = new StatsSet();
info.set("fuel", 600);
_airShipsInfo.put(ownerId, info);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_DB))
{
ps.setInt(1, ownerId);
@@ -233,7 +233,7 @@ public class AirShipManager
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(LOAD_DB))
{
@@ -264,7 +264,7 @@ public class AirShipManager
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_DB))
{
ps.setInt(1, info.getInt("fuel"));
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/CHSiegeManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/CHSiegeManager.java
index 79fa47c121..b0aff2f830 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/CHSiegeManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/CHSiegeManager.java
@@ -52,7 +52,7 @@ public final class CHSiegeManager
private final void loadClanHalls()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(SQL_LOAD_HALLS))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
index 19f4a89df7..53b20a40d2 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
@@ -282,7 +282,7 @@ public final class CastleManager implements InstanceListManager
}
}
// else offline-player circlet removal
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM items WHERE owner_id = ? and item_id = ?"))
{
ps.setInt(1, member.getObjectId());
@@ -299,7 +299,7 @@ public final class CastleManager implements InstanceListManager
@Override
public void loadInstances()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT id FROM castle ORDER BY id"))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
index 861236f919..e727579f72 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
@@ -158,7 +158,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
private final void loadDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stProduction = con.prepareStatement("SELECT * FROM castle_manor_production WHERE castle_id=?");
PreparedStatement stProcure = con.prepareStatement("SELECT * FROM castle_manor_procure WHERE castle_id=?"))
{
@@ -432,7 +432,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
_productionNext.put(castleId, list);
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement dps = con.prepareStatement("DELETE FROM castle_manor_production WHERE castle_id = ? AND next_period = 1");
PreparedStatement ips = con.prepareStatement(INSERT_PRODUCT))
{
@@ -468,7 +468,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
_procureNext.put(castleId, list);
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement dps = con.prepareStatement("DELETE FROM castle_manor_procure WHERE castle_id = ? AND next_period = 1");
PreparedStatement ips = con.prepareStatement(INSERT_CROP))
{
@@ -502,7 +502,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
public final void updateCurrentProduction(int castleId, Collection items)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle_manor_production SET amount = ? WHERE castle_id = ? AND seed_id = ? AND next_period = 0"))
{
for (SeedProduction sp : items)
@@ -522,7 +522,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
public final void updateCurrentProcure(int castleId, Collection items)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle_manor_procure SET amount = ? WHERE castle_id = ? AND crop_id = ? AND next_period = 0"))
{
for (CropProcure sp : items)
@@ -595,7 +595,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
@Override
public final boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ds = con.prepareStatement("DELETE FROM castle_manor_production");
PreparedStatement is = con.prepareStatement(INSERT_PRODUCT);
PreparedStatement dp = con.prepareStatement("DELETE FROM castle_manor_procure");
@@ -693,7 +693,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ds = con.prepareStatement("DELETE FROM castle_manor_production WHERE castle_id = ?");
PreparedStatement dc = con.prepareStatement("DELETE FROM castle_manor_procure WHERE castle_id = ?"))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/ClanHallAuctionManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/ClanHallAuctionManager.java
index 819002610d..2bded92c52 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/ClanHallAuctionManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/ClanHallAuctionManager.java
@@ -98,7 +98,7 @@ public final class ClanHallAuctionManager
private final void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT id FROM auction ORDER BY id"))
{
@@ -163,7 +163,7 @@ public final class ClanHallAuctionManager
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("INSERT INTO `auction` VALUES " + ITEM_INIT_DATA[i]);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/ClanHallManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/ClanHallManager.java
index ce483a71fd..402993ef64 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/ClanHallManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/ClanHallManager.java
@@ -61,7 +61,7 @@ public final class ClanHallManager
/** Load All Clan Hall */
private final void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT * FROM clanhall ORDER BY id"))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/CoupleManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/CoupleManager.java
index 84da1ae738..d424a91701 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/CoupleManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/CoupleManager.java
@@ -51,7 +51,7 @@ public final class CoupleManager
private final void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT id FROM mods_wedding ORDER BY id"))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
index a19dfa0453..10fce12055 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
@@ -169,7 +169,7 @@ public final class CursedWeaponsManager
private final void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT itemId, charId, playerKarma, playerPkKills, nbKills, endTime FROM cursed_weapons"))
{
@@ -202,7 +202,7 @@ public final class CursedWeaponsManager
// or a lost-child entry in the cursed weapons table, without a corresponding one in items...
// Retrieve the L2PcInstance from the characters table of the database
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT owner_id FROM items WHERE item_id=?"))
{
for (CursedWeapon cw : _cursedWeapons.values())
@@ -362,7 +362,7 @@ public final class CursedWeaponsManager
public static void removeFromDb(int itemId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM cursed_weapons WHERE itemId = ?"))
{
ps.setInt(1, itemId);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/DimensionalRiftManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/DimensionalRiftManager.java
index 1c8aadeddc..bb25591e46 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/DimensionalRiftManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/DimensionalRiftManager.java
@@ -74,7 +74,7 @@ public final class DimensionalRiftManager
private void loadRooms()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT * FROM dimensional_rift"))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java
index f635c19883..7101b82852 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java
@@ -46,7 +46,7 @@ public class FactionManager
private void loadAll()
{
_playerFactions.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT charId, faction FROM characters"))
{
@@ -75,7 +75,7 @@ public class FactionManager
return factionId;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT faction FROM characters WHERE charId=?"))
{
ps.setInt(1, id);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/FishingChampionshipManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/FishingChampionshipManager.java
index cf1cbf382b..bc62b07ae3 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/FishingChampionshipManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/FishingChampionshipManager.java
@@ -99,7 +99,7 @@ public class FishingChampionshipManager
{
_enddate = GlobalVariablesManager.getInstance().getLong("fishChampionshipEnd", 0);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement(SELECT);
final ResultSet rs = statement.executeQuery();
@@ -356,7 +356,7 @@ public class FishingChampionshipManager
{
GlobalVariablesManager.getInstance().set("fishChampionshipEnd", _enddate);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(DELETE);
statement.execute();
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/FortManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
index bb2f2cac2a..a363d10fc1 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
@@ -160,7 +160,7 @@ public final class FortManager implements InstanceListManager
@Override
public void loadInstances()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT id FROM fort ORDER BY id"))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/FortSiegeGuardManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/FortSiegeGuardManager.java
index 8c462404aa..d59a343aac 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/FortSiegeGuardManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/FortSiegeGuardManager.java
@@ -104,7 +104,7 @@ public final class FortSiegeGuardManager
void loadSiegeGuard()
{
_siegeGuards.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT npcId, x, y, z, heading, respawnDelay FROM fort_siege_guards WHERE fortId = ?"))
{
final int fortId = _fort.getResidenceId();
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
index 9d241d3c82..d71c05f45b 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
@@ -86,7 +86,7 @@ public final class FortSiegeManager
}
boolean register = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clan_id FROM fortsiege_clans where clan_id=? and fort_id=?"))
{
ps.setInt(1, clan.getId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/FourSepulchersManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/FourSepulchersManager.java
index 2d088162f7..6dd5293f50 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/FourSepulchersManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/FourSepulchersManager.java
@@ -404,7 +404,7 @@ public final class FourSepulchersManager
{
_mysteriousBoxSpawns.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY id"))
{
ps.setInt(1, 0);
@@ -457,7 +457,7 @@ public final class FourSepulchersManager
_physicalMonsters.clear();
int loaded = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("SELECT Distinct key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY key_npc_id"))
{
ps1.setInt(1, 1);
@@ -502,7 +502,7 @@ public final class FourSepulchersManager
_magicalMonsters.clear();
int loaded = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("SELECT Distinct key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY key_npc_id"))
{
ps1.setInt(1, 2);
@@ -549,7 +549,7 @@ public final class FourSepulchersManager
_archonSpawned.clear();
int loaded = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("SELECT Distinct key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY key_npc_id"))
{
ps1.setInt(1, 5);
@@ -598,7 +598,7 @@ public final class FourSepulchersManager
_emperorsGraveNpcs.clear();
int loaded = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("SELECT Distinct key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY key_npc_id"))
{
ps1.setInt(1, 6);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
index 63cb74f74e..3de347722e 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
@@ -50,7 +50,7 @@ public final class GlobalVariablesManager extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery(SELECT_QUERY))
{
@@ -81,7 +81,7 @@ public final class GlobalVariablesManager extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement del = con.createStatement();
PreparedStatement st = con.prepareStatement(INSERT_QUERY))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
index eda3f62de0..9d678c4110 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
@@ -73,7 +73,7 @@ public final class GrandBossManager implements IStorable
private void init()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT * from grandboss_data ORDER BY boss_id"))
{
@@ -123,7 +123,7 @@ public final class GrandBossManager implements IStorable
zones.put(zoneId, new ArrayList<>());
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT * from grandboss_list ORDER BY player_id"))
{
@@ -229,7 +229,7 @@ public final class GrandBossManager implements IStorable
@Override
public boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate(DELETE_GRAND_BOSS_LIST);
@@ -302,7 +302,7 @@ public final class GrandBossManager implements IStorable
private void updateDb(int bossId, boolean statusOnly)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final L2GrandBossInstance boss = BOSSES.get(bossId);
final StatsSet info = _storedInfo.get(bossId);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java
index 0e3df5353d..7c35809998 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java
@@ -119,7 +119,7 @@ public final class InstanceManager implements IGameXmlReader
restoreInstanceTimes(playerObjId);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_INSTANCE_TIME))
{
ps.setInt(1, playerObjId);
@@ -141,7 +141,7 @@ public final class InstanceManager implements IGameXmlReader
*/
public void deleteInstanceTime(int playerObjId, int id)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_INSTANCE_TIME))
{
ps.setInt(1, playerObjId);
@@ -165,7 +165,7 @@ public final class InstanceManager implements IGameXmlReader
return; // already restored
}
_playerInstanceTimes.put(playerObjId, new ConcurrentHashMap<>());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(RESTORE_INSTANCE_TIMES))
{
ps.setInt(1, playerObjId);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java
index 2a3e1c8d9e..9189da7efc 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java
@@ -58,7 +58,7 @@ public final class ItemAuctionManager
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT auctionId FROM item_auction ORDER BY auctionId DESC LIMIT 0, 1"))
{
@@ -135,7 +135,7 @@ public final class ItemAuctionManager
public static void deleteAuction(int auctionId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM item_auction WHERE auctionId=?"))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
index f8245be14b..faeb03db40 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
@@ -80,7 +80,7 @@ public final class ItemsOnGroundManager implements Runnable
str = "UPDATE itemsonground SET drop_time = ? WHERE drop_time = -1";
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(str))
{
ps.setLong(1, System.currentTimeMillis());
@@ -93,7 +93,7 @@ public final class ItemsOnGroundManager implements Runnable
}
// Add items to world
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable FROM itemsonground"))
{
int count = 0;
@@ -173,7 +173,7 @@ public final class ItemsOnGroundManager implements Runnable
public void emptyTable()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("DELETE FROM itemsonground");
@@ -199,7 +199,7 @@ public final class ItemsOnGroundManager implements Runnable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO itemsonground(object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable) VALUES(?,?,?,?,?,?,?,?,?)"))
{
for (L2ItemInstance item : _items)
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/MailManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/MailManager.java
index f5737828fa..524559759d 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/MailManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/MailManager.java
@@ -55,7 +55,7 @@ public final class MailManager
private void load()
{
int count = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT * FROM messages ORDER BY expiration"))
{
@@ -165,7 +165,7 @@ public final class MailManager
public void sendMessage(Message msg)
{
_messages.put(msg.getId(), msg);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = Message.getStatement(msg, con))
{
ps.execute();
@@ -186,7 +186,7 @@ public final class MailManager
public final void markAsReadInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isUnread = 'false' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -200,7 +200,7 @@ public final class MailManager
public final void markAsDeletedBySenderInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isDeletedBySender = 'true' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -214,7 +214,7 @@ public final class MailManager
public final void markAsDeletedByReceiverInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isDeletedByReceiver = 'true' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -228,7 +228,7 @@ public final class MailManager
public final void removeAttachmentsInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET hasAttachments = 'false' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -242,7 +242,7 @@ public final class MailManager
public final void deleteMessageInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM messages WHERE messageId = ?"))
{
ps.setInt(1, msgId);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/MercTicketManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/MercTicketManager.java
index 5d6d2c8765..3e7450defb 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/MercTicketManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/MercTicketManager.java
@@ -145,7 +145,7 @@ public final class MercTicketManager
*/
private final void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT * FROM castle_siege_guards Where isHired = 1"))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
index a29ed155fc..c03a9a8aae 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
@@ -128,7 +128,7 @@ public class PremiumManager
private void loadPremiumData(String accountName)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stmt = con.prepareStatement(LOAD_SQL))
{
stmt.setString(1, accountName);
@@ -160,7 +160,7 @@ public class PremiumManager
long newPremiumExpiration = oldPremiumExpiration + addTime;
// UPDATE DATABASE
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stmt = con.prepareStatement(UPDATE_SQL))
{
stmt.setLong(1, newPremiumExpiration);
@@ -205,7 +205,7 @@ public class PremiumManager
premiumData.remove(accountName);
// UPDATE DATABASE
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stmt = con.prepareStatement(DELETE_SQL))
{
stmt.setString(1, accountName);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java
index 88daa47c9f..eef555d824 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java
@@ -56,7 +56,7 @@ public final class PunishmentManager
int expired = 0;
// Load punishments.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery("SELECT * FROM punishments"))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/RaidBossPointsManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/RaidBossPointsManager.java
index 1b1ab2ed29..c30949f826 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/RaidBossPointsManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/RaidBossPointsManager.java
@@ -51,7 +51,7 @@ public class RaidBossPointsManager
private final void init()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT `charId`,`boss_id`,`points` FROM `character_raid_points`"))
{
@@ -78,7 +78,7 @@ public class RaidBossPointsManager
public final void updatePointsInDB(L2PcInstance player, int raidId, int points)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO character_raid_points (`charId`,`boss_id`,`points`) VALUES (?,?,?)"))
{
ps.setInt(1, player.getObjectId());
@@ -122,7 +122,7 @@ public class RaidBossPointsManager
public final void cleanUp()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE from character_raid_points WHERE charId > 0"))
{
statement.executeUpdate();
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/RaidBossSpawnManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/RaidBossSpawnManager.java
index a80c726d07..d3ea4b1487 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/RaidBossSpawnManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/RaidBossSpawnManager.java
@@ -75,7 +75,7 @@ public class RaidBossSpawnManager
_storedInfo.clear();
_schedules.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT * FROM raidboss_spawnlist ORDER BY boss_id"))
{
@@ -247,7 +247,7 @@ public class RaidBossSpawnManager
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO raidboss_spawnlist (boss_id,amount,loc_x,loc_y,loc_z,heading,respawn_time,currentHp,currentMp) VALUES(?,?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, spawnDat.getId());
@@ -307,7 +307,7 @@ public class RaidBossSpawnManager
if (updateDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM raidboss_spawnlist WHERE boss_id=?"))
{
ps.setInt(1, bossId);
@@ -326,7 +326,7 @@ public class RaidBossSpawnManager
*/
private void updateDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE raidboss_spawnlist SET respawn_time = ?, currentHP = ?, currentMP = ? WHERE boss_id = ?"))
{
for (Integer bossId : _storedInfo.keySet())
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
index 1ab184e465..1f802255fb 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
@@ -104,7 +104,7 @@ public final class SiegeGuardManager
*/
public void removeMerc(int npcId, int x, int y, int z)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("Delete From castle_siege_guards Where npcId = ? And x = ? AND y = ? AND z = ? AND isHired = 1"))
{
ps.setInt(1, npcId);
@@ -124,7 +124,7 @@ public final class SiegeGuardManager
*/
public void removeMercs()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("Delete From castle_siege_guards Where castleId = ? And isHired = 1"))
{
ps.setInt(1, _castle.getResidenceId());
@@ -191,7 +191,7 @@ public final class SiegeGuardManager
*/
private void loadSiegeGuard()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_siege_guards Where castleId = ? And isHired = ?"))
{
ps.setInt(1, _castle.getResidenceId());
@@ -228,7 +228,7 @@ public final class SiegeGuardManager
*/
private void saveSiegeGuard(int x, int y, int z, int heading, int npcId, int isHire)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("Insert Into castle_siege_guards (castleId, npcId, x, y, z, heading, respawnDelay, isHired) Values (?, ?, ?, ?, ?, ?, ?, ?)"))
{
ps.setInt(1, _castle.getResidenceId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
index 5919a7c02d..0fcd79597c 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
@@ -87,7 +87,7 @@ public final class SiegeManager
}
boolean register = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clan_id FROM siege_clans where clan_id=? and castle_id=?"))
{
ps.setInt(1, clan.getId());
@@ -276,7 +276,7 @@ public final class SiegeManager
private final void loadTrapUpgrade(int castleId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_trapupgrade WHERE castleId=?"))
{
ps.setInt(1, castleId);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/TerritoryWarManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/TerritoryWarManager.java
index 5cfa8202f3..ee09bfba35 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/TerritoryWarManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/TerritoryWarManager.java
@@ -749,7 +749,7 @@ public final class TerritoryWarManager implements Siegable
private void changeRegistration(int castleId, int objId, boolean delete)
{
final String query = delete ? DELETE : INSERT;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(query))
{
ps.setInt(1, castleId);
@@ -770,7 +770,7 @@ public final class TerritoryWarManager implements Siegable
wardList.append(i + ";");
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE territories SET ownedWardIds=? WHERE territoryId=?"))
{
ps.setString(1, wardList.toString());
@@ -800,7 +800,7 @@ public final class TerritoryWarManager implements Siegable
MINTWBADGEFORSTRIDERS = territoryWarSettings.getInt("MinTerritoryBadgeForStriders", 50);
MINTWBADGEFORBIGSTRIDER = territoryWarSettings.getInt("MinTerritoryBadgeForBigStrider", 80);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT * FROM territory_spawnlist"))
{
@@ -840,7 +840,7 @@ public final class TerritoryWarManager implements Siegable
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": SpawnList error: " + e.getMessage(), e);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT * FROM territories"))
{
@@ -878,7 +878,7 @@ public final class TerritoryWarManager implements Siegable
LOGGER.log(Level.WARNING, getClass().getSimpleName() + ": territory list error(): " + e.getMessage(), e);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT * FROM territory_registrations"))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/games/Lottery.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/games/Lottery.java
index f2806360d8..78873fbf92 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/games/Lottery.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/instancemanager/games/Lottery.java
@@ -91,7 +91,7 @@ public class Lottery
public void increasePrize(long count)
{
_prize += count;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_PRICE))
{
ps.setLong(1, _prize);
@@ -125,7 +125,7 @@ public class Lottery
@Override
public void run()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery(SELECT_LAST_LOTTERY))
{
@@ -194,7 +194,7 @@ public class Lottery
ThreadPool.schedule(new stopSellingTickets(), _enddate - System.currentTimeMillis() - (10 * MINUTE));
ThreadPool.schedule(new finishLottery(), _enddate - System.currentTimeMillis());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_LOTTERY))
{
ps.setInt(1, 1);
@@ -281,7 +281,7 @@ public class Lottery
int count3 = 0;
int count4 = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_LOTTERY_ITEM))
{
ps.setInt(1, _number);
@@ -382,7 +382,7 @@ public class Lottery
}
Broadcast.toAllOnlinePlayers(sm);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_LOTTERY))
{
ps.setLong(1, _prize);
@@ -452,7 +452,7 @@ public class Lottery
0,
0
};
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_LOTTERY_TICKET))
{
ps.setInt(1, id);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/AutoSpawnHandler.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/AutoSpawnHandler.java
index e19a54f2b3..db45d11bc5 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/AutoSpawnHandler.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/AutoSpawnHandler.java
@@ -123,7 +123,7 @@ public class AutoSpawnHandler
private void restoreSpawnData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT * FROM random_spawn ORDER BY groupId ASC");
PreparedStatement ps = con.prepareStatement("SELECT * FROM random_spawn_loc WHERE groupId=?"))
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/BlockList.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/BlockList.java
index a9a2975feb..cb5ece7b27 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/BlockList.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/BlockList.java
@@ -70,7 +70,7 @@ public class BlockList
private static List loadList(int ObjId)
{
final List list = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=? AND relation=1"))
{
statement.setInt(1, ObjId);
@@ -97,7 +97,7 @@ public class BlockList
private void updateInDB(int targetId, boolean state)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (state) // add
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/CursedWeapon.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/CursedWeapon.java
index 96c8647425..5658daf504 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/CursedWeapon.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/CursedWeapon.java
@@ -138,7 +138,7 @@ public class CursedWeapon implements INamable
// Remove from Db
LOGGER.info(_name + " being removed offline.");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement del = con.prepareStatement("DELETE FROM items WHERE owner_id=? AND item_id=?");
PreparedStatement ps = con.prepareStatement("UPDATE characters SET karma=?, pkkills=? WHERE charId=?"))
{
@@ -475,7 +475,7 @@ public class CursedWeapon implements INamable
public void saveData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement del = con.prepareStatement("DELETE FROM cursed_weapons WHERE itemId = ?");
PreparedStatement ps = con.prepareStatement("INSERT INTO cursed_weapons (itemId, charId, playerKarma, playerPkKills, nbKills, endTime) VALUES (?, ?, ?, ?, ?, ?)"))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Clan.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Clan.java
index a0d095574d..6eff8fe05e 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Clan.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2Clan.java
@@ -249,7 +249,7 @@ public class L2Clan implements IIdentifiable, INamable
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET clan_privs = ? WHERE charId = ?"))
{
ps.setInt(1, 0);
@@ -289,7 +289,7 @@ public class L2Clan implements IIdentifiable, INamable
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET clan_privs = ? WHERE charId = ?"))
{
ps.setInt(1, EnumIntBitmask.getAllBitmask(ClanPrivilege.class));
@@ -871,7 +871,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateBloodAllianceCountInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET blood_alliance_count=? WHERE clan_id=?"))
{
ps.setInt(1, _bloodAllianceCount);
@@ -915,7 +915,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateBloodOathCountInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET blood_oath_count=? WHERE clan_id=?"))
{
ps.setInt(1, _bloodOathCount);
@@ -933,7 +933,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET reputation_score=? WHERE clan_id=?"))
{
ps.setInt(1, _reputationScore);
@@ -962,7 +962,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateClanInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET leader_id=?,ally_id=?,ally_name=?,reputation_score=?,ally_penalty_expiry_time=?,ally_penalty_type=?,char_penalty_expiry_time=?,dissolving_expiry_time=?,new_leader_id=? WHERE clan_id=?"))
{
ps.setInt(1, getLeaderId());
@@ -1000,7 +1000,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void store()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_CLAN_DATA))
{
ps.setInt(1, _clanId);
@@ -1032,7 +1032,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
private void removeMemberInDatabase(int playerId, long clanJoinExpiryTime, long clanCreateExpiryTime)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("UPDATE characters SET clanid=0, title=?, clan_join_expiry_time=?, clan_create_expiry_time=?, clan_privs=0, wantspeace=0, subpledge=0, lvl_joined_academy=0, apprentice=0, sponsor=0 WHERE charId=?");
PreparedStatement ps2 = con.prepareStatement("UPDATE characters SET apprentice=0 WHERE apprentice=?");
PreparedStatement ps3 = con.prepareStatement("UPDATE characters SET sponsor=0 WHERE sponsor=?"))
@@ -1058,7 +1058,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_CLAN_DATA))
{
ps.setInt(1, _clanId);
@@ -1133,7 +1133,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreNotice()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT enabled,notice FROM clan_notices WHERE clan_id=?"))
{
ps.setInt(1, _clanId);
@@ -1164,7 +1164,7 @@ public class L2Clan implements IIdentifiable, INamable
notice = notice.substring(0, MAX_NOTICE_LENGTH - 1);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_notices (clan_id,notice,enabled) values (?,?,?) ON DUPLICATE KEY UPDATE notice=?,enabled=?"))
{
ps.setInt(1, _clanId);
@@ -1219,7 +1219,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreSkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT skill_id,skill_level,sub_pledge_id FROM clan_skills WHERE clan_id=?"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -1326,7 +1326,7 @@ public class L2Clan implements IIdentifiable, INamable
oldSkill = subunit.addNewSkill(newSkill);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (oldSkill != null)
{
@@ -1769,7 +1769,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreSubPledges()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT sub_pledge_id,name,leader_id FROM clan_subpledges WHERE clan_id=?"))
{
// Retrieve all subpledges of this clan from the database
@@ -1869,7 +1869,7 @@ public class L2Clan implements IIdentifiable, INamable
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_subpledges (clan_id,sub_pledge_id,name,leader_id) values (?,?,?,?)"))
{
ps.setInt(1, _clanId);
@@ -1952,7 +1952,7 @@ public class L2Clan implements IIdentifiable, INamable
public void updateSubPledgeInDB(int pledgeType)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_subpledges SET leader_id=?, name=? WHERE clan_id=? AND sub_pledge_id=?"))
{
ps.setInt(1, getSubPledge(pledgeType).getLeaderId());
@@ -1969,7 +1969,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreRankPrivs()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT privs,rank,party FROM clan_privs WHERE clan_id=?"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -2018,7 +2018,7 @@ public class L2Clan implements IIdentifiable, INamable
{
_privs.get(rank).setPrivs(privs);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_privs (clan_id,rank,party,privs) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE privs = ?"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -2055,7 +2055,7 @@ public class L2Clan implements IIdentifiable, INamable
{
_privs.put(rank, new RankPrivs(rank, 0, privs));
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_privs (clan_id,rank,party,privs) VALUES (?,?,?,?)"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -2174,7 +2174,7 @@ public class L2Clan implements IIdentifiable, INamable
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET auction_bid_at=? WHERE clan_id=?"))
{
ps.setInt(1, id);
@@ -2727,7 +2727,7 @@ public class L2Clan implements IIdentifiable, INamable
public void changeLevel(int level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET clan_level = ? WHERE clan_id = ?"))
{
ps.setInt(1, level);
@@ -2773,7 +2773,7 @@ public class L2Clan implements IIdentifiable, INamable
setCrestId(crestId);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET crest_id = ? WHERE clan_id = ?"))
{
ps.setInt(1, crestId);
@@ -2810,7 +2810,7 @@ public class L2Clan implements IIdentifiable, INamable
allyId = _allyId;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(sqlStatement))
{
ps.setInt(1, crestId);
@@ -2856,7 +2856,7 @@ public class L2Clan implements IIdentifiable, INamable
setCrestLargeId(crestId);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET crest_large_id = ? WHERE clan_id = ?"))
{
ps.setInt(1, crestId);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2ClanMember.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2ClanMember.java
index 5c28e1ce21..2e5f935c0b 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2ClanMember.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2ClanMember.java
@@ -232,7 +232,7 @@ public class L2ClanMember
*/
public void updatePledgeType()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET subpledge=? WHERE charId=?"))
{
ps.setLong(1, _pledgeType);
@@ -277,7 +277,7 @@ public class L2ClanMember
*/
public void updatePowerGrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET power_grade=? WHERE charId=?"))
{
ps.setLong(1, _powerGrade);
@@ -788,7 +788,7 @@ public class L2ClanMember
*/
public void saveApprenticeAndSponsor(int apprentice, int sponsor)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET apprentice=?,sponsor=? WHERE charId=?"))
{
ps.setInt(1, apprentice);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2ContactList.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2ContactList.java
index 7efd01c498..c64d3079aa 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2ContactList.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/L2ContactList.java
@@ -58,7 +58,7 @@ public class L2ContactList
{
_contacts.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY_LOAD))
{
statement.setInt(1, activeChar.getObjectId());
@@ -124,7 +124,7 @@ public class L2ContactList
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY_ADD))
{
statement.setInt(1, activeChar.getObjectId());
@@ -161,7 +161,7 @@ public class L2ContactList
_contacts.remove(name);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY_REMOVE))
{
statement.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/MacroList.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/MacroList.java
index 711e012d35..97eb61411b 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/MacroList.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/MacroList.java
@@ -128,7 +128,7 @@ public class MacroList implements IRestorable
private void registerMacroInDb(Macro macro)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO character_macroses (charId,id,icon,name,descr,acronym,commands) values(?,?,?,?,?,?,?)"))
{
ps.setInt(1, _owner.getObjectId());
@@ -164,7 +164,7 @@ public class MacroList implements IRestorable
private void deleteMacroFromDb(Macro macro)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_macroses WHERE charId=? AND id=?"))
{
ps.setInt(1, _owner.getObjectId());
@@ -181,7 +181,7 @@ public class MacroList implements IRestorable
public boolean restoreMe()
{
_macroses.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT charId, id, icon, name, descr, acronym, commands FROM character_macroses WHERE charId=?"))
{
ps.setInt(1, _owner.getObjectId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/ShortCuts.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/ShortCuts.java
index 13431bb913..28f2dfce5b 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/ShortCuts.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/ShortCuts.java
@@ -85,7 +85,7 @@ public class ShortCuts implements IRestorable
deleteShortCutFromDb(oldShortCut);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("REPLACE INTO character_shortcuts (charId,slot,page,type,shortcut_id,level,class_index) values(?,?,?,?,?,?,?)"))
{
statement.setInt(1, _owner.getObjectId());
@@ -153,7 +153,7 @@ public class ShortCuts implements IRestorable
*/
private void deleteShortCutFromDb(Shortcut shortcut)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=? AND slot=? AND page=? AND class_index=?"))
{
statement.setInt(1, _owner.getObjectId());
@@ -172,7 +172,7 @@ public class ShortCuts implements IRestorable
public boolean restoreMe()
{
_shortCuts.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT charId, slot, page, type, shortcut_id, level FROM character_shortcuts WHERE charId=? AND class_index=?"))
{
statement.setInt(1, _owner.getObjectId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/UIKeysSettings.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/UIKeysSettings.java
index c04e85d0da..6d39b3e0a6 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/UIKeysSettings.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/UIKeysSettings.java
@@ -104,7 +104,7 @@ public class UIKeysSettings
}
}
query = query.substring(0, query.length() - 1) + "; ";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(query))
{
statement.execute();
@@ -125,7 +125,7 @@ public class UIKeysSettings
}
query = query.substring(0, query.length() - 1) + ";";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(query))
{
statement.execute();
@@ -146,7 +146,7 @@ public class UIKeysSettings
_storedCategories = new HashMap<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM character_ui_categories WHERE `charId` = ? ORDER BY `catId`, `order`"))
{
ps.setInt(1, _playerObjId);
@@ -178,7 +178,7 @@ public class UIKeysSettings
_storedKeys = new HashMap<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM character_ui_actions WHERE `charId` = ? ORDER BY `cat`, `order`"))
{
ps.setInt(1, _playerObjId);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
index 8f6fc143e8..4f67bffd89 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
@@ -1357,7 +1357,7 @@ public final class L2PcInstance extends L2Playable
private void insertNewRecipeData(int recipeId, boolean isDwarf)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO character_recipebook (charId, id, classIndex, type) values(?,?,?,?)"))
{
ps.setInt(1, getObjectId());
@@ -1374,7 +1374,7 @@ public final class L2PcInstance extends L2Playable
private void deleteRecipeData(int recipeId, boolean isDwarf)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_recipebook WHERE charId=? AND id=? AND classIndex=?"))
{
ps.setInt(1, getObjectId());
@@ -6673,7 +6673,7 @@ public final class L2PcInstance extends L2Playable
*/
public void updateOnlineStatus()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET online=?, lastAccess=? WHERE charId=?"))
{
ps.setInt(1, isOnlineInt());
@@ -6693,7 +6693,7 @@ public final class L2PcInstance extends L2Playable
*/
private boolean createDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_CHARACTER))
{
ps.setString(1, _accountName);
@@ -6758,7 +6758,7 @@ public final class L2PcInstance extends L2Playable
double currentCp = 0;
double currentHp = 0;
double currentMp = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(RESTORE_CHARACTER))
{
// Retrieve the L2PcInstance from the characters table of the database
@@ -7087,7 +7087,7 @@ public final class L2PcInstance extends L2Playable
*/
private static boolean restoreSubClassData(L2PcInstance player)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(RESTORE_CHAR_SUBCLASSES))
{
ps.setInt(1, player.getObjectId());
@@ -7168,7 +7168,7 @@ public final class L2PcInstance extends L2Playable
private void restoreRecipeBook(boolean loadCommon)
{
final String sql = loadCommon ? "SELECT id, type, classIndex FROM character_recipebook WHERE charId=?" : "SELECT id FROM character_recipebook WHERE charId=? AND classIndex=? AND type = 1";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(sql))
{
ps.setInt(1, getObjectId());
@@ -7221,7 +7221,7 @@ public final class L2PcInstance extends L2Playable
private void loadPremiumItemList()
{
final String sql = "SELECT itemNum, itemId, itemCount, itemSender FROM character_premium_items WHERE charId=?";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(sql))
{
ps.setInt(1, getObjectId());
@@ -7241,7 +7241,7 @@ public final class L2PcInstance extends L2Playable
public void updatePremiumItem(int itemNum, long newcount)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE character_premium_items SET itemCount=? WHERE charId=? AND itemNum=? "))
{
ps.setLong(1, newcount);
@@ -7257,7 +7257,7 @@ public final class L2PcInstance extends L2Playable
public void deletePremiumItem(int itemNum)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_premium_items WHERE charId=? AND itemNum=? "))
{
ps.setInt(1, getObjectId());
@@ -7315,7 +7315,7 @@ public final class L2PcInstance extends L2Playable
final long exp = getStat().getBaseExp();
final int level = getStat().getBaseLevel();
final long sp = getStat().getBaseSp();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_CHARACTER))
{
ps.setInt(1, level);
@@ -7403,7 +7403,7 @@ public final class L2PcInstance extends L2Playable
}
// TODO(Zoey76): Refactor this to use batch.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_CHAR_SUBCLASS))
{
for (SubClass subClass : getSubClasses().values())
@@ -7432,7 +7432,7 @@ public final class L2PcInstance extends L2Playable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE);)
{
@@ -7537,7 +7537,7 @@ public final class L2PcInstance extends L2Playable
private void storeItemReuseDelay()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(DELETE_ITEM_REUSE_SAVE);
PreparedStatement ps2 = con.prepareStatement(ADD_ITEM_REUSE_SAVE))
{
@@ -7658,7 +7658,7 @@ public final class L2PcInstance extends L2Playable
final Skill oldSkill = super.removeSkill(skill, true);
if (oldSkill != null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_SKILL_FROM_CHAR))
{
// Remove or update a L2PcInstance skill from the character_skills table of the database
@@ -7701,7 +7701,7 @@ public final class L2PcInstance extends L2Playable
private void storeSkill(Skill newSkill, Skill oldSkill, int newClassIndex)
{
final int classIndex = (newClassIndex > -1) ? newClassIndex : _classIndex;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if ((oldSkill != null) && (newSkill != null))
{
@@ -7749,7 +7749,7 @@ public final class L2PcInstance extends L2Playable
}
final int classIndex = (newClassIndex > -1) ? newClassIndex : _classIndex;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_NEW_SKILLS))
{
con.setAutoCommit(false);
@@ -7775,7 +7775,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restoreSkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -7823,7 +7823,7 @@ public final class L2PcInstance extends L2Playable
@Override
public void restoreEffects()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(RESTORE_SKILL_SAVE))
{
ps.setInt(1, getObjectId());
@@ -7880,7 +7880,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restoreItemReuse()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(RESTORE_ITEM_REUSE_SAVE);
PreparedStatement delete = con.prepareStatement(DELETE_ITEM_REUSE_SAVE);)
{
@@ -7951,7 +7951,7 @@ public final class L2PcInstance extends L2Playable
_henna[i] = null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(RESTORE_CHAR_HENNAS))
{
ps.setInt(1, getObjectId());
@@ -8039,7 +8039,7 @@ public final class L2PcInstance extends L2Playable
_henna[slot] = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_CHAR_HENNA))
{
ps.setInt(1, getObjectId());
@@ -8092,7 +8092,7 @@ public final class L2PcInstance extends L2Playable
// Calculate Henna modifiers of this L2PcInstance
recalcHennaStats();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_CHAR_HENNA))
{
ps.setInt(1, getObjectId());
@@ -10121,7 +10121,7 @@ public final class L2PcInstance extends L2Playable
newClass.setClassId(classId);
newClass.setClassIndex(classIndex);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_CHAR_SUBCLASS))
{
// Store the basic info about this new sub-class.
@@ -10186,7 +10186,7 @@ public final class L2PcInstance extends L2Playable
try
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
@@ -12770,7 +12770,7 @@ public final class L2PcInstance extends L2Playable
return;
}
final String req = "UPDATE pets SET fed=? WHERE item_obj_id = ?";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(req))
{
ps.setInt(1, _curFeed);
@@ -12919,7 +12919,7 @@ public final class L2PcInstance extends L2Playable
bookmark.setTag(tag);
bookmark.setName(name);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_TP_BOOKMARK))
{
ps.setInt(1, icon);
@@ -12944,7 +12944,7 @@ public final class L2PcInstance extends L2Playable
{
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_TP_BOOKMARK))
{
ps.setInt(1, getObjectId());
@@ -13090,7 +13090,7 @@ public final class L2PcInstance extends L2Playable
sm.addItemName(20033);
sendPacket(sm);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_TP_BOOKMARK))
{
ps.setInt(1, getObjectId());
@@ -13112,7 +13112,7 @@ public final class L2PcInstance extends L2Playable
public void restoreTeleportBookmark()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(RESTORE_TP_BOOKMARK))
{
ps.setInt(1, getObjectId());
@@ -13350,7 +13350,7 @@ public final class L2PcInstance extends L2Playable
_friendList.clear();
final String sqlQuery = "SELECT friendId FROM character_friends WHERE charId=? AND relation=0";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(sqlQuery))
{
ps.setInt(1, getObjectId());
@@ -13440,7 +13440,7 @@ public final class L2PcInstance extends L2Playable
{
if (hasManufactureShop())
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement st = con.prepareStatement(DELETE_CHAR_RECIPE_SHOP))
{
@@ -13478,7 +13478,7 @@ public final class L2PcInstance extends L2Playable
_manufactureItems.clear();
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(RESTORE_CHAR_RECIPE_SHOP))
{
ps.setInt(1, getObjectId());
@@ -13922,7 +13922,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restorePetInventoryItems()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT object_id FROM `items` WHERE `owner_id`=? AND (`loc`='PET' OR `loc`='PET_EQUIP') LIMIT 1;"))
{
ps.setInt(1, getObjectId());
@@ -13964,7 +13964,7 @@ public final class L2PcInstance extends L2Playable
private long loadRecommendations()
{
long _time_left = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT rec_have,rec_left,time_left FROM character_reco_bonus WHERE charId=? LIMIT 1"))
{
ps.setInt(1, getObjectId());
@@ -14007,7 +14007,7 @@ public final class L2PcInstance extends L2Playable
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO character_reco_bonus (charId,rec_have,rec_left,time_left) VALUES (?,?,?,?)"))
{
ps.setInt(1, getObjectId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
index faefa9139a..2949345e06 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
@@ -775,7 +775,7 @@ public class L2PetInstance extends L2Summon
}
// pet control item no longer exists, delete the pet from the db
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM pets WHERE item_obj_id = ?"))
{
ps.setInt(1, _controlObjectId);
@@ -834,7 +834,7 @@ public class L2PetInstance extends L2Summon
private static L2PetInstance restore(L2ItemInstance control, L2NpcTemplate template, L2PcInstance owner)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT item_obj_id, name, level, curHp, curMp, exp, sp, fed FROM pets WHERE item_obj_id=?"))
{
L2PetInstance pet;
@@ -926,7 +926,7 @@ public class L2PetInstance extends L2Summon
}
final String req = !_respawned ? "INSERT INTO pets (name,level,curHp,curMp,exp,sp,fed,ownerId,restore,item_obj_id) VALUES (?,?,?,?,?,?,?,?,?,?)" : "UPDATE pets SET name=?,level=?,curHp=?,curMp=?,exp=?,sp=?,fed=?,ownerId=?,restore=? WHERE item_obj_id = ?";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(req))
{
ps.setString(1, getName());
@@ -976,7 +976,7 @@ public class L2PetInstance extends L2Summon
// Clear list for overwrite
SummonEffectsTable.getInstance().clearPetEffects(getControlObjectId());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement ps2 = con.prepareStatement(ADD_SKILL_SAVE))
{
@@ -1044,7 +1044,7 @@ public class L2PetInstance extends L2Summon
@Override
public void restoreEffects()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(RESTORE_SKILL_SAVE);
PreparedStatement ps2 = con.prepareStatement(DELETE_SKILL_SAVE))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java
index f1771c0fb4..98a8242086 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java
@@ -217,7 +217,7 @@ public class L2ServitorInstance extends L2Summon implements Runnable
// Clear list for overwrite
SummonEffectsTable.getInstance().clearServitorEffects(getOwner(), getReferenceSkill());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_SKILL_SAVE))
{
// Delete all current stored effects for summon to avoid dupe
@@ -296,7 +296,7 @@ public class L2ServitorInstance extends L2Summon implements Runnable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (!SummonEffectsTable.getInstance().containsSkill(getOwner(), getReferenceSkill()))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/announce/Announcement.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/announce/Announcement.java
index 4e5aa84b0f..a7117539ad 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/announce/Announcement.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/announce/Announcement.java
@@ -108,7 +108,7 @@ public class Announcement implements IAnnouncement
@Override
public boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
{
ps.setInt(1, _type.ordinal());
@@ -134,7 +134,7 @@ public class Announcement implements IAnnouncement
@Override
public boolean updateMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_QUERY))
{
ps.setInt(1, _type.ordinal());
@@ -154,7 +154,7 @@ public class Announcement implements IAnnouncement
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_QUERY))
{
ps.setInt(1, _id);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java
index 0754479290..7350a0b26f 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java
@@ -94,7 +94,7 @@ public final class AutoAnnouncement extends Announcement implements Runnable
@Override
public boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
{
ps.setInt(1, getType().ordinal());
@@ -123,7 +123,7 @@ public final class AutoAnnouncement extends Announcement implements Runnable
@Override
public boolean updateMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_QUERY))
{
ps.setInt(1, getType().ordinal());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/buylist/Product.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/buylist/Product.java
index f215c550c7..a1bacc10ae 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/buylist/Product.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/buylist/Product.java
@@ -155,7 +155,7 @@ public final class Product
private void save()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO `buylists`(`buylist_id`, `item_id`, `count`, `next_restock_time`) VALUES(?, ?, ?, ?) ON DUPLICATE KEY UPDATE `count` = ?, `next_restock_time` = ?"))
{
ps.setInt(1, _buyListId);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Auction.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Auction.java
index 113a5ef8c3..a1a513294d 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Auction.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Auction.java
@@ -162,7 +162,7 @@ public class Auction
/** Load auctions */
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("Select * from auction where id = ?"))
{
ps.setInt(1, _id);
@@ -197,7 +197,7 @@ public class Auction
_highestBidderName = "";
_highestBidderMaxBid = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT bidderId, bidderName, maxBid, clan_name, time_bid FROM auction_bid WHERE auctionId = ? ORDER BY maxBid DESC"))
{
ps.setInt(1, _id);
@@ -246,7 +246,7 @@ public class Auction
/** Save Auction Data End */
private void saveAuctionDate()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("Update auction set endDate = ? where id = ?"))
{
ps.setLong(1, _endDate);
@@ -337,7 +337,7 @@ public class Auction
*/
private void updateInDB(L2PcInstance bidder, long bid)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (_bidders.get(bidder.getClanId()) != null)
{
@@ -394,7 +394,7 @@ public class Auction
/** Remove bids */
private void removeBids()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM auction_bid WHERE auctionId=?"))
{
ps.setInt(1, _id);
@@ -424,7 +424,7 @@ public class Auction
public void deleteAuctionFromDB()
{
ClanHallAuctionManager.getInstance().getAuctions().remove(this);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM auction WHERE itemId=?"))
{
ps.setInt(1, _itemId);
@@ -480,7 +480,7 @@ public class Auction
*/
public synchronized void cancelBid(int bidder)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM auction_bid WHERE auctionId=? AND bidderId=?"))
{
ps.setInt(1, _id);
@@ -509,7 +509,7 @@ public class Auction
public void confirmAuction()
{
ClanHallAuctionManager.getInstance().getAuctions().add(this);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO auction (id, sellerId, sellerName, sellerClanName, itemType, itemId, itemObjectId, itemName, itemQuantity, startingBid, currentBid, endDate) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, _id);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Castle.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Castle.java
index ca6f0b2087..60d0dc8462 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Castle.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Castle.java
@@ -212,7 +212,7 @@ public final class Castle extends AbstractResidence
public void dbSave()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_functions (castle_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)"))
{
ps.setInt(1, getResidenceId());
@@ -345,7 +345,7 @@ public final class Castle extends AbstractResidence
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET treasury = ? WHERE id = ?"))
{
ps.setLong(1, _treasury);
@@ -578,7 +578,7 @@ public final class Castle extends AbstractResidence
_taxPercent = taxPercent;
_taxRate = _taxPercent / 100.0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET taxPercent = ? WHERE id = ?"))
{
ps.setInt(1, taxPercent);
@@ -625,7 +625,7 @@ public final class Castle extends AbstractResidence
@Override
protected void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("SELECT * FROM castle WHERE id = ?");
PreparedStatement ps2 = con.prepareStatement("SELECT clan_id FROM clan_data WHERE hasCastle = ?"))
{
@@ -671,7 +671,7 @@ public final class Castle extends AbstractResidence
/** Load All Functions */
private void loadFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_functions WHERE castle_id = ?"))
{
ps.setInt(1, getResidenceId());
@@ -696,7 +696,7 @@ public final class Castle extends AbstractResidence
public void removeFunction(int functionType)
{
_function.remove(functionType);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_functions WHERE castle_id=? AND type=?"))
{
ps.setInt(1, getResidenceId());
@@ -768,7 +768,7 @@ public final class Castle extends AbstractResidence
// This method loads castle door upgrade data from database
private void loadDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_doorupgrade WHERE castleId=?"))
{
ps.setInt(1, getResidenceId());
@@ -794,7 +794,7 @@ public final class Castle extends AbstractResidence
door.setCurrentHp(door.getCurrentHp());
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_doorupgrade WHERE castleId=?"))
{
ps.setInt(1, getResidenceId());
@@ -819,7 +819,7 @@ public final class Castle extends AbstractResidence
if (save)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_doorupgrade (doorId, ratio, castleId) values (?,?,?)"))
{
ps.setInt(1, doorId);
@@ -846,7 +846,7 @@ public final class Castle extends AbstractResidence
CastleManorManager.getInstance().resetManorData(getResidenceId());
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Need to remove has castle flag from clan_data, should be checked from castle table.
try (PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET hasCastle = 0 WHERE hasCastle = ?"))
@@ -1001,7 +1001,7 @@ public final class Castle extends AbstractResidence
public void updateShowNpcCrest()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET showNpcCrest = ? WHERE id = ?"))
{
ps.setString(1, String.valueOf(_showNpcCrest));
@@ -1096,7 +1096,7 @@ public final class Castle extends AbstractResidence
{
_ticketBuyCount = count;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET ticketBuyCount = ? WHERE id = ?"))
{
ps.setInt(1, _ticketBuyCount);
@@ -1119,7 +1119,7 @@ public final class Castle extends AbstractResidence
{
if (save)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_trapupgrade (castleId, towerIndex, level) values (?,?,?)"))
{
ps.setInt(1, getResidenceId());
@@ -1146,7 +1146,7 @@ public final class Castle extends AbstractResidence
ts.setUpgradeLevel(0);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_trapupgrade WHERE castleId=?"))
{
ps.setInt(1, getResidenceId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/ClanHall.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
index 15161225c5..e8d3cd12d6 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
@@ -180,7 +180,7 @@ public abstract class ClanHall
public void dbSave()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO clanhall_functions (hall_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)"))
{
ps.setInt(1, _clanHallId);
@@ -440,7 +440,7 @@ public abstract class ClanHall
/** Load All Functions */
protected void loadFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM clanhall_functions WHERE hall_id = ?"))
{
ps.setInt(1, _clanHallId);
@@ -465,7 +465,7 @@ public abstract class ClanHall
public void removeFunction(int functionType)
{
_functions.remove(functionType);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM clanhall_functions WHERE hall_id=? AND type=?"))
{
ps.setInt(1, _clanHallId);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Couple.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Couple.java
index e9ff36d7ef..0842a28e53 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Couple.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Couple.java
@@ -45,7 +45,7 @@ public class Couple
{
_Id = coupleId;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM mods_wedding WHERE id = ?"))
{
ps.setInt(1, _Id);
@@ -85,7 +85,7 @@ public class Couple
_weddingDate = Calendar.getInstance();
_weddingDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
{
_Id = IdFactory.getInstance().getNextId();
@@ -105,7 +105,7 @@ public class Couple
public void marry()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE mods_wedding set married = ?, weddingDate = ? where id = ?"))
{
ps.setBoolean(1, true);
@@ -123,7 +123,7 @@ public class Couple
public void divorce()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM mods_wedding WHERE id=?"))
{
ps.setInt(1, _Id);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Fort.java
index 8d80280e75..560362f37b 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Fort.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Fort.java
@@ -214,7 +214,7 @@ public final class Fort extends AbstractResidence
public void dbSave()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO fort_functions (fort_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)"))
{
ps.setInt(1, getResidenceId());
@@ -484,7 +484,7 @@ public final class Fort extends AbstractResidence
public void saveFortVariables()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET supplyLvL=? WHERE id = ?"))
{
ps.setInt(1, _supplyLvL);
@@ -549,7 +549,7 @@ public final class Fort extends AbstractResidence
@Override
protected void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort WHERE id = ?"))
{
ps.setInt(1, getResidenceId());
@@ -610,7 +610,7 @@ public final class Fort extends AbstractResidence
/** Load All Functions */
private void loadFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_functions WHERE fort_id = ?"))
{
ps.setInt(1, getResidenceId());
@@ -635,7 +635,7 @@ public final class Fort extends AbstractResidence
public void removeFunction(int functionType)
{
_function.remove(functionType);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM fort_functions WHERE fort_id=? AND type=?"))
{
ps.setInt(1, getResidenceId());
@@ -727,7 +727,7 @@ public final class Fort extends AbstractResidence
// This method loads fort door upgrade data from database
private void loadDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_doorupgrade WHERE fortId = ?"))
{
ps.setInt(1, getResidenceId());
@@ -747,7 +747,7 @@ public final class Fort extends AbstractResidence
private void removeDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM fort_doorupgrade WHERE fortId = ?"))
{
ps.setInt(1, getResidenceId());
@@ -761,7 +761,7 @@ public final class Fort extends AbstractResidence
private void saveDoorUpgrade(int doorId, int hp, int pDef, int mDef)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO fort_doorupgrade (doorId, hp, pDef, mDef) VALUES (?,?,?,?)"))
{
ps.setInt(1, doorId);
@@ -790,7 +790,7 @@ public final class Fort extends AbstractResidence
_lastOwnedTime.setTimeInMillis(0);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET owner=?,lastOwnedTime=?,state=?,castleId=? WHERE id = ?"))
{
ps.setInt(1, clanId);
@@ -987,7 +987,7 @@ public final class Fort extends AbstractResidence
{
_state = state;
_castleId = castleId;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET state=?,castleId=? WHERE id = ?"))
{
ps.setInt(1, _state);
@@ -1119,7 +1119,7 @@ public final class Fort extends AbstractResidence
private void initNpcs()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_spawnlist WHERE fortId = ? AND spawnType = ?"))
{
ps.setInt(1, getResidenceId());
@@ -1148,7 +1148,7 @@ public final class Fort extends AbstractResidence
private void initSiegeNpcs()
{
_siegeNpcs.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, npcId, x, y, z, heading FROM fort_spawnlist WHERE fortId = ? AND spawnType = ? ORDER BY id"))
{
ps.setInt(1, getResidenceId());
@@ -1175,7 +1175,7 @@ public final class Fort extends AbstractResidence
private void initNpcCommanders()
{
_npcCommanders.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, npcId, x, y, z, heading FROM fort_spawnlist WHERE fortId = ? AND spawnType = ? ORDER BY id"))
{
ps.setInt(1, getResidenceId());
@@ -1205,7 +1205,7 @@ public final class Fort extends AbstractResidence
_specialEnvoys.clear();
_envoyCastles.clear();
_availableCastles.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, npcId, x, y, z, heading, castleId FROM fort_spawnlist WHERE fortId = ? AND spawnType = ? ORDER BY id"))
{
ps.setInt(1, getResidenceId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/FortSiege.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/FortSiege.java
index a264d70085..5d52eba105 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/FortSiege.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/FortSiege.java
@@ -491,7 +491,7 @@ public class FortSiege implements Siegable
/** Clear all registered siege clans from database for fort */
public void clearSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM fortsiege_clans WHERE fort_id=?"))
{
ps.setInt(1, _fort.getResidenceId());
@@ -775,7 +775,7 @@ public class FortSiege implements Siegable
private void removeSiegeClan(int clanId)
{
final String query = (clanId != 0) ? DELETE_FORT_SIEGECLANS_BY_CLAN_ID : DELETE_FORT_SIEGECLANS;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(query))
{
ps.setInt(1, _fort.getResidenceId());
@@ -989,7 +989,7 @@ public class FortSiege implements Siegable
private void loadSiegeClan()
{
_attackerClans.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clan_id FROM fortsiege_clans WHERE fort_id=?"))
{
ps.setInt(1, _fort.getResidenceId());
@@ -1051,7 +1051,7 @@ public class FortSiege implements Siegable
/** Save siege date to database. */
private void saveSiegeDate()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET siegeDate = ? WHERE id = ?"))
{
ps.setLong(1, getFort().getSiegeDate().getTimeInMillis());
@@ -1075,7 +1075,7 @@ public class FortSiege implements Siegable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO fortsiege_clans (clan_id,fort_id) values (?,?)"))
{
ps.setInt(1, clan.getId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Hero.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Hero.java
index 555cdf7fde..0e0cf613e1 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Hero.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Hero.java
@@ -108,7 +108,7 @@ public class Hero
HERO_DIARY.clear();
HERO_MESSAGE.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s1 = con.createStatement();
ResultSet rset = s1.executeQuery(GET_HEROES);
PreparedStatement ps = con.prepareStatement(GET_CLAN_ALLY);
@@ -203,7 +203,7 @@ public class Hero
*/
public void loadMessage(int charId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT message FROM heroes WHERE charId=?"))
{
ps.setInt(1, charId);
@@ -225,7 +225,7 @@ public class Hero
{
final List diary = new ArrayList<>();
int diaryentries = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM heroes_diary WHERE charId=? ORDER BY time ASC"))
{
ps.setInt(1, charId);
@@ -292,7 +292,7 @@ public class Hero
int _losses = 0;
int _draws = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM olympiad_fights WHERE (charOneId=? OR charTwoId=?) AND start ORDER BY start ASC"))
{
ps.setInt(1, charId);
@@ -689,7 +689,7 @@ public class Hero
public void updateHeroes(boolean setDefault)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (setDefault)
{
@@ -822,7 +822,7 @@ public class Hero
public void setDiaryData(int charId, int action, int param)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO heroes_diary (charId, time, action, param) values(?,?,?,?)"))
{
ps.setInt(1, charId);
@@ -858,7 +858,7 @@ public class Hero
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE heroes SET message=? WHERE charId=?;"))
{
ps.setString(1, HERO_MESSAGE.get(charId));
@@ -873,7 +873,7 @@ public class Hero
private void deleteItemsInDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate(DELETE_ITEMS);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Siege.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Siege.java
index 66f7b1b2ab..465cf18941 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Siege.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/Siege.java
@@ -724,7 +724,7 @@ public class Siege implements Siegable
/** Clear all registered siege clans from database for castle */
public void clearSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=?"))
{
ps.setInt(1, getCastle().getResidenceId());
@@ -752,7 +752,7 @@ public class Siege implements Siegable
/** Clear all siege clans waiting for approval from database for castle */
public void clearSiegeWaitingClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=? and type = 2"))
{
ps.setInt(1, getCastle().getResidenceId());
@@ -972,7 +972,7 @@ public class Siege implements Siegable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=? and clan_id=?"))
{
ps.setInt(1, getCastle().getResidenceId());
@@ -1237,7 +1237,7 @@ public class Siege implements Siegable
/** Load siege clans. */
private void loadSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clan_id,type FROM siege_clans where castle_id=?"))
{
getAttackerClans().clear();
@@ -1348,7 +1348,7 @@ public class Siege implements Siegable
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(getCastle()), 1000);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET siegeDate = ?, regTimeEnd = ?, regTimeOver = ? WHERE id = ?"))
{
ps.setLong(1, getSiegeDate().getTimeInMillis());
@@ -1377,7 +1377,7 @@ public class Siege implements Siegable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if ((typeId == DEFENDER) || (typeId == DEFENDER_NOT_APPROVED) || (typeId == OWNER))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/clanhall/AuctionableHall.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/clanhall/AuctionableHall.java
index 941ae1948b..e85a735707 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/clanhall/AuctionableHall.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/clanhall/AuctionableHall.java
@@ -215,7 +215,7 @@ public final class AuctionableHall extends ClanHall
@Override
public final void updateDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clanhall SET ownerId=?, paidUntil=?, paid=? WHERE id=?"))
{
ps.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/clanhall/ClanHallSiegeEngine.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/clanhall/ClanHallSiegeEngine.java
index aae7267265..0e3e24c083 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/clanhall/ClanHallSiegeEngine.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/clanhall/ClanHallSiegeEngine.java
@@ -93,7 +93,7 @@ public abstract class ClanHallSiegeEngine extends Quest implements Siegable
public void loadAttackers()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SQL_LOAD_ATTACKERS))
{
ps.setInt(1, _hall.getId());
@@ -114,7 +114,7 @@ public abstract class ClanHallSiegeEngine extends Quest implements Siegable
public final void saveAttackers()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM clanhall_siege_attackers WHERE clanhall_id = ?"))
{
ps.setInt(1, _hall.getId());
@@ -148,7 +148,7 @@ public abstract class ClanHallSiegeEngine extends Quest implements Siegable
return;
}
_guards = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SQL_LOAD_GUARDS))
{
ps.setInt(1, _hall.getId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/clanhall/SiegableHall.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/clanhall/SiegableHall.java
index f4ee12c056..97d3953415 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/clanhall/SiegableHall.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/entity/clanhall/SiegableHall.java
@@ -130,7 +130,7 @@ public final class SiegableHall extends ClanHall
@Override
public final void updateDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SQL_SAVE))
{
ps.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java
index f517b8f27f..ec576067dd 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java
@@ -192,7 +192,7 @@ public final class ItemAuction
public final void storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO item_auction (auctionId,instanceId,auctionItemId,startingTime,endingTime,auctionStateId) VALUES (?,?,?,?,?,?) ON DUPLICATE KEY UPDATE auctionStateId=?"))
{
ps.setInt(1, _auctionId);
@@ -226,7 +226,7 @@ public final class ItemAuction
final void updatePlayerBidInternal(ItemAuctionBid bid, boolean delete)
{
final String query = delete ? DELETE_ITEM_AUCTION_BID : INSERT_ITEM_AUCTION_BID;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(query))
{
ps.setInt(1, _auctionId);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java
index 01cea11d5a..af3832b9a5 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java
@@ -162,7 +162,7 @@ public final class ItemAuctionInstance
throw new IllegalArgumentException("No items defined");
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_AUCTION_ID_BY_INSTANCE_ID))
{
ps.setInt(1, _instanceId);
@@ -527,7 +527,7 @@ public final class ItemAuctionInstance
private final ItemAuction loadAuction(int auctionId) throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
int auctionItemId = 0;
long startingTime = 0;
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java
index 60402346fa..3d11abb22a 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java
@@ -1793,7 +1793,7 @@ public abstract class Inventory extends ItemContainer
@Override
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT object_id, item_id, count, enchant_level, loc, loc_data, custom_type1, custom_type2, mana_left, time FROM items WHERE owner_id=? AND (loc=? OR loc=?) ORDER BY loc_data"))
{
statement.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java
index 83be2af576..3111c861c2 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java
@@ -620,7 +620,7 @@ public abstract class ItemContainer
*/
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT object_id, item_id, count, enchant_level, loc, loc_data, custom_type1, custom_type2, mana_left, time FROM items WHERE owner_id=? AND (loc=?)"))
{
ps.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java
index ea4928fc99..47e2a8155b 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java
@@ -116,7 +116,7 @@ public class Mail extends ItemContainer
@Override
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT object_id, item_id, count, enchant_level, loc, loc_data, custom_type1, custom_type2, mana_left, time FROM items WHERE owner_id=? AND loc=? AND loc_data=?"))
{
ps.setInt(1, _ownerId);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java
index 3d357dc6df..5b7295d965 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java
@@ -753,7 +753,7 @@ public class PcInventory extends Inventory
public static int[][] restoreVisibleInventory(int objectId)
{
final int[][] paperdoll = new int[31][3];
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT object_id,item_id,loc_data,enchant_level FROM items WHERE owner_id=? AND loc='PAPERDOLL'"))
{
ps.setInt(1, objectId);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java
index 5ba4666031..303836301e 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java
@@ -898,7 +898,7 @@ public final class L2ItemInstance extends L2Object
}
_augmentation = augmentation;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
updateItemAttributes(con);
}
@@ -924,7 +924,7 @@ public final class L2ItemInstance extends L2Object
final L2Augmentation augment = _augmentation;
_augmentation = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_attributes WHERE itemId = ?"))
{
ps.setInt(1, getObjectId());
@@ -941,7 +941,7 @@ public final class L2ItemInstance extends L2Object
public void restoreAttributes()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("SELECT augAttributes FROM item_attributes WHERE itemId=?");
PreparedStatement ps2 = con.prepareStatement("SELECT elemType,elemValue FROM item_elementals WHERE itemId=?"))
{
@@ -1139,7 +1139,7 @@ public final class L2ItemInstance extends L2Object
public void setElementAttr(byte element, int value)
{
applyAttribute(element, value);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
updateItemElements(con);
}
@@ -1176,7 +1176,7 @@ public final class L2ItemInstance extends L2Object
_elementals = array;
final String query = (element != -1) ? "DELETE FROM item_elementals WHERE itemId = ? AND elemType = ?" : "DELETE FROM item_elementals WHERE itemId = ?";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(query))
{
if (element != -1)
@@ -1598,7 +1598,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE items SET owner_id=?,count=?,loc=?,loc_data=?,enchant_level=?,custom_type1=?,custom_type2=?,mana_left=?,time=? WHERE object_id = ?"))
{
ps.setInt(1, _ownerId);
@@ -1631,7 +1631,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO items (owner_id,item_id,count,loc,loc_data,enchant_level,object_id,custom_type1,custom_type2,mana_left,time) VALUES (?,?,?,?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, _ownerId);
@@ -1675,7 +1675,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM items WHERE object_id = ?"))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java
index f577d3326a..91c06d984e 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java
@@ -175,7 +175,7 @@ public class Olympiad extends ListenersContainer
{
NOBLES.clear();
boolean loaded = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rset = s.executeQuery(OLYMPIAD_LOAD_DATA))
{
@@ -253,7 +253,7 @@ public class Olympiad extends ListenersContainer
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rset = s.executeQuery(OLYMPIAD_LOAD_NOBLES))
{
@@ -321,7 +321,7 @@ public class Olympiad extends ListenersContainer
{
NOBLES_RANK.clear();
final Map tmpPlace = new HashMap<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery(GET_ALL_CLASSIFIED_NOBLESS))
{
@@ -839,7 +839,7 @@ public class Olympiad extends ListenersContainer
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
for (Entry entry : NOBLES.entrySet())
{
@@ -911,7 +911,7 @@ public class Olympiad extends ListenersContainer
{
saveNobleData();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(OLYMPIAD_SAVE_DATA))
{
ps.setInt(1, _currentCycle);
@@ -952,7 +952,7 @@ public class Olympiad extends ListenersContainer
protected void updateMonthlyData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s1 = con.createStatement();
Statement s2 = con.createStatement())
{
@@ -994,7 +994,7 @@ public class Olympiad extends ListenersContainer
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(OLYMPIAD_GET_HEROS))
{
StatsSet hero;
@@ -1101,7 +1101,7 @@ public class Olympiad extends ListenersContainer
{
final List names = new ArrayList<>();
final String query = Config.ALT_OLY_SHOW_MONTHLY_WINNERS ? ((classId == 132) ? GET_EACH_CLASS_LEADER_SOULHOUND : GET_EACH_CLASS_LEADER) : ((classId == 132) ? GET_EACH_CLASS_LEADER_CURRENT_SOULHOUND : GET_EACH_CLASS_LEADER_CURRENT);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(query))
{
ps.setInt(1, classId);
@@ -1184,7 +1184,7 @@ public class Olympiad extends ListenersContainer
public int getLastNobleOlympiadPoints(int objId)
{
int result = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT olympiad_points FROM olympiad_nobles_eom WHERE charId = ?"))
{
ps.setInt(1, objId);
@@ -1300,7 +1300,7 @@ public class Olympiad extends ListenersContainer
protected void deleteNobles()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate(OLYMPIAD_DELETE_ALL);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java
index c23bb28e4e..dd786e5284 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java
@@ -713,7 +713,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
protected static void saveResults(Participant one, Participant two, int winner, long startTime, long fightTime, CompetitionType type)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO olympiad_fights (charOneId, charTwoId, charOneClass, charTwoClass, winner, start, time, classed) values(?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, one.getObjectId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java
index c46c23f065..6a1f4c017c 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java
@@ -183,7 +183,7 @@ public class PunishmentTask implements Runnable
{
if (!_isStored)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
{
ps.setString(1, _key);
@@ -222,7 +222,7 @@ public class PunishmentTask implements Runnable
{
if (_isStored)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_QUERY))
{
ps.setLong(1, System.currentTimeMillis());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java
index 3d499c7da0..6612cbcc2b 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java
@@ -383,7 +383,7 @@ public class LongTimeEvent extends Quest
}
}
// Update database
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM items WHERE item_id=?"))
{
statement.setInt(1, itemId);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/quest/Quest.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/quest/Quest.java
index 585adff153..b5d27cc25e 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/quest/Quest.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/quest/Quest.java
@@ -1468,7 +1468,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void playerEnter(L2PcInstance player)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement invalidQuestData = con.prepareStatement("DELETE FROM character_quests WHERE charId = ? AND name = ?");
PreparedStatement invalidQuestDataVar = con.prepareStatement("DELETE FROM character_quests WHERE charId = ? AND name = ? AND var = ?");
PreparedStatement ps1 = con.prepareStatement("SELECT name, value FROM character_quests WHERE charId = ? AND var = ?"))
@@ -1556,7 +1556,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void createQuestVarInDb(QuestState qs, String var, String value)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_quests (charId,name,var,value) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE value=?"))
{
statement.setInt(1, qs.getPlayer().getObjectId());
@@ -1580,7 +1580,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void updateQuestVarInDb(QuestState qs, String var, String value)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE character_quests SET value=? WHERE charId=? AND name=? AND var = ?"))
{
statement.setString(1, value);
@@ -1602,7 +1602,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void deleteQuestVarInDb(QuestState qs, String var)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_quests WHERE charId=? AND name=? AND var=?"))
{
statement.setInt(1, qs.getPlayer().getObjectId());
@@ -1623,7 +1623,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void deleteQuestInDb(QuestState qs, boolean repeatable)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(repeatable ? QUEST_DELETE_FROM_CHAR_QUERY : QUEST_DELETE_FROM_CHAR_QUERY_NON_REPEATABLE_QUERY))
{
ps.setInt(1, qs.getPlayer().getObjectId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
index 8524d8e039..ae9d01b04a 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
@@ -50,7 +50,7 @@ public class AccountVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setString(1, _accountName);
@@ -83,7 +83,7 @@ public class AccountVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
index 05a4d09037..80f9cf5e6b 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
@@ -52,7 +52,7 @@ public class PlayerVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setInt(1, _objectId);
@@ -85,7 +85,7 @@ public class PlayerVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/L2GameClient.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/L2GameClient.java
index 5946a6d3f1..b540abad95 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/L2GameClient.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/L2GameClient.java
@@ -286,7 +286,7 @@ public final class L2GameClient extends ChannelInboundHandler
return -1;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT clanId FROM characters WHERE charId=?"))
{
statement.setInt(1, objectId);
@@ -349,7 +349,7 @@ public final class L2GameClient extends ChannelInboundHandler
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE characters SET deletetime=0 WHERE charId=?"))
{
statement.setInt(1, objectId);
@@ -372,7 +372,7 @@ public final class L2GameClient extends ChannelInboundHandler
CharNameTable.getInstance().removeName(objid);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM character_contacts WHERE charId=? OR contactId=?"))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestAnswerFriendInvite.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestAnswerFriendInvite.java
index f063459137..e0e5e77f58 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestAnswerFriendInvite.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestAnswerFriendInvite.java
@@ -65,7 +65,7 @@ public final class RequestAnswerFriendInvite implements IClientIncomingPacket
if (_response == 1)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_friends (charId, friendId) VALUES (?, ?), (?, ?)"))
{
statement.setInt(1, requestor.getObjectId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestBrBuyProduct.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestBrBuyProduct.java
index 85baf74165..b10fcd9d1d 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestBrBuyProduct.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestBrBuyProduct.java
@@ -122,7 +122,7 @@ public class RequestBrBuyProduct implements IClientIncomingPacket
player.broadcastUserInfo();
// Save transaction info at SQL table item_mall_transactions
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO item_mall_transactions (charId, productId, quantity) values (?,?,?)"))
{
statement.setLong(1, player.getObjectId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
index d10fe2773a..b5b1b7e1e2 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
@@ -152,7 +152,7 @@ public final class RequestDestroyItem implements IClientIncomingPacket
activeChar.getSummon().unSummon(activeChar);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
{
statement.setInt(1, _objectId);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestFriendDel.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestFriendDel.java
index c93a1e63bb..0ac666d524 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestFriendDel.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestFriendDel.java
@@ -74,7 +74,7 @@ public final class RequestFriendDel implements IClientIncomingPacket
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_friends WHERE (charId=? AND friendId=?) OR (charId=? AND friendId=?)"))
{
statement.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java
index 53c39108b0..03b1fcdad1 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java
@@ -62,7 +62,7 @@ public class RequestPetitionFeedback implements IClientIncomingPacket
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_FEEDBACK))
{
statement.setString(1, player.getName());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java
index f4f3766acf..9bd35f82ff 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java
@@ -178,7 +178,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
CharSelectInfoPackage charInfopackage;
final List characterList = new LinkedList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM characters WHERE account_name=? ORDER BY createDate"))
{
statement.setString(1, loginName);
@@ -211,7 +211,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
private static void loadCharacterSubclassInfo(CharSelectInfoPackage charInfopackage, int ObjectId, int activeClassId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT exp, sp, level FROM character_subclasses WHERE charId=? AND class_id=? ORDER BY charId"))
{
statement.setInt(1, ObjectId);
@@ -320,7 +320,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
if (weaponObjId > 0)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT augAttributes FROM item_attributes WHERE itemId=?"))
{
statement.setInt(1, weaponObjId);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/ExBrRecentProductList.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/ExBrRecentProductList.java
index eba6442381..0a77ef1768 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/ExBrRecentProductList.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/ExBrRecentProductList.java
@@ -41,7 +41,7 @@ public class ExBrRecentProductList implements IClientOutgoingPacket
{
final int playerObj = player.getObjectId();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT productId FROM item_mall_transactions WHERE charId=? ORDER BY transactionTime DESC"))
{
statement.setInt(1, playerObj);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/FriendListExtended.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/FriendListExtended.java
index 0f73a7bee5..cb54624bd9 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/FriendListExtended.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/network/serverpackets/FriendListExtended.java
@@ -70,7 +70,7 @@ public class FriendListExtended implements IClientOutgoingPacket
if (player1 == null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT char_name, online, classid, level FROM characters WHERE charId = ?"))
{
statement.setInt(1, objId);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java
index fd27cfb194..4f38e67544 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java
@@ -72,7 +72,7 @@ public class SecondaryPasswordAuth
private void loadPassword()
{
String var, value = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SELECT_PASSWORD))
{
statement.setString(1, _activeClient.getAccountName());
@@ -117,7 +117,7 @@ public class SecondaryPasswordAuth
password = cryptPassword(password);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_PASSWORD))
{
statement.setString(1, _activeClient.getAccountName());
@@ -136,7 +136,7 @@ public class SecondaryPasswordAuth
public boolean insertWrongAttempt(int attempts)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_ATTEMPT))
{
statement.setString(1, _activeClient.getAccountName());
@@ -175,7 +175,7 @@ public class SecondaryPasswordAuth
newPassword = cryptPassword(newPassword);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_PASSWORD))
{
statement.setString(1, newPassword);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
index c5987d8d0a..9528625326 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
@@ -103,7 +103,7 @@ public final class TaskManager
{
task.onTimeElapsed(this);
lastActivation = System.currentTimeMillis();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[1]))
{
statement.setLong(1, lastActivation);
@@ -198,7 +198,7 @@ public final class TaskManager
private void startAllTasks()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[0]);
ResultSet rset = statement.executeQuery())
{
@@ -330,7 +330,7 @@ public final class TaskManager
private static boolean addUniqueTask(String task, TaskTypes type, String param1, String param2, String param3, long lastActivation)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(SQL_STATEMENTS[2]))
{
ps1.setString(1, task);
@@ -366,7 +366,7 @@ public final class TaskManager
private static boolean addTask(String task, TaskTypes type, String param1, String param2, String param3, long lastActivation)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[3]))
{
statement.setString(1, task);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java
index c3d464dc47..dfc1e3030b 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java
@@ -56,7 +56,7 @@ public class TaskBirthday extends Task
private int giveBirthdayGifts(long lastActivation)
{
int birthdayGiftCount = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_PENDING_BIRTHDAY_GIFTS))
{
ps.setLong(1, TimeUnit.SECONDS.convert(lastActivation, TimeUnit.MILLISECONDS));
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskDailySkillReuseClean.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskDailySkillReuseClean.java
index ad20f81bcb..a2f5b6bd95 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskDailySkillReuseClean.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskDailySkillReuseClean.java
@@ -44,7 +44,7 @@ public class TaskDailySkillReuseClean extends Task
@Override
public void onTimeElapsed(ExecutedTask task)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
for (int skill_id : _daily_skills)
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskRecom.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskRecom.java
index f74938e7af..1b3524701c 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskRecom.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskRecom.java
@@ -44,7 +44,7 @@ public class TaskRecom extends Task
@Override
public void onTimeElapsed(ExecutedTask task)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("UPDATE character_reco_bonus SET rec_left=?, time_left=?, rec_have=0 WHERE rec_have <= 20"))
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/util/Evolve.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/util/Evolve.java
index ac806a3947..594c8f543e 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/util/Evolve.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/gameserver/util/Evolve.java
@@ -252,7 +252,7 @@ public final class Evolve
}
// pet control item no longer exists, delete the pet from the db
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
{
ps.setInt(1, removedItem.getObjectId());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/GameServerTable.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/GameServerTable.java
index 7f38f14949..6e0acf7823 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/GameServerTable.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/GameServerTable.java
@@ -115,7 +115,7 @@ public final class GameServerTable implements IGameXmlReader
*/
private void loadRegisteredGameServers()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT * FROM gameservers"))
{
@@ -222,7 +222,7 @@ public final class GameServerTable implements IGameXmlReader
public void registerServerOnDB(byte[] hexId, int id, String externalHost)
{
register(id, new GameServerInfo(id, hexId));
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO gameservers (hexid,server_id,host) values (?,?,?)"))
{
ps.setString(1, hexToString(hexId));
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/LoginController.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/LoginController.java
index 47fb44a496..310c9355cb 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/LoginController.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/LoginController.java
@@ -176,7 +176,7 @@ public class LoginController
final byte[] raw = password.getBytes(StandardCharsets.UTF_8);
final String hashBase64 = Base64.getEncoder().encodeToString(md.digest(raw));
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(USER_INFO_SELECT))
{
ps.setString(1, Long.toString(System.currentTimeMillis()));
@@ -206,7 +206,7 @@ public class LoginController
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(AUTOCREATE_ACCOUNTS_INSERT))
{
ps.setString(1, login);
@@ -405,7 +405,7 @@ public class LoginController
if (loginOk && (client.getLastServer() != serverId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_LAST_SERVER_UPDATE))
{
ps.setInt(1, serverId);
@@ -424,7 +424,7 @@ public class LoginController
public void setAccountAccessLevel(String account, int banLevel)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_ACCESS_LEVEL_UPDATE))
{
ps.setInt(1, banLevel);
@@ -439,7 +439,7 @@ public class LoginController
public void setAccountLastTracert(String account, String pcIp, String hop1, String hop2, String hop3, String hop4)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_IPS_UPDATE))
{
ps.setString(1, pcIp);
@@ -499,7 +499,7 @@ public class LoginController
{
final List ipWhiteList = new ArrayList<>();
final List ipBlackList = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_IPAUTH_SELECT))
{
ps.setString(1, info.getLogin());
@@ -545,7 +545,7 @@ public class LoginController
client.setAccessLevel(info.getAccessLevel());
client.setLastServer(info.getLastServer());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_INFO_UPDATE))
{
ps.setLong(1, System.currentTimeMillis());
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/LoginServer.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/LoginServer.java
index d3e85d3abf..04dea3ee01 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/LoginServer.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/LoginServer.java
@@ -89,7 +89,7 @@ public final class LoginServer
Config.load();
// Prepare Database
- DatabaseFactory.getInstance();
+ DatabaseFactory.init();
try
{
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java
index ed7420dda3..d96c660c8c 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java
@@ -78,7 +78,7 @@ public class ChangePassword extends BaseRecievePacket
int passUpdated = 0;
// SQL connection
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT password FROM accounts WHERE login=?"))
{
ps.setString(1, accountName);
@@ -95,7 +95,7 @@ public class ChangePassword extends BaseRecievePacket
{
final byte[] password = md.digest(newpass.getBytes("UTF-8"));
// SQL connection
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE accounts SET password=? WHERE login=?"))
{
ps.setString(1, Base64.getEncoder().encodeToString(password));
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java
index 6786f79cf6..d3e73f7130 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java
@@ -58,7 +58,7 @@ public class RequestTempBan extends BaseRecievePacket
private void banUser()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO account_data VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE value=?"))
{
ps.setString(1, _accountName);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
index 59b0e01835..4fb705c8b1 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
@@ -43,6 +43,7 @@ public class SQLAccountManager
{
Server.serverMode = Server.MODE_LOGINSERVER;
Config.load();
+ DatabaseFactory.init();
try (Scanner _scn = new Scanner(System.in))
{
@@ -166,7 +167,7 @@ public class SQLAccountManager
}
q = q.concat(" ORDER BY login ASC");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(q);
ResultSet rset = ps.executeQuery())
{
@@ -187,7 +188,7 @@ public class SQLAccountManager
private static void addOrUpdateAccount(String account, String password, String level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE accounts(login, password, accessLevel) VALUES (?, ?, ?)"))
{
final MessageDigest md = MessageDigest.getInstance("SHA");
@@ -213,7 +214,7 @@ public class SQLAccountManager
private static void changeAccountLevel(String account, String level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE accounts SET accessLevel = ? WHERE login = ?"))
{
ps.setString(1, level);
@@ -236,7 +237,7 @@ public class SQLAccountManager
private static void deleteAccount(String account)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM accounts WHERE login = ?"))
{
ps.setString(1, account);
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java
index 4ac531c664..fd25fddae4 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java
@@ -34,7 +34,7 @@ public class DBInstallerConsole implements DBOutputInterface
public DBInstallerConsole(String db, String dir) throws Exception
{
- System.out.println("Welcome to L2J DataBase installer");
+ System.out.println("Welcome to DataBase installer");
final Preferences prop = Preferences.userRoot();
RunTasks rt = null;
try (Scanner scn = new Scanner(new CloseShieldedInputStream(System.in)))
diff --git a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
index 8563b4b64a..851bf5bbc3 100644
--- a/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
+++ b/L2J_Mobius_CT_2.6_HighFive/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
@@ -68,6 +68,7 @@ public abstract class BaseGameServerRegister
Server.serverMode = Server.MODE_LOGINSERVER;
Config.load();
+ DatabaseFactory.init();
GameServerTable.getInstance();
_loaded = true;
@@ -96,7 +97,7 @@ public abstract class BaseGameServerRegister
*/
public static void unregisterGameServer(int id) throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM gameservers WHERE server_id = ?"))
{
@@ -112,7 +113,7 @@ public abstract class BaseGameServerRegister
*/
public static void unregisterAllGameServers() throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("DELETE FROM gameservers");
diff --git a/L2J_Mobius_CT_2.6_HighFive/launcher/Gameserver.launch b/L2J_Mobius_CT_2.6_HighFive/launcher/Gameserver.launch
index de3b2c7562..f7e3a0408d 100644
--- a/L2J_Mobius_CT_2.6_HighFive/launcher/Gameserver.launch
+++ b/L2J_Mobius_CT_2.6_HighFive/launcher/Gameserver.launch
@@ -7,12 +7,13 @@
-
+
+
diff --git a/L2J_Mobius_CT_2.6_HighFive/launcher/Loginserver.launch b/L2J_Mobius_CT_2.6_HighFive/launcher/Loginserver.launch
index 76ad0cbdca..f2478ffae0 100644
--- a/L2J_Mobius_CT_2.6_HighFive/launcher/Loginserver.launch
+++ b/L2J_Mobius_CT_2.6_HighFive/launcher/Loginserver.launch
@@ -7,7 +7,7 @@
-
+
@@ -15,5 +15,6 @@
+
diff --git a/L2J_Mobius_Classic_2.0_Saviors/.classpath b/L2J_Mobius_Classic_2.0_Saviors/.classpath
index 0e50693da9..619d354392 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/.classpath
+++ b/L2J_Mobius_Classic_2.0_Saviors/.classpath
@@ -5,11 +5,12 @@
-
+
-
+
+
diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java
index 9a3b363f56..68ef6d5320 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java
@@ -76,7 +76,7 @@ public final class AdminChangeAccessLevel implements IAdminCommandHandler
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET accesslevel=? WHERE char_name=?");
statement.setInt(1, lvl);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
index 7ef34c44ff..0c90671033 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
@@ -627,7 +627,7 @@ public class AdminEditChar implements IAdminCommandHandler
if (player == null)
{
- final Connection con = DatabaseFactory.getInstance().getConnection();
+ final Connection con = DatabaseFactory.getConnection();
final PreparedStatement ps = con.prepareStatement("UPDATE characters SET " + (changeCreateExpiryTime ? "clan_create_expiry_time" : "clan_join_expiry_time") + " WHERE char_name=? LIMIT 1");
ps.setString(1, playerName);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java
index 764ab77c25..969633adcb 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java
@@ -62,7 +62,7 @@ public class AdminRepairChar implements IAdminCommandHandler
}
final String cmd = "UPDATE characters SET x=-84318, y=244579, z=-3730 WHERE char_name=?";
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(cmd);
statement.setString(1, parts[1]);
@@ -87,13 +87,13 @@ public class AdminRepairChar implements IAdminCommandHandler
return;
}
- // connection = L2DatabaseFactory.getInstance().getConnection();
+ // connection = L2DatabaseFactory.getConnection();
statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=?");
statement.setInt(1, objId);
statement.execute();
statement.close();
- // connection = L2DatabaseFactory.getInstance().getConnection();
+ // connection = L2DatabaseFactory.getConnection();
statement = con.prepareStatement("UPDATE items SET loc=\"INVENTORY\" WHERE owner_id=?");
statement.setInt(1, objId);
statement.execute();
diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java
index 780c3b0088..da0c7dcad2 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java
@@ -173,7 +173,7 @@ public class AdminShowQuests implements IAdminCommandHandler
private static void showQuestMenu(L2PcInstance target, L2PcInstance actor, String[] val)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
ResultSet rs;
PreparedStatement req;
diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java
index 35508761a2..a8b6ed6963 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java
@@ -489,7 +489,7 @@ public class AdminTeleport implements IAdminCommandHandler
final int x = activeChar.getX();
final int y = activeChar.getY();
final int z = activeChar.getZ();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=? WHERE char_name=?");
statement.setInt(1, x);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java
index b4e722f105..3913b5b368 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java
@@ -61,7 +61,7 @@ public class FavoriteBoard implements IParseBoardHandler
// Load Favorite links
final String list = HtmCache.getInstance().getHtm(activeChar, "data/html/CommunityBoard/favorite_list.html");
final StringBuilder sb = new StringBuilder();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_FAVORITES))
{
ps.setInt(1, activeChar.getObjectId());
@@ -98,7 +98,7 @@ public class FavoriteBoard implements IParseBoardHandler
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_FAVORITE))
{
ps.setInt(1, activeChar.getObjectId());
@@ -123,7 +123,7 @@ public class FavoriteBoard implements IParseBoardHandler
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_FAVORITE))
{
ps.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/communityboard/HomeBoard.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
index bed19004d2..1f5572ec39 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
@@ -300,7 +300,7 @@ public final class HomeBoard implements IParseBoardHandler
private static int getFavoriteCount(L2PcInstance player)
{
int count = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(COUNT_FAVORITES))
{
ps.setInt(1, player.getObjectId());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
index 59ecba44bb..e0708990b7 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
@@ -62,7 +62,7 @@ public class ClanWarsList implements IUserCommandHandler
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
String query;
// Attack List
diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/game/java.cfg b/L2J_Mobius_Classic_2.0_Saviors/dist/game/java.cfg
index cb4a4dc204..58213e428e 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/dist/game/java.cfg
+++ b/L2J_Mobius_Classic_2.0_Saviors/dist/game/java.cfg
@@ -1 +1 @@
--server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
\ No newline at end of file
+-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=error -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
\ No newline at end of file
diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/libs/HikariCP-3.2.0.jar b/L2J_Mobius_Classic_2.0_Saviors/dist/libs/HikariCP-3.2.0.jar
new file mode 100644
index 0000000000..a030a7f8dc
Binary files /dev/null and b/L2J_Mobius_Classic_2.0_Saviors/dist/libs/HikariCP-3.2.0.jar differ
diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/libs/c3p0-0.9.5.2.jar b/L2J_Mobius_Classic_2.0_Saviors/dist/libs/c3p0-0.9.5.2.jar
deleted file mode 100644
index 579cedd980..0000000000
Binary files a/L2J_Mobius_Classic_2.0_Saviors/dist/libs/c3p0-0.9.5.2.jar and /dev/null differ
diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/libs/mchange-commons-java-0.2.12.jar b/L2J_Mobius_Classic_2.0_Saviors/dist/libs/mchange-commons-java-0.2.12.jar
deleted file mode 100644
index af11054860..0000000000
Binary files a/L2J_Mobius_Classic_2.0_Saviors/dist/libs/mchange-commons-java-0.2.12.jar and /dev/null differ
diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/libs/slf4j-api-1.7.25.jar b/L2J_Mobius_Classic_2.0_Saviors/dist/libs/slf4j-api-1.7.25.jar
new file mode 100644
index 0000000000..7e62f1336d
Binary files /dev/null and b/L2J_Mobius_Classic_2.0_Saviors/dist/libs/slf4j-api-1.7.25.jar differ
diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/libs/slf4j-simple-1.7.25.jar b/L2J_Mobius_Classic_2.0_Saviors/dist/libs/slf4j-simple-1.7.25.jar
new file mode 100644
index 0000000000..b29ca12719
Binary files /dev/null and b/L2J_Mobius_Classic_2.0_Saviors/dist/libs/slf4j-simple-1.7.25.jar differ
diff --git a/L2J_Mobius_Classic_2.0_Saviors/dist/login/java.cfg b/L2J_Mobius_Classic_2.0_Saviors/dist/login/java.cfg
index 00ae5b3a66..bda4cdd24d 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/dist/login/java.cfg
+++ b/L2J_Mobius_Classic_2.0_Saviors/dist/login/java.cfg
@@ -1 +1 @@
--server -Xms128m -Xmx256m
\ No newline at end of file
+-server -Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=error -Xms128m -Xmx256m
\ No newline at end of file
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/commons/database/DatabaseFactory.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/commons/database/DatabaseFactory.java
index 68d02d4171..dd481d2fd0 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/commons/database/DatabaseFactory.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/commons/database/DatabaseFactory.java
@@ -16,122 +16,68 @@
*/
package com.l2jmobius.commons.database;
-import java.beans.PropertyVetoException;
import java.sql.Connection;
-import java.sql.SQLException;
import java.util.logging.Logger;
import com.l2jmobius.Config;
-import com.mchange.v2.c3p0.ComboPooledDataSource;
+import com.zaxxer.hikari.HikariDataSource;
/**
- * Database Factory implementation.
- * @author Zoey76, Mobius
+ * @author Mobius
*/
public class DatabaseFactory
{
private static final Logger LOGGER = Logger.getLogger(DatabaseFactory.class.getName());
- private final ComboPooledDataSource _dataSource;
+ private static final HikariDataSource _hds = new HikariDataSource();
- public DatabaseFactory()
+ public static void init()
{
- if (Config.DATABASE_MAX_CONNECTIONS < 2)
- {
- Config.DATABASE_MAX_CONNECTIONS = 2;
- LOGGER.warning("A minimum of 2 connections are required.");
- }
-
- _dataSource = new ComboPooledDataSource();
- _dataSource.setAutoCommitOnClose(true);
-
- _dataSource.setInitialPoolSize(10);
- _dataSource.setMinPoolSize(10);
- _dataSource.setMaxPoolSize(Math.max(10, Config.DATABASE_MAX_CONNECTIONS));
-
- _dataSource.setAcquireRetryAttempts(0); // try to obtain connections indefinitely (0 = never quit)
- _dataSource.setAcquireRetryDelay(500); // 500 milliseconds wait before try to acquire connection again
- _dataSource.setCheckoutTimeout(0); // 0 = wait indefinitely for new connection if pool is exhausted
- _dataSource.setAcquireIncrement(5); // if pool is exhausted, get 5 more connections at a time cause there is
- // a "long" delay on acquire connection so taking more than one connection at once will make connection pooling more effective.
-
- // this "connection_test_table" is automatically created if not already there
- _dataSource.setAutomaticTestTable("connection_test_table");
- _dataSource.setTestConnectionOnCheckin(false);
-
- // testing OnCheckin used with IdleConnectionTestPeriod is faster than testing on checkout
-
- _dataSource.setIdleConnectionTestPeriod(3600); // test idle connection every 60 sec
- _dataSource.setMaxIdleTime(Config.DATABASE_MAX_IDLE_TIME); // 0 = idle connections never expire
- // *THANKS* to connection testing configured above but I prefer to disconnect all connections not used for more than 1 hour
-
- // enables statement caching, there is a "semi-bug" in c3p0 0.9.0 but in 0.9.0.2 and later it's fixed
- _dataSource.setMaxStatementsPerConnection(100);
-
- _dataSource.setBreakAfterAcquireFailure(false); // never fail if any way possible setting this to true will make c3p0 "crash"
- // and refuse to work till restart thus making acquire errors "FATAL" ... we don't want that it should be possible to recover
+ _hds.setDriverClassName(Config.DATABASE_DRIVER);
+ _hds.setJdbcUrl(Config.DATABASE_URL);
+ _hds.setUsername(Config.DATABASE_LOGIN);
+ _hds.setPassword(Config.DATABASE_PASSWORD);
+ _hds.setMaximumPoolSize(Config.DATABASE_MAX_CONNECTIONS);
+ _hds.setIdleTimeout(Config.DATABASE_MAX_IDLE_TIME);
+ // Test if connection is valid.
try
{
- _dataSource.setDriverClass(Config.DATABASE_DRIVER);
+ _hds.getConnection().close();
+ LOGGER.info("Database: Initialized.");
}
- catch (PropertyVetoException e)
+ catch (Exception e)
{
e.printStackTrace();
}
- _dataSource.setJdbcUrl(Config.DATABASE_URL);
- _dataSource.setUser(Config.DATABASE_LOGIN);
- _dataSource.setPassword(Config.DATABASE_PASSWORD);
-
- /* Test the connection */
- try
- {
- _dataSource.getConnection().close();
- }
- catch (SQLException e)
- {
- e.printStackTrace();
- }
-
- LOGGER.info("Database: Initialized.");
}
- public Connection getConnection()
+ public static Connection getConnection()
{
Connection con = null;
while (con == null)
{
try
{
- con = _dataSource.getConnection();
+ con = _hds.getConnection();
}
- catch (SQLException e)
+ catch (Exception e)
{
- LOGGER.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage());
+ LOGGER.severe("DatabaseFactory: Cound not get a connection. " + e);
}
}
return con;
}
- public void close()
+ public static void close()
{
try
{
- _dataSource.close();
+ _hds.close();
}
catch (Exception e)
{
- LOGGER.info(e.getMessage());
+ LOGGER.severe("DatabaseFactory: There was a problem closing the data source. " + e);
}
}
-
- public static DatabaseFactory getInstance()
- {
- return SingletonHolder.INSTANCE;
- }
-
- private static class SingletonHolder
- {
- protected static final DatabaseFactory INSTANCE = new DatabaseFactory();
- }
}
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/GameServer.java
index 8443fe28c5..a7f428efde 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/GameServer.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/GameServer.java
@@ -193,7 +193,7 @@ public class GameServer
// Initialize config
Config.load();
printSection("Database");
- DatabaseFactory.getInstance();
+ DatabaseFactory.init();
printSection("ThreadPool");
ThreadPool.init();
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/LoginServerThread.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/LoginServerThread.java
index e26cf1111a..ba22e9ae11 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/LoginServerThread.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/LoginServerThread.java
@@ -587,7 +587,7 @@ public class LoginServerThread extends Thread
int chars = 0;
final List charToDel = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT deletetime FROM characters WHERE account_name=?"))
{
ps.setString(1, account);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/Shutdown.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/Shutdown.java
index 1faf2780db..09b0fd9c85 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/Shutdown.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/Shutdown.java
@@ -205,7 +205,7 @@ public class Shutdown extends Thread
// commit data, last chance
try
{
- DatabaseFactory.getInstance().close();
+ DatabaseFactory.close();
LOGGER.info("Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
}
catch (Throwable t)
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
index 3f98953c02..320a104fca 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
@@ -93,7 +93,7 @@ public class Forum
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM forums WHERE forum_id=?"))
{
ps.setInt(1, _forumId);
@@ -114,7 +114,7 @@ public class Forum
LOGGER.log(Level.WARNING, "Data error on Forum " + _forumId + " : " + e.getMessage(), e);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM topic WHERE topic_forum_id=? ORDER BY topic_id DESC"))
{
ps.setInt(1, _forumId);
@@ -139,7 +139,7 @@ public class Forum
private void getChildren()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT forum_id FROM forums WHERE forum_parent=?"))
{
ps.setInt(1, _forumId);
@@ -217,7 +217,7 @@ public class Forum
public void insertIntoDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO forums (forum_id,forum_name,forum_parent,forum_post,forum_type,forum_perm,forum_owner_id) VALUES (?,?,?,?,?,?,?)"))
{
ps.setInt(1, _forumId);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
index fa2f1da2d9..5f970fa0a5 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
@@ -72,7 +72,7 @@ public class Post
private void insertindb(CPost cp)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)"))
{
ps.setInt(1, cp.postId);
@@ -112,7 +112,7 @@ public class Post
public void deleteme(Topic t)
{
PostBBSManager.getInstance().delPostByTopic(t);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM posts WHERE post_forum_id=? AND post_topic_id=?"))
{
ps.setInt(1, t.getForumID());
@@ -130,7 +130,7 @@ public class Post
*/
private void load(Topic t)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM posts WHERE post_forum_id=? AND post_topic_id=? ORDER BY post_id ASC"))
{
ps.setInt(1, t.getForumID());
@@ -162,7 +162,7 @@ public class Post
*/
public void updatetxt(int i)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?"))
{
final CPost cp = getCPost(i);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
index ae7b7c6318..2cb2303f58 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
@@ -71,7 +71,7 @@ public class Topic
private void insertindb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO topic (topic_id,topic_forum_id,topic_name,topic_date,topic_ownername,topic_ownerid,topic_type,topic_reply) values (?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, _id);
@@ -129,7 +129,7 @@ public class Topic
{
TopicBBSManager.getInstance().delTopic(this);
f.rmTopicByID(_id);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM topic WHERE topic_id=? AND topic_forum_id=?"))
{
ps.setInt(1, _id);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
index 57a47cf456..c68fb57089 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
@@ -40,7 +40,7 @@ public class ForumsBBSManager extends BaseBBSManager
protected ForumsBBSManager()
{
_table = new CopyOnWriteArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT forum_id FROM forums WHERE forum_type = 0"))
{
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java
index adc2b28a17..b3b101e521 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java
@@ -52,7 +52,7 @@ public final class AnnouncementsTable
private void load()
{
_announcements.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery("SELECT * FROM announcements"))
{
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java
index 4aa8b72edb..5bb8ebbe43 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java
@@ -99,7 +99,7 @@ public class CharNameTable
int id = -1;
int accessLevel = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT charId,accesslevel FROM characters WHERE char_name=?"))
{
ps.setString(1, name);
@@ -145,7 +145,7 @@ public class CharNameTable
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT char_name,accesslevel FROM characters WHERE charId=?"))
{
ps.setInt(1, id);
@@ -176,7 +176,7 @@ public class CharNameTable
public synchronized boolean doesCharNameExist(String name)
{
boolean result = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT COUNT(*) as count FROM characters WHERE char_name=?"))
{
ps.setString(1, name);
@@ -197,7 +197,7 @@ public class CharNameTable
public int getAccountCharacterCount(String account)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT COUNT(char_name) as count FROM characters WHERE account_name=?"))
{
ps.setString(1, account);
@@ -218,7 +218,7 @@ public class CharNameTable
public int getLevelById(int objectId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT level FROM characters WHERE charId = ?"))
{
ps.setInt(1, objectId);
@@ -239,7 +239,7 @@ public class CharNameTable
public int getClassIdById(int objectId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT classid FROM characters WHERE charId = ?"))
{
ps.setInt(1, objectId);
@@ -260,7 +260,7 @@ public class CharNameTable
public int getClanIdById(int objectId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clanId FROM characters WHERE charId = ?"))
{
ps.setInt(1, objectId);
@@ -281,7 +281,7 @@ public class CharNameTable
private void loadAll()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT charId, char_name, accesslevel FROM characters"))
{
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java
index 021a434a38..6315404c36 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java
@@ -70,7 +70,7 @@ public class CharSummonTable
{
if (Config.RESTORE_SERVITOR_ON_RECONNECT)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(INIT_SUMMONS))
{
@@ -87,7 +87,7 @@ public class CharSummonTable
if (Config.RESTORE_PET_ON_RECONNECT)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(INIT_PET))
{
@@ -111,7 +111,7 @@ public class CharSummonTable
return !v.isEmpty() ? v : null;
});
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(REMOVE_SUMMON))
{
ps.setInt(1, activeChar.getObjectId());
@@ -181,7 +181,7 @@ public class CharSummonTable
public void restoreServitor(L2PcInstance activeChar)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(LOAD_SUMMON))
{
ps.setInt(1, activeChar.getObjectId());
@@ -229,7 +229,7 @@ public class CharSummonTable
_servitors.computeIfAbsent(summon.getOwner().getObjectId(), k -> ConcurrentHashMap.newKeySet()).add(summon.getObjectId());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SAVE_SUMMON))
{
ps.setInt(1, summon.getOwner().getObjectId());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java
index d0cd743b0f..aee103e2e5 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java
@@ -80,7 +80,7 @@ public class ClanTable
L2Clan clan;
// Count the clans
int clanCount = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT clan_id FROM clan_data"))
{
@@ -262,7 +262,7 @@ public class ClanTable
_clans.remove(clanId);
IdFactory.getInstance().releaseId(clanId);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM clan_data WHERE clan_id=?"))
{
@@ -361,7 +361,7 @@ public class ClanTable
public void storeclanswars(ClanWar war)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO clan_wars (clan1, clan2, clan1Kill, clan2Kill, winnerClan, startTime, endTime, state) VALUES(?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, war.getAttackerClanId());
@@ -392,7 +392,7 @@ public class ClanTable
clan1.broadcastClanStatus();
clan2.broadcastClanStatus();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM clan_wars WHERE clan1=? AND clan2=?"))
{
ps.setInt(1, clanId1);
@@ -407,7 +407,7 @@ public class ClanTable
private void restorewars()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery("SELECT clan1, clan2, clan1Kill, clan2Kill, winnerClan, startTime, endTime, state FROM clan_wars"))
{
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java
index f90657a886..907f92e5f6 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java
@@ -72,7 +72,7 @@ public final class CrestTable
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
ResultSet rs = statement.executeQuery("SELECT `crest_id`, `data`, `type` FROM `crests` ORDER BY `crest_id` DESC"))
{
@@ -154,7 +154,7 @@ public final class CrestTable
*/
public L2Crest createCrest(byte[] data, CrestType crestType)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO `crests`(`crest_id`, `data`, `type`) VALUES(?, ?, ?)"))
{
final L2Crest crest = new L2Crest(_nextId.getAndIncrement(), data, crestType);
@@ -187,7 +187,7 @@ public final class CrestTable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM `crests` WHERE `crest_id` = ?"))
{
statement.setInt(1, crestId);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java
index 2be088cd17..b281c6dbe0 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java
@@ -56,7 +56,7 @@ public class OfflineTradersTable
public void storeOffliners()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS);
PreparedStatement stm3 = con.prepareStatement(SAVE_OFFLINE_STATUS);
@@ -173,7 +173,7 @@ public class OfflineTradersTable
{
LOGGER.info(getClass().getSimpleName() + ": Loading offline traders...");
int nTraders = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement stm = con.createStatement();
ResultSet rs = stm.executeQuery(LOAD_OFFLINE_STATUS))
{
@@ -329,7 +329,7 @@ public class OfflineTradersTable
public static synchronized void onTransaction(L2PcInstance trader, boolean finished, boolean firstCall)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_PLAYER);
PreparedStatement stm3 = con.prepareStatement(SAVE_ITEMS);
@@ -453,7 +453,7 @@ public class OfflineTradersTable
{
PlayerCountManager.getInstance().decOfflineTradeCount();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_PLAYER))
{
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java
index 333e0e2289..4013e5e460 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java
@@ -42,7 +42,7 @@ public class PetNameTable
public boolean doesPetNameExist(String name, int petNpcId)
{
boolean result = true;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT name FROM pets p, items i WHERE p.item_obj_id = i.object_id AND name=? AND i.item_id IN (?)"))
{
ps.setString(1, name);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java
index 33e2d0df1d..0de4769849 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java
@@ -66,7 +66,7 @@ public final class BuyListData implements IGameXmlReader
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _buyLists.size() + " BuyLists.");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rs = statement.executeQuery("SELECT * FROM `buylists`"))
{
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/datatables/BotReportTable.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/datatables/BotReportTable.java
index bbc6672f94..1d92e316f3 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/datatables/BotReportTable.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/datatables/BotReportTable.java
@@ -112,7 +112,7 @@ public final class BotReportTable
*/
private void loadReportedCharData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery(SQL_LOAD_REPORTED_CHAR_DATA))
{
@@ -181,7 +181,7 @@ public final class BotReportTable
*/
public void saveReportedCharData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
PreparedStatement ps = con.prepareStatement(SQL_INSERT_REPORTED_CHAR_DATA))
{
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/datatables/ItemTable.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/datatables/ItemTable.java
index c8f34ed812..e4f3a0098d 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/datatables/ItemTable.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/datatables/ItemTable.java
@@ -386,7 +386,7 @@ public class ItemTable
// if it's a pet control item, delete the pet as well
if (item.getItem().isPetItem())
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
{
// Delete the pet in db
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/datatables/SchemeBufferTable.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/datatables/SchemeBufferTable.java
index 7b47d8fc45..e72715b441 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/datatables/SchemeBufferTable.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/datatables/SchemeBufferTable.java
@@ -58,7 +58,7 @@ public class SchemeBufferTable
{
int count = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement st = con.prepareStatement(LOAD_SCHEMES);
ResultSet rs = st.executeQuery();
@@ -135,7 +135,7 @@ public class SchemeBufferTable
public void saveSchemes()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Delete all entries from database.
PreparedStatement st = con.prepareStatement(DELETE_SCHEMES);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java
index be6c70ea35..721671de46 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java
@@ -71,7 +71,7 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer
public synchronized void reset()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_daily_rewards WHERE rewardId = ? AND status = ?"))
{
ps.setInt(1, _holder.getId());
@@ -111,7 +111,7 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer
protected void storePlayerEntry(DailyMissionPlayerEntry entry)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO character_daily_rewards (charId, rewardId, status, progress, lastCompleted) VALUES (?, ?, ?, ?, ?)"))
{
ps.setInt(1, entry.getObjectId());
@@ -138,7 +138,7 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer
return existingEntry;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM character_daily_rewards WHERE charId = ? AND rewardId = ?"))
{
ps.setInt(1, objectId);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
index baaadc776c..34f7280917 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -128,7 +128,7 @@ public abstract class IdFactory
*/
private void setAllCharacterOffline()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("UPDATE characters SET online = 0");
@@ -145,7 +145,7 @@ public abstract class IdFactory
*/
private void cleanUpDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement stmt = con.createStatement())
{
final long cleanupStart = System.currentTimeMillis();
@@ -253,7 +253,7 @@ public abstract class IdFactory
private void cleanUpTimeStamps()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
int cleanCount = 0;
for (String line : TIMESTAMPS_CLEAN)
@@ -279,7 +279,7 @@ public abstract class IdFactory
protected final Integer[] extractUsedObjectIDTable() throws Exception
{
final List temp = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
String extractUsedObjectIdsQuery = "";
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
index 9e5d1cedcf..21ed01119d 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
@@ -42,7 +42,7 @@ public class StackIDFactory extends IdFactory
_curOID = FIRST_OID;
_tempOID = FIRST_OID;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// con.createStatement().execute("drop table if exists tmp_obj_id");
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java
index c1c614e3f8..85f3d57b5d 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java
@@ -169,7 +169,7 @@ public class AirShipManager
_airShipsInfo.put(ownerId, info);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_DB))
{
ps.setInt(1, ownerId);
@@ -265,7 +265,7 @@ public class AirShipManager
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(LOAD_DB))
{
@@ -296,7 +296,7 @@ public class AirShipManager
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_DB))
{
ps.setInt(1, info.getInt("fuel"));
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
index afc836f427..0808ef7947 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
@@ -198,7 +198,7 @@ public final class CastleManager implements InstanceListManager
}
}
// else offline-player circlet removal
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM items WHERE owner_id = ? and item_id = ?"))
{
ps.setInt(1, member.getObjectId());
@@ -215,7 +215,7 @@ public final class CastleManager implements InstanceListManager
@Override
public void loadInstances()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT id FROM castle ORDER BY id"))
{
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
index 6a9dff749b..4c73fd01a3 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
@@ -162,7 +162,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
private void loadDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stProduction = con.prepareStatement("SELECT * FROM castle_manor_production WHERE castle_id=?");
PreparedStatement stProcure = con.prepareStatement("SELECT * FROM castle_manor_procure WHERE castle_id=?"))
{
@@ -436,7 +436,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
_productionNext.put(castleId, list);
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement dps = con.prepareStatement("DELETE FROM castle_manor_production WHERE castle_id = ? AND next_period = 1");
PreparedStatement ips = con.prepareStatement(INSERT_PRODUCT))
{
@@ -472,7 +472,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
_procureNext.put(castleId, list);
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement dps = con.prepareStatement("DELETE FROM castle_manor_procure WHERE castle_id = ? AND next_period = 1");
PreparedStatement ips = con.prepareStatement(INSERT_CROP))
{
@@ -506,7 +506,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
public final void updateCurrentProduction(int castleId, Collection items)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle_manor_production SET amount = ? WHERE castle_id = ? AND seed_id = ? AND next_period = 0"))
{
for (SeedProduction sp : items)
@@ -526,7 +526,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
public final void updateCurrentProcure(int castleId, Collection items)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle_manor_procure SET amount = ? WHERE castle_id = ? AND crop_id = ? AND next_period = 0"))
{
for (CropProcure sp : items)
@@ -599,7 +599,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
@Override
public final boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ds = con.prepareStatement("DELETE FROM castle_manor_production");
PreparedStatement is = con.prepareStatement(INSERT_PRODUCT);
PreparedStatement dp = con.prepareStatement("DELETE FROM castle_manor_procure");
@@ -697,7 +697,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ds = con.prepareStatement("DELETE FROM castle_manor_production WHERE castle_id = ?");
PreparedStatement dc = con.prepareStatement("DELETE FROM castle_manor_procure WHERE castle_id = ?"))
{
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java
index 47fa22adb0..47b57a17b8 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java
@@ -91,7 +91,7 @@ public class CeremonyOfChaosManager extends AbstractEventManager clanApplicantList = _applicantList.get(clanId);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_APPLICANT))
{
statement.setInt(1, playerId);
@@ -189,7 +189,7 @@ public class ClanEntryManager
{
_applicantList.computeIfAbsent(clanId, k -> new ConcurrentHashMap<>()).put(info.getPlayerId(), info);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_APPLICANT))
{
statement.setInt(1, info.getPlayerId());
@@ -216,7 +216,7 @@ public class ClanEntryManager
{
if (!_playerLocked.containsKey(playerId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_WAITING_LIST))
{
statement.setInt(1, info.getPlayerId());
@@ -237,7 +237,7 @@ public class ClanEntryManager
{
if (_waitingList.containsKey(playerId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_WAITING_LIST))
{
statement.setInt(1, playerId);
@@ -258,7 +258,7 @@ public class ClanEntryManager
{
if (!_clanList.containsKey(clanId) && !_clanLocked.containsKey(clanId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_CLAN_RECRUIT))
{
statement.setInt(1, info.getClanId());
@@ -283,7 +283,7 @@ public class ClanEntryManager
{
if (_clanList.containsKey(clanId) && !_clanLocked.containsKey(clanId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CLAN_RECRUIT))
{
statement.setInt(1, info.getKarma());
@@ -307,7 +307,7 @@ public class ClanEntryManager
{
if (_clanList.containsKey(clanId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_CLAN_RECRUIT))
{
statement.setInt(1, clanId);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java
index e424e0ad7e..6ba2c94bb2 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java
@@ -79,7 +79,7 @@ public final class CommissionManager
protected CommissionManager()
{
final Map itemInstances = new HashMap<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement(SELECT_ALL_ITEMS))
{
@@ -245,7 +245,7 @@ public final class CommissionManager
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_COMMISSION_ITEM, Statement.RETURN_GENERATED_KEYS))
{
final Instant startTime = Instant.now();
@@ -398,7 +398,7 @@ public final class CommissionManager
*/
private boolean deleteItemFromDB(long commissionId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_COMMISSION_ITEM))
{
ps.setLong(1, commissionId);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
index 9e5b85cf52..398058a743 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
@@ -142,7 +142,7 @@ public final class CursedWeaponsManager implements IGameXmlReader
private void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT itemId, charId, playerReputation, playerPkKills, nbKills, endTime FROM cursed_weapons"))
{
@@ -167,7 +167,7 @@ public final class CursedWeaponsManager implements IGameXmlReader
private void controlPlayers()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT owner_id FROM items WHERE item_id=?"))
{
// TODO: See comments below...
@@ -338,7 +338,7 @@ public final class CursedWeaponsManager implements IGameXmlReader
public static void removeFromDb(int itemId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM cursed_weapons WHERE itemId = ?"))
{
ps.setInt(1, itemId);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java
index ced8c5abd2..a881e85ae4 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java
@@ -85,7 +85,7 @@ public class DBSpawnManager
_storedInfo.clear();
_schedules.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM npc_respawns");
ResultSet rset = statement.executeQuery())
{
@@ -275,7 +275,7 @@ public class DBSpawnManager
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO npc_respawns (id, x, y, z, heading, respawnTime, currentHp, currentMp) VALUES(?, ?, ?, ?, ?, ?, ?, ?)"))
{
statement.setInt(1, spawn.getId());
@@ -331,7 +331,7 @@ public class DBSpawnManager
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO npc_respawns (id, x, y, z, heading, respawnTime, currentHp, currentMp) VALUES(?, ?, ?, ?, ?, ?, ?, ?)"))
{
statement.setInt(1, spawn.getId());
@@ -380,7 +380,7 @@ public class DBSpawnManager
if (updateDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM npc_respawns WHERE id = ?"))
{
ps.setInt(1, npcId);
@@ -401,7 +401,7 @@ public class DBSpawnManager
*/
private void updateDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE npc_respawns SET respawnTime = ?, currentHP = ?, currentMP = ? WHERE id = ?"))
{
for (Integer npcId : _storedInfo.keySet())
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java
index 3dd467d653..f25bc2e852 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java
@@ -120,7 +120,7 @@ public class DailyTaskManager extends AbstractEventManager>
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement st = con.prepareStatement("UPDATE character_subclasses SET vitality_points = ?"))
{
@@ -150,7 +150,7 @@ public class DailyTaskManager extends AbstractEventManager>
private void resetExtendDrop()
{
// Update data for offline players.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_variables WHERE var = ?"))
{
ps.setString(1, PlayerVariables.EXTEND_DROP);
@@ -173,7 +173,7 @@ public class DailyTaskManager extends AbstractEventManager>
private void resetDailySkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final List dailySkills = getVariables().getList("reset_skills", SkillHolder.class, Collections.emptyList());
for (SkillHolder skill : dailySkills)
@@ -200,7 +200,7 @@ public class DailyTaskManager extends AbstractEventManager>
}
// Update data for offline players.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE character_variables SET val = ? WHERE var = ?"))
{
ps.setInt(1, 0);
@@ -225,7 +225,7 @@ public class DailyTaskManager extends AbstractEventManager>
private void resetRecommends()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("UPDATE character_reco_bonus SET rec_left = ?, rec_have = 0 WHERE rec_have <= 20"))
{
@@ -258,7 +258,7 @@ public class DailyTaskManager extends AbstractEventManager>
if (Config.TRAINING_CAMP_ENABLE)
{
// Update data for offline players.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM account_gsdata WHERE var = ?"))
{
ps.setString(1, "TRAINING_CAMP_DURATION");
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java
index f635c19883..7101b82852 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java
@@ -46,7 +46,7 @@ public class FactionManager
private void loadAll()
{
_playerFactions.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT charId, faction FROM characters"))
{
@@ -75,7 +75,7 @@ public class FactionManager
return factionId;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT faction FROM characters WHERE charId=?"))
{
ps.setInt(1, id);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/FortManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
index 0fbe44bc6d..56ab9144cf 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
@@ -121,7 +121,7 @@ public final class FortManager implements InstanceListManager
@Override
public void loadInstances()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT id FROM fort ORDER BY id"))
{
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
index 0a5245dafc..4eb6258b05 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
@@ -86,7 +86,7 @@ public final class FortSiegeManager
}
boolean register = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clan_id FROM fortsiege_clans where clan_id=? and fort_id=?"))
{
ps.setInt(1, clan.getId());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
index e9f6bb3475..044d74609a 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
@@ -56,7 +56,7 @@ public final class GlobalVariablesManager extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery(SELECT_QUERY))
{
@@ -87,7 +87,7 @@ public final class GlobalVariablesManager extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement del = con.createStatement();
PreparedStatement st = con.prepareStatement(INSERT_QUERY))
{
@@ -119,7 +119,7 @@ public final class GlobalVariablesManager extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement del = con.createStatement())
{
del.execute(DELETE_QUERY);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
index 0a62e46364..30f9519c00 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
@@ -62,7 +62,7 @@ public final class GrandBossManager implements IStorable
private void init()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT * from grandboss_data ORDER BY boss_id"))
{
@@ -150,7 +150,7 @@ public final class GrandBossManager implements IStorable
@Override
public boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
for (Entry e : _storedInfo.entrySet())
{
@@ -202,7 +202,7 @@ public final class GrandBossManager implements IStorable
private void updateDb(int bossId, boolean statusOnly)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final L2GrandBossInstance boss = _bosses.get(bossId);
final StatsSet info = _storedInfo.get(bossId);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java
index 0939f2cf18..4a0efbc831 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java
@@ -498,7 +498,7 @@ public final class InstanceManager implements IGameXmlReader
*/
private void restoreInstanceTimes()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT * FROM character_instance_time ORDER BY charId"))
{
@@ -550,7 +550,7 @@ public final class InstanceManager implements IGameXmlReader
// Remove them
if (!invalidPenalty.isEmpty())
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_INSTANCE_TIME))
{
for (Integer id : invalidPenalty)
@@ -615,7 +615,7 @@ public final class InstanceManager implements IGameXmlReader
*/
public void deleteInstanceTime(L2PcInstance player, int id)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_INSTANCE_TIME))
{
ps.setInt(1, player.getObjectId());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java
index e0599ea3fe..eb105b45f3 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java
@@ -55,7 +55,7 @@ public final class ItemAuctionManager implements IGameXmlReader
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery("SELECT auctionId FROM item_auction ORDER BY auctionId DESC LIMIT 0, 1"))
{
@@ -134,7 +134,7 @@ public final class ItemAuctionManager implements IGameXmlReader
public static void deleteAuction(int auctionId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement statement = con.prepareStatement("DELETE FROM item_auction WHERE auctionId=?"))
{
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
index fba190d620..5bbbecc082 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
@@ -80,7 +80,7 @@ public final class ItemsOnGroundManager implements Runnable
str = "UPDATE itemsonground SET drop_time = ? WHERE drop_time = -1";
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(str))
{
ps.setLong(1, System.currentTimeMillis());
@@ -93,7 +93,7 @@ public final class ItemsOnGroundManager implements Runnable
}
// Add items to world
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable FROM itemsonground"))
{
int count = 0;
@@ -178,7 +178,7 @@ public final class ItemsOnGroundManager implements Runnable
public void emptyTable()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("DELETE FROM itemsonground");
@@ -204,7 +204,7 @@ public final class ItemsOnGroundManager implements Runnable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO itemsonground(object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable) VALUES(?,?,?,?,?,?,?,?,?)"))
{
for (L2ItemInstance item : _items)
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/MailManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/MailManager.java
index 0b4c7601cb..fbc14a23e6 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/MailManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/MailManager.java
@@ -57,7 +57,7 @@ public final class MailManager
private void load()
{
int count = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT * FROM messages ORDER BY expiration"))
{
@@ -192,7 +192,7 @@ public final class MailManager
public void sendMessage(Message msg)
{
_messages.put(msg.getId(), msg);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = Message.getStatement(msg, con))
{
ps.execute();
@@ -214,7 +214,7 @@ public final class MailManager
public final void markAsReadInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isUnread = 'false' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -228,7 +228,7 @@ public final class MailManager
public final void markAsDeletedBySenderInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isDeletedBySender = 'true' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -242,7 +242,7 @@ public final class MailManager
public final void markAsDeletedByReceiverInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isDeletedByReceiver = 'true' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -256,7 +256,7 @@ public final class MailManager
public final void removeAttachmentsInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET hasAttachments = 'false' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -270,7 +270,7 @@ public final class MailManager
public final void deleteMessageInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM messages WHERE messageId = ?"))
{
ps.setInt(1, msgId);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java
index f47cf3f813..82a7f2288b 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java
@@ -54,7 +54,7 @@ public class MentorManager
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery("SELECT * FROM character_mentees"))
{
@@ -76,7 +76,7 @@ public class MentorManager
*/
public void deleteMentee(int mentorId, int menteeId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_mentees WHERE mentorId = ? AND charId = ?"))
{
statement.setInt(1, mentorId);
@@ -95,7 +95,7 @@ public class MentorManager
*/
public void deleteMentor(int mentorId, int menteeId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_mentees WHERE mentorId = ? AND charId = ?"))
{
statement.setInt(1, mentorId);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
index a29ed155fc..c03a9a8aae 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
@@ -128,7 +128,7 @@ public class PremiumManager
private void loadPremiumData(String accountName)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stmt = con.prepareStatement(LOAD_SQL))
{
stmt.setString(1, accountName);
@@ -160,7 +160,7 @@ public class PremiumManager
long newPremiumExpiration = oldPremiumExpiration + addTime;
// UPDATE DATABASE
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stmt = con.prepareStatement(UPDATE_SQL))
{
stmt.setLong(1, newPremiumExpiration);
@@ -205,7 +205,7 @@ public class PremiumManager
premiumData.remove(accountName);
// UPDATE DATABASE
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stmt = con.prepareStatement(DELETE_SQL))
{
stmt.setString(1, accountName);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java
index 001e262042..7438bf62f8 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java
@@ -56,7 +56,7 @@ public final class PunishmentManager
int expired = 0;
// Load punishments.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery("SELECT * FROM punishments"))
{
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
index b99c5e77d5..fe296e2e53 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
@@ -57,7 +57,7 @@ public final class SiegeGuardManager
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
ResultSet rs = con.createStatement().executeQuery("SELECT * FROM castle_siege_guards Where isHired = 1"))
{
while (rs.next())
@@ -158,7 +158,7 @@ public final class SiegeGuardManager
final SiegeGuardHolder holder = getSiegeGuardByItem(castle.getResidenceId(), itemId);
if (holder != null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("Insert Into castle_siege_guards (castleId, npcId, x, y, z, heading, respawnDelay, isHired) Values (?, ?, ?, ?, ?, ?, ?, ?)"))
{
statement.setInt(1, castle.getResidenceId());
@@ -249,7 +249,7 @@ public final class SiegeGuardManager
*/
private void loadSiegeGuard(Castle castle)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_siege_guards Where castleId = ? And isHired = ?"))
{
ps.setInt(1, castle.getResidenceId());
@@ -283,7 +283,7 @@ public final class SiegeGuardManager
*/
public void removeSiegeGuard(int npcId, IPositionable pos)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("Delete From castle_siege_guards Where npcId = ? And x = ? AND y = ? AND z = ? AND isHired = 1"))
{
ps.setInt(1, npcId);
@@ -304,7 +304,7 @@ public final class SiegeGuardManager
*/
public void removeSiegeGuards(Castle castle)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("Delete From castle_siege_guards Where castleId = ? And isHired = 1"))
{
ps.setInt(1, castle.getResidenceId());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
index e7fa0b41a8..65bd2b1bcf 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
@@ -88,7 +88,7 @@ public final class SiegeManager
}
boolean register = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT clan_id FROM siege_clans where clan_id=? and castle_id=?"))
{
statement.setInt(1, clan.getId());
@@ -275,7 +275,7 @@ public final class SiegeManager
private void loadTrapUpgrade(int castleId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_trapupgrade WHERE castleId=?"))
{
ps.setInt(1, castleId);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/BlockList.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/BlockList.java
index f34f2aa666..9498d19d95 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/BlockList.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/BlockList.java
@@ -71,7 +71,7 @@ public class BlockList
private static List loadList(int ObjId)
{
final List list = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=? AND relation=1"))
{
statement.setInt(1, ObjId);
@@ -98,7 +98,7 @@ public class BlockList
private void updateInDB(int targetId, boolean state)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (state) // add
{
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/CursedWeapon.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/CursedWeapon.java
index 2265d6876c..e767a0de19 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/CursedWeapon.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/CursedWeapon.java
@@ -136,7 +136,7 @@ public class CursedWeapon implements INamable
// Remove from Db
LOGGER.info(_name + " being removed offline.");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement del = con.prepareStatement("DELETE FROM items WHERE owner_id=? AND item_id=?");
PreparedStatement ps = con.prepareStatement("UPDATE characters SET reputation=?, pkkills=? WHERE charId=?"))
{
@@ -471,7 +471,7 @@ public class CursedWeapon implements INamable
public void saveData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement del = con.prepareStatement("DELETE FROM cursed_weapons WHERE itemId = ?");
PreparedStatement ps = con.prepareStatement("INSERT INTO cursed_weapons (itemId, charId, playerReputation, playerPkKills, nbKills, endTime) VALUES (?, ?, ?, ?, ?, ?)"))
{
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Clan.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Clan.java
index 03f440a3fd..8a1ad46dd7 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Clan.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Clan.java
@@ -266,7 +266,7 @@ public class L2Clan implements IIdentifiable, INamable
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET clan_privs = ? WHERE charId = ?"))
{
ps.setInt(1, 0);
@@ -306,7 +306,7 @@ public class L2Clan implements IIdentifiable, INamable
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET clan_privs = ? WHERE charId = ?"))
{
ps.setInt(1, EnumIntBitmask.getAllBitmask(ClanPrivilege.class));
@@ -883,7 +883,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateBloodAllianceCountInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET blood_alliance_count=? WHERE clan_id=?"))
{
ps.setInt(1, _bloodAllianceCount);
@@ -927,7 +927,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateBloodOathCountInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET blood_oath_count=? WHERE clan_id=?"))
{
ps.setInt(1, _bloodOathCount);
@@ -943,7 +943,7 @@ public class L2Clan implements IIdentifiable, INamable
public void updateInDB()
{
// Update reputation
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET reputation_score=? WHERE clan_id=?"))
{
ps.setInt(1, _reputationScore);
@@ -978,7 +978,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateClanInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET leader_id=?,ally_id=?,ally_name=?,reputation_score=?,ally_penalty_expiry_time=?,ally_penalty_type=?,char_penalty_expiry_time=?,dissolving_expiry_time=?,new_leader_id=? WHERE clan_id=?"))
{
ps.setInt(1, getLeaderId());
@@ -1016,7 +1016,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void store()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_CLAN_DATA))
{
ps.setInt(1, _clanId);
@@ -1047,7 +1047,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
private void removeMemberInDatabase(L2ClanMember member, long clanJoinExpiryTime, long clanCreateExpiryTime)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("UPDATE characters SET clanid=0, title=?, clan_join_expiry_time=?, clan_create_expiry_time=?, clan_privs=0, wantspeace=0, subpledge=0, lvl_joined_academy=0, apprentice=0, sponsor=0 WHERE charId=?");
PreparedStatement ps2 = con.prepareStatement("UPDATE characters SET apprentice=0 WHERE apprentice=?");
PreparedStatement ps3 = con.prepareStatement("UPDATE characters SET sponsor=0 WHERE sponsor=?"))
@@ -1072,7 +1072,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_CLAN_DATA))
{
ps.setInt(1, _clanId);
@@ -1147,7 +1147,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreNotice()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT enabled,notice FROM clan_notices WHERE clan_id=?"))
{
ps.setInt(1, _clanId);
@@ -1178,7 +1178,7 @@ public class L2Clan implements IIdentifiable, INamable
notice = notice.substring(0, MAX_NOTICE_LENGTH - 1);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_notices (clan_id,notice,enabled) values (?,?,?) ON DUPLICATE KEY UPDATE notice=?,enabled=?"))
{
ps.setInt(1, _clanId);
@@ -1237,7 +1237,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreSkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT skill_id,skill_level,sub_pledge_id FROM clan_skills WHERE clan_id=?"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -1360,7 +1360,7 @@ public class L2Clan implements IIdentifiable, INamable
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (oldSkill != null)
{
@@ -1770,7 +1770,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreSubPledges()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT sub_pledge_id,name,leader_id FROM clan_subpledges WHERE clan_id=?"))
{
// Retrieve all subpledges of this clan from the database
@@ -1870,7 +1870,7 @@ public class L2Clan implements IIdentifiable, INamable
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_subpledges (clan_id,sub_pledge_id,name,leader_id) values (?,?,?,?)"))
{
ps.setInt(1, _clanId);
@@ -1953,7 +1953,7 @@ public class L2Clan implements IIdentifiable, INamable
public void updateSubPledgeInDB(int pledgeType)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_subpledges SET leader_id=?, name=? WHERE clan_id=? AND sub_pledge_id=?"))
{
ps.setInt(1, getSubPledge(pledgeType).getLeaderId());
@@ -1970,7 +1970,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreRankPrivs()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT privs,rank,party FROM clan_privs WHERE clan_id=?"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -2019,7 +2019,7 @@ public class L2Clan implements IIdentifiable, INamable
{
_privs.get(rank).setPrivs(privs);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_privs (clan_id,rank,party,privs) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE privs = ?"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -2055,7 +2055,7 @@ public class L2Clan implements IIdentifiable, INamable
{
_privs.put(rank, new RankPrivs(rank, 0, privs));
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_privs (clan_id,rank,party,privs) VALUES (?,?,?,?)"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -2174,7 +2174,7 @@ public class L2Clan implements IIdentifiable, INamable
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET auction_bid_at=? WHERE clan_id=?"))
{
ps.setInt(1, id);
@@ -2623,7 +2623,7 @@ public class L2Clan implements IIdentifiable, INamable
public void changeLevel(int level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET clan_level = ? WHERE clan_id = ?"))
{
ps.setInt(1, level);
@@ -2669,7 +2669,7 @@ public class L2Clan implements IIdentifiable, INamable
setCrestId(crestId);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET crest_id = ? WHERE clan_id = ?"))
{
ps.setInt(1, crestId);
@@ -2706,7 +2706,7 @@ public class L2Clan implements IIdentifiable, INamable
allyId = _allyId;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(sqlStatement))
{
ps.setInt(1, crestId);
@@ -2752,7 +2752,7 @@ public class L2Clan implements IIdentifiable, INamable
setCrestLargeId(crestId);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET crest_large_id = ? WHERE clan_id = ?"))
{
ps.setInt(1, crestId);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2ClanMember.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2ClanMember.java
index 8827f75a89..f1efba8e6e 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2ClanMember.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2ClanMember.java
@@ -244,7 +244,7 @@ public class L2ClanMember
*/
public void updatePledgeType()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET subpledge=? WHERE charId=?"))
{
ps.setLong(1, _pledgeType);
@@ -289,7 +289,7 @@ public class L2ClanMember
*/
public void updatePowerGrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET power_grade=? WHERE charId=?"))
{
ps.setLong(1, _powerGrade);
@@ -800,7 +800,7 @@ public class L2ClanMember
*/
public void saveApprenticeAndSponsor(int apprentice, int sponsor)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET apprentice=?,sponsor=? WHERE charId=?"))
{
ps.setInt(1, apprentice);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2ContactList.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2ContactList.java
index ea5f1f9d5d..5b5f5ab2bc 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2ContactList.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2ContactList.java
@@ -58,7 +58,7 @@ public class L2ContactList
{
_contacts.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY_LOAD))
{
statement.setInt(1, activeChar.getObjectId());
@@ -124,7 +124,7 @@ public class L2ContactList
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY_ADD))
{
statement.setInt(1, activeChar.getObjectId());
@@ -161,7 +161,7 @@ public class L2ContactList
_contacts.remove(name);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY_REMOVE))
{
statement.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Mentee.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Mentee.java
index 5c086b9d83..5414107ac4 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Mentee.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/L2Mentee.java
@@ -49,7 +49,7 @@ public class L2Mentee
final L2PcInstance player = getPlayerInstance();
if (player == null) // Only if player is offline
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT char_name, level, base_class FROM characters WHERE charId = ?"))
{
statement.setInt(1, _objectId);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/MacroList.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/MacroList.java
index 577b101249..176fa12d48 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/MacroList.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/MacroList.java
@@ -124,7 +124,7 @@ public class MacroList implements IRestorable
private void registerMacroInDb(Macro macro)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO character_macroses (charId,id,icon,name,descr,acronym,commands) values(?,?,?,?,?,?,?)"))
{
ps.setInt(1, _owner.getObjectId());
@@ -160,7 +160,7 @@ public class MacroList implements IRestorable
private void deleteMacroFromDb(Macro macro)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_macroses WHERE charId=? AND id=?"))
{
ps.setInt(1, _owner.getObjectId());
@@ -177,7 +177,7 @@ public class MacroList implements IRestorable
public boolean restoreMe()
{
_macroses.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT charId, id, icon, name, descr, acronym, commands FROM character_macroses WHERE charId=?"))
{
ps.setInt(1, _owner.getObjectId());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/ShortCuts.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/ShortCuts.java
index 81e2c6f902..cbb856704d 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/ShortCuts.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/ShortCuts.java
@@ -85,7 +85,7 @@ public class ShortCuts implements IRestorable
deleteShortCutFromDb(oldShortCut);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("REPLACE INTO character_shortcuts (charId,slot,page,type,shortcut_id,level,sub_level,class_index) values(?,?,?,?,?,?,?,?)"))
{
statement.setInt(1, _owner.getObjectId());
@@ -154,7 +154,7 @@ public class ShortCuts implements IRestorable
*/
private void deleteShortCutFromDb(Shortcut shortcut)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=? AND slot=? AND page=? AND class_index=?"))
{
statement.setInt(1, _owner.getObjectId());
@@ -173,7 +173,7 @@ public class ShortCuts implements IRestorable
public boolean restoreMe()
{
_shortCuts.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT charId, slot, page, type, shortcut_id, level, sub_level FROM character_shortcuts WHERE charId=? AND class_index=?"))
{
statement.setInt(1, _owner.getObjectId());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
index db7b4d2cb0..fd18661570 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
@@ -1324,7 +1324,7 @@ public final class L2PcInstance extends L2Playable
private void insertNewRecipeData(int recipeId, boolean isDwarf)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_recipebook (charId, id, classIndex, type) values(?,?,?,?)"))
{
statement.setInt(1, getObjectId());
@@ -1341,7 +1341,7 @@ public final class L2PcInstance extends L2Playable
private void deleteRecipeData(int recipeId, boolean isDwarf)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_recipebook WHERE charId=? AND id=? AND classIndex=?"))
{
statement.setInt(1, getObjectId());
@@ -6305,7 +6305,7 @@ public final class L2PcInstance extends L2Playable
if (updateInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_CHARACTER_ACCESS))
{
ps.setInt(1, accessLevel.getLevel());
@@ -6424,7 +6424,7 @@ public final class L2PcInstance extends L2Playable
*/
public void updateOnlineStatus()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE characters SET online=?, lastAccess=? WHERE charId=?"))
{
statement.setInt(1, isOnlineInt());
@@ -6444,7 +6444,7 @@ public final class L2PcInstance extends L2Playable
*/
private boolean createDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_CHARACTER))
{
statement.setString(1, _accountName);
@@ -6508,7 +6508,7 @@ public final class L2PcInstance extends L2Playable
double currentCp = 0;
double currentHp = 0;
double currentMp = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHARACTER))
{
// Retrieve the L2PcInstance from the characters table of the database
@@ -6869,7 +6869,7 @@ public final class L2PcInstance extends L2Playable
*/
private static boolean restoreSubClassData(L2PcInstance player)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_SUBCLASSES))
{
statement.setInt(1, player.getObjectId());
@@ -6960,7 +6960,7 @@ public final class L2PcInstance extends L2Playable
private void restoreRecipeBook(boolean loadCommon)
{
final String sql = loadCommon ? "SELECT id, type, classIndex FROM character_recipebook WHERE charId=?" : "SELECT id FROM character_recipebook WHERE charId=? AND classIndex=? AND type = 1";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(sql))
{
statement.setInt(1, getObjectId());
@@ -7013,7 +7013,7 @@ public final class L2PcInstance extends L2Playable
private void loadPremiumItemList()
{
final String sql = "SELECT itemNum, itemId, itemCount, itemSender FROM character_premium_items WHERE charId=?";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(sql))
{
statement.setInt(1, getObjectId());
@@ -7037,7 +7037,7 @@ public final class L2PcInstance extends L2Playable
public void updatePremiumItem(int itemNum, long newcount)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE character_premium_items SET itemCount=? WHERE charId=? AND itemNum=? "))
{
statement.setLong(1, newcount);
@@ -7053,7 +7053,7 @@ public final class L2PcInstance extends L2Playable
public void deletePremiumItem(int itemNum)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_premium_items WHERE charId=? AND itemNum=? "))
{
statement.setInt(1, getObjectId());
@@ -7106,7 +7106,7 @@ public final class L2PcInstance extends L2Playable
final long exp = getStat().getBaseExp();
final int level = getStat().getBaseLevel();
final long sp = getStat().getBaseSp();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CHARACTER))
{
statement.setInt(1, level);
@@ -7191,7 +7191,7 @@ public final class L2PcInstance extends L2Playable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CHAR_SUBCLASS))
{
for (SubClass subClass : getSubClasses().values())
@@ -7222,7 +7222,7 @@ public final class L2PcInstance extends L2Playable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
{
@@ -7342,7 +7342,7 @@ public final class L2PcInstance extends L2Playable
private void storeItemReuseDelay()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(DELETE_ITEM_REUSE_SAVE);
PreparedStatement ps2 = con.prepareStatement(ADD_ITEM_REUSE_SAVE))
{
@@ -7459,7 +7459,7 @@ public final class L2PcInstance extends L2Playable
final Skill oldSkill = super.removeSkill(skill, true);
if (oldSkill != null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_SKILL_FROM_CHAR))
{
// Remove or update a L2PcInstance skill from the character_skills table of the database
@@ -7502,7 +7502,7 @@ public final class L2PcInstance extends L2Playable
private void storeSkill(Skill newSkill, Skill oldSkill, int newClassIndex)
{
final int classIndex = (newClassIndex > -1) ? newClassIndex : _classIndex;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if ((oldSkill != null) && (newSkill != null))
{
@@ -7552,7 +7552,7 @@ public final class L2PcInstance extends L2Playable
}
final int classIndex = (newClassIndex > -1) ? newClassIndex : _classIndex;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_NEW_SKILLS))
{
con.setAutoCommit(false);
@@ -7579,7 +7579,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restoreSkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -7631,7 +7631,7 @@ public final class L2PcInstance extends L2Playable
@Override
public void restoreEffects()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_SKILL_SAVE))
{
statement.setInt(1, getObjectId());
@@ -7688,7 +7688,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restoreItemReuse()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_ITEM_REUSE_SAVE);
PreparedStatement delete = con.prepareStatement(DELETE_ITEM_REUSE_SAVE))
{
@@ -7759,7 +7759,7 @@ public final class L2PcInstance extends L2Playable
_henna[i - 1] = null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_HENNAS))
{
statement.setInt(1, getObjectId());
@@ -7866,7 +7866,7 @@ public final class L2PcInstance extends L2Playable
_henna[slot - 1] = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_CHAR_HENNA))
{
statement.setInt(1, getObjectId());
@@ -7947,7 +7947,7 @@ public final class L2PcInstance extends L2Playable
// Calculate Henna modifiers of this L2PcInstance
recalcHennaStats();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(ADD_CHAR_HENNA))
{
statement.setInt(1, getObjectId());
@@ -9565,7 +9565,7 @@ public final class L2PcInstance extends L2Playable
newClass.setLevel(Config.BASE_DUALCLASS_LEVEL);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(ADD_CHAR_SUBCLASS))
{
// Store the basic info about this new sub-class.
@@ -9665,7 +9665,7 @@ public final class L2PcInstance extends L2Playable
// Remove after stats are recalculated.
getSubClasses().remove(classIndex);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
@@ -11809,7 +11809,7 @@ public final class L2PcInstance extends L2Playable
{
String req;
req = "UPDATE pets SET fed=? WHERE item_obj_id = ?";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(req))
{
statement.setInt(1, _curFeed);
@@ -11936,7 +11936,7 @@ public final class L2PcInstance extends L2Playable
bookmark.setTag(tag);
bookmark.setName(name);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_TP_BOOKMARK))
{
statement.setInt(1, icon);
@@ -11959,7 +11959,7 @@ public final class L2PcInstance extends L2Playable
{
if (_tpbookmarks.remove(id) != null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_TP_BOOKMARK))
{
statement.setInt(1, getObjectId());
@@ -12102,7 +12102,7 @@ public final class L2PcInstance extends L2Playable
sm.addItemName(20033);
sendPacket(sm);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_TP_BOOKMARK))
{
statement.setInt(1, getObjectId());
@@ -12124,7 +12124,7 @@ public final class L2PcInstance extends L2Playable
public void restoreTeleportBookmark()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_TP_BOOKMARK))
{
statement.setInt(1, getObjectId());
@@ -12336,7 +12336,7 @@ public final class L2PcInstance extends L2Playable
_friendList.clear();
final String sqlQuery = "SELECT friendId FROM character_friends WHERE charId=? AND relation=0";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(sqlQuery))
{
statement.setInt(1, getObjectId());
@@ -12426,7 +12426,7 @@ public final class L2PcInstance extends L2Playable
{
if (hasManufactureShop())
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement st = con.prepareStatement(DELETE_CHAR_RECIPE_SHOP))
{
@@ -12464,7 +12464,7 @@ public final class L2PcInstance extends L2Playable
_manufactureItems.clear();
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_RECIPE_SHOP))
{
statement.setInt(1, getObjectId());
@@ -12882,7 +12882,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restorePetInventoryItems()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT object_id FROM `items` WHERE `owner_id`=? AND (`loc`='PET' OR `loc`='PET_EQUIP') LIMIT 1;"))
{
statement.setInt(1, getObjectId());
@@ -12922,7 +12922,7 @@ public final class L2PcInstance extends L2Playable
*/
private void loadRecommendations()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT rec_have, rec_left FROM character_reco_bonus WHERE charId = ?"))
{
statement.setInt(1, getObjectId());
@@ -12946,7 +12946,7 @@ public final class L2PcInstance extends L2Playable
*/
public void storeRecommendations()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO character_reco_bonus (charId,rec_have,rec_left,time_left) VALUES (?,?,?,?)"))
{
ps.setInt(1, getObjectId());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
index c5b882a533..2a22ce6fa1 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
@@ -788,7 +788,7 @@ public class L2PetInstance extends L2Summon
}
// pet control item no longer exists, delete the pet from the db
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id = ?"))
{
statement.setInt(1, _controlObjectId);
@@ -846,7 +846,7 @@ public class L2PetInstance extends L2Summon
private static L2PetInstance restore(L2ItemInstance control, L2NpcTemplate template, L2PcInstance owner)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT item_obj_id, name, level, curHp, curMp, exp, sp, fed FROM pets WHERE item_obj_id=?"))
{
L2PetInstance pet;
@@ -942,7 +942,7 @@ public class L2PetInstance extends L2Summon
req = "UPDATE pets SET name=?,level=?,curHp=?,curMp=?,exp=?,sp=?,fed=?,ownerId=?,restore=? WHERE item_obj_id = ?";
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(req))
{
statement.setString(1, getName());
@@ -992,7 +992,7 @@ public class L2PetInstance extends L2Summon
// Clear list for overwrite
SummonEffectsTable.getInstance().getPetEffects().getOrDefault(getControlObjectId(), Collections.emptyList()).clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement ps2 = con.prepareStatement(ADD_SKILL_SAVE))
{
@@ -1067,7 +1067,7 @@ public class L2PetInstance extends L2Summon
@Override
public void restoreEffects()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(RESTORE_SKILL_SAVE);
PreparedStatement ps2 = con.prepareStatement(DELETE_SKILL_SAVE))
{
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java
index 320505de11..8cbf9119b6 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java
@@ -288,7 +288,7 @@ public class L2ServitorInstance extends L2Summon implements Runnable
SummonEffectsTable.getInstance().getServitorEffects(getOwner()).getOrDefault(getReferenceSkill(), Collections.emptyList()).clear();
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_SKILL_SAVE))
{
// Delete all current stored effects for summon to avoid dupe
@@ -389,7 +389,7 @@ public class L2ServitorInstance extends L2Summon implements Runnable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (!SummonEffectsTable.getInstance().getServitorEffectsOwner().containsKey(getOwner().getObjectId()) || !SummonEffectsTable.getInstance().getServitorEffectsOwner().get(getOwner().getObjectId()).containsKey(getOwner().getClassIndex()) || !SummonEffectsTable.getInstance().getServitorEffects(getOwner()).containsKey(getReferenceSkill()))
{
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/announce/Announcement.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/announce/Announcement.java
index 4e5aa84b0f..a7117539ad 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/announce/Announcement.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/announce/Announcement.java
@@ -108,7 +108,7 @@ public class Announcement implements IAnnouncement
@Override
public boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
{
ps.setInt(1, _type.ordinal());
@@ -134,7 +134,7 @@ public class Announcement implements IAnnouncement
@Override
public boolean updateMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_QUERY))
{
ps.setInt(1, _type.ordinal());
@@ -154,7 +154,7 @@ public class Announcement implements IAnnouncement
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_QUERY))
{
ps.setInt(1, _id);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java
index 1adc7b039f..21eb44294e 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java
@@ -94,7 +94,7 @@ public final class AutoAnnouncement extends Announcement implements Runnable
@Override
public boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
{
st.setInt(1, getType().ordinal());
@@ -123,7 +123,7 @@ public final class AutoAnnouncement extends Announcement implements Runnable
@Override
public boolean updateMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(UPDATE_QUERY))
{
st.setInt(1, getType().ordinal());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/buylist/Product.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/buylist/Product.java
index 8360f7712c..639a9bfa1a 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/buylist/Product.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/buylist/Product.java
@@ -157,7 +157,7 @@ public final class Product
private void save()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO `buylists`(`buylist_id`, `item_id`, `count`, `next_restock_time`) VALUES(?, ?, ?, ?) ON DUPLICATE KEY UPDATE `count` = ?, `next_restock_time` = ?"))
{
statement.setInt(1, _buyListId);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java
index 757b5512d0..5d970e7abd 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java
@@ -58,7 +58,7 @@ public class ClanHallAuction
private final void loadBidder()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(LOAD_CLANHALL_BIDDERS))
{
ps.setInt(1, _clanHallId);
@@ -102,7 +102,7 @@ public class ClanHallAuction
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_CLANHALL_BIDDER))
{
ps.setInt(1, _clanHallId);
@@ -121,7 +121,7 @@ public class ClanHallAuction
public void removeBid(L2Clan clan)
{
getBids().remove(clan.getId());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_CLANHALL_BIDDER))
{
ps.setInt(1, clan.getId());
@@ -170,7 +170,7 @@ public class ClanHallAuction
clanHall.setOwner(highestBidder.getClan());
getBids().clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_CLANHALL_BIDDERS))
{
ps.setInt(1, _clanHallId);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Castle.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Castle.java
index ca9513714d..08284f3f0b 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Castle.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Castle.java
@@ -219,7 +219,7 @@ public final class Castle extends AbstractResidence
public void dbSave()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_functions (castle_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)"))
{
ps.setInt(1, getResidenceId());
@@ -361,7 +361,7 @@ public final class Castle extends AbstractResidence
_treasury += amount;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET treasury = ? WHERE id = ?"))
{
ps.setLong(1, _treasury);
@@ -644,7 +644,7 @@ public final class Castle extends AbstractResidence
@Override
protected void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("SELECT * FROM castle WHERE id = ?");
PreparedStatement ps2 = con.prepareStatement("SELECT clan_id FROM clan_data WHERE hasCastle = ?"))
{
@@ -690,7 +690,7 @@ public final class Castle extends AbstractResidence
/** Load All Functions */
private void loadFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_functions WHERE castle_id = ?"))
{
ps.setInt(1, getResidenceId());
@@ -715,7 +715,7 @@ public final class Castle extends AbstractResidence
public void removeFunction(int functionType)
{
_function.remove(functionType);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_functions WHERE castle_id=? AND type=?"))
{
ps.setInt(1, getResidenceId());
@@ -787,7 +787,7 @@ public final class Castle extends AbstractResidence
// This method loads castle door upgrade data from database
private void loadDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_doorupgrade WHERE castleId=?"))
{
ps.setInt(1, getResidenceId());
@@ -813,7 +813,7 @@ public final class Castle extends AbstractResidence
door.setCurrentHp(door.getCurrentHp());
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_doorupgrade WHERE castleId=?"))
{
ps.setInt(1, getResidenceId());
@@ -838,7 +838,7 @@ public final class Castle extends AbstractResidence
if (save)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_doorupgrade (doorId, ratio, castleId) values (?,?,?)"))
{
ps.setInt(1, doorId);
@@ -865,7 +865,7 @@ public final class Castle extends AbstractResidence
CastleManorManager.getInstance().resetManorData(getResidenceId());
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Need to remove has castle flag from clan_data, should be checked from castle table.
try (PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET hasCastle = 0 WHERE hasCastle = ?"))
@@ -1033,7 +1033,7 @@ public final class Castle extends AbstractResidence
public void updateShowNpcCrest()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET showNpcCrest = ? WHERE id = ?"))
{
ps.setString(1, String.valueOf(_showNpcCrest));
@@ -1077,7 +1077,7 @@ public final class Castle extends AbstractResidence
{
_ticketBuyCount = count;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET ticketBuyCount = ? WHERE id = ?"))
{
ps.setInt(1, _ticketBuyCount);
@@ -1100,7 +1100,7 @@ public final class Castle extends AbstractResidence
{
if (save)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_trapupgrade (castleId, towerIndex, level) values (?,?,?)"))
{
ps.setInt(1, getResidenceId());
@@ -1127,7 +1127,7 @@ public final class Castle extends AbstractResidence
ts.setUpgradeLevel(0);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_trapupgrade WHERE castleId=?"))
{
ps.setInt(1, getResidenceId());
@@ -1208,7 +1208,7 @@ public final class Castle extends AbstractResidence
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET side = ? WHERE id = ?"))
{
ps.setString(1, side.toString());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/ClanHall.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
index 6fc9b45046..79906bc875 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
@@ -100,7 +100,7 @@ public final class ClanHall extends AbstractResidence
@Override
protected void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement loadStatement = con.prepareStatement(LOAD_CLANHALL);
PreparedStatement insertStatement = con.prepareStatement(INSERT_CLANHALL))
{
@@ -133,7 +133,7 @@ public final class ClanHall extends AbstractResidence
public void updateDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CLANHALL))
{
statement.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Couple.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Couple.java
index c40e7d454a..45294842ce 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Couple.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Couple.java
@@ -45,7 +45,7 @@ public class Couple
{
_Id = coupleId;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM mods_wedding WHERE id = ?"))
{
ps.setInt(1, _Id);
@@ -85,7 +85,7 @@ public class Couple
_weddingDate = Calendar.getInstance();
_weddingDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
{
_Id = IdFactory.getInstance().getNextId();
@@ -105,7 +105,7 @@ public class Couple
public void marry()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE mods_wedding set married = ?, weddingDate = ? where id = ?"))
{
ps.setBoolean(1, true);
@@ -123,7 +123,7 @@ public class Couple
public void divorce()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM mods_wedding WHERE id=?"))
{
ps.setInt(1, _Id);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Fort.java
index e6262fdc29..3b29461e3a 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Fort.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Fort.java
@@ -214,7 +214,7 @@ public final class Fort extends AbstractResidence
public void dbSave()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO fort_functions (fort_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)"))
{
ps.setInt(1, getResidenceId());
@@ -487,7 +487,7 @@ public final class Fort extends AbstractResidence
public void saveFortVariables()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET supplyLvL=? WHERE id = ?"))
{
ps.setInt(1, _supplyLvL);
@@ -552,7 +552,7 @@ public final class Fort extends AbstractResidence
@Override
protected void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort WHERE id = ?"))
{
ps.setInt(1, getResidenceId());
@@ -613,7 +613,7 @@ public final class Fort extends AbstractResidence
/** Load All Functions */
private void loadFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_functions WHERE fort_id = ?"))
{
ps.setInt(1, getResidenceId());
@@ -638,7 +638,7 @@ public final class Fort extends AbstractResidence
public void removeFunction(int functionType)
{
_function.remove(functionType);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM fort_functions WHERE fort_id=? AND type=?"))
{
ps.setInt(1, getResidenceId());
@@ -730,7 +730,7 @@ public final class Fort extends AbstractResidence
// This method loads fort door upgrade data from database
private void loadDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_doorupgrade WHERE fortId = ?"))
{
ps.setInt(1, getResidenceId());
@@ -750,7 +750,7 @@ public final class Fort extends AbstractResidence
private void removeDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM fort_doorupgrade WHERE fortId = ?"))
{
ps.setInt(1, getResidenceId());
@@ -764,7 +764,7 @@ public final class Fort extends AbstractResidence
private void saveDoorUpgrade(int doorId, int hp, int pDef, int mDef)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO fort_doorupgrade (doorId, hp, pDef, mDef) VALUES (?,?,?,?)"))
{
ps.setInt(1, doorId);
@@ -793,7 +793,7 @@ public final class Fort extends AbstractResidence
_lastOwnedTime.setTimeInMillis(0);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET owner=?,lastOwnedTime=?,state=?,castleId=? WHERE id = ?"))
{
ps.setInt(1, clanId);
@@ -998,7 +998,7 @@ public final class Fort extends AbstractResidence
{
_state = state;
_castleId = castleId;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET state=?,castleId=? WHERE id = ?"))
{
ps.setInt(1, _state);
@@ -1130,7 +1130,7 @@ public final class Fort extends AbstractResidence
private void initNpcs()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_spawnlist WHERE fortId = ? AND spawnType = ?"))
{
ps.setInt(1, getResidenceId());
@@ -1159,7 +1159,7 @@ public final class Fort extends AbstractResidence
private void initSiegeNpcs()
{
_siegeNpcs.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, npcId, x, y, z, heading FROM fort_spawnlist WHERE fortId = ? AND spawnType = ? ORDER BY id"))
{
ps.setInt(1, getResidenceId());
@@ -1186,7 +1186,7 @@ public final class Fort extends AbstractResidence
private void initNpcCommanders()
{
_npcCommanders.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, npcId, x, y, z, heading FROM fort_spawnlist WHERE fortId = ? AND spawnType = ? ORDER BY id"))
{
ps.setInt(1, getResidenceId());
@@ -1216,7 +1216,7 @@ public final class Fort extends AbstractResidence
_specialEnvoys.clear();
_envoyCastles.clear();
_availableCastles.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, npcId, x, y, z, heading, castleId FROM fort_spawnlist WHERE fortId = ? AND spawnType = ? ORDER BY id"))
{
ps.setInt(1, getResidenceId());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/FortSiege.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/FortSiege.java
index ffba04e6c3..d558045fab 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/FortSiege.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/FortSiege.java
@@ -501,7 +501,7 @@ public class FortSiege implements Siegable
/** Clear all registered siege clans from database for fort */
public void clearSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM fortsiege_clans WHERE fort_id=?"))
{
ps.setInt(1, _fort.getResidenceId());
@@ -785,7 +785,7 @@ public class FortSiege implements Siegable
private void removeSiegeClan(int clanId)
{
final String query = (clanId != 0) ? DELETE_FORT_SIEGECLANS_BY_CLAN_ID : DELETE_FORT_SIEGECLANS;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(query))
{
statement.setInt(1, _fort.getResidenceId());
@@ -999,7 +999,7 @@ public class FortSiege implements Siegable
private void loadSiegeClan()
{
_attackerClans.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clan_id FROM fortsiege_clans WHERE fort_id=?"))
{
ps.setInt(1, _fort.getResidenceId());
@@ -1057,7 +1057,7 @@ public class FortSiege implements Siegable
/** Save siege date to database. */
private void saveSiegeDate()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET siegeDate = ? WHERE id = ?"))
{
ps.setLong(1, _fort.getSiegeDate().getTimeInMillis());
@@ -1081,7 +1081,7 @@ public class FortSiege implements Siegable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO fortsiege_clans (clan_id,fort_id) values (?,?)"))
{
statement.setInt(1, clan.getId());
@@ -1146,7 +1146,7 @@ public class FortSiege implements Siegable
public void loadSiegeGuard()
{
_siegeGuards.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT npcId, x, y, z, heading, respawnDelay FROM fort_siege_guards WHERE fortId = ?"))
{
final int fortId = _fort.getResidenceId();
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Hero.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Hero.java
index 924ecead2f..27be59aa41 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Hero.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Hero.java
@@ -114,7 +114,7 @@ public class Hero
_herodiary.clear();
_heroMessage.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s1 = con.createStatement();
ResultSet rset = s1.executeQuery(GET_HEROES);
PreparedStatement ps = con.prepareStatement(GET_CLAN_ALLY);
@@ -211,7 +211,7 @@ public class Hero
*/
public void loadMessage(int charId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT message FROM heroes WHERE charId=?"))
{
statement.setInt(1, charId);
@@ -233,7 +233,7 @@ public class Hero
{
final List _diary = new CopyOnWriteArrayList<>();
int diaryentries = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM heroes_diary WHERE charId=? ORDER BY time ASC"))
{
statement.setInt(1, charId);
@@ -300,7 +300,7 @@ public class Hero
int _losses = 0;
int _draws = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM olympiad_fights WHERE (charOneId=? OR charTwoId=?) AND start ORDER BY start ASC"))
{
statement.setInt(1, charId);
@@ -699,7 +699,7 @@ public class Hero
public void updateHeroes(boolean setDefault)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (setDefault)
{
@@ -841,7 +841,7 @@ public class Hero
public void setDiaryData(int charId, int action, int param)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO heroes_diary (charId, time, action, param) values(?,?,?,?)"))
{
statement.setInt(1, charId);
@@ -877,7 +877,7 @@ public class Hero
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE heroes SET message=? WHERE charId=?;"))
{
statement.setString(1, _heroMessage.get(charId));
@@ -892,7 +892,7 @@ public class Hero
private void deleteItemsInDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_ITEMS))
{
statement.execute();
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Siege.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Siege.java
index 2ed07c3d33..9e70d283d4 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Siege.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/entity/Siege.java
@@ -760,7 +760,7 @@ public class Siege implements Siegable
/** Clear all registered siege clans from database for castle */
public void clearSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=?"))
{
statement.setInt(1, _castle.getResidenceId());
@@ -788,7 +788,7 @@ public class Siege implements Siegable
/** Clear all siege clans waiting for approval from database for castle */
public void clearSiegeWaitingClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=? and type = 2"))
{
statement.setInt(1, _castle.getResidenceId());
@@ -972,7 +972,7 @@ public class Siege implements Siegable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=? and clan_id=?"))
{
statement.setInt(1, _castle.getResidenceId());
@@ -1238,7 +1238,7 @@ public class Siege implements Siegable
private void loadSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT clan_id,type FROM siege_clans where castle_id=?"))
{
getAttackerClans().clear();
@@ -1349,7 +1349,7 @@ public class Siege implements Siegable
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castle), 1000);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE castle SET siegeDate = ?, regTimeEnd = ?, regTimeOver = ? WHERE id = ?"))
{
statement.setLong(1, _castle.getSiegeDate().getTimeInMillis());
@@ -1378,7 +1378,7 @@ public class Siege implements Siegable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if ((typeId == DEFENDER) || (typeId == DEFENDER_NOT_APPROVED) || (typeId == OWNER))
{
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java
index ac490ba86d..f23e511ede 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java
@@ -138,7 +138,7 @@ public class EventScheduler
public boolean updateLastRun()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO event_schedulers (eventName, schedulerName, lastRun) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE eventName = ?, schedulerName = ?, lastRun = ?"))
{
ps.setString(1, _eventManager.getName());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java
index 3185dae127..fc59ec7842 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java
@@ -52,7 +52,7 @@ public class HaventRunConditionalScheduler implements IConditionalEventScheduler
throw new NullPointerException("Scheduler not found: " + _name);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT lastRun FROM event_schedulers WHERE eventName = ? AND schedulerName = ?"))
{
ps.setString(1, _eventManager.getName());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/instancezone/Instance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/instancezone/Instance.java
index 053ffa54cf..ccef54aad0 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/instancezone/Instance.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/instancezone/Instance.java
@@ -815,7 +815,7 @@ public final class Instance implements IIdentifiable, INamable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT IGNORE INTO character_instance_time (charId,instanceId,time) VALUES (?,?,?)"))
{
// Save to database
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java
index 24c473792a..3f1ad0c250 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java
@@ -191,7 +191,7 @@ public final class ItemAuction
public final void storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO item_auction (auctionId,instanceId,auctionItemId,startingTime,endingTime,auctionStateId) VALUES (?,?,?,?,?,?) ON DUPLICATE KEY UPDATE auctionStateId=?"))
{
statement.setInt(1, _auctionId);
@@ -225,7 +225,7 @@ public final class ItemAuction
final void updatePlayerBidInternal(ItemAuctionBid bid, boolean delete)
{
final String query = delete ? DELETE_ITEM_AUCTION_BID : INSERT_ITEM_AUCTION_BID;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(query))
{
ps.setInt(1, _auctionId);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java
index ec5eb4074e..d388e90796 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java
@@ -161,7 +161,7 @@ public final class ItemAuctionInstance
throw new IllegalArgumentException("No items defined");
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_AUCTION_ID_BY_INSTANCE_ID))
{
ps.setInt(1, _instanceId);
@@ -533,7 +533,7 @@ public final class ItemAuctionInstance
private ItemAuction loadAuction(int auctionId) throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
int auctionItemId = 0;
long startingTime = 0;
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java
index 102306be1b..f73b31f758 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java
@@ -1813,7 +1813,7 @@ public abstract class Inventory extends ItemContainer
@Override
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM items WHERE owner_id=? AND (loc=? OR loc=?) ORDER BY loc_data"))
{
ps.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java
index 1501c166e8..9a71ec3c76 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java
@@ -673,7 +673,7 @@ public abstract class ItemContainer
*/
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM items WHERE owner_id=? AND (loc=?)"))
{
ps.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java
index 9e94b591e8..09cbc47e3b 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java
@@ -112,7 +112,7 @@ public class Mail extends ItemContainer
@Override
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM items WHERE owner_id=? AND loc=? AND loc_data=?"))
{
statement.setInt(1, _ownerId);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java
index 9228d151c2..a3a85dfeba 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java
@@ -738,7 +738,7 @@ public class PcInventory extends Inventory
public static int[][] restoreVisibleInventory(int objectId)
{
final int[][] paperdoll = new int[33][4];
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement2 = con.prepareStatement("SELECT object_id,item_id,loc_data,enchant_level FROM items WHERE owner_id=? AND loc='PAPERDOLL'"))
{
statement2.setInt(1, objectId);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java
index 000d3a0924..c7e109b9d3 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java
@@ -983,7 +983,7 @@ public final class L2ItemInstance extends L2Object
final VariationInstance augment = _augmentation;
_augmentation = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_variations WHERE itemId = ?"))
{
ps.setInt(1, getObjectId());
@@ -1000,7 +1000,7 @@ public final class L2ItemInstance extends L2Object
public void restoreAttributes()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("SELECT mineralId,option1,option2 FROM item_variations WHERE itemId=?");
PreparedStatement ps2 = con.prepareStatement("SELECT elemType,elemValue FROM item_elementals WHERE itemId=?"))
{
@@ -1041,7 +1041,7 @@ public final class L2ItemInstance extends L2Object
public void updateItemOptions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
updateItemOptions(con);
}
@@ -1069,7 +1069,7 @@ public final class L2ItemInstance extends L2Object
public void updateItemElementals()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
updateItemElements(con);
}
@@ -1231,7 +1231,7 @@ public final class L2ItemInstance extends L2Object
_elementals.remove(type);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_elementals WHERE itemId = ? AND elemType = ?"))
{
ps.setInt(1, getObjectId());
@@ -1256,7 +1256,7 @@ public final class L2ItemInstance extends L2Object
_elementals.clear();
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_elementals WHERE itemId = ?"))
{
ps.setInt(1, getObjectId());
@@ -1588,7 +1588,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE items SET owner_id=?,count=?,loc=?,loc_data=?,enchant_level=?,custom_type1=?,custom_type2=?,mana_left=?,time=? WHERE object_id = ?"))
{
ps.setInt(1, _ownerId);
@@ -1621,7 +1621,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO items (owner_id,item_id,count,loc,loc_data,enchant_level,object_id,custom_type1,custom_type2,mana_left,time) VALUES (?,?,?,?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, _ownerId);
@@ -1669,7 +1669,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM items WHERE object_id = ?"))
{
@@ -2183,7 +2183,7 @@ public final class L2ItemInstance extends L2Object
private void removeSpecialAbility(EnsoulOption option)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_special_abilities WHERE objectId = ? AND optionId = ?"))
{
ps.setInt(1, getObjectId());
@@ -2237,7 +2237,7 @@ public final class L2ItemInstance extends L2Object
private void restoreSpecialAbilities()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM item_special_abilities WHERE objectId = ? ORDER BY position"))
{
ps.setInt(1, getObjectId());
@@ -2264,7 +2264,7 @@ public final class L2ItemInstance extends L2Object
public void updateSpecialAbilities()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
updateSpecialAbilities(con);
}
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java
index 44b0ac9c43..1ad8f4c201 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java
@@ -142,7 +142,7 @@ public class Olympiad extends ListenersContainer
{
_nobles.clear();
boolean loaded = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_LOAD_DATA);
ResultSet rset = statement.executeQuery())
{
@@ -221,7 +221,7 @@ public class Olympiad extends ListenersContainer
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_LOAD_NOBLES);
ResultSet rset = statement.executeQuery())
{
@@ -295,7 +295,7 @@ public class Olympiad extends ListenersContainer
{
_noblesRank.clear();
final Map tmpPlace = new HashMap<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(GET_ALL_CLASSIFIED_NOBLESS);
ResultSet rset = statement.executeQuery())
{
@@ -806,7 +806,7 @@ public class Olympiad extends ListenersContainer
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
for (Entry entry : _nobles.entrySet())
{
@@ -878,7 +878,7 @@ public class Olympiad extends ListenersContainer
{
saveNobleData();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_SAVE_DATA))
{
statement.setInt(1, _currentCycle);
@@ -919,7 +919,7 @@ public class Olympiad extends ListenersContainer
protected void updateMonthlyData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(OLYMPIAD_MONTH_CLEAR);
PreparedStatement ps2 = con.prepareStatement(OLYMPIAD_MONTH_CREATE))
{
@@ -963,7 +963,7 @@ public class Olympiad extends ListenersContainer
final List heroesToBe = new LinkedList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_GET_HEROS))
{
StatsSet hero;
@@ -998,7 +998,7 @@ public class Olympiad extends ListenersContainer
{
final List names = new ArrayList<>();
final String query = Config.ALT_OLY_SHOW_MONTHLY_WINNERS ? ((classId == 132) ? GET_EACH_CLASS_LEADER_SOULHOUND : GET_EACH_CLASS_LEADER) : ((classId == 132) ? GET_EACH_CLASS_LEADER_CURRENT_SOULHOUND : GET_EACH_CLASS_LEADER_CURRENT);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(query))
{
ps.setInt(1, classId);
@@ -1108,7 +1108,7 @@ public class Olympiad extends ListenersContainer
public int getLastNobleOlympiadPoints(int objId)
{
int result = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT olympiad_points FROM olympiad_nobles_eom WHERE charId = ?"))
{
ps.setInt(1, objId);
@@ -1252,7 +1252,7 @@ public class Olympiad extends ListenersContainer
protected void deleteNobles()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_DELETE_ALL))
{
statement.execute();
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java
index 9249ca2223..2824298209 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java
@@ -743,7 +743,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
protected static void saveResults(Participant one, Participant two, int winner, long startTime, long fightTime, CompetitionType type)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO olympiad_fights (charOneId, charTwoId, charOneClass, charTwoClass, winner, start, time, classed) values(?,?,?,?,?,?,?,?)"))
{
statement.setInt(1, one.getObjectId());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java
index d73e56cbe8..c805ee421d 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java
@@ -185,7 +185,7 @@ public class PunishmentTask implements Runnable
{
if (!_isStored)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
{
st.setString(1, _key);
@@ -224,7 +224,7 @@ public class PunishmentTask implements Runnable
{
if (_isStored)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(UPDATE_QUERY))
{
st.setLong(1, System.currentTimeMillis());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java
index 248d5997e4..0dea776f93 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java
@@ -409,7 +409,7 @@ public class LongTimeEvent extends Quest
}
}
// Update database
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM items WHERE item_id=?"))
{
statement.setInt(1, itemId);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/quest/Quest.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/quest/Quest.java
index 177a86908f..fcf44bfa6f 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/quest/Quest.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/quest/Quest.java
@@ -1568,7 +1568,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void playerEnter(L2PcInstance player)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement invalidQuestData = con.prepareStatement("DELETE FROM character_quests WHERE charId = ? AND name = ?");
PreparedStatement invalidQuestDataVar = con.prepareStatement("DELETE FROM character_quests WHERE charId = ? AND name = ? AND var = ?");
PreparedStatement ps1 = con.prepareStatement("SELECT name, value FROM character_quests WHERE charId = ? AND var = ?"))
@@ -1650,7 +1650,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void createQuestVarInDb(QuestState qs, String var, String value)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_quests (charId,name,var,value) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE value=?"))
{
statement.setInt(1, qs.getPlayer().getObjectId());
@@ -1674,7 +1674,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void updateQuestVarInDb(QuestState qs, String var, String value)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE character_quests SET value=? WHERE charId=? AND name=? AND var = ?"))
{
statement.setString(1, value);
@@ -1696,7 +1696,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void deleteQuestVarInDb(QuestState qs, String var)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_quests WHERE charId=? AND name=? AND var=?"))
{
statement.setInt(1, qs.getPlayer().getObjectId());
@@ -1717,7 +1717,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void deleteQuestInDb(QuestState qs, boolean repeatable)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(repeatable ? QUEST_DELETE_FROM_CHAR_QUERY : QUEST_DELETE_FROM_CHAR_QUERY_NON_REPEATABLE_QUERY))
{
ps.setInt(1, qs.getPlayer().getObjectId());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java
index 11c78a1a47..9af2be9039 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java
@@ -126,7 +126,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
protected void initFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM residence_functions WHERE residenceId = ?"))
{
ps.setInt(1, _residenceId);
@@ -164,7 +164,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
public void addFunction(ResidenceFunction func)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO residence_functions (id, level, expiration, residenceId) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE level = ?, expiration = ?"))
{
ps.setInt(1, func.getId());
@@ -196,7 +196,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
public void removeFunction(ResidenceFunction func)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM residence_functions WHERE residenceId = ? and id = ?"))
{
ps.setInt(1, _residenceId);
@@ -219,7 +219,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
public void removeFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM residence_functions WHERE residenceId = ?"))
{
ps.setInt(1, _residenceId);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
index 8b91fc77d2..53958bcf5c 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
@@ -50,7 +50,7 @@ public class AccountVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setString(1, _accountName);
@@ -83,7 +83,7 @@ public class AccountVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -120,7 +120,7 @@ public class AccountVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java
index 50fcf2ab6f..5af41a23af 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java
@@ -50,7 +50,7 @@ public class ClanVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setInt(1, _objectId);
@@ -83,7 +83,7 @@ public class ClanVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -120,7 +120,7 @@ public class ClanVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java
index c7ba2ff071..048b15a86e 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java
@@ -55,7 +55,7 @@ public class ItemVariables extends AbstractVariables
public static boolean hasVariables(int objectId)
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_COUNT))
{
st.setInt(1, objectId);
@@ -79,7 +79,7 @@ public class ItemVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setInt(1, _objectId);
@@ -112,7 +112,7 @@ public class ItemVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -149,7 +149,7 @@ public class ItemVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
index 85508e687b..c677c68971 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
@@ -76,7 +76,7 @@ public class PlayerVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setInt(1, _objectId);
@@ -109,7 +109,7 @@ public class PlayerVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -146,7 +146,7 @@ public class PlayerVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/L2GameClient.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/L2GameClient.java
index f1e975876e..fd5baeb233 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/L2GameClient.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/L2GameClient.java
@@ -329,7 +329,7 @@ public final class L2GameClient extends ChannelInboundHandler
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps2 = con.prepareStatement("UPDATE characters SET deletetime=? WHERE charId=?"))
{
ps2.setLong(1, System.currentTimeMillis() + (Config.DELETE_DAYS * 86400000)); // 24*60*60*1000 = 86400000
@@ -354,7 +354,7 @@ public final class L2GameClient extends ChannelInboundHandler
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE characters SET deletetime=0 WHERE charId=?"))
{
statement.setInt(1, objectId);
@@ -377,7 +377,7 @@ public final class L2GameClient extends ChannelInboundHandler
CharNameTable.getInstance().removeName(objid);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM character_contacts WHERE charId=? OR contactId=?"))
{
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
index 297edda360..afcc3fcbb0 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
@@ -164,7 +164,7 @@ public final class RequestDestroyItem implements IClientIncomingPacket
pet.unSummon(activeChar);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
{
statement.setInt(1, _objectId);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java
index 29ab10a108..a9c8dadb8a 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java
@@ -62,7 +62,7 @@ public class RequestPetitionFeedback implements IClientIncomingPacket
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_FEEDBACK))
{
statement.setString(1, player.getName());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java
index 213b230d0b..7fad3b21f2 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java
@@ -73,7 +73,7 @@ public final class RequestAnswerFriendInvite implements IClientIncomingPacket
if (_response == 1)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_friends (charId, friendId) VALUES (?, ?), (?, ?)"))
{
statement.setInt(1, requestor.getObjectId());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java
index 2897338b82..69a271f422 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java
@@ -75,7 +75,7 @@ public final class RequestFriendDel implements IClientIncomingPacket
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_friends WHERE (charId=? AND friendId=?) OR (charId=? AND friendId=?)"))
{
statement.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java
index 94715a15c1..27668b0d62 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java
@@ -74,7 +74,7 @@ public class ConfirmMenteeAdd implements IClientIncomingPacket
}
else if (validate(mentor, mentee))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_mentees (charId, mentorId) VALUES (?, ?)"))
{
statement.setInt(1, mentee.getObjectId());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java
index 91ada4fbba..002abfa04d 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java
@@ -226,7 +226,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
CharSelectInfoPackage charInfopackage;
final List characterList = new LinkedList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM characters WHERE account_name=? ORDER BY createDate"))
{
statement.setString(1, loginName);
@@ -259,7 +259,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
private static void loadCharacterSubclassInfo(CharSelectInfoPackage charInfopackage, int ObjectId, int activeClassId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT exp, sp, level, vitality_points FROM character_subclasses WHERE charId=? AND class_id=? ORDER BY charId"))
{
statement.setInt(1, ObjectId);
@@ -369,7 +369,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
if (weaponObjId > 0)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT mineralId,option1,option2 FROM item_variations WHERE itemId=?"))
{
statement.setInt(1, weaponObjId);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java
index 14cd41a31e..ebb3f90088 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java
@@ -70,7 +70,7 @@ public class FriendList implements IClientOutgoingPacket
if (player1 == null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT char_name, online, classid, level FROM characters WHERE charId = ?"))
{
statement.setInt(1, objId);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java
index 8344576a3e..8876431ff9 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java
@@ -72,7 +72,7 @@ public class SecondaryPasswordAuth
private void loadPassword()
{
String var, value = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SELECT_PASSWORD))
{
statement.setString(1, _activeClient.getAccountName());
@@ -117,7 +117,7 @@ public class SecondaryPasswordAuth
password = cryptPassword(password);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_PASSWORD))
{
statement.setString(1, _activeClient.getAccountName());
@@ -136,7 +136,7 @@ public class SecondaryPasswordAuth
public boolean insertWrongAttempt(int attempts)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_ATTEMPT))
{
statement.setString(1, _activeClient.getAccountName());
@@ -175,7 +175,7 @@ public class SecondaryPasswordAuth
newPassword = cryptPassword(newPassword);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_PASSWORD))
{
statement.setString(1, newPassword);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
index ca0cef4b3b..a78d28bdc9 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
@@ -95,7 +95,7 @@ public final class TaskManager
{
task.onTimeElapsed(this);
lastActivation = System.currentTimeMillis();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[1]))
{
statement.setLong(1, lastActivation);
@@ -182,7 +182,7 @@ public final class TaskManager
private void startAllTasks()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[0]);
ResultSet rset = statement.executeQuery())
{
@@ -314,7 +314,7 @@ public final class TaskManager
private static boolean addUniqueTask(String task, TaskTypes type, String param1, String param2, String param3, long lastActivation)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(SQL_STATEMENTS[2]))
{
ps1.setString(1, task);
@@ -350,7 +350,7 @@ public final class TaskManager
private static boolean addTask(String task, TaskTypes type, String param1, String param2, String param3, long lastActivation)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[3]))
{
statement.setString(1, task);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java
index 5e3e35c6a9..e81b95cba3 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java
@@ -76,7 +76,7 @@ public class TaskBirthday extends Task
private void checkBirthday(int year, int month, int day)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY))
{
statement.setString(1, "%-" + getNum(month + 1) + "-" + getNum(day));
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/Evolve.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/Evolve.java
index 66a22f62fd..f87e33ed8d 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/Evolve.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/gameserver/util/Evolve.java
@@ -248,7 +248,7 @@ public final class Evolve
}
// pet control item no longer exists, delete the pet from the db
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
{
ps.setInt(1, removedItem.getObjectId());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/GameServerTable.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/GameServerTable.java
index 1a0713b155..2410f6ede8 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/GameServerTable.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/GameServerTable.java
@@ -115,7 +115,7 @@ public final class GameServerTable implements IGameXmlReader
*/
private void loadRegisteredGameServers()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT * FROM gameservers"))
{
@@ -222,7 +222,7 @@ public final class GameServerTable implements IGameXmlReader
public void registerServerOnDB(byte[] hexId, int id, String externalHost)
{
register(id, new GameServerInfo(id, hexId));
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO gameservers (hexid,server_id,host) values (?,?,?)"))
{
ps.setString(1, hexToString(hexId));
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/LoginController.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/LoginController.java
index a896c7fd7a..fbee48fc33 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/LoginController.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/LoginController.java
@@ -176,7 +176,7 @@ public class LoginController
final byte[] raw = password.getBytes(StandardCharsets.UTF_8);
final String hashBase64 = Base64.getEncoder().encodeToString(md.digest(raw));
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(USER_INFO_SELECT))
{
ps.setString(1, Long.toString(System.currentTimeMillis()));
@@ -206,7 +206,7 @@ public class LoginController
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(AUTOCREATE_ACCOUNTS_INSERT))
{
ps.setString(1, login);
@@ -405,7 +405,7 @@ public class LoginController
if (loginOk && (client.getLastServer() != serverId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_LAST_SERVER_UPDATE))
{
ps.setInt(1, serverId);
@@ -424,7 +424,7 @@ public class LoginController
public void setAccountAccessLevel(String account, int banLevel)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_ACCESS_LEVEL_UPDATE))
{
ps.setInt(1, banLevel);
@@ -439,7 +439,7 @@ public class LoginController
public void setAccountLastTracert(String account, String pcIp, String hop1, String hop2, String hop3, String hop4)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_IPS_UPDATE))
{
ps.setString(1, pcIp);
@@ -499,7 +499,7 @@ public class LoginController
{
final List ipWhiteList = new ArrayList<>();
final List ipBlackList = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_IPAUTH_SELECT))
{
ps.setString(1, info.getLogin());
@@ -545,7 +545,7 @@ public class LoginController
client.setAccessLevel(info.getAccessLevel());
client.setLastServer(info.getLastServer());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_INFO_UPDATE))
{
ps.setLong(1, System.currentTimeMillis());
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/LoginServer.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/LoginServer.java
index 39377afee3..d598992bdf 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/LoginServer.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/LoginServer.java
@@ -89,7 +89,7 @@ public final class LoginServer
Config.load();
// Prepare Database
- DatabaseFactory.getInstance();
+ DatabaseFactory.init();
try
{
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java
index 69ba99271d..6c73dea27a 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java
@@ -78,7 +78,7 @@ public class ChangePassword extends BaseRecievePacket
int passUpdated = 0;
// SQL connection
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT password FROM accounts WHERE login=?"))
{
ps.setString(1, accountName);
@@ -95,7 +95,7 @@ public class ChangePassword extends BaseRecievePacket
{
final byte[] password = md.digest(newpass.getBytes("UTF-8"));
// SQL connection
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE accounts SET password=? WHERE login=?"))
{
ps.setString(1, Base64.getEncoder().encodeToString(password));
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java
index f9a24a80d8..785946a687 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java
@@ -58,7 +58,7 @@ public class RequestTempBan extends BaseRecievePacket
private void banUser()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO account_data VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE value=?"))
{
ps.setString(1, _accountName);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
index 59b0e01835..4fb705c8b1 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
@@ -43,6 +43,7 @@ public class SQLAccountManager
{
Server.serverMode = Server.MODE_LOGINSERVER;
Config.load();
+ DatabaseFactory.init();
try (Scanner _scn = new Scanner(System.in))
{
@@ -166,7 +167,7 @@ public class SQLAccountManager
}
q = q.concat(" ORDER BY login ASC");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(q);
ResultSet rset = ps.executeQuery())
{
@@ -187,7 +188,7 @@ public class SQLAccountManager
private static void addOrUpdateAccount(String account, String password, String level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE accounts(login, password, accessLevel) VALUES (?, ?, ?)"))
{
final MessageDigest md = MessageDigest.getInstance("SHA");
@@ -213,7 +214,7 @@ public class SQLAccountManager
private static void changeAccountLevel(String account, String level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE accounts SET accessLevel = ? WHERE login = ?"))
{
ps.setString(1, level);
@@ -236,7 +237,7 @@ public class SQLAccountManager
private static void deleteAccount(String account)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM accounts WHERE login = ?"))
{
ps.setString(1, account);
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java
index 4ac531c664..fd25fddae4 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java
@@ -34,7 +34,7 @@ public class DBInstallerConsole implements DBOutputInterface
public DBInstallerConsole(String db, String dir) throws Exception
{
- System.out.println("Welcome to L2J DataBase installer");
+ System.out.println("Welcome to DataBase installer");
final Preferences prop = Preferences.userRoot();
RunTasks rt = null;
try (Scanner scn = new Scanner(new CloseShieldedInputStream(System.in)))
diff --git a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
index c90c8127a6..8e5a6bde49 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
+++ b/L2J_Mobius_Classic_2.0_Saviors/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
@@ -187,6 +187,7 @@ public abstract class BaseGameServerRegister
Server.serverMode = Server.MODE_LOGINSERVER;
Config.load();
+ DatabaseFactory.init();
GameServerTable.getInstance();
_loaded = true;
@@ -215,7 +216,7 @@ public abstract class BaseGameServerRegister
*/
public static void unregisterGameServer(int id) throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM gameservers WHERE server_id = ?"))
{
@@ -231,7 +232,7 @@ public abstract class BaseGameServerRegister
*/
public static void unregisterAllGameServers() throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("DELETE FROM gameservers");
diff --git a/L2J_Mobius_Classic_2.0_Saviors/launcher/Gameserver.launch b/L2J_Mobius_Classic_2.0_Saviors/launcher/Gameserver.launch
index 93f50ff128..15c5097462 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/launcher/Gameserver.launch
+++ b/L2J_Mobius_Classic_2.0_Saviors/launcher/Gameserver.launch
@@ -7,12 +7,13 @@
-
+
+
diff --git a/L2J_Mobius_Classic_2.0_Saviors/launcher/Loginserver.launch b/L2J_Mobius_Classic_2.0_Saviors/launcher/Loginserver.launch
index 8a179f60f7..28a815eb8a 100644
--- a/L2J_Mobius_Classic_2.0_Saviors/launcher/Loginserver.launch
+++ b/L2J_Mobius_Classic_2.0_Saviors/launcher/Loginserver.launch
@@ -7,7 +7,7 @@
-
+
@@ -15,5 +15,6 @@
+
diff --git a/L2J_Mobius_Classic_2.1_Zaken/.classpath b/L2J_Mobius_Classic_2.1_Zaken/.classpath
index 0e50693da9..619d354392 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/.classpath
+++ b/L2J_Mobius_Classic_2.1_Zaken/.classpath
@@ -5,11 +5,12 @@
-
+
-
+
+
diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java
index 9a3b363f56..68ef6d5320 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java
@@ -76,7 +76,7 @@ public final class AdminChangeAccessLevel implements IAdminCommandHandler
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET accesslevel=? WHERE char_name=?");
statement.setInt(1, lvl);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
index 7ef34c44ff..0c90671033 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
@@ -627,7 +627,7 @@ public class AdminEditChar implements IAdminCommandHandler
if (player == null)
{
- final Connection con = DatabaseFactory.getInstance().getConnection();
+ final Connection con = DatabaseFactory.getConnection();
final PreparedStatement ps = con.prepareStatement("UPDATE characters SET " + (changeCreateExpiryTime ? "clan_create_expiry_time" : "clan_join_expiry_time") + " WHERE char_name=? LIMIT 1");
ps.setString(1, playerName);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java
index 764ab77c25..969633adcb 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java
@@ -62,7 +62,7 @@ public class AdminRepairChar implements IAdminCommandHandler
}
final String cmd = "UPDATE characters SET x=-84318, y=244579, z=-3730 WHERE char_name=?";
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(cmd);
statement.setString(1, parts[1]);
@@ -87,13 +87,13 @@ public class AdminRepairChar implements IAdminCommandHandler
return;
}
- // connection = L2DatabaseFactory.getInstance().getConnection();
+ // connection = L2DatabaseFactory.getConnection();
statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=?");
statement.setInt(1, objId);
statement.execute();
statement.close();
- // connection = L2DatabaseFactory.getInstance().getConnection();
+ // connection = L2DatabaseFactory.getConnection();
statement = con.prepareStatement("UPDATE items SET loc=\"INVENTORY\" WHERE owner_id=?");
statement.setInt(1, objId);
statement.execute();
diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java
index 780c3b0088..da0c7dcad2 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java
@@ -173,7 +173,7 @@ public class AdminShowQuests implements IAdminCommandHandler
private static void showQuestMenu(L2PcInstance target, L2PcInstance actor, String[] val)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
ResultSet rs;
PreparedStatement req;
diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java
index 35508761a2..a8b6ed6963 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java
@@ -489,7 +489,7 @@ public class AdminTeleport implements IAdminCommandHandler
final int x = activeChar.getX();
final int y = activeChar.getY();
final int z = activeChar.getZ();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=? WHERE char_name=?");
statement.setInt(1, x);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java
index b4e722f105..3913b5b368 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java
@@ -61,7 +61,7 @@ public class FavoriteBoard implements IParseBoardHandler
// Load Favorite links
final String list = HtmCache.getInstance().getHtm(activeChar, "data/html/CommunityBoard/favorite_list.html");
final StringBuilder sb = new StringBuilder();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_FAVORITES))
{
ps.setInt(1, activeChar.getObjectId());
@@ -98,7 +98,7 @@ public class FavoriteBoard implements IParseBoardHandler
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_FAVORITE))
{
ps.setInt(1, activeChar.getObjectId());
@@ -123,7 +123,7 @@ public class FavoriteBoard implements IParseBoardHandler
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_FAVORITE))
{
ps.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/communityboard/HomeBoard.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
index bed19004d2..1f5572ec39 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
@@ -300,7 +300,7 @@ public final class HomeBoard implements IParseBoardHandler
private static int getFavoriteCount(L2PcInstance player)
{
int count = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(COUNT_FAVORITES))
{
ps.setInt(1, player.getObjectId());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
index 59ecba44bb..e0708990b7 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
@@ -62,7 +62,7 @@ public class ClanWarsList implements IUserCommandHandler
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
String query;
// Attack List
diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/game/java.cfg b/L2J_Mobius_Classic_2.1_Zaken/dist/game/java.cfg
index cb4a4dc204..58213e428e 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/dist/game/java.cfg
+++ b/L2J_Mobius_Classic_2.1_Zaken/dist/game/java.cfg
@@ -1 +1 @@
--server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
\ No newline at end of file
+-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=error -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
\ No newline at end of file
diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/libs/HikariCP-3.2.0.jar b/L2J_Mobius_Classic_2.1_Zaken/dist/libs/HikariCP-3.2.0.jar
new file mode 100644
index 0000000000..a030a7f8dc
Binary files /dev/null and b/L2J_Mobius_Classic_2.1_Zaken/dist/libs/HikariCP-3.2.0.jar differ
diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/libs/c3p0-0.9.5.2.jar b/L2J_Mobius_Classic_2.1_Zaken/dist/libs/c3p0-0.9.5.2.jar
deleted file mode 100644
index 579cedd980..0000000000
Binary files a/L2J_Mobius_Classic_2.1_Zaken/dist/libs/c3p0-0.9.5.2.jar and /dev/null differ
diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/libs/mchange-commons-java-0.2.12.jar b/L2J_Mobius_Classic_2.1_Zaken/dist/libs/mchange-commons-java-0.2.12.jar
deleted file mode 100644
index af11054860..0000000000
Binary files a/L2J_Mobius_Classic_2.1_Zaken/dist/libs/mchange-commons-java-0.2.12.jar and /dev/null differ
diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/libs/slf4j-api-1.7.25.jar b/L2J_Mobius_Classic_2.1_Zaken/dist/libs/slf4j-api-1.7.25.jar
new file mode 100644
index 0000000000..7e62f1336d
Binary files /dev/null and b/L2J_Mobius_Classic_2.1_Zaken/dist/libs/slf4j-api-1.7.25.jar differ
diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/libs/slf4j-simple-1.7.25.jar b/L2J_Mobius_Classic_2.1_Zaken/dist/libs/slf4j-simple-1.7.25.jar
new file mode 100644
index 0000000000..b29ca12719
Binary files /dev/null and b/L2J_Mobius_Classic_2.1_Zaken/dist/libs/slf4j-simple-1.7.25.jar differ
diff --git a/L2J_Mobius_Classic_2.1_Zaken/dist/login/java.cfg b/L2J_Mobius_Classic_2.1_Zaken/dist/login/java.cfg
index 00ae5b3a66..bda4cdd24d 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/dist/login/java.cfg
+++ b/L2J_Mobius_Classic_2.1_Zaken/dist/login/java.cfg
@@ -1 +1 @@
--server -Xms128m -Xmx256m
\ No newline at end of file
+-server -Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=error -Xms128m -Xmx256m
\ No newline at end of file
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/commons/database/DatabaseFactory.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/commons/database/DatabaseFactory.java
index 68d02d4171..dd481d2fd0 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/commons/database/DatabaseFactory.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/commons/database/DatabaseFactory.java
@@ -16,122 +16,68 @@
*/
package com.l2jmobius.commons.database;
-import java.beans.PropertyVetoException;
import java.sql.Connection;
-import java.sql.SQLException;
import java.util.logging.Logger;
import com.l2jmobius.Config;
-import com.mchange.v2.c3p0.ComboPooledDataSource;
+import com.zaxxer.hikari.HikariDataSource;
/**
- * Database Factory implementation.
- * @author Zoey76, Mobius
+ * @author Mobius
*/
public class DatabaseFactory
{
private static final Logger LOGGER = Logger.getLogger(DatabaseFactory.class.getName());
- private final ComboPooledDataSource _dataSource;
+ private static final HikariDataSource _hds = new HikariDataSource();
- public DatabaseFactory()
+ public static void init()
{
- if (Config.DATABASE_MAX_CONNECTIONS < 2)
- {
- Config.DATABASE_MAX_CONNECTIONS = 2;
- LOGGER.warning("A minimum of 2 connections are required.");
- }
-
- _dataSource = new ComboPooledDataSource();
- _dataSource.setAutoCommitOnClose(true);
-
- _dataSource.setInitialPoolSize(10);
- _dataSource.setMinPoolSize(10);
- _dataSource.setMaxPoolSize(Math.max(10, Config.DATABASE_MAX_CONNECTIONS));
-
- _dataSource.setAcquireRetryAttempts(0); // try to obtain connections indefinitely (0 = never quit)
- _dataSource.setAcquireRetryDelay(500); // 500 milliseconds wait before try to acquire connection again
- _dataSource.setCheckoutTimeout(0); // 0 = wait indefinitely for new connection if pool is exhausted
- _dataSource.setAcquireIncrement(5); // if pool is exhausted, get 5 more connections at a time cause there is
- // a "long" delay on acquire connection so taking more than one connection at once will make connection pooling more effective.
-
- // this "connection_test_table" is automatically created if not already there
- _dataSource.setAutomaticTestTable("connection_test_table");
- _dataSource.setTestConnectionOnCheckin(false);
-
- // testing OnCheckin used with IdleConnectionTestPeriod is faster than testing on checkout
-
- _dataSource.setIdleConnectionTestPeriod(3600); // test idle connection every 60 sec
- _dataSource.setMaxIdleTime(Config.DATABASE_MAX_IDLE_TIME); // 0 = idle connections never expire
- // *THANKS* to connection testing configured above but I prefer to disconnect all connections not used for more than 1 hour
-
- // enables statement caching, there is a "semi-bug" in c3p0 0.9.0 but in 0.9.0.2 and later it's fixed
- _dataSource.setMaxStatementsPerConnection(100);
-
- _dataSource.setBreakAfterAcquireFailure(false); // never fail if any way possible setting this to true will make c3p0 "crash"
- // and refuse to work till restart thus making acquire errors "FATAL" ... we don't want that it should be possible to recover
+ _hds.setDriverClassName(Config.DATABASE_DRIVER);
+ _hds.setJdbcUrl(Config.DATABASE_URL);
+ _hds.setUsername(Config.DATABASE_LOGIN);
+ _hds.setPassword(Config.DATABASE_PASSWORD);
+ _hds.setMaximumPoolSize(Config.DATABASE_MAX_CONNECTIONS);
+ _hds.setIdleTimeout(Config.DATABASE_MAX_IDLE_TIME);
+ // Test if connection is valid.
try
{
- _dataSource.setDriverClass(Config.DATABASE_DRIVER);
+ _hds.getConnection().close();
+ LOGGER.info("Database: Initialized.");
}
- catch (PropertyVetoException e)
+ catch (Exception e)
{
e.printStackTrace();
}
- _dataSource.setJdbcUrl(Config.DATABASE_URL);
- _dataSource.setUser(Config.DATABASE_LOGIN);
- _dataSource.setPassword(Config.DATABASE_PASSWORD);
-
- /* Test the connection */
- try
- {
- _dataSource.getConnection().close();
- }
- catch (SQLException e)
- {
- e.printStackTrace();
- }
-
- LOGGER.info("Database: Initialized.");
}
- public Connection getConnection()
+ public static Connection getConnection()
{
Connection con = null;
while (con == null)
{
try
{
- con = _dataSource.getConnection();
+ con = _hds.getConnection();
}
- catch (SQLException e)
+ catch (Exception e)
{
- LOGGER.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage());
+ LOGGER.severe("DatabaseFactory: Cound not get a connection. " + e);
}
}
return con;
}
- public void close()
+ public static void close()
{
try
{
- _dataSource.close();
+ _hds.close();
}
catch (Exception e)
{
- LOGGER.info(e.getMessage());
+ LOGGER.severe("DatabaseFactory: There was a problem closing the data source. " + e);
}
}
-
- public static DatabaseFactory getInstance()
- {
- return SingletonHolder.INSTANCE;
- }
-
- private static class SingletonHolder
- {
- protected static final DatabaseFactory INSTANCE = new DatabaseFactory();
- }
}
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/GameServer.java
index 8443fe28c5..a7f428efde 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/GameServer.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/GameServer.java
@@ -193,7 +193,7 @@ public class GameServer
// Initialize config
Config.load();
printSection("Database");
- DatabaseFactory.getInstance();
+ DatabaseFactory.init();
printSection("ThreadPool");
ThreadPool.init();
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/LoginServerThread.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/LoginServerThread.java
index e26cf1111a..ba22e9ae11 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/LoginServerThread.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/LoginServerThread.java
@@ -587,7 +587,7 @@ public class LoginServerThread extends Thread
int chars = 0;
final List charToDel = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT deletetime FROM characters WHERE account_name=?"))
{
ps.setString(1, account);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/Shutdown.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/Shutdown.java
index 1faf2780db..09b0fd9c85 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/Shutdown.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/Shutdown.java
@@ -205,7 +205,7 @@ public class Shutdown extends Thread
// commit data, last chance
try
{
- DatabaseFactory.getInstance().close();
+ DatabaseFactory.close();
LOGGER.info("Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
}
catch (Throwable t)
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
index 3f98953c02..320a104fca 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
@@ -93,7 +93,7 @@ public class Forum
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM forums WHERE forum_id=?"))
{
ps.setInt(1, _forumId);
@@ -114,7 +114,7 @@ public class Forum
LOGGER.log(Level.WARNING, "Data error on Forum " + _forumId + " : " + e.getMessage(), e);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM topic WHERE topic_forum_id=? ORDER BY topic_id DESC"))
{
ps.setInt(1, _forumId);
@@ -139,7 +139,7 @@ public class Forum
private void getChildren()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT forum_id FROM forums WHERE forum_parent=?"))
{
ps.setInt(1, _forumId);
@@ -217,7 +217,7 @@ public class Forum
public void insertIntoDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO forums (forum_id,forum_name,forum_parent,forum_post,forum_type,forum_perm,forum_owner_id) VALUES (?,?,?,?,?,?,?)"))
{
ps.setInt(1, _forumId);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
index fa2f1da2d9..5f970fa0a5 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
@@ -72,7 +72,7 @@ public class Post
private void insertindb(CPost cp)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)"))
{
ps.setInt(1, cp.postId);
@@ -112,7 +112,7 @@ public class Post
public void deleteme(Topic t)
{
PostBBSManager.getInstance().delPostByTopic(t);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM posts WHERE post_forum_id=? AND post_topic_id=?"))
{
ps.setInt(1, t.getForumID());
@@ -130,7 +130,7 @@ public class Post
*/
private void load(Topic t)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM posts WHERE post_forum_id=? AND post_topic_id=? ORDER BY post_id ASC"))
{
ps.setInt(1, t.getForumID());
@@ -162,7 +162,7 @@ public class Post
*/
public void updatetxt(int i)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?"))
{
final CPost cp = getCPost(i);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
index ae7b7c6318..2cb2303f58 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
@@ -71,7 +71,7 @@ public class Topic
private void insertindb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO topic (topic_id,topic_forum_id,topic_name,topic_date,topic_ownername,topic_ownerid,topic_type,topic_reply) values (?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, _id);
@@ -129,7 +129,7 @@ public class Topic
{
TopicBBSManager.getInstance().delTopic(this);
f.rmTopicByID(_id);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM topic WHERE topic_id=? AND topic_forum_id=?"))
{
ps.setInt(1, _id);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
index 57a47cf456..c68fb57089 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
@@ -40,7 +40,7 @@ public class ForumsBBSManager extends BaseBBSManager
protected ForumsBBSManager()
{
_table = new CopyOnWriteArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT forum_id FROM forums WHERE forum_type = 0"))
{
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java
index adc2b28a17..b3b101e521 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java
@@ -52,7 +52,7 @@ public final class AnnouncementsTable
private void load()
{
_announcements.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery("SELECT * FROM announcements"))
{
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java
index 4aa8b72edb..5bb8ebbe43 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java
@@ -99,7 +99,7 @@ public class CharNameTable
int id = -1;
int accessLevel = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT charId,accesslevel FROM characters WHERE char_name=?"))
{
ps.setString(1, name);
@@ -145,7 +145,7 @@ public class CharNameTable
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT char_name,accesslevel FROM characters WHERE charId=?"))
{
ps.setInt(1, id);
@@ -176,7 +176,7 @@ public class CharNameTable
public synchronized boolean doesCharNameExist(String name)
{
boolean result = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT COUNT(*) as count FROM characters WHERE char_name=?"))
{
ps.setString(1, name);
@@ -197,7 +197,7 @@ public class CharNameTable
public int getAccountCharacterCount(String account)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT COUNT(char_name) as count FROM characters WHERE account_name=?"))
{
ps.setString(1, account);
@@ -218,7 +218,7 @@ public class CharNameTable
public int getLevelById(int objectId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT level FROM characters WHERE charId = ?"))
{
ps.setInt(1, objectId);
@@ -239,7 +239,7 @@ public class CharNameTable
public int getClassIdById(int objectId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT classid FROM characters WHERE charId = ?"))
{
ps.setInt(1, objectId);
@@ -260,7 +260,7 @@ public class CharNameTable
public int getClanIdById(int objectId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clanId FROM characters WHERE charId = ?"))
{
ps.setInt(1, objectId);
@@ -281,7 +281,7 @@ public class CharNameTable
private void loadAll()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT charId, char_name, accesslevel FROM characters"))
{
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java
index 021a434a38..6315404c36 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java
@@ -70,7 +70,7 @@ public class CharSummonTable
{
if (Config.RESTORE_SERVITOR_ON_RECONNECT)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(INIT_SUMMONS))
{
@@ -87,7 +87,7 @@ public class CharSummonTable
if (Config.RESTORE_PET_ON_RECONNECT)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(INIT_PET))
{
@@ -111,7 +111,7 @@ public class CharSummonTable
return !v.isEmpty() ? v : null;
});
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(REMOVE_SUMMON))
{
ps.setInt(1, activeChar.getObjectId());
@@ -181,7 +181,7 @@ public class CharSummonTable
public void restoreServitor(L2PcInstance activeChar)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(LOAD_SUMMON))
{
ps.setInt(1, activeChar.getObjectId());
@@ -229,7 +229,7 @@ public class CharSummonTable
_servitors.computeIfAbsent(summon.getOwner().getObjectId(), k -> ConcurrentHashMap.newKeySet()).add(summon.getObjectId());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SAVE_SUMMON))
{
ps.setInt(1, summon.getOwner().getObjectId());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java
index d0cd743b0f..aee103e2e5 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java
@@ -80,7 +80,7 @@ public class ClanTable
L2Clan clan;
// Count the clans
int clanCount = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT clan_id FROM clan_data"))
{
@@ -262,7 +262,7 @@ public class ClanTable
_clans.remove(clanId);
IdFactory.getInstance().releaseId(clanId);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM clan_data WHERE clan_id=?"))
{
@@ -361,7 +361,7 @@ public class ClanTable
public void storeclanswars(ClanWar war)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO clan_wars (clan1, clan2, clan1Kill, clan2Kill, winnerClan, startTime, endTime, state) VALUES(?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, war.getAttackerClanId());
@@ -392,7 +392,7 @@ public class ClanTable
clan1.broadcastClanStatus();
clan2.broadcastClanStatus();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM clan_wars WHERE clan1=? AND clan2=?"))
{
ps.setInt(1, clanId1);
@@ -407,7 +407,7 @@ public class ClanTable
private void restorewars()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery("SELECT clan1, clan2, clan1Kill, clan2Kill, winnerClan, startTime, endTime, state FROM clan_wars"))
{
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java
index f90657a886..907f92e5f6 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java
@@ -72,7 +72,7 @@ public final class CrestTable
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
ResultSet rs = statement.executeQuery("SELECT `crest_id`, `data`, `type` FROM `crests` ORDER BY `crest_id` DESC"))
{
@@ -154,7 +154,7 @@ public final class CrestTable
*/
public L2Crest createCrest(byte[] data, CrestType crestType)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO `crests`(`crest_id`, `data`, `type`) VALUES(?, ?, ?)"))
{
final L2Crest crest = new L2Crest(_nextId.getAndIncrement(), data, crestType);
@@ -187,7 +187,7 @@ public final class CrestTable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM `crests` WHERE `crest_id` = ?"))
{
statement.setInt(1, crestId);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java
index 2be088cd17..b281c6dbe0 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java
@@ -56,7 +56,7 @@ public class OfflineTradersTable
public void storeOffliners()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS);
PreparedStatement stm3 = con.prepareStatement(SAVE_OFFLINE_STATUS);
@@ -173,7 +173,7 @@ public class OfflineTradersTable
{
LOGGER.info(getClass().getSimpleName() + ": Loading offline traders...");
int nTraders = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement stm = con.createStatement();
ResultSet rs = stm.executeQuery(LOAD_OFFLINE_STATUS))
{
@@ -329,7 +329,7 @@ public class OfflineTradersTable
public static synchronized void onTransaction(L2PcInstance trader, boolean finished, boolean firstCall)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_PLAYER);
PreparedStatement stm3 = con.prepareStatement(SAVE_ITEMS);
@@ -453,7 +453,7 @@ public class OfflineTradersTable
{
PlayerCountManager.getInstance().decOfflineTradeCount();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_PLAYER))
{
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java
index 333e0e2289..4013e5e460 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java
@@ -42,7 +42,7 @@ public class PetNameTable
public boolean doesPetNameExist(String name, int petNpcId)
{
boolean result = true;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT name FROM pets p, items i WHERE p.item_obj_id = i.object_id AND name=? AND i.item_id IN (?)"))
{
ps.setString(1, name);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java
index 33e2d0df1d..0de4769849 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java
@@ -66,7 +66,7 @@ public final class BuyListData implements IGameXmlReader
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _buyLists.size() + " BuyLists.");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rs = statement.executeQuery("SELECT * FROM `buylists`"))
{
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/datatables/BotReportTable.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/datatables/BotReportTable.java
index bbc6672f94..1d92e316f3 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/datatables/BotReportTable.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/datatables/BotReportTable.java
@@ -112,7 +112,7 @@ public final class BotReportTable
*/
private void loadReportedCharData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery(SQL_LOAD_REPORTED_CHAR_DATA))
{
@@ -181,7 +181,7 @@ public final class BotReportTable
*/
public void saveReportedCharData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
PreparedStatement ps = con.prepareStatement(SQL_INSERT_REPORTED_CHAR_DATA))
{
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/datatables/ItemTable.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/datatables/ItemTable.java
index c8f34ed812..e4f3a0098d 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/datatables/ItemTable.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/datatables/ItemTable.java
@@ -386,7 +386,7 @@ public class ItemTable
// if it's a pet control item, delete the pet as well
if (item.getItem().isPetItem())
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
{
// Delete the pet in db
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/datatables/SchemeBufferTable.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/datatables/SchemeBufferTable.java
index 7b47d8fc45..e72715b441 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/datatables/SchemeBufferTable.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/datatables/SchemeBufferTable.java
@@ -58,7 +58,7 @@ public class SchemeBufferTable
{
int count = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement st = con.prepareStatement(LOAD_SCHEMES);
ResultSet rs = st.executeQuery();
@@ -135,7 +135,7 @@ public class SchemeBufferTable
public void saveSchemes()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Delete all entries from database.
PreparedStatement st = con.prepareStatement(DELETE_SCHEMES);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java
index 660b537dc5..5854717647 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java
@@ -77,7 +77,7 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer
public synchronized void reset()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_daily_rewards WHERE rewardId = ? AND status = ?"))
{
ps.setInt(1, _holder.getId());
@@ -118,7 +118,7 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer
protected void storePlayerEntry(DailyMissionPlayerEntry entry)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO character_daily_rewards (charId, rewardId, status, progress, lastCompleted) VALUES (?, ?, ?, ?, ?)"))
{
ps.setInt(1, entry.getObjectId());
@@ -145,7 +145,7 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer
return existingEntry;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM character_daily_rewards WHERE charId = ? AND rewardId = ?"))
{
ps.setInt(1, objectId);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
index baaadc776c..34f7280917 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -128,7 +128,7 @@ public abstract class IdFactory
*/
private void setAllCharacterOffline()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("UPDATE characters SET online = 0");
@@ -145,7 +145,7 @@ public abstract class IdFactory
*/
private void cleanUpDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement stmt = con.createStatement())
{
final long cleanupStart = System.currentTimeMillis();
@@ -253,7 +253,7 @@ public abstract class IdFactory
private void cleanUpTimeStamps()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
int cleanCount = 0;
for (String line : TIMESTAMPS_CLEAN)
@@ -279,7 +279,7 @@ public abstract class IdFactory
protected final Integer[] extractUsedObjectIDTable() throws Exception
{
final List temp = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
String extractUsedObjectIdsQuery = "";
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
index 9e5d1cedcf..21ed01119d 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
@@ -42,7 +42,7 @@ public class StackIDFactory extends IdFactory
_curOID = FIRST_OID;
_tempOID = FIRST_OID;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// con.createStatement().execute("drop table if exists tmp_obj_id");
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java
index c1c614e3f8..85f3d57b5d 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java
@@ -169,7 +169,7 @@ public class AirShipManager
_airShipsInfo.put(ownerId, info);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_DB))
{
ps.setInt(1, ownerId);
@@ -265,7 +265,7 @@ public class AirShipManager
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(LOAD_DB))
{
@@ -296,7 +296,7 @@ public class AirShipManager
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_DB))
{
ps.setInt(1, info.getInt("fuel"));
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
index afc836f427..0808ef7947 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
@@ -198,7 +198,7 @@ public final class CastleManager implements InstanceListManager
}
}
// else offline-player circlet removal
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM items WHERE owner_id = ? and item_id = ?"))
{
ps.setInt(1, member.getObjectId());
@@ -215,7 +215,7 @@ public final class CastleManager implements InstanceListManager
@Override
public void loadInstances()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT id FROM castle ORDER BY id"))
{
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
index 6a9dff749b..4c73fd01a3 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
@@ -162,7 +162,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
private void loadDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stProduction = con.prepareStatement("SELECT * FROM castle_manor_production WHERE castle_id=?");
PreparedStatement stProcure = con.prepareStatement("SELECT * FROM castle_manor_procure WHERE castle_id=?"))
{
@@ -436,7 +436,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
_productionNext.put(castleId, list);
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement dps = con.prepareStatement("DELETE FROM castle_manor_production WHERE castle_id = ? AND next_period = 1");
PreparedStatement ips = con.prepareStatement(INSERT_PRODUCT))
{
@@ -472,7 +472,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
_procureNext.put(castleId, list);
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement dps = con.prepareStatement("DELETE FROM castle_manor_procure WHERE castle_id = ? AND next_period = 1");
PreparedStatement ips = con.prepareStatement(INSERT_CROP))
{
@@ -506,7 +506,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
public final void updateCurrentProduction(int castleId, Collection items)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle_manor_production SET amount = ? WHERE castle_id = ? AND seed_id = ? AND next_period = 0"))
{
for (SeedProduction sp : items)
@@ -526,7 +526,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
public final void updateCurrentProcure(int castleId, Collection items)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle_manor_procure SET amount = ? WHERE castle_id = ? AND crop_id = ? AND next_period = 0"))
{
for (CropProcure sp : items)
@@ -599,7 +599,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
@Override
public final boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ds = con.prepareStatement("DELETE FROM castle_manor_production");
PreparedStatement is = con.prepareStatement(INSERT_PRODUCT);
PreparedStatement dp = con.prepareStatement("DELETE FROM castle_manor_procure");
@@ -697,7 +697,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ds = con.prepareStatement("DELETE FROM castle_manor_production WHERE castle_id = ?");
PreparedStatement dc = con.prepareStatement("DELETE FROM castle_manor_procure WHERE castle_id = ?"))
{
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java
index 60b1435775..f40c3bdd04 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java
@@ -91,7 +91,7 @@ public class CeremonyOfChaosManager extends AbstractEventManager clanApplicantList = _applicantList.get(clanId);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_APPLICANT))
{
statement.setInt(1, playerId);
@@ -189,7 +189,7 @@ public class ClanEntryManager
{
_applicantList.computeIfAbsent(clanId, k -> new ConcurrentHashMap<>()).put(info.getPlayerId(), info);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_APPLICANT))
{
statement.setInt(1, info.getPlayerId());
@@ -216,7 +216,7 @@ public class ClanEntryManager
{
if (!_playerLocked.containsKey(playerId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_WAITING_LIST))
{
statement.setInt(1, info.getPlayerId());
@@ -237,7 +237,7 @@ public class ClanEntryManager
{
if (_waitingList.containsKey(playerId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_WAITING_LIST))
{
statement.setInt(1, playerId);
@@ -258,7 +258,7 @@ public class ClanEntryManager
{
if (!_clanList.containsKey(clanId) && !_clanLocked.containsKey(clanId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_CLAN_RECRUIT))
{
statement.setInt(1, info.getClanId());
@@ -283,7 +283,7 @@ public class ClanEntryManager
{
if (_clanList.containsKey(clanId) && !_clanLocked.containsKey(clanId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CLAN_RECRUIT))
{
statement.setInt(1, info.getKarma());
@@ -307,7 +307,7 @@ public class ClanEntryManager
{
if (_clanList.containsKey(clanId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_CLAN_RECRUIT))
{
statement.setInt(1, clanId);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java
index e424e0ad7e..6ba2c94bb2 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java
@@ -79,7 +79,7 @@ public final class CommissionManager
protected CommissionManager()
{
final Map itemInstances = new HashMap<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement(SELECT_ALL_ITEMS))
{
@@ -245,7 +245,7 @@ public final class CommissionManager
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_COMMISSION_ITEM, Statement.RETURN_GENERATED_KEYS))
{
final Instant startTime = Instant.now();
@@ -398,7 +398,7 @@ public final class CommissionManager
*/
private boolean deleteItemFromDB(long commissionId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_COMMISSION_ITEM))
{
ps.setLong(1, commissionId);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
index 9e5b85cf52..398058a743 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
@@ -142,7 +142,7 @@ public final class CursedWeaponsManager implements IGameXmlReader
private void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT itemId, charId, playerReputation, playerPkKills, nbKills, endTime FROM cursed_weapons"))
{
@@ -167,7 +167,7 @@ public final class CursedWeaponsManager implements IGameXmlReader
private void controlPlayers()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT owner_id FROM items WHERE item_id=?"))
{
// TODO: See comments below...
@@ -338,7 +338,7 @@ public final class CursedWeaponsManager implements IGameXmlReader
public static void removeFromDb(int itemId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM cursed_weapons WHERE itemId = ?"))
{
ps.setInt(1, itemId);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java
index ced8c5abd2..a881e85ae4 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java
@@ -85,7 +85,7 @@ public class DBSpawnManager
_storedInfo.clear();
_schedules.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM npc_respawns");
ResultSet rset = statement.executeQuery())
{
@@ -275,7 +275,7 @@ public class DBSpawnManager
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO npc_respawns (id, x, y, z, heading, respawnTime, currentHp, currentMp) VALUES(?, ?, ?, ?, ?, ?, ?, ?)"))
{
statement.setInt(1, spawn.getId());
@@ -331,7 +331,7 @@ public class DBSpawnManager
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO npc_respawns (id, x, y, z, heading, respawnTime, currentHp, currentMp) VALUES(?, ?, ?, ?, ?, ?, ?, ?)"))
{
statement.setInt(1, spawn.getId());
@@ -380,7 +380,7 @@ public class DBSpawnManager
if (updateDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM npc_respawns WHERE id = ?"))
{
ps.setInt(1, npcId);
@@ -401,7 +401,7 @@ public class DBSpawnManager
*/
private void updateDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE npc_respawns SET respawnTime = ?, currentHP = ?, currentMP = ? WHERE id = ?"))
{
for (Integer npcId : _storedInfo.keySet())
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java
index 3dd467d653..f25bc2e852 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java
@@ -120,7 +120,7 @@ public class DailyTaskManager extends AbstractEventManager>
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement st = con.prepareStatement("UPDATE character_subclasses SET vitality_points = ?"))
{
@@ -150,7 +150,7 @@ public class DailyTaskManager extends AbstractEventManager>
private void resetExtendDrop()
{
// Update data for offline players.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_variables WHERE var = ?"))
{
ps.setString(1, PlayerVariables.EXTEND_DROP);
@@ -173,7 +173,7 @@ public class DailyTaskManager extends AbstractEventManager>
private void resetDailySkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final List dailySkills = getVariables().getList("reset_skills", SkillHolder.class, Collections.emptyList());
for (SkillHolder skill : dailySkills)
@@ -200,7 +200,7 @@ public class DailyTaskManager extends AbstractEventManager>
}
// Update data for offline players.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE character_variables SET val = ? WHERE var = ?"))
{
ps.setInt(1, 0);
@@ -225,7 +225,7 @@ public class DailyTaskManager extends AbstractEventManager>
private void resetRecommends()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("UPDATE character_reco_bonus SET rec_left = ?, rec_have = 0 WHERE rec_have <= 20"))
{
@@ -258,7 +258,7 @@ public class DailyTaskManager extends AbstractEventManager>
if (Config.TRAINING_CAMP_ENABLE)
{
// Update data for offline players.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM account_gsdata WHERE var = ?"))
{
ps.setString(1, "TRAINING_CAMP_DURATION");
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java
index f635c19883..7101b82852 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java
@@ -46,7 +46,7 @@ public class FactionManager
private void loadAll()
{
_playerFactions.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT charId, faction FROM characters"))
{
@@ -75,7 +75,7 @@ public class FactionManager
return factionId;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT faction FROM characters WHERE charId=?"))
{
ps.setInt(1, id);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/FortManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
index 0fbe44bc6d..56ab9144cf 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
@@ -121,7 +121,7 @@ public final class FortManager implements InstanceListManager
@Override
public void loadInstances()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT id FROM fort ORDER BY id"))
{
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
index 0a5245dafc..4eb6258b05 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
@@ -86,7 +86,7 @@ public final class FortSiegeManager
}
boolean register = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clan_id FROM fortsiege_clans where clan_id=? and fort_id=?"))
{
ps.setInt(1, clan.getId());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
index e9f6bb3475..044d74609a 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
@@ -56,7 +56,7 @@ public final class GlobalVariablesManager extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery(SELECT_QUERY))
{
@@ -87,7 +87,7 @@ public final class GlobalVariablesManager extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement del = con.createStatement();
PreparedStatement st = con.prepareStatement(INSERT_QUERY))
{
@@ -119,7 +119,7 @@ public final class GlobalVariablesManager extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement del = con.createStatement())
{
del.execute(DELETE_QUERY);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
index 7102530261..e46a1599e4 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
@@ -62,7 +62,7 @@ public final class GrandBossManager implements IStorable
private void init()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT * from grandboss_data ORDER BY boss_id"))
{
@@ -154,7 +154,7 @@ public final class GrandBossManager implements IStorable
@Override
public boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
for (Entry e : _storedInfo.entrySet())
{
@@ -206,7 +206,7 @@ public final class GrandBossManager implements IStorable
private void updateDb(int bossId, boolean statusOnly)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final L2GrandBossInstance boss = _bosses.get(bossId);
final StatsSet info = _storedInfo.get(bossId);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java
index 0939f2cf18..4a0efbc831 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java
@@ -498,7 +498,7 @@ public final class InstanceManager implements IGameXmlReader
*/
private void restoreInstanceTimes()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT * FROM character_instance_time ORDER BY charId"))
{
@@ -550,7 +550,7 @@ public final class InstanceManager implements IGameXmlReader
// Remove them
if (!invalidPenalty.isEmpty())
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_INSTANCE_TIME))
{
for (Integer id : invalidPenalty)
@@ -615,7 +615,7 @@ public final class InstanceManager implements IGameXmlReader
*/
public void deleteInstanceTime(L2PcInstance player, int id)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_INSTANCE_TIME))
{
ps.setInt(1, player.getObjectId());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java
index e0599ea3fe..eb105b45f3 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java
@@ -55,7 +55,7 @@ public final class ItemAuctionManager implements IGameXmlReader
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery("SELECT auctionId FROM item_auction ORDER BY auctionId DESC LIMIT 0, 1"))
{
@@ -134,7 +134,7 @@ public final class ItemAuctionManager implements IGameXmlReader
public static void deleteAuction(int auctionId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement statement = con.prepareStatement("DELETE FROM item_auction WHERE auctionId=?"))
{
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
index fba190d620..5bbbecc082 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
@@ -80,7 +80,7 @@ public final class ItemsOnGroundManager implements Runnable
str = "UPDATE itemsonground SET drop_time = ? WHERE drop_time = -1";
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(str))
{
ps.setLong(1, System.currentTimeMillis());
@@ -93,7 +93,7 @@ public final class ItemsOnGroundManager implements Runnable
}
// Add items to world
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable FROM itemsonground"))
{
int count = 0;
@@ -178,7 +178,7 @@ public final class ItemsOnGroundManager implements Runnable
public void emptyTable()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("DELETE FROM itemsonground");
@@ -204,7 +204,7 @@ public final class ItemsOnGroundManager implements Runnable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO itemsonground(object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable) VALUES(?,?,?,?,?,?,?,?,?)"))
{
for (L2ItemInstance item : _items)
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/MailManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/MailManager.java
index 0b4c7601cb..fbc14a23e6 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/MailManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/MailManager.java
@@ -57,7 +57,7 @@ public final class MailManager
private void load()
{
int count = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT * FROM messages ORDER BY expiration"))
{
@@ -192,7 +192,7 @@ public final class MailManager
public void sendMessage(Message msg)
{
_messages.put(msg.getId(), msg);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = Message.getStatement(msg, con))
{
ps.execute();
@@ -214,7 +214,7 @@ public final class MailManager
public final void markAsReadInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isUnread = 'false' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -228,7 +228,7 @@ public final class MailManager
public final void markAsDeletedBySenderInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isDeletedBySender = 'true' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -242,7 +242,7 @@ public final class MailManager
public final void markAsDeletedByReceiverInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isDeletedByReceiver = 'true' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -256,7 +256,7 @@ public final class MailManager
public final void removeAttachmentsInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET hasAttachments = 'false' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -270,7 +270,7 @@ public final class MailManager
public final void deleteMessageInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM messages WHERE messageId = ?"))
{
ps.setInt(1, msgId);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java
index f47cf3f813..82a7f2288b 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java
@@ -54,7 +54,7 @@ public class MentorManager
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery("SELECT * FROM character_mentees"))
{
@@ -76,7 +76,7 @@ public class MentorManager
*/
public void deleteMentee(int mentorId, int menteeId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_mentees WHERE mentorId = ? AND charId = ?"))
{
statement.setInt(1, mentorId);
@@ -95,7 +95,7 @@ public class MentorManager
*/
public void deleteMentor(int mentorId, int menteeId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_mentees WHERE mentorId = ? AND charId = ?"))
{
statement.setInt(1, mentorId);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
index a29ed155fc..c03a9a8aae 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
@@ -128,7 +128,7 @@ public class PremiumManager
private void loadPremiumData(String accountName)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stmt = con.prepareStatement(LOAD_SQL))
{
stmt.setString(1, accountName);
@@ -160,7 +160,7 @@ public class PremiumManager
long newPremiumExpiration = oldPremiumExpiration + addTime;
// UPDATE DATABASE
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stmt = con.prepareStatement(UPDATE_SQL))
{
stmt.setLong(1, newPremiumExpiration);
@@ -205,7 +205,7 @@ public class PremiumManager
premiumData.remove(accountName);
// UPDATE DATABASE
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stmt = con.prepareStatement(DELETE_SQL))
{
stmt.setString(1, accountName);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java
index 001e262042..7438bf62f8 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java
@@ -56,7 +56,7 @@ public final class PunishmentManager
int expired = 0;
// Load punishments.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery("SELECT * FROM punishments"))
{
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
index b99c5e77d5..fe296e2e53 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
@@ -57,7 +57,7 @@ public final class SiegeGuardManager
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
ResultSet rs = con.createStatement().executeQuery("SELECT * FROM castle_siege_guards Where isHired = 1"))
{
while (rs.next())
@@ -158,7 +158,7 @@ public final class SiegeGuardManager
final SiegeGuardHolder holder = getSiegeGuardByItem(castle.getResidenceId(), itemId);
if (holder != null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("Insert Into castle_siege_guards (castleId, npcId, x, y, z, heading, respawnDelay, isHired) Values (?, ?, ?, ?, ?, ?, ?, ?)"))
{
statement.setInt(1, castle.getResidenceId());
@@ -249,7 +249,7 @@ public final class SiegeGuardManager
*/
private void loadSiegeGuard(Castle castle)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_siege_guards Where castleId = ? And isHired = ?"))
{
ps.setInt(1, castle.getResidenceId());
@@ -283,7 +283,7 @@ public final class SiegeGuardManager
*/
public void removeSiegeGuard(int npcId, IPositionable pos)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("Delete From castle_siege_guards Where npcId = ? And x = ? AND y = ? AND z = ? AND isHired = 1"))
{
ps.setInt(1, npcId);
@@ -304,7 +304,7 @@ public final class SiegeGuardManager
*/
public void removeSiegeGuards(Castle castle)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("Delete From castle_siege_guards Where castleId = ? And isHired = 1"))
{
ps.setInt(1, castle.getResidenceId());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
index e7fa0b41a8..65bd2b1bcf 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
@@ -88,7 +88,7 @@ public final class SiegeManager
}
boolean register = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT clan_id FROM siege_clans where clan_id=? and castle_id=?"))
{
statement.setInt(1, clan.getId());
@@ -275,7 +275,7 @@ public final class SiegeManager
private void loadTrapUpgrade(int castleId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_trapupgrade WHERE castleId=?"))
{
ps.setInt(1, castleId);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/BlockList.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/BlockList.java
index f34f2aa666..9498d19d95 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/BlockList.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/BlockList.java
@@ -71,7 +71,7 @@ public class BlockList
private static List loadList(int ObjId)
{
final List list = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=? AND relation=1"))
{
statement.setInt(1, ObjId);
@@ -98,7 +98,7 @@ public class BlockList
private void updateInDB(int targetId, boolean state)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (state) // add
{
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/CursedWeapon.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/CursedWeapon.java
index 2265d6876c..e767a0de19 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/CursedWeapon.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/CursedWeapon.java
@@ -136,7 +136,7 @@ public class CursedWeapon implements INamable
// Remove from Db
LOGGER.info(_name + " being removed offline.");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement del = con.prepareStatement("DELETE FROM items WHERE owner_id=? AND item_id=?");
PreparedStatement ps = con.prepareStatement("UPDATE characters SET reputation=?, pkkills=? WHERE charId=?"))
{
@@ -471,7 +471,7 @@ public class CursedWeapon implements INamable
public void saveData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement del = con.prepareStatement("DELETE FROM cursed_weapons WHERE itemId = ?");
PreparedStatement ps = con.prepareStatement("INSERT INTO cursed_weapons (itemId, charId, playerReputation, playerPkKills, nbKills, endTime) VALUES (?, ?, ?, ?, ?, ?)"))
{
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/L2Clan.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/L2Clan.java
index a1072abca6..6947800c12 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/L2Clan.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/L2Clan.java
@@ -266,7 +266,7 @@ public class L2Clan implements IIdentifiable, INamable
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET clan_privs = ? WHERE charId = ?"))
{
ps.setInt(1, 0);
@@ -306,7 +306,7 @@ public class L2Clan implements IIdentifiable, INamable
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET clan_privs = ? WHERE charId = ?"))
{
ps.setInt(1, EnumIntBitmask.getAllBitmask(ClanPrivilege.class));
@@ -883,7 +883,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateBloodAllianceCountInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET blood_alliance_count=? WHERE clan_id=?"))
{
ps.setInt(1, _bloodAllianceCount);
@@ -927,7 +927,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateBloodOathCountInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET blood_oath_count=? WHERE clan_id=?"))
{
ps.setInt(1, _bloodOathCount);
@@ -943,7 +943,7 @@ public class L2Clan implements IIdentifiable, INamable
public void updateInDB()
{
// Update reputation
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET reputation_score=? WHERE clan_id=?"))
{
ps.setInt(1, _reputationScore);
@@ -978,7 +978,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateClanInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET leader_id=?,ally_id=?,ally_name=?,reputation_score=?,ally_penalty_expiry_time=?,ally_penalty_type=?,char_penalty_expiry_time=?,dissolving_expiry_time=?,new_leader_id=? WHERE clan_id=?"))
{
ps.setInt(1, getLeaderId());
@@ -1016,7 +1016,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void store()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_CLAN_DATA))
{
ps.setInt(1, _clanId);
@@ -1047,7 +1047,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
private void removeMemberInDatabase(L2ClanMember member, long clanJoinExpiryTime, long clanCreateExpiryTime)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("UPDATE characters SET clanid=0, title=?, clan_join_expiry_time=?, clan_create_expiry_time=?, clan_privs=0, wantspeace=0, subpledge=0, lvl_joined_academy=0, apprentice=0, sponsor=0 WHERE charId=?");
PreparedStatement ps2 = con.prepareStatement("UPDATE characters SET apprentice=0 WHERE apprentice=?");
PreparedStatement ps3 = con.prepareStatement("UPDATE characters SET sponsor=0 WHERE sponsor=?"))
@@ -1072,7 +1072,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_CLAN_DATA))
{
ps.setInt(1, _clanId);
@@ -1147,7 +1147,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreNotice()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT enabled,notice FROM clan_notices WHERE clan_id=?"))
{
ps.setInt(1, _clanId);
@@ -1178,7 +1178,7 @@ public class L2Clan implements IIdentifiable, INamable
notice = notice.substring(0, MAX_NOTICE_LENGTH - 1);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_notices (clan_id,notice,enabled) values (?,?,?) ON DUPLICATE KEY UPDATE notice=?,enabled=?"))
{
ps.setInt(1, _clanId);
@@ -1237,7 +1237,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreSkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT skill_id,skill_level,sub_pledge_id FROM clan_skills WHERE clan_id=?"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -1360,7 +1360,7 @@ public class L2Clan implements IIdentifiable, INamable
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (oldSkill != null)
{
@@ -1770,7 +1770,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreSubPledges()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT sub_pledge_id,name,leader_id FROM clan_subpledges WHERE clan_id=?"))
{
// Retrieve all subpledges of this clan from the database
@@ -1870,7 +1870,7 @@ public class L2Clan implements IIdentifiable, INamable
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_subpledges (clan_id,sub_pledge_id,name,leader_id) values (?,?,?,?)"))
{
ps.setInt(1, _clanId);
@@ -1953,7 +1953,7 @@ public class L2Clan implements IIdentifiable, INamable
public void updateSubPledgeInDB(int pledgeType)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_subpledges SET leader_id=?, name=? WHERE clan_id=? AND sub_pledge_id=?"))
{
ps.setInt(1, getSubPledge(pledgeType).getLeaderId());
@@ -1970,7 +1970,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreRankPrivs()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT privs,rank,party FROM clan_privs WHERE clan_id=?"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -2019,7 +2019,7 @@ public class L2Clan implements IIdentifiable, INamable
{
_privs.get(rank).setPrivs(privs);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_privs (clan_id,rank,party,privs) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE privs = ?"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -2055,7 +2055,7 @@ public class L2Clan implements IIdentifiable, INamable
{
_privs.put(rank, new RankPrivs(rank, 0, privs));
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_privs (clan_id,rank,party,privs) VALUES (?,?,?,?)"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -2174,7 +2174,7 @@ public class L2Clan implements IIdentifiable, INamable
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET auction_bid_at=? WHERE clan_id=?"))
{
ps.setInt(1, id);
@@ -2623,7 +2623,7 @@ public class L2Clan implements IIdentifiable, INamable
public void changeLevel(int level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET clan_level = ? WHERE clan_id = ?"))
{
ps.setInt(1, level);
@@ -2669,7 +2669,7 @@ public class L2Clan implements IIdentifiable, INamable
setCrestId(crestId);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET crest_id = ? WHERE clan_id = ?"))
{
ps.setInt(1, crestId);
@@ -2706,7 +2706,7 @@ public class L2Clan implements IIdentifiable, INamable
allyId = _allyId;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(sqlStatement))
{
ps.setInt(1, crestId);
@@ -2752,7 +2752,7 @@ public class L2Clan implements IIdentifiable, INamable
setCrestLargeId(crestId);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET crest_large_id = ? WHERE clan_id = ?"))
{
ps.setInt(1, crestId);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/L2ClanMember.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/L2ClanMember.java
index 8827f75a89..f1efba8e6e 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/L2ClanMember.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/L2ClanMember.java
@@ -244,7 +244,7 @@ public class L2ClanMember
*/
public void updatePledgeType()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET subpledge=? WHERE charId=?"))
{
ps.setLong(1, _pledgeType);
@@ -289,7 +289,7 @@ public class L2ClanMember
*/
public void updatePowerGrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET power_grade=? WHERE charId=?"))
{
ps.setLong(1, _powerGrade);
@@ -800,7 +800,7 @@ public class L2ClanMember
*/
public void saveApprenticeAndSponsor(int apprentice, int sponsor)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET apprentice=?,sponsor=? WHERE charId=?"))
{
ps.setInt(1, apprentice);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/L2ContactList.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/L2ContactList.java
index ea5f1f9d5d..5b5f5ab2bc 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/L2ContactList.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/L2ContactList.java
@@ -58,7 +58,7 @@ public class L2ContactList
{
_contacts.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY_LOAD))
{
statement.setInt(1, activeChar.getObjectId());
@@ -124,7 +124,7 @@ public class L2ContactList
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY_ADD))
{
statement.setInt(1, activeChar.getObjectId());
@@ -161,7 +161,7 @@ public class L2ContactList
_contacts.remove(name);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY_REMOVE))
{
statement.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/L2Mentee.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/L2Mentee.java
index 5c086b9d83..5414107ac4 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/L2Mentee.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/L2Mentee.java
@@ -49,7 +49,7 @@ public class L2Mentee
final L2PcInstance player = getPlayerInstance();
if (player == null) // Only if player is offline
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT char_name, level, base_class FROM characters WHERE charId = ?"))
{
statement.setInt(1, _objectId);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/MacroList.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/MacroList.java
index 577b101249..176fa12d48 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/MacroList.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/MacroList.java
@@ -124,7 +124,7 @@ public class MacroList implements IRestorable
private void registerMacroInDb(Macro macro)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO character_macroses (charId,id,icon,name,descr,acronym,commands) values(?,?,?,?,?,?,?)"))
{
ps.setInt(1, _owner.getObjectId());
@@ -160,7 +160,7 @@ public class MacroList implements IRestorable
private void deleteMacroFromDb(Macro macro)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_macroses WHERE charId=? AND id=?"))
{
ps.setInt(1, _owner.getObjectId());
@@ -177,7 +177,7 @@ public class MacroList implements IRestorable
public boolean restoreMe()
{
_macroses.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT charId, id, icon, name, descr, acronym, commands FROM character_macroses WHERE charId=?"))
{
ps.setInt(1, _owner.getObjectId());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/ShortCuts.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/ShortCuts.java
index 81e2c6f902..cbb856704d 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/ShortCuts.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/ShortCuts.java
@@ -85,7 +85,7 @@ public class ShortCuts implements IRestorable
deleteShortCutFromDb(oldShortCut);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("REPLACE INTO character_shortcuts (charId,slot,page,type,shortcut_id,level,sub_level,class_index) values(?,?,?,?,?,?,?,?)"))
{
statement.setInt(1, _owner.getObjectId());
@@ -154,7 +154,7 @@ public class ShortCuts implements IRestorable
*/
private void deleteShortCutFromDb(Shortcut shortcut)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=? AND slot=? AND page=? AND class_index=?"))
{
statement.setInt(1, _owner.getObjectId());
@@ -173,7 +173,7 @@ public class ShortCuts implements IRestorable
public boolean restoreMe()
{
_shortCuts.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT charId, slot, page, type, shortcut_id, level, sub_level FROM character_shortcuts WHERE charId=? AND class_index=?"))
{
statement.setInt(1, _owner.getObjectId());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
index d1df0be62c..d11248c99b 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
@@ -1325,7 +1325,7 @@ public final class L2PcInstance extends L2Playable
private void insertNewRecipeData(int recipeId, boolean isDwarf)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_recipebook (charId, id, classIndex, type) values(?,?,?,?)"))
{
statement.setInt(1, getObjectId());
@@ -1342,7 +1342,7 @@ public final class L2PcInstance extends L2Playable
private void deleteRecipeData(int recipeId, boolean isDwarf)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_recipebook WHERE charId=? AND id=? AND classIndex=?"))
{
statement.setInt(1, getObjectId());
@@ -6306,7 +6306,7 @@ public final class L2PcInstance extends L2Playable
if (updateInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_CHARACTER_ACCESS))
{
ps.setInt(1, accessLevel.getLevel());
@@ -6425,7 +6425,7 @@ public final class L2PcInstance extends L2Playable
*/
public void updateOnlineStatus()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE characters SET online=?, lastAccess=? WHERE charId=?"))
{
statement.setInt(1, isOnlineInt());
@@ -6445,7 +6445,7 @@ public final class L2PcInstance extends L2Playable
*/
private boolean createDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_CHARACTER))
{
statement.setString(1, _accountName);
@@ -6509,7 +6509,7 @@ public final class L2PcInstance extends L2Playable
double currentCp = 0;
double currentHp = 0;
double currentMp = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHARACTER))
{
// Retrieve the L2PcInstance from the characters table of the database
@@ -6870,7 +6870,7 @@ public final class L2PcInstance extends L2Playable
*/
private static boolean restoreSubClassData(L2PcInstance player)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_SUBCLASSES))
{
statement.setInt(1, player.getObjectId());
@@ -6961,7 +6961,7 @@ public final class L2PcInstance extends L2Playable
private void restoreRecipeBook(boolean loadCommon)
{
final String sql = loadCommon ? "SELECT id, type, classIndex FROM character_recipebook WHERE charId=?" : "SELECT id FROM character_recipebook WHERE charId=? AND classIndex=? AND type = 1";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(sql))
{
statement.setInt(1, getObjectId());
@@ -7014,7 +7014,7 @@ public final class L2PcInstance extends L2Playable
private void loadPremiumItemList()
{
final String sql = "SELECT itemNum, itemId, itemCount, itemSender FROM character_premium_items WHERE charId=?";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(sql))
{
statement.setInt(1, getObjectId());
@@ -7038,7 +7038,7 @@ public final class L2PcInstance extends L2Playable
public void updatePremiumItem(int itemNum, long newcount)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE character_premium_items SET itemCount=? WHERE charId=? AND itemNum=? "))
{
statement.setLong(1, newcount);
@@ -7054,7 +7054,7 @@ public final class L2PcInstance extends L2Playable
public void deletePremiumItem(int itemNum)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_premium_items WHERE charId=? AND itemNum=? "))
{
statement.setInt(1, getObjectId());
@@ -7107,7 +7107,7 @@ public final class L2PcInstance extends L2Playable
final long exp = getStat().getBaseExp();
final int level = getStat().getBaseLevel();
final long sp = getStat().getBaseSp();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CHARACTER))
{
statement.setInt(1, level);
@@ -7192,7 +7192,7 @@ public final class L2PcInstance extends L2Playable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CHAR_SUBCLASS))
{
for (SubClass subClass : getSubClasses().values())
@@ -7223,7 +7223,7 @@ public final class L2PcInstance extends L2Playable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
{
@@ -7343,7 +7343,7 @@ public final class L2PcInstance extends L2Playable
private void storeItemReuseDelay()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(DELETE_ITEM_REUSE_SAVE);
PreparedStatement ps2 = con.prepareStatement(ADD_ITEM_REUSE_SAVE))
{
@@ -7460,7 +7460,7 @@ public final class L2PcInstance extends L2Playable
final Skill oldSkill = super.removeSkill(skill, true);
if (oldSkill != null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_SKILL_FROM_CHAR))
{
// Remove or update a L2PcInstance skill from the character_skills table of the database
@@ -7503,7 +7503,7 @@ public final class L2PcInstance extends L2Playable
private void storeSkill(Skill newSkill, Skill oldSkill, int newClassIndex)
{
final int classIndex = (newClassIndex > -1) ? newClassIndex : _classIndex;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if ((oldSkill != null) && (newSkill != null))
{
@@ -7553,7 +7553,7 @@ public final class L2PcInstance extends L2Playable
}
final int classIndex = (newClassIndex > -1) ? newClassIndex : _classIndex;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_NEW_SKILLS))
{
con.setAutoCommit(false);
@@ -7580,7 +7580,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restoreSkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -7632,7 +7632,7 @@ public final class L2PcInstance extends L2Playable
@Override
public void restoreEffects()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_SKILL_SAVE))
{
statement.setInt(1, getObjectId());
@@ -7689,7 +7689,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restoreItemReuse()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_ITEM_REUSE_SAVE);
PreparedStatement delete = con.prepareStatement(DELETE_ITEM_REUSE_SAVE))
{
@@ -7760,7 +7760,7 @@ public final class L2PcInstance extends L2Playable
_henna[i - 1] = null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_HENNAS))
{
statement.setInt(1, getObjectId());
@@ -7867,7 +7867,7 @@ public final class L2PcInstance extends L2Playable
_henna[slot - 1] = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_CHAR_HENNA))
{
statement.setInt(1, getObjectId());
@@ -7948,7 +7948,7 @@ public final class L2PcInstance extends L2Playable
// Calculate Henna modifiers of this L2PcInstance
recalcHennaStats();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(ADD_CHAR_HENNA))
{
statement.setInt(1, getObjectId());
@@ -9572,7 +9572,7 @@ public final class L2PcInstance extends L2Playable
newClass.setLevel(Config.BASE_DUALCLASS_LEVEL);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(ADD_CHAR_SUBCLASS))
{
// Store the basic info about this new sub-class.
@@ -9672,7 +9672,7 @@ public final class L2PcInstance extends L2Playable
// Remove after stats are recalculated.
getSubClasses().remove(classIndex);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
@@ -11816,7 +11816,7 @@ public final class L2PcInstance extends L2Playable
{
String req;
req = "UPDATE pets SET fed=? WHERE item_obj_id = ?";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(req))
{
statement.setInt(1, _curFeed);
@@ -11943,7 +11943,7 @@ public final class L2PcInstance extends L2Playable
bookmark.setTag(tag);
bookmark.setName(name);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_TP_BOOKMARK))
{
statement.setInt(1, icon);
@@ -11966,7 +11966,7 @@ public final class L2PcInstance extends L2Playable
{
if (_tpbookmarks.remove(id) != null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_TP_BOOKMARK))
{
statement.setInt(1, getObjectId());
@@ -12109,7 +12109,7 @@ public final class L2PcInstance extends L2Playable
sm.addItemName(20033);
sendPacket(sm);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_TP_BOOKMARK))
{
statement.setInt(1, getObjectId());
@@ -12131,7 +12131,7 @@ public final class L2PcInstance extends L2Playable
public void restoreTeleportBookmark()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_TP_BOOKMARK))
{
statement.setInt(1, getObjectId());
@@ -12343,7 +12343,7 @@ public final class L2PcInstance extends L2Playable
_friendList.clear();
final String sqlQuery = "SELECT friendId FROM character_friends WHERE charId=? AND relation=0";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(sqlQuery))
{
statement.setInt(1, getObjectId());
@@ -12433,7 +12433,7 @@ public final class L2PcInstance extends L2Playable
{
if (hasManufactureShop())
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement st = con.prepareStatement(DELETE_CHAR_RECIPE_SHOP))
{
@@ -12471,7 +12471,7 @@ public final class L2PcInstance extends L2Playable
_manufactureItems.clear();
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_RECIPE_SHOP))
{
statement.setInt(1, getObjectId());
@@ -12889,7 +12889,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restorePetInventoryItems()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT object_id FROM `items` WHERE `owner_id`=? AND (`loc`='PET' OR `loc`='PET_EQUIP') LIMIT 1;"))
{
statement.setInt(1, getObjectId());
@@ -12929,7 +12929,7 @@ public final class L2PcInstance extends L2Playable
*/
private void loadRecommendations()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT rec_have, rec_left FROM character_reco_bonus WHERE charId = ?"))
{
statement.setInt(1, getObjectId());
@@ -12953,7 +12953,7 @@ public final class L2PcInstance extends L2Playable
*/
public void storeRecommendations()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO character_reco_bonus (charId,rec_have,rec_left,time_left) VALUES (?,?,?,?)"))
{
ps.setInt(1, getObjectId());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
index c5b882a533..2a22ce6fa1 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
@@ -788,7 +788,7 @@ public class L2PetInstance extends L2Summon
}
// pet control item no longer exists, delete the pet from the db
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id = ?"))
{
statement.setInt(1, _controlObjectId);
@@ -846,7 +846,7 @@ public class L2PetInstance extends L2Summon
private static L2PetInstance restore(L2ItemInstance control, L2NpcTemplate template, L2PcInstance owner)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT item_obj_id, name, level, curHp, curMp, exp, sp, fed FROM pets WHERE item_obj_id=?"))
{
L2PetInstance pet;
@@ -942,7 +942,7 @@ public class L2PetInstance extends L2Summon
req = "UPDATE pets SET name=?,level=?,curHp=?,curMp=?,exp=?,sp=?,fed=?,ownerId=?,restore=? WHERE item_obj_id = ?";
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(req))
{
statement.setString(1, getName());
@@ -992,7 +992,7 @@ public class L2PetInstance extends L2Summon
// Clear list for overwrite
SummonEffectsTable.getInstance().getPetEffects().getOrDefault(getControlObjectId(), Collections.emptyList()).clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement ps2 = con.prepareStatement(ADD_SKILL_SAVE))
{
@@ -1067,7 +1067,7 @@ public class L2PetInstance extends L2Summon
@Override
public void restoreEffects()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(RESTORE_SKILL_SAVE);
PreparedStatement ps2 = con.prepareStatement(DELETE_SKILL_SAVE))
{
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java
index 320505de11..8cbf9119b6 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java
@@ -288,7 +288,7 @@ public class L2ServitorInstance extends L2Summon implements Runnable
SummonEffectsTable.getInstance().getServitorEffects(getOwner()).getOrDefault(getReferenceSkill(), Collections.emptyList()).clear();
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_SKILL_SAVE))
{
// Delete all current stored effects for summon to avoid dupe
@@ -389,7 +389,7 @@ public class L2ServitorInstance extends L2Summon implements Runnable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (!SummonEffectsTable.getInstance().getServitorEffectsOwner().containsKey(getOwner().getObjectId()) || !SummonEffectsTable.getInstance().getServitorEffectsOwner().get(getOwner().getObjectId()).containsKey(getOwner().getClassIndex()) || !SummonEffectsTable.getInstance().getServitorEffects(getOwner()).containsKey(getReferenceSkill()))
{
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/announce/Announcement.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/announce/Announcement.java
index 4e5aa84b0f..a7117539ad 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/announce/Announcement.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/announce/Announcement.java
@@ -108,7 +108,7 @@ public class Announcement implements IAnnouncement
@Override
public boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
{
ps.setInt(1, _type.ordinal());
@@ -134,7 +134,7 @@ public class Announcement implements IAnnouncement
@Override
public boolean updateMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_QUERY))
{
ps.setInt(1, _type.ordinal());
@@ -154,7 +154,7 @@ public class Announcement implements IAnnouncement
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_QUERY))
{
ps.setInt(1, _id);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java
index 1adc7b039f..21eb44294e 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java
@@ -94,7 +94,7 @@ public final class AutoAnnouncement extends Announcement implements Runnable
@Override
public boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
{
st.setInt(1, getType().ordinal());
@@ -123,7 +123,7 @@ public final class AutoAnnouncement extends Announcement implements Runnable
@Override
public boolean updateMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(UPDATE_QUERY))
{
st.setInt(1, getType().ordinal());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/buylist/Product.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/buylist/Product.java
index 8360f7712c..639a9bfa1a 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/buylist/Product.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/buylist/Product.java
@@ -157,7 +157,7 @@ public final class Product
private void save()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO `buylists`(`buylist_id`, `item_id`, `count`, `next_restock_time`) VALUES(?, ?, ?, ?) ON DUPLICATE KEY UPDATE `count` = ?, `next_restock_time` = ?"))
{
statement.setInt(1, _buyListId);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java
index 757b5512d0..5d970e7abd 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java
@@ -58,7 +58,7 @@ public class ClanHallAuction
private final void loadBidder()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(LOAD_CLANHALL_BIDDERS))
{
ps.setInt(1, _clanHallId);
@@ -102,7 +102,7 @@ public class ClanHallAuction
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_CLANHALL_BIDDER))
{
ps.setInt(1, _clanHallId);
@@ -121,7 +121,7 @@ public class ClanHallAuction
public void removeBid(L2Clan clan)
{
getBids().remove(clan.getId());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_CLANHALL_BIDDER))
{
ps.setInt(1, clan.getId());
@@ -170,7 +170,7 @@ public class ClanHallAuction
clanHall.setOwner(highestBidder.getClan());
getBids().clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_CLANHALL_BIDDERS))
{
ps.setInt(1, _clanHallId);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Castle.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Castle.java
index ca9513714d..08284f3f0b 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Castle.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Castle.java
@@ -219,7 +219,7 @@ public final class Castle extends AbstractResidence
public void dbSave()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_functions (castle_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)"))
{
ps.setInt(1, getResidenceId());
@@ -361,7 +361,7 @@ public final class Castle extends AbstractResidence
_treasury += amount;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET treasury = ? WHERE id = ?"))
{
ps.setLong(1, _treasury);
@@ -644,7 +644,7 @@ public final class Castle extends AbstractResidence
@Override
protected void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("SELECT * FROM castle WHERE id = ?");
PreparedStatement ps2 = con.prepareStatement("SELECT clan_id FROM clan_data WHERE hasCastle = ?"))
{
@@ -690,7 +690,7 @@ public final class Castle extends AbstractResidence
/** Load All Functions */
private void loadFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_functions WHERE castle_id = ?"))
{
ps.setInt(1, getResidenceId());
@@ -715,7 +715,7 @@ public final class Castle extends AbstractResidence
public void removeFunction(int functionType)
{
_function.remove(functionType);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_functions WHERE castle_id=? AND type=?"))
{
ps.setInt(1, getResidenceId());
@@ -787,7 +787,7 @@ public final class Castle extends AbstractResidence
// This method loads castle door upgrade data from database
private void loadDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_doorupgrade WHERE castleId=?"))
{
ps.setInt(1, getResidenceId());
@@ -813,7 +813,7 @@ public final class Castle extends AbstractResidence
door.setCurrentHp(door.getCurrentHp());
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_doorupgrade WHERE castleId=?"))
{
ps.setInt(1, getResidenceId());
@@ -838,7 +838,7 @@ public final class Castle extends AbstractResidence
if (save)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_doorupgrade (doorId, ratio, castleId) values (?,?,?)"))
{
ps.setInt(1, doorId);
@@ -865,7 +865,7 @@ public final class Castle extends AbstractResidence
CastleManorManager.getInstance().resetManorData(getResidenceId());
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Need to remove has castle flag from clan_data, should be checked from castle table.
try (PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET hasCastle = 0 WHERE hasCastle = ?"))
@@ -1033,7 +1033,7 @@ public final class Castle extends AbstractResidence
public void updateShowNpcCrest()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET showNpcCrest = ? WHERE id = ?"))
{
ps.setString(1, String.valueOf(_showNpcCrest));
@@ -1077,7 +1077,7 @@ public final class Castle extends AbstractResidence
{
_ticketBuyCount = count;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET ticketBuyCount = ? WHERE id = ?"))
{
ps.setInt(1, _ticketBuyCount);
@@ -1100,7 +1100,7 @@ public final class Castle extends AbstractResidence
{
if (save)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_trapupgrade (castleId, towerIndex, level) values (?,?,?)"))
{
ps.setInt(1, getResidenceId());
@@ -1127,7 +1127,7 @@ public final class Castle extends AbstractResidence
ts.setUpgradeLevel(0);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_trapupgrade WHERE castleId=?"))
{
ps.setInt(1, getResidenceId());
@@ -1208,7 +1208,7 @@ public final class Castle extends AbstractResidence
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET side = ? WHERE id = ?"))
{
ps.setString(1, side.toString());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/ClanHall.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
index 6fc9b45046..79906bc875 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
@@ -100,7 +100,7 @@ public final class ClanHall extends AbstractResidence
@Override
protected void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement loadStatement = con.prepareStatement(LOAD_CLANHALL);
PreparedStatement insertStatement = con.prepareStatement(INSERT_CLANHALL))
{
@@ -133,7 +133,7 @@ public final class ClanHall extends AbstractResidence
public void updateDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CLANHALL))
{
statement.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Couple.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Couple.java
index c40e7d454a..45294842ce 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Couple.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Couple.java
@@ -45,7 +45,7 @@ public class Couple
{
_Id = coupleId;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM mods_wedding WHERE id = ?"))
{
ps.setInt(1, _Id);
@@ -85,7 +85,7 @@ public class Couple
_weddingDate = Calendar.getInstance();
_weddingDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
{
_Id = IdFactory.getInstance().getNextId();
@@ -105,7 +105,7 @@ public class Couple
public void marry()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE mods_wedding set married = ?, weddingDate = ? where id = ?"))
{
ps.setBoolean(1, true);
@@ -123,7 +123,7 @@ public class Couple
public void divorce()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM mods_wedding WHERE id=?"))
{
ps.setInt(1, _Id);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Fort.java
index e6262fdc29..3b29461e3a 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Fort.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Fort.java
@@ -214,7 +214,7 @@ public final class Fort extends AbstractResidence
public void dbSave()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO fort_functions (fort_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)"))
{
ps.setInt(1, getResidenceId());
@@ -487,7 +487,7 @@ public final class Fort extends AbstractResidence
public void saveFortVariables()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET supplyLvL=? WHERE id = ?"))
{
ps.setInt(1, _supplyLvL);
@@ -552,7 +552,7 @@ public final class Fort extends AbstractResidence
@Override
protected void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort WHERE id = ?"))
{
ps.setInt(1, getResidenceId());
@@ -613,7 +613,7 @@ public final class Fort extends AbstractResidence
/** Load All Functions */
private void loadFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_functions WHERE fort_id = ?"))
{
ps.setInt(1, getResidenceId());
@@ -638,7 +638,7 @@ public final class Fort extends AbstractResidence
public void removeFunction(int functionType)
{
_function.remove(functionType);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM fort_functions WHERE fort_id=? AND type=?"))
{
ps.setInt(1, getResidenceId());
@@ -730,7 +730,7 @@ public final class Fort extends AbstractResidence
// This method loads fort door upgrade data from database
private void loadDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_doorupgrade WHERE fortId = ?"))
{
ps.setInt(1, getResidenceId());
@@ -750,7 +750,7 @@ public final class Fort extends AbstractResidence
private void removeDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM fort_doorupgrade WHERE fortId = ?"))
{
ps.setInt(1, getResidenceId());
@@ -764,7 +764,7 @@ public final class Fort extends AbstractResidence
private void saveDoorUpgrade(int doorId, int hp, int pDef, int mDef)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO fort_doorupgrade (doorId, hp, pDef, mDef) VALUES (?,?,?,?)"))
{
ps.setInt(1, doorId);
@@ -793,7 +793,7 @@ public final class Fort extends AbstractResidence
_lastOwnedTime.setTimeInMillis(0);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET owner=?,lastOwnedTime=?,state=?,castleId=? WHERE id = ?"))
{
ps.setInt(1, clanId);
@@ -998,7 +998,7 @@ public final class Fort extends AbstractResidence
{
_state = state;
_castleId = castleId;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET state=?,castleId=? WHERE id = ?"))
{
ps.setInt(1, _state);
@@ -1130,7 +1130,7 @@ public final class Fort extends AbstractResidence
private void initNpcs()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_spawnlist WHERE fortId = ? AND spawnType = ?"))
{
ps.setInt(1, getResidenceId());
@@ -1159,7 +1159,7 @@ public final class Fort extends AbstractResidence
private void initSiegeNpcs()
{
_siegeNpcs.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, npcId, x, y, z, heading FROM fort_spawnlist WHERE fortId = ? AND spawnType = ? ORDER BY id"))
{
ps.setInt(1, getResidenceId());
@@ -1186,7 +1186,7 @@ public final class Fort extends AbstractResidence
private void initNpcCommanders()
{
_npcCommanders.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, npcId, x, y, z, heading FROM fort_spawnlist WHERE fortId = ? AND spawnType = ? ORDER BY id"))
{
ps.setInt(1, getResidenceId());
@@ -1216,7 +1216,7 @@ public final class Fort extends AbstractResidence
_specialEnvoys.clear();
_envoyCastles.clear();
_availableCastles.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, npcId, x, y, z, heading, castleId FROM fort_spawnlist WHERE fortId = ? AND spawnType = ? ORDER BY id"))
{
ps.setInt(1, getResidenceId());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/FortSiege.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/FortSiege.java
index ffba04e6c3..d558045fab 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/FortSiege.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/FortSiege.java
@@ -501,7 +501,7 @@ public class FortSiege implements Siegable
/** Clear all registered siege clans from database for fort */
public void clearSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM fortsiege_clans WHERE fort_id=?"))
{
ps.setInt(1, _fort.getResidenceId());
@@ -785,7 +785,7 @@ public class FortSiege implements Siegable
private void removeSiegeClan(int clanId)
{
final String query = (clanId != 0) ? DELETE_FORT_SIEGECLANS_BY_CLAN_ID : DELETE_FORT_SIEGECLANS;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(query))
{
statement.setInt(1, _fort.getResidenceId());
@@ -999,7 +999,7 @@ public class FortSiege implements Siegable
private void loadSiegeClan()
{
_attackerClans.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clan_id FROM fortsiege_clans WHERE fort_id=?"))
{
ps.setInt(1, _fort.getResidenceId());
@@ -1057,7 +1057,7 @@ public class FortSiege implements Siegable
/** Save siege date to database. */
private void saveSiegeDate()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET siegeDate = ? WHERE id = ?"))
{
ps.setLong(1, _fort.getSiegeDate().getTimeInMillis());
@@ -1081,7 +1081,7 @@ public class FortSiege implements Siegable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO fortsiege_clans (clan_id,fort_id) values (?,?)"))
{
statement.setInt(1, clan.getId());
@@ -1146,7 +1146,7 @@ public class FortSiege implements Siegable
public void loadSiegeGuard()
{
_siegeGuards.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT npcId, x, y, z, heading, respawnDelay FROM fort_siege_guards WHERE fortId = ?"))
{
final int fortId = _fort.getResidenceId();
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Hero.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Hero.java
index 924ecead2f..27be59aa41 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Hero.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Hero.java
@@ -114,7 +114,7 @@ public class Hero
_herodiary.clear();
_heroMessage.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s1 = con.createStatement();
ResultSet rset = s1.executeQuery(GET_HEROES);
PreparedStatement ps = con.prepareStatement(GET_CLAN_ALLY);
@@ -211,7 +211,7 @@ public class Hero
*/
public void loadMessage(int charId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT message FROM heroes WHERE charId=?"))
{
statement.setInt(1, charId);
@@ -233,7 +233,7 @@ public class Hero
{
final List _diary = new CopyOnWriteArrayList<>();
int diaryentries = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM heroes_diary WHERE charId=? ORDER BY time ASC"))
{
statement.setInt(1, charId);
@@ -300,7 +300,7 @@ public class Hero
int _losses = 0;
int _draws = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM olympiad_fights WHERE (charOneId=? OR charTwoId=?) AND start ORDER BY start ASC"))
{
statement.setInt(1, charId);
@@ -699,7 +699,7 @@ public class Hero
public void updateHeroes(boolean setDefault)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (setDefault)
{
@@ -841,7 +841,7 @@ public class Hero
public void setDiaryData(int charId, int action, int param)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO heroes_diary (charId, time, action, param) values(?,?,?,?)"))
{
statement.setInt(1, charId);
@@ -877,7 +877,7 @@ public class Hero
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE heroes SET message=? WHERE charId=?;"))
{
statement.setString(1, _heroMessage.get(charId));
@@ -892,7 +892,7 @@ public class Hero
private void deleteItemsInDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_ITEMS))
{
statement.execute();
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Siege.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Siege.java
index 2ed07c3d33..9e70d283d4 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Siege.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/entity/Siege.java
@@ -760,7 +760,7 @@ public class Siege implements Siegable
/** Clear all registered siege clans from database for castle */
public void clearSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=?"))
{
statement.setInt(1, _castle.getResidenceId());
@@ -788,7 +788,7 @@ public class Siege implements Siegable
/** Clear all siege clans waiting for approval from database for castle */
public void clearSiegeWaitingClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=? and type = 2"))
{
statement.setInt(1, _castle.getResidenceId());
@@ -972,7 +972,7 @@ public class Siege implements Siegable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=? and clan_id=?"))
{
statement.setInt(1, _castle.getResidenceId());
@@ -1238,7 +1238,7 @@ public class Siege implements Siegable
private void loadSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT clan_id,type FROM siege_clans where castle_id=?"))
{
getAttackerClans().clear();
@@ -1349,7 +1349,7 @@ public class Siege implements Siegable
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castle), 1000);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE castle SET siegeDate = ?, regTimeEnd = ?, regTimeOver = ? WHERE id = ?"))
{
statement.setLong(1, _castle.getSiegeDate().getTimeInMillis());
@@ -1378,7 +1378,7 @@ public class Siege implements Siegable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if ((typeId == DEFENDER) || (typeId == DEFENDER_NOT_APPROVED) || (typeId == OWNER))
{
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java
index ac490ba86d..f23e511ede 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java
@@ -138,7 +138,7 @@ public class EventScheduler
public boolean updateLastRun()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO event_schedulers (eventName, schedulerName, lastRun) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE eventName = ?, schedulerName = ?, lastRun = ?"))
{
ps.setString(1, _eventManager.getName());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java
index 3185dae127..fc59ec7842 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java
@@ -52,7 +52,7 @@ public class HaventRunConditionalScheduler implements IConditionalEventScheduler
throw new NullPointerException("Scheduler not found: " + _name);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT lastRun FROM event_schedulers WHERE eventName = ? AND schedulerName = ?"))
{
ps.setString(1, _eventManager.getName());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/instancezone/Instance.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/instancezone/Instance.java
index 053ffa54cf..ccef54aad0 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/instancezone/Instance.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/instancezone/Instance.java
@@ -815,7 +815,7 @@ public final class Instance implements IIdentifiable, INamable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT IGNORE INTO character_instance_time (charId,instanceId,time) VALUES (?,?,?)"))
{
// Save to database
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java
index 8a3ac20ed4..4865f4c0b2 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java
@@ -191,7 +191,7 @@ public final class ItemAuction
public final void storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO item_auction (auctionId,instanceId,auctionItemId,startingTime,endingTime,auctionStateId) VALUES (?,?,?,?,?,?) ON DUPLICATE KEY UPDATE auctionStateId=?"))
{
statement.setInt(1, _auctionId);
@@ -225,7 +225,7 @@ public final class ItemAuction
final void updatePlayerBidInternal(ItemAuctionBid bid, boolean delete)
{
final String query = delete ? DELETE_ITEM_AUCTION_BID : INSERT_ITEM_AUCTION_BID;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(query))
{
ps.setInt(1, _auctionId);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java
index ec5eb4074e..d388e90796 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java
@@ -161,7 +161,7 @@ public final class ItemAuctionInstance
throw new IllegalArgumentException("No items defined");
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_AUCTION_ID_BY_INSTANCE_ID))
{
ps.setInt(1, _instanceId);
@@ -533,7 +533,7 @@ public final class ItemAuctionInstance
private ItemAuction loadAuction(int auctionId) throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
int auctionItemId = 0;
long startingTime = 0;
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java
index 102306be1b..f73b31f758 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java
@@ -1813,7 +1813,7 @@ public abstract class Inventory extends ItemContainer
@Override
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM items WHERE owner_id=? AND (loc=? OR loc=?) ORDER BY loc_data"))
{
ps.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java
index 1501c166e8..9a71ec3c76 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java
@@ -673,7 +673,7 @@ public abstract class ItemContainer
*/
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM items WHERE owner_id=? AND (loc=?)"))
{
ps.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java
index 9e94b591e8..09cbc47e3b 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java
@@ -112,7 +112,7 @@ public class Mail extends ItemContainer
@Override
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM items WHERE owner_id=? AND loc=? AND loc_data=?"))
{
statement.setInt(1, _ownerId);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java
index 9228d151c2..a3a85dfeba 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java
@@ -738,7 +738,7 @@ public class PcInventory extends Inventory
public static int[][] restoreVisibleInventory(int objectId)
{
final int[][] paperdoll = new int[33][4];
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement2 = con.prepareStatement("SELECT object_id,item_id,loc_data,enchant_level FROM items WHERE owner_id=? AND loc='PAPERDOLL'"))
{
statement2.setInt(1, objectId);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java
index 000d3a0924..c7e109b9d3 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java
@@ -983,7 +983,7 @@ public final class L2ItemInstance extends L2Object
final VariationInstance augment = _augmentation;
_augmentation = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_variations WHERE itemId = ?"))
{
ps.setInt(1, getObjectId());
@@ -1000,7 +1000,7 @@ public final class L2ItemInstance extends L2Object
public void restoreAttributes()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("SELECT mineralId,option1,option2 FROM item_variations WHERE itemId=?");
PreparedStatement ps2 = con.prepareStatement("SELECT elemType,elemValue FROM item_elementals WHERE itemId=?"))
{
@@ -1041,7 +1041,7 @@ public final class L2ItemInstance extends L2Object
public void updateItemOptions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
updateItemOptions(con);
}
@@ -1069,7 +1069,7 @@ public final class L2ItemInstance extends L2Object
public void updateItemElementals()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
updateItemElements(con);
}
@@ -1231,7 +1231,7 @@ public final class L2ItemInstance extends L2Object
_elementals.remove(type);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_elementals WHERE itemId = ? AND elemType = ?"))
{
ps.setInt(1, getObjectId());
@@ -1256,7 +1256,7 @@ public final class L2ItemInstance extends L2Object
_elementals.clear();
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_elementals WHERE itemId = ?"))
{
ps.setInt(1, getObjectId());
@@ -1588,7 +1588,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE items SET owner_id=?,count=?,loc=?,loc_data=?,enchant_level=?,custom_type1=?,custom_type2=?,mana_left=?,time=? WHERE object_id = ?"))
{
ps.setInt(1, _ownerId);
@@ -1621,7 +1621,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO items (owner_id,item_id,count,loc,loc_data,enchant_level,object_id,custom_type1,custom_type2,mana_left,time) VALUES (?,?,?,?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, _ownerId);
@@ -1669,7 +1669,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM items WHERE object_id = ?"))
{
@@ -2183,7 +2183,7 @@ public final class L2ItemInstance extends L2Object
private void removeSpecialAbility(EnsoulOption option)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_special_abilities WHERE objectId = ? AND optionId = ?"))
{
ps.setInt(1, getObjectId());
@@ -2237,7 +2237,7 @@ public final class L2ItemInstance extends L2Object
private void restoreSpecialAbilities()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM item_special_abilities WHERE objectId = ? ORDER BY position"))
{
ps.setInt(1, getObjectId());
@@ -2264,7 +2264,7 @@ public final class L2ItemInstance extends L2Object
public void updateSpecialAbilities()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
updateSpecialAbilities(con);
}
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java
index 44b0ac9c43..1ad8f4c201 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java
@@ -142,7 +142,7 @@ public class Olympiad extends ListenersContainer
{
_nobles.clear();
boolean loaded = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_LOAD_DATA);
ResultSet rset = statement.executeQuery())
{
@@ -221,7 +221,7 @@ public class Olympiad extends ListenersContainer
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_LOAD_NOBLES);
ResultSet rset = statement.executeQuery())
{
@@ -295,7 +295,7 @@ public class Olympiad extends ListenersContainer
{
_noblesRank.clear();
final Map tmpPlace = new HashMap<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(GET_ALL_CLASSIFIED_NOBLESS);
ResultSet rset = statement.executeQuery())
{
@@ -806,7 +806,7 @@ public class Olympiad extends ListenersContainer
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
for (Entry entry : _nobles.entrySet())
{
@@ -878,7 +878,7 @@ public class Olympiad extends ListenersContainer
{
saveNobleData();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_SAVE_DATA))
{
statement.setInt(1, _currentCycle);
@@ -919,7 +919,7 @@ public class Olympiad extends ListenersContainer
protected void updateMonthlyData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(OLYMPIAD_MONTH_CLEAR);
PreparedStatement ps2 = con.prepareStatement(OLYMPIAD_MONTH_CREATE))
{
@@ -963,7 +963,7 @@ public class Olympiad extends ListenersContainer
final List heroesToBe = new LinkedList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_GET_HEROS))
{
StatsSet hero;
@@ -998,7 +998,7 @@ public class Olympiad extends ListenersContainer
{
final List names = new ArrayList<>();
final String query = Config.ALT_OLY_SHOW_MONTHLY_WINNERS ? ((classId == 132) ? GET_EACH_CLASS_LEADER_SOULHOUND : GET_EACH_CLASS_LEADER) : ((classId == 132) ? GET_EACH_CLASS_LEADER_CURRENT_SOULHOUND : GET_EACH_CLASS_LEADER_CURRENT);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(query))
{
ps.setInt(1, classId);
@@ -1108,7 +1108,7 @@ public class Olympiad extends ListenersContainer
public int getLastNobleOlympiadPoints(int objId)
{
int result = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT olympiad_points FROM olympiad_nobles_eom WHERE charId = ?"))
{
ps.setInt(1, objId);
@@ -1252,7 +1252,7 @@ public class Olympiad extends ListenersContainer
protected void deleteNobles()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_DELETE_ALL))
{
statement.execute();
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java
index 9249ca2223..2824298209 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java
@@ -743,7 +743,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
protected static void saveResults(Participant one, Participant two, int winner, long startTime, long fightTime, CompetitionType type)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO olympiad_fights (charOneId, charTwoId, charOneClass, charTwoClass, winner, start, time, classed) values(?,?,?,?,?,?,?,?)"))
{
statement.setInt(1, one.getObjectId());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java
index d73e56cbe8..c805ee421d 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java
@@ -185,7 +185,7 @@ public class PunishmentTask implements Runnable
{
if (!_isStored)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
{
st.setString(1, _key);
@@ -224,7 +224,7 @@ public class PunishmentTask implements Runnable
{
if (_isStored)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(UPDATE_QUERY))
{
st.setLong(1, System.currentTimeMillis());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java
index 248d5997e4..0dea776f93 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java
@@ -409,7 +409,7 @@ public class LongTimeEvent extends Quest
}
}
// Update database
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM items WHERE item_id=?"))
{
statement.setInt(1, itemId);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/quest/Quest.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/quest/Quest.java
index 177a86908f..fcf44bfa6f 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/quest/Quest.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/quest/Quest.java
@@ -1568,7 +1568,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void playerEnter(L2PcInstance player)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement invalidQuestData = con.prepareStatement("DELETE FROM character_quests WHERE charId = ? AND name = ?");
PreparedStatement invalidQuestDataVar = con.prepareStatement("DELETE FROM character_quests WHERE charId = ? AND name = ? AND var = ?");
PreparedStatement ps1 = con.prepareStatement("SELECT name, value FROM character_quests WHERE charId = ? AND var = ?"))
@@ -1650,7 +1650,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void createQuestVarInDb(QuestState qs, String var, String value)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_quests (charId,name,var,value) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE value=?"))
{
statement.setInt(1, qs.getPlayer().getObjectId());
@@ -1674,7 +1674,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void updateQuestVarInDb(QuestState qs, String var, String value)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE character_quests SET value=? WHERE charId=? AND name=? AND var = ?"))
{
statement.setString(1, value);
@@ -1696,7 +1696,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void deleteQuestVarInDb(QuestState qs, String var)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_quests WHERE charId=? AND name=? AND var=?"))
{
statement.setInt(1, qs.getPlayer().getObjectId());
@@ -1717,7 +1717,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void deleteQuestInDb(QuestState qs, boolean repeatable)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(repeatable ? QUEST_DELETE_FROM_CHAR_QUERY : QUEST_DELETE_FROM_CHAR_QUERY_NON_REPEATABLE_QUERY))
{
ps.setInt(1, qs.getPlayer().getObjectId());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java
index 11c78a1a47..9af2be9039 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java
@@ -126,7 +126,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
protected void initFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM residence_functions WHERE residenceId = ?"))
{
ps.setInt(1, _residenceId);
@@ -164,7 +164,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
public void addFunction(ResidenceFunction func)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO residence_functions (id, level, expiration, residenceId) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE level = ?, expiration = ?"))
{
ps.setInt(1, func.getId());
@@ -196,7 +196,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
public void removeFunction(ResidenceFunction func)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM residence_functions WHERE residenceId = ? and id = ?"))
{
ps.setInt(1, _residenceId);
@@ -219,7 +219,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
public void removeFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM residence_functions WHERE residenceId = ?"))
{
ps.setInt(1, _residenceId);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
index 8b91fc77d2..53958bcf5c 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
@@ -50,7 +50,7 @@ public class AccountVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setString(1, _accountName);
@@ -83,7 +83,7 @@ public class AccountVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -120,7 +120,7 @@ public class AccountVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java
index 50fcf2ab6f..5af41a23af 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java
@@ -50,7 +50,7 @@ public class ClanVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setInt(1, _objectId);
@@ -83,7 +83,7 @@ public class ClanVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -120,7 +120,7 @@ public class ClanVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java
index c7ba2ff071..048b15a86e 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java
@@ -55,7 +55,7 @@ public class ItemVariables extends AbstractVariables
public static boolean hasVariables(int objectId)
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_COUNT))
{
st.setInt(1, objectId);
@@ -79,7 +79,7 @@ public class ItemVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setInt(1, _objectId);
@@ -112,7 +112,7 @@ public class ItemVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -149,7 +149,7 @@ public class ItemVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
index 85508e687b..c677c68971 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
@@ -76,7 +76,7 @@ public class PlayerVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setInt(1, _objectId);
@@ -109,7 +109,7 @@ public class PlayerVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -146,7 +146,7 @@ public class PlayerVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/L2GameClient.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/L2GameClient.java
index f1e975876e..fd5baeb233 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/L2GameClient.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/L2GameClient.java
@@ -329,7 +329,7 @@ public final class L2GameClient extends ChannelInboundHandler
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps2 = con.prepareStatement("UPDATE characters SET deletetime=? WHERE charId=?"))
{
ps2.setLong(1, System.currentTimeMillis() + (Config.DELETE_DAYS * 86400000)); // 24*60*60*1000 = 86400000
@@ -354,7 +354,7 @@ public final class L2GameClient extends ChannelInboundHandler
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE characters SET deletetime=0 WHERE charId=?"))
{
statement.setInt(1, objectId);
@@ -377,7 +377,7 @@ public final class L2GameClient extends ChannelInboundHandler
CharNameTable.getInstance().removeName(objid);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM character_contacts WHERE charId=? OR contactId=?"))
{
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
index 297edda360..afcc3fcbb0 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
@@ -164,7 +164,7 @@ public final class RequestDestroyItem implements IClientIncomingPacket
pet.unSummon(activeChar);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
{
statement.setInt(1, _objectId);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java
index 29ab10a108..a9c8dadb8a 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java
@@ -62,7 +62,7 @@ public class RequestPetitionFeedback implements IClientIncomingPacket
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_FEEDBACK))
{
statement.setString(1, player.getName());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java
index 213b230d0b..7fad3b21f2 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java
@@ -73,7 +73,7 @@ public final class RequestAnswerFriendInvite implements IClientIncomingPacket
if (_response == 1)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_friends (charId, friendId) VALUES (?, ?), (?, ?)"))
{
statement.setInt(1, requestor.getObjectId());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java
index 2897338b82..69a271f422 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java
@@ -75,7 +75,7 @@ public final class RequestFriendDel implements IClientIncomingPacket
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_friends WHERE (charId=? AND friendId=?) OR (charId=? AND friendId=?)"))
{
statement.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java
index 94715a15c1..27668b0d62 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java
@@ -74,7 +74,7 @@ public class ConfirmMenteeAdd implements IClientIncomingPacket
}
else if (validate(mentor, mentee))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_mentees (charId, mentorId) VALUES (?, ?)"))
{
statement.setInt(1, mentee.getObjectId());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java
index 91ada4fbba..002abfa04d 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java
@@ -226,7 +226,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
CharSelectInfoPackage charInfopackage;
final List characterList = new LinkedList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM characters WHERE account_name=? ORDER BY createDate"))
{
statement.setString(1, loginName);
@@ -259,7 +259,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
private static void loadCharacterSubclassInfo(CharSelectInfoPackage charInfopackage, int ObjectId, int activeClassId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT exp, sp, level, vitality_points FROM character_subclasses WHERE charId=? AND class_id=? ORDER BY charId"))
{
statement.setInt(1, ObjectId);
@@ -369,7 +369,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
if (weaponObjId > 0)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT mineralId,option1,option2 FROM item_variations WHERE itemId=?"))
{
statement.setInt(1, weaponObjId);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java
index 14cd41a31e..ebb3f90088 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java
@@ -70,7 +70,7 @@ public class FriendList implements IClientOutgoingPacket
if (player1 == null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT char_name, online, classid, level FROM characters WHERE charId = ?"))
{
statement.setInt(1, objId);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java
index 8344576a3e..8876431ff9 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java
@@ -72,7 +72,7 @@ public class SecondaryPasswordAuth
private void loadPassword()
{
String var, value = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SELECT_PASSWORD))
{
statement.setString(1, _activeClient.getAccountName());
@@ -117,7 +117,7 @@ public class SecondaryPasswordAuth
password = cryptPassword(password);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_PASSWORD))
{
statement.setString(1, _activeClient.getAccountName());
@@ -136,7 +136,7 @@ public class SecondaryPasswordAuth
public boolean insertWrongAttempt(int attempts)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_ATTEMPT))
{
statement.setString(1, _activeClient.getAccountName());
@@ -175,7 +175,7 @@ public class SecondaryPasswordAuth
newPassword = cryptPassword(newPassword);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_PASSWORD))
{
statement.setString(1, newPassword);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
index ca0cef4b3b..a78d28bdc9 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
@@ -95,7 +95,7 @@ public final class TaskManager
{
task.onTimeElapsed(this);
lastActivation = System.currentTimeMillis();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[1]))
{
statement.setLong(1, lastActivation);
@@ -182,7 +182,7 @@ public final class TaskManager
private void startAllTasks()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[0]);
ResultSet rset = statement.executeQuery())
{
@@ -314,7 +314,7 @@ public final class TaskManager
private static boolean addUniqueTask(String task, TaskTypes type, String param1, String param2, String param3, long lastActivation)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(SQL_STATEMENTS[2]))
{
ps1.setString(1, task);
@@ -350,7 +350,7 @@ public final class TaskManager
private static boolean addTask(String task, TaskTypes type, String param1, String param2, String param3, long lastActivation)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[3]))
{
statement.setString(1, task);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java
index 5e3e35c6a9..e81b95cba3 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java
@@ -76,7 +76,7 @@ public class TaskBirthday extends Task
private void checkBirthday(int year, int month, int day)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY))
{
statement.setString(1, "%-" + getNum(month + 1) + "-" + getNum(day));
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/util/Evolve.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/util/Evolve.java
index 66a22f62fd..f87e33ed8d 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/util/Evolve.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/gameserver/util/Evolve.java
@@ -248,7 +248,7 @@ public final class Evolve
}
// pet control item no longer exists, delete the pet from the db
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
{
ps.setInt(1, removedItem.getObjectId());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/loginserver/GameServerTable.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/loginserver/GameServerTable.java
index 1a0713b155..2410f6ede8 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/loginserver/GameServerTable.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/loginserver/GameServerTable.java
@@ -115,7 +115,7 @@ public final class GameServerTable implements IGameXmlReader
*/
private void loadRegisteredGameServers()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT * FROM gameservers"))
{
@@ -222,7 +222,7 @@ public final class GameServerTable implements IGameXmlReader
public void registerServerOnDB(byte[] hexId, int id, String externalHost)
{
register(id, new GameServerInfo(id, hexId));
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO gameservers (hexid,server_id,host) values (?,?,?)"))
{
ps.setString(1, hexToString(hexId));
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/loginserver/LoginController.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/loginserver/LoginController.java
index a896c7fd7a..fbee48fc33 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/loginserver/LoginController.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/loginserver/LoginController.java
@@ -176,7 +176,7 @@ public class LoginController
final byte[] raw = password.getBytes(StandardCharsets.UTF_8);
final String hashBase64 = Base64.getEncoder().encodeToString(md.digest(raw));
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(USER_INFO_SELECT))
{
ps.setString(1, Long.toString(System.currentTimeMillis()));
@@ -206,7 +206,7 @@ public class LoginController
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(AUTOCREATE_ACCOUNTS_INSERT))
{
ps.setString(1, login);
@@ -405,7 +405,7 @@ public class LoginController
if (loginOk && (client.getLastServer() != serverId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_LAST_SERVER_UPDATE))
{
ps.setInt(1, serverId);
@@ -424,7 +424,7 @@ public class LoginController
public void setAccountAccessLevel(String account, int banLevel)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_ACCESS_LEVEL_UPDATE))
{
ps.setInt(1, banLevel);
@@ -439,7 +439,7 @@ public class LoginController
public void setAccountLastTracert(String account, String pcIp, String hop1, String hop2, String hop3, String hop4)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_IPS_UPDATE))
{
ps.setString(1, pcIp);
@@ -499,7 +499,7 @@ public class LoginController
{
final List ipWhiteList = new ArrayList<>();
final List ipBlackList = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_IPAUTH_SELECT))
{
ps.setString(1, info.getLogin());
@@ -545,7 +545,7 @@ public class LoginController
client.setAccessLevel(info.getAccessLevel());
client.setLastServer(info.getLastServer());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_INFO_UPDATE))
{
ps.setLong(1, System.currentTimeMillis());
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/loginserver/LoginServer.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/loginserver/LoginServer.java
index 39377afee3..d598992bdf 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/loginserver/LoginServer.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/loginserver/LoginServer.java
@@ -89,7 +89,7 @@ public final class LoginServer
Config.load();
// Prepare Database
- DatabaseFactory.getInstance();
+ DatabaseFactory.init();
try
{
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java
index 69ba99271d..6c73dea27a 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java
@@ -78,7 +78,7 @@ public class ChangePassword extends BaseRecievePacket
int passUpdated = 0;
// SQL connection
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT password FROM accounts WHERE login=?"))
{
ps.setString(1, accountName);
@@ -95,7 +95,7 @@ public class ChangePassword extends BaseRecievePacket
{
final byte[] password = md.digest(newpass.getBytes("UTF-8"));
// SQL connection
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE accounts SET password=? WHERE login=?"))
{
ps.setString(1, Base64.getEncoder().encodeToString(password));
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java
index f9a24a80d8..785946a687 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java
@@ -58,7 +58,7 @@ public class RequestTempBan extends BaseRecievePacket
private void banUser()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO account_data VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE value=?"))
{
ps.setString(1, _accountName);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
index 59b0e01835..4fb705c8b1 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
@@ -43,6 +43,7 @@ public class SQLAccountManager
{
Server.serverMode = Server.MODE_LOGINSERVER;
Config.load();
+ DatabaseFactory.init();
try (Scanner _scn = new Scanner(System.in))
{
@@ -166,7 +167,7 @@ public class SQLAccountManager
}
q = q.concat(" ORDER BY login ASC");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(q);
ResultSet rset = ps.executeQuery())
{
@@ -187,7 +188,7 @@ public class SQLAccountManager
private static void addOrUpdateAccount(String account, String password, String level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE accounts(login, password, accessLevel) VALUES (?, ?, ?)"))
{
final MessageDigest md = MessageDigest.getInstance("SHA");
@@ -213,7 +214,7 @@ public class SQLAccountManager
private static void changeAccountLevel(String account, String level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE accounts SET accessLevel = ? WHERE login = ?"))
{
ps.setString(1, level);
@@ -236,7 +237,7 @@ public class SQLAccountManager
private static void deleteAccount(String account)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM accounts WHERE login = ?"))
{
ps.setString(1, account);
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java
index 4ac531c664..fd25fddae4 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java
@@ -34,7 +34,7 @@ public class DBInstallerConsole implements DBOutputInterface
public DBInstallerConsole(String db, String dir) throws Exception
{
- System.out.println("Welcome to L2J DataBase installer");
+ System.out.println("Welcome to DataBase installer");
final Preferences prop = Preferences.userRoot();
RunTasks rt = null;
try (Scanner scn = new Scanner(new CloseShieldedInputStream(System.in)))
diff --git a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
index c90c8127a6..8e5a6bde49 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
+++ b/L2J_Mobius_Classic_2.1_Zaken/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
@@ -187,6 +187,7 @@ public abstract class BaseGameServerRegister
Server.serverMode = Server.MODE_LOGINSERVER;
Config.load();
+ DatabaseFactory.init();
GameServerTable.getInstance();
_loaded = true;
@@ -215,7 +216,7 @@ public abstract class BaseGameServerRegister
*/
public static void unregisterGameServer(int id) throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM gameservers WHERE server_id = ?"))
{
@@ -231,7 +232,7 @@ public abstract class BaseGameServerRegister
*/
public static void unregisterAllGameServers() throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("DELETE FROM gameservers");
diff --git a/L2J_Mobius_Classic_2.1_Zaken/launcher/Gameserver.launch b/L2J_Mobius_Classic_2.1_Zaken/launcher/Gameserver.launch
index 00717646f6..e7df329a63 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/launcher/Gameserver.launch
+++ b/L2J_Mobius_Classic_2.1_Zaken/launcher/Gameserver.launch
@@ -7,12 +7,13 @@
-
+
+
diff --git a/L2J_Mobius_Classic_2.1_Zaken/launcher/Loginserver.launch b/L2J_Mobius_Classic_2.1_Zaken/launcher/Loginserver.launch
index 966787b80d..9f4d7ddc07 100644
--- a/L2J_Mobius_Classic_2.1_Zaken/launcher/Loginserver.launch
+++ b/L2J_Mobius_Classic_2.1_Zaken/launcher/Loginserver.launch
@@ -7,7 +7,7 @@
-
+
@@ -15,5 +15,6 @@
+
diff --git a/L2J_Mobius_Classic_2.2_Antharas/.classpath b/L2J_Mobius_Classic_2.2_Antharas/.classpath
index 0e50693da9..619d354392 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/.classpath
+++ b/L2J_Mobius_Classic_2.2_Antharas/.classpath
@@ -5,11 +5,12 @@
-
+
-
+
+
diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java
index 9a3b363f56..68ef6d5320 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminChangeAccessLevel.java
@@ -76,7 +76,7 @@ public final class AdminChangeAccessLevel implements IAdminCommandHandler
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET accesslevel=? WHERE char_name=?");
statement.setInt(1, lvl);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
index da016769c5..423854be2a 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminEditChar.java
@@ -627,7 +627,7 @@ public class AdminEditChar implements IAdminCommandHandler
if (player == null)
{
- final Connection con = DatabaseFactory.getInstance().getConnection();
+ final Connection con = DatabaseFactory.getConnection();
final PreparedStatement ps = con.prepareStatement("UPDATE characters SET " + (changeCreateExpiryTime ? "clan_create_expiry_time" : "clan_join_expiry_time") + " WHERE char_name=? LIMIT 1");
ps.setString(1, playerName);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java
index 764ab77c25..969633adcb 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminRepairChar.java
@@ -62,7 +62,7 @@ public class AdminRepairChar implements IAdminCommandHandler
}
final String cmd = "UPDATE characters SET x=-84318, y=244579, z=-3730 WHERE char_name=?";
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement statement = con.prepareStatement(cmd);
statement.setString(1, parts[1]);
@@ -87,13 +87,13 @@ public class AdminRepairChar implements IAdminCommandHandler
return;
}
- // connection = L2DatabaseFactory.getInstance().getConnection();
+ // connection = L2DatabaseFactory.getConnection();
statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=?");
statement.setInt(1, objId);
statement.execute();
statement.close();
- // connection = L2DatabaseFactory.getInstance().getConnection();
+ // connection = L2DatabaseFactory.getConnection();
statement = con.prepareStatement("UPDATE items SET loc=\"INVENTORY\" WHERE owner_id=?");
statement.setInt(1, objId);
statement.execute();
diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java
index 780c3b0088..da0c7dcad2 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminShowQuests.java
@@ -173,7 +173,7 @@ public class AdminShowQuests implements IAdminCommandHandler
private static void showQuestMenu(L2PcInstance target, L2PcInstance actor, String[] val)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
ResultSet rs;
PreparedStatement req;
diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java
index 35508761a2..a8b6ed6963 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/admincommandhandlers/AdminTeleport.java
@@ -489,7 +489,7 @@ public class AdminTeleport implements IAdminCommandHandler
final int x = activeChar.getX();
final int y = activeChar.getY();
final int z = activeChar.getZ();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final PreparedStatement statement = con.prepareStatement("UPDATE characters SET x=?, y=?, z=? WHERE char_name=?");
statement.setInt(1, x);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java
index b4e722f105..3913b5b368 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/communityboard/FavoriteBoard.java
@@ -61,7 +61,7 @@ public class FavoriteBoard implements IParseBoardHandler
// Load Favorite links
final String list = HtmCache.getInstance().getHtm(activeChar, "data/html/CommunityBoard/favorite_list.html");
final StringBuilder sb = new StringBuilder();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_FAVORITES))
{
ps.setInt(1, activeChar.getObjectId());
@@ -98,7 +98,7 @@ public class FavoriteBoard implements IParseBoardHandler
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_FAVORITE))
{
ps.setInt(1, activeChar.getObjectId());
@@ -123,7 +123,7 @@ public class FavoriteBoard implements IParseBoardHandler
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_FAVORITE))
{
ps.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/communityboard/HomeBoard.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
index bed19004d2..1f5572ec39 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/communityboard/HomeBoard.java
@@ -300,7 +300,7 @@ public final class HomeBoard implements IParseBoardHandler
private static int getFavoriteCount(L2PcInstance player)
{
int count = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(COUNT_FAVORITES))
{
ps.setInt(1, player.getObjectId());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
index 59ecba44bb..e0708990b7 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/data/scripts/handlers/usercommandhandlers/ClanWarsList.java
@@ -62,7 +62,7 @@ public class ClanWarsList implements IUserCommandHandler
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
String query;
// Attack List
diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/game/java.cfg b/L2J_Mobius_Classic_2.2_Antharas/dist/game/java.cfg
index cb4a4dc204..58213e428e 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/dist/game/java.cfg
+++ b/L2J_Mobius_Classic_2.2_Antharas/dist/game/java.cfg
@@ -1 +1 @@
--server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
\ No newline at end of file
+-server -Dfile.encoding=UTF-8 -Djava.util.logging.manager=com.l2jmobius.log.L2LogManager -Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=error -XX:+AggressiveOpts -Xnoclassgc -XX:+CMSParallelRemarkEnabled -XX:SurvivorRatio=8 -Xmx4g -Xms2g -Xmn1g
\ No newline at end of file
diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/libs/HikariCP-3.2.0.jar b/L2J_Mobius_Classic_2.2_Antharas/dist/libs/HikariCP-3.2.0.jar
new file mode 100644
index 0000000000..a030a7f8dc
Binary files /dev/null and b/L2J_Mobius_Classic_2.2_Antharas/dist/libs/HikariCP-3.2.0.jar differ
diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/libs/c3p0-0.9.5.2.jar b/L2J_Mobius_Classic_2.2_Antharas/dist/libs/c3p0-0.9.5.2.jar
deleted file mode 100644
index 579cedd980..0000000000
Binary files a/L2J_Mobius_Classic_2.2_Antharas/dist/libs/c3p0-0.9.5.2.jar and /dev/null differ
diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/libs/mchange-commons-java-0.2.12.jar b/L2J_Mobius_Classic_2.2_Antharas/dist/libs/mchange-commons-java-0.2.12.jar
deleted file mode 100644
index af11054860..0000000000
Binary files a/L2J_Mobius_Classic_2.2_Antharas/dist/libs/mchange-commons-java-0.2.12.jar and /dev/null differ
diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/libs/slf4j-api-1.7.25.jar b/L2J_Mobius_Classic_2.2_Antharas/dist/libs/slf4j-api-1.7.25.jar
new file mode 100644
index 0000000000..7e62f1336d
Binary files /dev/null and b/L2J_Mobius_Classic_2.2_Antharas/dist/libs/slf4j-api-1.7.25.jar differ
diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/libs/slf4j-simple-1.7.25.jar b/L2J_Mobius_Classic_2.2_Antharas/dist/libs/slf4j-simple-1.7.25.jar
new file mode 100644
index 0000000000..b29ca12719
Binary files /dev/null and b/L2J_Mobius_Classic_2.2_Antharas/dist/libs/slf4j-simple-1.7.25.jar differ
diff --git a/L2J_Mobius_Classic_2.2_Antharas/dist/login/java.cfg b/L2J_Mobius_Classic_2.2_Antharas/dist/login/java.cfg
index 00ae5b3a66..bda4cdd24d 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/dist/login/java.cfg
+++ b/L2J_Mobius_Classic_2.2_Antharas/dist/login/java.cfg
@@ -1 +1 @@
--server -Xms128m -Xmx256m
\ No newline at end of file
+-server -Dorg.slf4j.simpleLogger.log.com.zaxxer.hikari=error -Xms128m -Xmx256m
\ No newline at end of file
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/commons/database/DatabaseFactory.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/commons/database/DatabaseFactory.java
index 68d02d4171..dd481d2fd0 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/commons/database/DatabaseFactory.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/commons/database/DatabaseFactory.java
@@ -16,122 +16,68 @@
*/
package com.l2jmobius.commons.database;
-import java.beans.PropertyVetoException;
import java.sql.Connection;
-import java.sql.SQLException;
import java.util.logging.Logger;
import com.l2jmobius.Config;
-import com.mchange.v2.c3p0.ComboPooledDataSource;
+import com.zaxxer.hikari.HikariDataSource;
/**
- * Database Factory implementation.
- * @author Zoey76, Mobius
+ * @author Mobius
*/
public class DatabaseFactory
{
private static final Logger LOGGER = Logger.getLogger(DatabaseFactory.class.getName());
- private final ComboPooledDataSource _dataSource;
+ private static final HikariDataSource _hds = new HikariDataSource();
- public DatabaseFactory()
+ public static void init()
{
- if (Config.DATABASE_MAX_CONNECTIONS < 2)
- {
- Config.DATABASE_MAX_CONNECTIONS = 2;
- LOGGER.warning("A minimum of 2 connections are required.");
- }
-
- _dataSource = new ComboPooledDataSource();
- _dataSource.setAutoCommitOnClose(true);
-
- _dataSource.setInitialPoolSize(10);
- _dataSource.setMinPoolSize(10);
- _dataSource.setMaxPoolSize(Math.max(10, Config.DATABASE_MAX_CONNECTIONS));
-
- _dataSource.setAcquireRetryAttempts(0); // try to obtain connections indefinitely (0 = never quit)
- _dataSource.setAcquireRetryDelay(500); // 500 milliseconds wait before try to acquire connection again
- _dataSource.setCheckoutTimeout(0); // 0 = wait indefinitely for new connection if pool is exhausted
- _dataSource.setAcquireIncrement(5); // if pool is exhausted, get 5 more connections at a time cause there is
- // a "long" delay on acquire connection so taking more than one connection at once will make connection pooling more effective.
-
- // this "connection_test_table" is automatically created if not already there
- _dataSource.setAutomaticTestTable("connection_test_table");
- _dataSource.setTestConnectionOnCheckin(false);
-
- // testing OnCheckin used with IdleConnectionTestPeriod is faster than testing on checkout
-
- _dataSource.setIdleConnectionTestPeriod(3600); // test idle connection every 60 sec
- _dataSource.setMaxIdleTime(Config.DATABASE_MAX_IDLE_TIME); // 0 = idle connections never expire
- // *THANKS* to connection testing configured above but I prefer to disconnect all connections not used for more than 1 hour
-
- // enables statement caching, there is a "semi-bug" in c3p0 0.9.0 but in 0.9.0.2 and later it's fixed
- _dataSource.setMaxStatementsPerConnection(100);
-
- _dataSource.setBreakAfterAcquireFailure(false); // never fail if any way possible setting this to true will make c3p0 "crash"
- // and refuse to work till restart thus making acquire errors "FATAL" ... we don't want that it should be possible to recover
+ _hds.setDriverClassName(Config.DATABASE_DRIVER);
+ _hds.setJdbcUrl(Config.DATABASE_URL);
+ _hds.setUsername(Config.DATABASE_LOGIN);
+ _hds.setPassword(Config.DATABASE_PASSWORD);
+ _hds.setMaximumPoolSize(Config.DATABASE_MAX_CONNECTIONS);
+ _hds.setIdleTimeout(Config.DATABASE_MAX_IDLE_TIME);
+ // Test if connection is valid.
try
{
- _dataSource.setDriverClass(Config.DATABASE_DRIVER);
+ _hds.getConnection().close();
+ LOGGER.info("Database: Initialized.");
}
- catch (PropertyVetoException e)
+ catch (Exception e)
{
e.printStackTrace();
}
- _dataSource.setJdbcUrl(Config.DATABASE_URL);
- _dataSource.setUser(Config.DATABASE_LOGIN);
- _dataSource.setPassword(Config.DATABASE_PASSWORD);
-
- /* Test the connection */
- try
- {
- _dataSource.getConnection().close();
- }
- catch (SQLException e)
- {
- e.printStackTrace();
- }
-
- LOGGER.info("Database: Initialized.");
}
- public Connection getConnection()
+ public static Connection getConnection()
{
Connection con = null;
while (con == null)
{
try
{
- con = _dataSource.getConnection();
+ con = _hds.getConnection();
}
- catch (SQLException e)
+ catch (Exception e)
{
- LOGGER.warning(getClass().getSimpleName() + ": Unable to get a connection: " + e.getMessage());
+ LOGGER.severe("DatabaseFactory: Cound not get a connection. " + e);
}
}
return con;
}
- public void close()
+ public static void close()
{
try
{
- _dataSource.close();
+ _hds.close();
}
catch (Exception e)
{
- LOGGER.info(e.getMessage());
+ LOGGER.severe("DatabaseFactory: There was a problem closing the data source. " + e);
}
}
-
- public static DatabaseFactory getInstance()
- {
- return SingletonHolder.INSTANCE;
- }
-
- private static class SingletonHolder
- {
- protected static final DatabaseFactory INSTANCE = new DatabaseFactory();
- }
}
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/GameServer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/GameServer.java
index 8443fe28c5..a7f428efde 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/GameServer.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/GameServer.java
@@ -193,7 +193,7 @@ public class GameServer
// Initialize config
Config.load();
printSection("Database");
- DatabaseFactory.getInstance();
+ DatabaseFactory.init();
printSection("ThreadPool");
ThreadPool.init();
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/LoginServerThread.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/LoginServerThread.java
index e26cf1111a..ba22e9ae11 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/LoginServerThread.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/LoginServerThread.java
@@ -587,7 +587,7 @@ public class LoginServerThread extends Thread
int chars = 0;
final List charToDel = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT deletetime FROM characters WHERE account_name=?"))
{
ps.setString(1, account);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/Shutdown.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/Shutdown.java
index 1faf2780db..09b0fd9c85 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/Shutdown.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/Shutdown.java
@@ -205,7 +205,7 @@ public class Shutdown extends Thread
// commit data, last chance
try
{
- DatabaseFactory.getInstance().close();
+ DatabaseFactory.close();
LOGGER.info("Database Factory: Database connection has been shut down(" + tc.getEstimatedTimeAndRestartCounter() + "ms).");
}
catch (Throwable t)
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
index 3f98953c02..320a104fca 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/communitybbs/BB/Forum.java
@@ -93,7 +93,7 @@ public class Forum
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM forums WHERE forum_id=?"))
{
ps.setInt(1, _forumId);
@@ -114,7 +114,7 @@ public class Forum
LOGGER.log(Level.WARNING, "Data error on Forum " + _forumId + " : " + e.getMessage(), e);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM topic WHERE topic_forum_id=? ORDER BY topic_id DESC"))
{
ps.setInt(1, _forumId);
@@ -139,7 +139,7 @@ public class Forum
private void getChildren()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT forum_id FROM forums WHERE forum_parent=?"))
{
ps.setInt(1, _forumId);
@@ -217,7 +217,7 @@ public class Forum
public void insertIntoDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO forums (forum_id,forum_name,forum_parent,forum_post,forum_type,forum_perm,forum_owner_id) VALUES (?,?,?,?,?,?,?)"))
{
ps.setInt(1, _forumId);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
index fa2f1da2d9..5f970fa0a5 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/communitybbs/BB/Post.java
@@ -72,7 +72,7 @@ public class Post
private void insertindb(CPost cp)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO posts (post_id,post_owner_name,post_ownerid,post_date,post_topic_id,post_forum_id,post_txt) values (?,?,?,?,?,?,?)"))
{
ps.setInt(1, cp.postId);
@@ -112,7 +112,7 @@ public class Post
public void deleteme(Topic t)
{
PostBBSManager.getInstance().delPostByTopic(t);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM posts WHERE post_forum_id=? AND post_topic_id=?"))
{
ps.setInt(1, t.getForumID());
@@ -130,7 +130,7 @@ public class Post
*/
private void load(Topic t)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM posts WHERE post_forum_id=? AND post_topic_id=? ORDER BY post_id ASC"))
{
ps.setInt(1, t.getForumID());
@@ -162,7 +162,7 @@ public class Post
*/
public void updatetxt(int i)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE posts SET post_txt=? WHERE post_id=? AND post_topic_id=? AND post_forum_id=?"))
{
final CPost cp = getCPost(i);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
index ae7b7c6318..2cb2303f58 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/communitybbs/BB/Topic.java
@@ -71,7 +71,7 @@ public class Topic
private void insertindb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO topic (topic_id,topic_forum_id,topic_name,topic_date,topic_ownername,topic_ownerid,topic_type,topic_reply) values (?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, _id);
@@ -129,7 +129,7 @@ public class Topic
{
TopicBBSManager.getInstance().delTopic(this);
f.rmTopicByID(_id);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM topic WHERE topic_id=? AND topic_forum_id=?"))
{
ps.setInt(1, _id);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
index 57a47cf456..c68fb57089 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/communitybbs/Manager/ForumsBBSManager.java
@@ -40,7 +40,7 @@ public class ForumsBBSManager extends BaseBBSManager
protected ForumsBBSManager()
{
_table = new CopyOnWriteArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT forum_id FROM forums WHERE forum_type = 0"))
{
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java
index adc2b28a17..b3b101e521 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/AnnouncementsTable.java
@@ -52,7 +52,7 @@ public final class AnnouncementsTable
private void load()
{
_announcements.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery("SELECT * FROM announcements"))
{
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java
index 4aa8b72edb..5bb8ebbe43 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/CharNameTable.java
@@ -99,7 +99,7 @@ public class CharNameTable
int id = -1;
int accessLevel = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT charId,accesslevel FROM characters WHERE char_name=?"))
{
ps.setString(1, name);
@@ -145,7 +145,7 @@ public class CharNameTable
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT char_name,accesslevel FROM characters WHERE charId=?"))
{
ps.setInt(1, id);
@@ -176,7 +176,7 @@ public class CharNameTable
public synchronized boolean doesCharNameExist(String name)
{
boolean result = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT COUNT(*) as count FROM characters WHERE char_name=?"))
{
ps.setString(1, name);
@@ -197,7 +197,7 @@ public class CharNameTable
public int getAccountCharacterCount(String account)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT COUNT(char_name) as count FROM characters WHERE account_name=?"))
{
ps.setString(1, account);
@@ -218,7 +218,7 @@ public class CharNameTable
public int getLevelById(int objectId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT level FROM characters WHERE charId = ?"))
{
ps.setInt(1, objectId);
@@ -239,7 +239,7 @@ public class CharNameTable
public int getClassIdById(int objectId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT classid FROM characters WHERE charId = ?"))
{
ps.setInt(1, objectId);
@@ -260,7 +260,7 @@ public class CharNameTable
public int getClanIdById(int objectId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clanId FROM characters WHERE charId = ?"))
{
ps.setInt(1, objectId);
@@ -281,7 +281,7 @@ public class CharNameTable
private void loadAll()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT charId, char_name, accesslevel FROM characters"))
{
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java
index 021a434a38..6315404c36 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/CharSummonTable.java
@@ -70,7 +70,7 @@ public class CharSummonTable
{
if (Config.RESTORE_SERVITOR_ON_RECONNECT)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(INIT_SUMMONS))
{
@@ -87,7 +87,7 @@ public class CharSummonTable
if (Config.RESTORE_PET_ON_RECONNECT)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(INIT_PET))
{
@@ -111,7 +111,7 @@ public class CharSummonTable
return !v.isEmpty() ? v : null;
});
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(REMOVE_SUMMON))
{
ps.setInt(1, activeChar.getObjectId());
@@ -181,7 +181,7 @@ public class CharSummonTable
public void restoreServitor(L2PcInstance activeChar)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(LOAD_SUMMON))
{
ps.setInt(1, activeChar.getObjectId());
@@ -229,7 +229,7 @@ public class CharSummonTable
_servitors.computeIfAbsent(summon.getOwner().getObjectId(), k -> ConcurrentHashMap.newKeySet()).add(summon.getObjectId());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SAVE_SUMMON))
{
ps.setInt(1, summon.getOwner().getObjectId());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java
index d0cd743b0f..aee103e2e5 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/ClanTable.java
@@ -80,7 +80,7 @@ public class ClanTable
L2Clan clan;
// Count the clans
int clanCount = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT clan_id FROM clan_data"))
{
@@ -262,7 +262,7 @@ public class ClanTable
_clans.remove(clanId);
IdFactory.getInstance().releaseId(clanId);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM clan_data WHERE clan_id=?"))
{
@@ -361,7 +361,7 @@ public class ClanTable
public void storeclanswars(ClanWar war)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO clan_wars (clan1, clan2, clan1Kill, clan2Kill, winnerClan, startTime, endTime, state) VALUES(?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, war.getAttackerClanId());
@@ -392,7 +392,7 @@ public class ClanTable
clan1.broadcastClanStatus();
clan2.broadcastClanStatus();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM clan_wars WHERE clan1=? AND clan2=?"))
{
ps.setInt(1, clanId1);
@@ -407,7 +407,7 @@ public class ClanTable
private void restorewars()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery("SELECT clan1, clan2, clan1Kill, clan2Kill, winnerClan, startTime, endTime, state FROM clan_wars"))
{
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java
index f90657a886..907f92e5f6 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/CrestTable.java
@@ -72,7 +72,7 @@ public final class CrestTable
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement(ResultSet.TYPE_FORWARD_ONLY, ResultSet.CONCUR_UPDATABLE);
ResultSet rs = statement.executeQuery("SELECT `crest_id`, `data`, `type` FROM `crests` ORDER BY `crest_id` DESC"))
{
@@ -154,7 +154,7 @@ public final class CrestTable
*/
public L2Crest createCrest(byte[] data, CrestType crestType)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO `crests`(`crest_id`, `data`, `type`) VALUES(?, ?, ?)"))
{
final L2Crest crest = new L2Crest(_nextId.getAndIncrement(), data, crestType);
@@ -187,7 +187,7 @@ public final class CrestTable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM `crests` WHERE `crest_id` = ?"))
{
statement.setInt(1, crestId);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java
index 2be088cd17..b281c6dbe0 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/OfflineTradersTable.java
@@ -56,7 +56,7 @@ public class OfflineTradersTable
public void storeOffliners()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS);
PreparedStatement stm3 = con.prepareStatement(SAVE_OFFLINE_STATUS);
@@ -173,7 +173,7 @@ public class OfflineTradersTable
{
LOGGER.info(getClass().getSimpleName() + ": Loading offline traders...");
int nTraders = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement stm = con.createStatement();
ResultSet rs = stm.executeQuery(LOAD_OFFLINE_STATUS))
{
@@ -329,7 +329,7 @@ public class OfflineTradersTable
public static synchronized void onTransaction(L2PcInstance trader, boolean finished, boolean firstCall)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_PLAYER);
PreparedStatement stm3 = con.prepareStatement(SAVE_ITEMS);
@@ -453,7 +453,7 @@ public class OfflineTradersTable
{
PlayerCountManager.getInstance().decOfflineTradeCount();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stm1 = con.prepareStatement(CLEAR_OFFLINE_TABLE_ITEMS_PLAYER);
PreparedStatement stm2 = con.prepareStatement(CLEAR_OFFLINE_TABLE_PLAYER))
{
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java
index 333e0e2289..4013e5e460 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/sql/impl/PetNameTable.java
@@ -42,7 +42,7 @@ public class PetNameTable
public boolean doesPetNameExist(String name, int petNpcId)
{
boolean result = true;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT name FROM pets p, items i WHERE p.item_obj_id = i.object_id AND name=? AND i.item_id IN (?)"))
{
ps.setString(1, name);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java
index 33e2d0df1d..0de4769849 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/data/xml/impl/BuyListData.java
@@ -66,7 +66,7 @@ public final class BuyListData implements IGameXmlReader
LOGGER.info(getClass().getSimpleName() + ": Loaded " + _buyLists.size() + " BuyLists.");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rs = statement.executeQuery("SELECT * FROM `buylists`"))
{
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/datatables/BotReportTable.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/datatables/BotReportTable.java
index bbc6672f94..1d92e316f3 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/datatables/BotReportTable.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/datatables/BotReportTable.java
@@ -112,7 +112,7 @@ public final class BotReportTable
*/
private void loadReportedCharData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery(SQL_LOAD_REPORTED_CHAR_DATA))
{
@@ -181,7 +181,7 @@ public final class BotReportTable
*/
public void saveReportedCharData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
PreparedStatement ps = con.prepareStatement(SQL_INSERT_REPORTED_CHAR_DATA))
{
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/datatables/ItemTable.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/datatables/ItemTable.java
index 2f5fde4fb3..69ba816691 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/datatables/ItemTable.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/datatables/ItemTable.java
@@ -387,7 +387,7 @@ public class ItemTable
// if it's a pet control item, delete the pet as well
if (item.getItem().isPetItem())
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
{
// Delete the pet in db
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/datatables/SchemeBufferTable.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/datatables/SchemeBufferTable.java
index 7b47d8fc45..e72715b441 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/datatables/SchemeBufferTable.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/datatables/SchemeBufferTable.java
@@ -58,7 +58,7 @@ public class SchemeBufferTable
{
int count = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
PreparedStatement st = con.prepareStatement(LOAD_SCHEMES);
ResultSet rs = st.executeQuery();
@@ -135,7 +135,7 @@ public class SchemeBufferTable
public void saveSchemes()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Delete all entries from database.
PreparedStatement st = con.prepareStatement(DELETE_SCHEMES);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java
index 660b537dc5..5854717647 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/handler/AbstractDailyMissionHandler.java
@@ -77,7 +77,7 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer
public synchronized void reset()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_daily_rewards WHERE rewardId = ? AND status = ?"))
{
ps.setInt(1, _holder.getId());
@@ -118,7 +118,7 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer
protected void storePlayerEntry(DailyMissionPlayerEntry entry)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO character_daily_rewards (charId, rewardId, status, progress, lastCompleted) VALUES (?, ?, ?, ?, ?)"))
{
ps.setInt(1, entry.getObjectId());
@@ -145,7 +145,7 @@ public abstract class AbstractDailyMissionHandler extends ListenersContainer
return existingEntry;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM character_daily_rewards WHERE charId = ? AND rewardId = ?"))
{
ps.setInt(1, objectId);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/idfactory/IdFactory.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
index baaadc776c..34f7280917 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/idfactory/IdFactory.java
@@ -128,7 +128,7 @@ public abstract class IdFactory
*/
private void setAllCharacterOffline()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("UPDATE characters SET online = 0");
@@ -145,7 +145,7 @@ public abstract class IdFactory
*/
private void cleanUpDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement stmt = con.createStatement())
{
final long cleanupStart = System.currentTimeMillis();
@@ -253,7 +253,7 @@ public abstract class IdFactory
private void cleanUpTimeStamps()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
int cleanCount = 0;
for (String line : TIMESTAMPS_CLEAN)
@@ -279,7 +279,7 @@ public abstract class IdFactory
protected final Integer[] extractUsedObjectIDTable() throws Exception
{
final List temp = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
String extractUsedObjectIdsQuery = "";
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
index 9e5d1cedcf..21ed01119d 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/idfactory/StackIDFactory.java
@@ -42,7 +42,7 @@ public class StackIDFactory extends IdFactory
_curOID = FIRST_OID;
_tempOID = FIRST_OID;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// con.createStatement().execute("drop table if exists tmp_obj_id");
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java
index c1c614e3f8..85f3d57b5d 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/AirShipManager.java
@@ -169,7 +169,7 @@ public class AirShipManager
_airShipsInfo.put(ownerId, info);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_DB))
{
ps.setInt(1, ownerId);
@@ -265,7 +265,7 @@ public class AirShipManager
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery(LOAD_DB))
{
@@ -296,7 +296,7 @@ public class AirShipManager
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_DB))
{
ps.setInt(1, info.getInt("fuel"));
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
index afc836f427..0808ef7947 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/CastleManager.java
@@ -198,7 +198,7 @@ public final class CastleManager implements InstanceListManager
}
}
// else offline-player circlet removal
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM items WHERE owner_id = ? and item_id = ?"))
{
ps.setInt(1, member.getObjectId());
@@ -215,7 +215,7 @@ public final class CastleManager implements InstanceListManager
@Override
public void loadInstances()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT id FROM castle ORDER BY id"))
{
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
index 6a9dff749b..4c73fd01a3 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/CastleManorManager.java
@@ -162,7 +162,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
private void loadDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stProduction = con.prepareStatement("SELECT * FROM castle_manor_production WHERE castle_id=?");
PreparedStatement stProcure = con.prepareStatement("SELECT * FROM castle_manor_procure WHERE castle_id=?"))
{
@@ -436,7 +436,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
_productionNext.put(castleId, list);
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement dps = con.prepareStatement("DELETE FROM castle_manor_production WHERE castle_id = ? AND next_period = 1");
PreparedStatement ips = con.prepareStatement(INSERT_PRODUCT))
{
@@ -472,7 +472,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
_procureNext.put(castleId, list);
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement dps = con.prepareStatement("DELETE FROM castle_manor_procure WHERE castle_id = ? AND next_period = 1");
PreparedStatement ips = con.prepareStatement(INSERT_CROP))
{
@@ -506,7 +506,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
public final void updateCurrentProduction(int castleId, Collection items)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle_manor_production SET amount = ? WHERE castle_id = ? AND seed_id = ? AND next_period = 0"))
{
for (SeedProduction sp : items)
@@ -526,7 +526,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
public final void updateCurrentProcure(int castleId, Collection items)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle_manor_procure SET amount = ? WHERE castle_id = ? AND crop_id = ? AND next_period = 0"))
{
for (CropProcure sp : items)
@@ -599,7 +599,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
@Override
public final boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ds = con.prepareStatement("DELETE FROM castle_manor_production");
PreparedStatement is = con.prepareStatement(INSERT_PRODUCT);
PreparedStatement dp = con.prepareStatement("DELETE FROM castle_manor_procure");
@@ -697,7 +697,7 @@ public final class CastleManorManager implements IGameXmlReader, IStorable
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ds = con.prepareStatement("DELETE FROM castle_manor_production WHERE castle_id = ?");
PreparedStatement dc = con.prepareStatement("DELETE FROM castle_manor_procure WHERE castle_id = ?"))
{
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java
index 60b1435775..f40c3bdd04 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/CeremonyOfChaosManager.java
@@ -91,7 +91,7 @@ public class CeremonyOfChaosManager extends AbstractEventManager clanApplicantList = _applicantList.get(clanId);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_APPLICANT))
{
statement.setInt(1, playerId);
@@ -189,7 +189,7 @@ public class ClanEntryManager
{
_applicantList.computeIfAbsent(clanId, k -> new ConcurrentHashMap<>()).put(info.getPlayerId(), info);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_APPLICANT))
{
statement.setInt(1, info.getPlayerId());
@@ -216,7 +216,7 @@ public class ClanEntryManager
{
if (!_playerLocked.containsKey(playerId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_WAITING_LIST))
{
statement.setInt(1, info.getPlayerId());
@@ -237,7 +237,7 @@ public class ClanEntryManager
{
if (_waitingList.containsKey(playerId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_WAITING_LIST))
{
statement.setInt(1, playerId);
@@ -258,7 +258,7 @@ public class ClanEntryManager
{
if (!_clanList.containsKey(clanId) && !_clanLocked.containsKey(clanId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_CLAN_RECRUIT))
{
statement.setInt(1, info.getClanId());
@@ -283,7 +283,7 @@ public class ClanEntryManager
{
if (_clanList.containsKey(clanId) && !_clanLocked.containsKey(clanId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CLAN_RECRUIT))
{
statement.setInt(1, info.getKarma());
@@ -307,7 +307,7 @@ public class ClanEntryManager
{
if (_clanList.containsKey(clanId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_CLAN_RECRUIT))
{
statement.setInt(1, clanId);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java
index e424e0ad7e..6ba2c94bb2 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/CommissionManager.java
@@ -79,7 +79,7 @@ public final class CommissionManager
protected CommissionManager()
{
final Map itemInstances = new HashMap<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement(SELECT_ALL_ITEMS))
{
@@ -245,7 +245,7 @@ public final class CommissionManager
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_COMMISSION_ITEM, Statement.RETURN_GENERATED_KEYS))
{
final Instant startTime = Instant.now();
@@ -398,7 +398,7 @@ public final class CommissionManager
*/
private boolean deleteItemFromDB(long commissionId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_COMMISSION_ITEM))
{
ps.setLong(1, commissionId);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
index 9e5b85cf52..398058a743 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/CursedWeaponsManager.java
@@ -142,7 +142,7 @@ public final class CursedWeaponsManager implements IGameXmlReader
private void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT itemId, charId, playerReputation, playerPkKills, nbKills, endTime FROM cursed_weapons"))
{
@@ -167,7 +167,7 @@ public final class CursedWeaponsManager implements IGameXmlReader
private void controlPlayers()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT owner_id FROM items WHERE item_id=?"))
{
// TODO: See comments below...
@@ -338,7 +338,7 @@ public final class CursedWeaponsManager implements IGameXmlReader
public static void removeFromDb(int itemId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM cursed_weapons WHERE itemId = ?"))
{
ps.setInt(1, itemId);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java
index ced8c5abd2..a881e85ae4 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/DBSpawnManager.java
@@ -85,7 +85,7 @@ public class DBSpawnManager
_storedInfo.clear();
_schedules.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM npc_respawns");
ResultSet rset = statement.executeQuery())
{
@@ -275,7 +275,7 @@ public class DBSpawnManager
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO npc_respawns (id, x, y, z, heading, respawnTime, currentHp, currentMp) VALUES(?, ?, ?, ?, ?, ?, ?, ?)"))
{
statement.setInt(1, spawn.getId());
@@ -331,7 +331,7 @@ public class DBSpawnManager
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO npc_respawns (id, x, y, z, heading, respawnTime, currentHp, currentMp) VALUES(?, ?, ?, ?, ?, ?, ?, ?)"))
{
statement.setInt(1, spawn.getId());
@@ -380,7 +380,7 @@ public class DBSpawnManager
if (updateDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM npc_respawns WHERE id = ?"))
{
ps.setInt(1, npcId);
@@ -401,7 +401,7 @@ public class DBSpawnManager
*/
private void updateDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE npc_respawns SET respawnTime = ?, currentHP = ?, currentMP = ? WHERE id = ?"))
{
for (Integer npcId : _storedInfo.keySet())
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java
index 3dd467d653..f25bc2e852 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/DailyTaskManager.java
@@ -120,7 +120,7 @@ public class DailyTaskManager extends AbstractEventManager>
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement st = con.prepareStatement("UPDATE character_subclasses SET vitality_points = ?"))
{
@@ -150,7 +150,7 @@ public class DailyTaskManager extends AbstractEventManager>
private void resetExtendDrop()
{
// Update data for offline players.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_variables WHERE var = ?"))
{
ps.setString(1, PlayerVariables.EXTEND_DROP);
@@ -173,7 +173,7 @@ public class DailyTaskManager extends AbstractEventManager>
private void resetDailySkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final List dailySkills = getVariables().getList("reset_skills", SkillHolder.class, Collections.emptyList());
for (SkillHolder skill : dailySkills)
@@ -200,7 +200,7 @@ public class DailyTaskManager extends AbstractEventManager>
}
// Update data for offline players.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE character_variables SET val = ? WHERE var = ?"))
{
ps.setInt(1, 0);
@@ -225,7 +225,7 @@ public class DailyTaskManager extends AbstractEventManager>
private void resetRecommends()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("UPDATE character_reco_bonus SET rec_left = ?, rec_have = 0 WHERE rec_have <= 20"))
{
@@ -258,7 +258,7 @@ public class DailyTaskManager extends AbstractEventManager>
if (Config.TRAINING_CAMP_ENABLE)
{
// Update data for offline players.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM account_gsdata WHERE var = ?"))
{
ps.setString(1, "TRAINING_CAMP_DURATION");
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java
index f635c19883..7101b82852 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/FactionManager.java
@@ -46,7 +46,7 @@ public class FactionManager
private void loadAll()
{
_playerFactions.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT charId, faction FROM characters"))
{
@@ -75,7 +75,7 @@ public class FactionManager
return factionId;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT faction FROM characters WHERE charId=?"))
{
ps.setInt(1, id);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/FortManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
index 0fbe44bc6d..56ab9144cf 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/FortManager.java
@@ -121,7 +121,7 @@ public final class FortManager implements InstanceListManager
@Override
public void loadInstances()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT id FROM fort ORDER BY id"))
{
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
index 0a5245dafc..4eb6258b05 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/FortSiegeManager.java
@@ -86,7 +86,7 @@ public final class FortSiegeManager
}
boolean register = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clan_id FROM fortsiege_clans where clan_id=? and fort_id=?"))
{
ps.setInt(1, clan.getId());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
index e9f6bb3475..044d74609a 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/GlobalVariablesManager.java
@@ -56,7 +56,7 @@ public final class GlobalVariablesManager extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery(SELECT_QUERY))
{
@@ -87,7 +87,7 @@ public final class GlobalVariablesManager extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement del = con.createStatement();
PreparedStatement st = con.prepareStatement(INSERT_QUERY))
{
@@ -119,7 +119,7 @@ public final class GlobalVariablesManager extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement del = con.createStatement())
{
del.execute(DELETE_QUERY);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
index 7102530261..e46a1599e4 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/GrandBossManager.java
@@ -62,7 +62,7 @@ public final class GrandBossManager implements IStorable
private void init()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement();
ResultSet rs = s.executeQuery("SELECT * from grandboss_data ORDER BY boss_id"))
{
@@ -154,7 +154,7 @@ public final class GrandBossManager implements IStorable
@Override
public boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
for (Entry e : _storedInfo.entrySet())
{
@@ -206,7 +206,7 @@ public final class GrandBossManager implements IStorable
private void updateDb(int bossId, boolean statusOnly)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
final L2GrandBossInstance boss = _bosses.get(bossId);
final StatsSet info = _storedInfo.get(bossId);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java
index 0939f2cf18..4a0efbc831 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/InstanceManager.java
@@ -498,7 +498,7 @@ public final class InstanceManager implements IGameXmlReader
*/
private void restoreInstanceTimes()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT * FROM character_instance_time ORDER BY charId"))
{
@@ -550,7 +550,7 @@ public final class InstanceManager implements IGameXmlReader
// Remove them
if (!invalidPenalty.isEmpty())
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_INSTANCE_TIME))
{
for (Integer id : invalidPenalty)
@@ -615,7 +615,7 @@ public final class InstanceManager implements IGameXmlReader
*/
public void deleteInstanceTime(L2PcInstance player, int id)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_INSTANCE_TIME))
{
ps.setInt(1, player.getObjectId());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java
index e0599ea3fe..eb105b45f3 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/ItemAuctionManager.java
@@ -55,7 +55,7 @@ public final class ItemAuctionManager implements IGameXmlReader
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery("SELECT auctionId FROM item_auction ORDER BY auctionId DESC LIMIT 0, 1"))
{
@@ -134,7 +134,7 @@ public final class ItemAuctionManager implements IGameXmlReader
public static void deleteAuction(int auctionId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement statement = con.prepareStatement("DELETE FROM item_auction WHERE auctionId=?"))
{
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
index fba190d620..5bbbecc082 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/ItemsOnGroundManager.java
@@ -80,7 +80,7 @@ public final class ItemsOnGroundManager implements Runnable
str = "UPDATE itemsonground SET drop_time = ? WHERE drop_time = -1";
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(str))
{
ps.setLong(1, System.currentTimeMillis());
@@ -93,7 +93,7 @@ public final class ItemsOnGroundManager implements Runnable
}
// Add items to world
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable FROM itemsonground"))
{
int count = 0;
@@ -178,7 +178,7 @@ public final class ItemsOnGroundManager implements Runnable
public void emptyTable()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("DELETE FROM itemsonground");
@@ -204,7 +204,7 @@ public final class ItemsOnGroundManager implements Runnable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO itemsonground(object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable) VALUES(?,?,?,?,?,?,?,?,?)"))
{
for (L2ItemInstance item : _items)
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/MailManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/MailManager.java
index 0b4c7601cb..fbc14a23e6 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/MailManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/MailManager.java
@@ -57,7 +57,7 @@ public final class MailManager
private void load()
{
int count = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT * FROM messages ORDER BY expiration"))
{
@@ -192,7 +192,7 @@ public final class MailManager
public void sendMessage(Message msg)
{
_messages.put(msg.getId(), msg);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = Message.getStatement(msg, con))
{
ps.execute();
@@ -214,7 +214,7 @@ public final class MailManager
public final void markAsReadInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isUnread = 'false' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -228,7 +228,7 @@ public final class MailManager
public final void markAsDeletedBySenderInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isDeletedBySender = 'true' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -242,7 +242,7 @@ public final class MailManager
public final void markAsDeletedByReceiverInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isDeletedByReceiver = 'true' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -256,7 +256,7 @@ public final class MailManager
public final void removeAttachmentsInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE messages SET hasAttachments = 'false' WHERE messageId = ?"))
{
ps.setInt(1, msgId);
@@ -270,7 +270,7 @@ public final class MailManager
public final void deleteMessageInDb(int msgId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM messages WHERE messageId = ?"))
{
ps.setInt(1, msgId);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java
index f47cf3f813..82a7f2288b 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/MentorManager.java
@@ -54,7 +54,7 @@ public class MentorManager
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement statement = con.createStatement();
ResultSet rset = statement.executeQuery("SELECT * FROM character_mentees"))
{
@@ -76,7 +76,7 @@ public class MentorManager
*/
public void deleteMentee(int mentorId, int menteeId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_mentees WHERE mentorId = ? AND charId = ?"))
{
statement.setInt(1, mentorId);
@@ -95,7 +95,7 @@ public class MentorManager
*/
public void deleteMentor(int mentorId, int menteeId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_mentees WHERE mentorId = ? AND charId = ?"))
{
statement.setInt(1, mentorId);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
index a29ed155fc..c03a9a8aae 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/PremiumManager.java
@@ -128,7 +128,7 @@ public class PremiumManager
private void loadPremiumData(String accountName)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stmt = con.prepareStatement(LOAD_SQL))
{
stmt.setString(1, accountName);
@@ -160,7 +160,7 @@ public class PremiumManager
long newPremiumExpiration = oldPremiumExpiration + addTime;
// UPDATE DATABASE
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stmt = con.prepareStatement(UPDATE_SQL))
{
stmt.setLong(1, newPremiumExpiration);
@@ -205,7 +205,7 @@ public class PremiumManager
premiumData.remove(accountName);
// UPDATE DATABASE
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement stmt = con.prepareStatement(DELETE_SQL))
{
stmt.setString(1, accountName);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java
index 001e262042..7438bf62f8 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/PunishmentManager.java
@@ -56,7 +56,7 @@ public final class PunishmentManager
int expired = 0;
// Load punishments.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement st = con.createStatement();
ResultSet rset = st.executeQuery("SELECT * FROM punishments"))
{
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
index b99c5e77d5..fe296e2e53 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/SiegeGuardManager.java
@@ -57,7 +57,7 @@ public final class SiegeGuardManager
private void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
ResultSet rs = con.createStatement().executeQuery("SELECT * FROM castle_siege_guards Where isHired = 1"))
{
while (rs.next())
@@ -158,7 +158,7 @@ public final class SiegeGuardManager
final SiegeGuardHolder holder = getSiegeGuardByItem(castle.getResidenceId(), itemId);
if (holder != null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("Insert Into castle_siege_guards (castleId, npcId, x, y, z, heading, respawnDelay, isHired) Values (?, ?, ?, ?, ?, ?, ?, ?)"))
{
statement.setInt(1, castle.getResidenceId());
@@ -249,7 +249,7 @@ public final class SiegeGuardManager
*/
private void loadSiegeGuard(Castle castle)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_siege_guards Where castleId = ? And isHired = ?"))
{
ps.setInt(1, castle.getResidenceId());
@@ -283,7 +283,7 @@ public final class SiegeGuardManager
*/
public void removeSiegeGuard(int npcId, IPositionable pos)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("Delete From castle_siege_guards Where npcId = ? And x = ? AND y = ? AND z = ? AND isHired = 1"))
{
ps.setInt(1, npcId);
@@ -304,7 +304,7 @@ public final class SiegeGuardManager
*/
public void removeSiegeGuards(Castle castle)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("Delete From castle_siege_guards Where castleId = ? And isHired = 1"))
{
ps.setInt(1, castle.getResidenceId());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
index e7fa0b41a8..65bd2b1bcf 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/instancemanager/SiegeManager.java
@@ -88,7 +88,7 @@ public final class SiegeManager
}
boolean register = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT clan_id FROM siege_clans where clan_id=? and castle_id=?"))
{
statement.setInt(1, clan.getId());
@@ -275,7 +275,7 @@ public final class SiegeManager
private void loadTrapUpgrade(int castleId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_trapupgrade WHERE castleId=?"))
{
ps.setInt(1, castleId);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/BlockList.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/BlockList.java
index f34f2aa666..9498d19d95 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/BlockList.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/BlockList.java
@@ -71,7 +71,7 @@ public class BlockList
private static List loadList(int ObjId)
{
final List list = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT friendId FROM character_friends WHERE charId=? AND relation=1"))
{
statement.setInt(1, ObjId);
@@ -98,7 +98,7 @@ public class BlockList
private void updateInDB(int targetId, boolean state)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (state) // add
{
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/CursedWeapon.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/CursedWeapon.java
index 7881f1e322..1f6ab1c29a 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/CursedWeapon.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/CursedWeapon.java
@@ -136,7 +136,7 @@ public class CursedWeapon implements INamable
// Remove from Db
LOGGER.info(_name + " being removed offline.");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement del = con.prepareStatement("DELETE FROM items WHERE owner_id=? AND item_id=?");
PreparedStatement ps = con.prepareStatement("UPDATE characters SET reputation=?, pkkills=? WHERE charId=?"))
{
@@ -471,7 +471,7 @@ public class CursedWeapon implements INamable
public void saveData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement del = con.prepareStatement("DELETE FROM cursed_weapons WHERE itemId = ?");
PreparedStatement ps = con.prepareStatement("INSERT INTO cursed_weapons (itemId, charId, playerReputation, playerPkKills, nbKills, endTime) VALUES (?, ?, ?, ?, ?, ?)"))
{
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/L2Clan.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/L2Clan.java
index be44951dc0..2f9213917c 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/L2Clan.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/L2Clan.java
@@ -266,7 +266,7 @@ public class L2Clan implements IIdentifiable, INamable
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET clan_privs = ? WHERE charId = ?"))
{
ps.setInt(1, 0);
@@ -306,7 +306,7 @@ public class L2Clan implements IIdentifiable, INamable
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET clan_privs = ? WHERE charId = ?"))
{
ps.setInt(1, EnumIntBitmask.getAllBitmask(ClanPrivilege.class));
@@ -883,7 +883,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateBloodAllianceCountInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET blood_alliance_count=? WHERE clan_id=?"))
{
ps.setInt(1, _bloodAllianceCount);
@@ -927,7 +927,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateBloodOathCountInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET blood_oath_count=? WHERE clan_id=?"))
{
ps.setInt(1, _bloodOathCount);
@@ -943,7 +943,7 @@ public class L2Clan implements IIdentifiable, INamable
public void updateInDB()
{
// Update reputation
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET reputation_score=? WHERE clan_id=?"))
{
ps.setInt(1, _reputationScore);
@@ -978,7 +978,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void updateClanInDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET leader_id=?,ally_id=?,ally_name=?,reputation_score=?,ally_penalty_expiry_time=?,ally_penalty_type=?,char_penalty_expiry_time=?,dissolving_expiry_time=?,new_leader_id=? WHERE clan_id=?"))
{
ps.setInt(1, getLeaderId());
@@ -1016,7 +1016,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
public void store()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_CLAN_DATA))
{
ps.setInt(1, _clanId);
@@ -1047,7 +1047,7 @@ public class L2Clan implements IIdentifiable, INamable
*/
private void removeMemberInDatabase(L2ClanMember member, long clanJoinExpiryTime, long clanCreateExpiryTime)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("UPDATE characters SET clanid=0, title=?, clan_join_expiry_time=?, clan_create_expiry_time=?, clan_privs=0, wantspeace=0, subpledge=0, lvl_joined_academy=0, apprentice=0, sponsor=0 WHERE charId=?");
PreparedStatement ps2 = con.prepareStatement("UPDATE characters SET apprentice=0 WHERE apprentice=?");
PreparedStatement ps3 = con.prepareStatement("UPDATE characters SET sponsor=0 WHERE sponsor=?"))
@@ -1072,7 +1072,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_CLAN_DATA))
{
ps.setInt(1, _clanId);
@@ -1147,7 +1147,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreNotice()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT enabled,notice FROM clan_notices WHERE clan_id=?"))
{
ps.setInt(1, _clanId);
@@ -1178,7 +1178,7 @@ public class L2Clan implements IIdentifiable, INamable
notice = notice.substring(0, MAX_NOTICE_LENGTH - 1);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_notices (clan_id,notice,enabled) values (?,?,?) ON DUPLICATE KEY UPDATE notice=?,enabled=?"))
{
ps.setInt(1, _clanId);
@@ -1237,7 +1237,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreSkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT skill_id,skill_level,sub_pledge_id FROM clan_skills WHERE clan_id=?"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -1360,7 +1360,7 @@ public class L2Clan implements IIdentifiable, INamable
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (oldSkill != null)
{
@@ -1770,7 +1770,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreSubPledges()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT sub_pledge_id,name,leader_id FROM clan_subpledges WHERE clan_id=?"))
{
// Retrieve all subpledges of this clan from the database
@@ -1870,7 +1870,7 @@ public class L2Clan implements IIdentifiable, INamable
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_subpledges (clan_id,sub_pledge_id,name,leader_id) values (?,?,?,?)"))
{
ps.setInt(1, _clanId);
@@ -1953,7 +1953,7 @@ public class L2Clan implements IIdentifiable, INamable
public void updateSubPledgeInDB(int pledgeType)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_subpledges SET leader_id=?, name=? WHERE clan_id=? AND sub_pledge_id=?"))
{
ps.setInt(1, getSubPledge(pledgeType).getLeaderId());
@@ -1970,7 +1970,7 @@ public class L2Clan implements IIdentifiable, INamable
private void restoreRankPrivs()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT privs,rank,party FROM clan_privs WHERE clan_id=?"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -2019,7 +2019,7 @@ public class L2Clan implements IIdentifiable, INamable
{
_privs.get(rank).setPrivs(privs);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_privs (clan_id,rank,party,privs) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE privs = ?"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -2055,7 +2055,7 @@ public class L2Clan implements IIdentifiable, INamable
{
_privs.put(rank, new RankPrivs(rank, 0, privs));
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_privs (clan_id,rank,party,privs) VALUES (?,?,?,?)"))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -2174,7 +2174,7 @@ public class L2Clan implements IIdentifiable, INamable
if (storeInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET auction_bid_at=? WHERE clan_id=?"))
{
ps.setInt(1, id);
@@ -2623,7 +2623,7 @@ public class L2Clan implements IIdentifiable, INamable
public void changeLevel(int level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET clan_level = ? WHERE clan_id = ?"))
{
ps.setInt(1, level);
@@ -2669,7 +2669,7 @@ public class L2Clan implements IIdentifiable, INamable
setCrestId(crestId);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET crest_id = ? WHERE clan_id = ?"))
{
ps.setInt(1, crestId);
@@ -2706,7 +2706,7 @@ public class L2Clan implements IIdentifiable, INamable
allyId = _allyId;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(sqlStatement))
{
ps.setInt(1, crestId);
@@ -2752,7 +2752,7 @@ public class L2Clan implements IIdentifiable, INamable
setCrestLargeId(crestId);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET crest_large_id = ? WHERE clan_id = ?"))
{
ps.setInt(1, crestId);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/L2ClanMember.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/L2ClanMember.java
index 8827f75a89..f1efba8e6e 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/L2ClanMember.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/L2ClanMember.java
@@ -244,7 +244,7 @@ public class L2ClanMember
*/
public void updatePledgeType()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET subpledge=? WHERE charId=?"))
{
ps.setLong(1, _pledgeType);
@@ -289,7 +289,7 @@ public class L2ClanMember
*/
public void updatePowerGrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET power_grade=? WHERE charId=?"))
{
ps.setLong(1, _powerGrade);
@@ -800,7 +800,7 @@ public class L2ClanMember
*/
public void saveApprenticeAndSponsor(int apprentice, int sponsor)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE characters SET apprentice=?,sponsor=? WHERE charId=?"))
{
ps.setInt(1, apprentice);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/L2ContactList.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/L2ContactList.java
index ea5f1f9d5d..5b5f5ab2bc 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/L2ContactList.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/L2ContactList.java
@@ -58,7 +58,7 @@ public class L2ContactList
{
_contacts.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY_LOAD))
{
statement.setInt(1, activeChar.getObjectId());
@@ -124,7 +124,7 @@ public class L2ContactList
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY_ADD))
{
statement.setInt(1, activeChar.getObjectId());
@@ -161,7 +161,7 @@ public class L2ContactList
_contacts.remove(name);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY_REMOVE))
{
statement.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/L2Mentee.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/L2Mentee.java
index 5c086b9d83..5414107ac4 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/L2Mentee.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/L2Mentee.java
@@ -49,7 +49,7 @@ public class L2Mentee
final L2PcInstance player = getPlayerInstance();
if (player == null) // Only if player is offline
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT char_name, level, base_class FROM characters WHERE charId = ?"))
{
statement.setInt(1, _objectId);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/MacroList.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/MacroList.java
index 577b101249..176fa12d48 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/MacroList.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/MacroList.java
@@ -124,7 +124,7 @@ public class MacroList implements IRestorable
private void registerMacroInDb(Macro macro)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO character_macroses (charId,id,icon,name,descr,acronym,commands) values(?,?,?,?,?,?,?)"))
{
ps.setInt(1, _owner.getObjectId());
@@ -160,7 +160,7 @@ public class MacroList implements IRestorable
private void deleteMacroFromDb(Macro macro)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM character_macroses WHERE charId=? AND id=?"))
{
ps.setInt(1, _owner.getObjectId());
@@ -177,7 +177,7 @@ public class MacroList implements IRestorable
public boolean restoreMe()
{
_macroses.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT charId, id, icon, name, descr, acronym, commands FROM character_macroses WHERE charId=?"))
{
ps.setInt(1, _owner.getObjectId());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/ShortCuts.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/ShortCuts.java
index 81e2c6f902..cbb856704d 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/ShortCuts.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/ShortCuts.java
@@ -85,7 +85,7 @@ public class ShortCuts implements IRestorable
deleteShortCutFromDb(oldShortCut);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("REPLACE INTO character_shortcuts (charId,slot,page,type,shortcut_id,level,sub_level,class_index) values(?,?,?,?,?,?,?,?)"))
{
statement.setInt(1, _owner.getObjectId());
@@ -154,7 +154,7 @@ public class ShortCuts implements IRestorable
*/
private void deleteShortCutFromDb(Shortcut shortcut)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=? AND slot=? AND page=? AND class_index=?"))
{
statement.setInt(1, _owner.getObjectId());
@@ -173,7 +173,7 @@ public class ShortCuts implements IRestorable
public boolean restoreMe()
{
_shortCuts.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT charId, slot, page, type, shortcut_id, level, sub_level FROM character_shortcuts WHERE charId=? AND class_index=?"))
{
statement.setInt(1, _owner.getObjectId());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
index 7a325d4b61..efcae6092f 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2PcInstance.java
@@ -1325,7 +1325,7 @@ public final class L2PcInstance extends L2Playable
private void insertNewRecipeData(int recipeId, boolean isDwarf)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_recipebook (charId, id, classIndex, type) values(?,?,?,?)"))
{
statement.setInt(1, getObjectId());
@@ -1342,7 +1342,7 @@ public final class L2PcInstance extends L2Playable
private void deleteRecipeData(int recipeId, boolean isDwarf)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_recipebook WHERE charId=? AND id=? AND classIndex=?"))
{
statement.setInt(1, getObjectId());
@@ -6308,7 +6308,7 @@ public final class L2PcInstance extends L2Playable
if (updateInDb)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_CHARACTER_ACCESS))
{
ps.setInt(1, accessLevel.getLevel());
@@ -6427,7 +6427,7 @@ public final class L2PcInstance extends L2Playable
*/
public void updateOnlineStatus()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE characters SET online=?, lastAccess=? WHERE charId=?"))
{
statement.setInt(1, isOnlineInt());
@@ -6447,7 +6447,7 @@ public final class L2PcInstance extends L2Playable
*/
private boolean createDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_CHARACTER))
{
statement.setString(1, _accountName);
@@ -6511,7 +6511,7 @@ public final class L2PcInstance extends L2Playable
double currentCp = 0;
double currentHp = 0;
double currentMp = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHARACTER))
{
// Retrieve the L2PcInstance from the characters table of the database
@@ -6872,7 +6872,7 @@ public final class L2PcInstance extends L2Playable
*/
private static boolean restoreSubClassData(L2PcInstance player)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_SUBCLASSES))
{
statement.setInt(1, player.getObjectId());
@@ -6963,7 +6963,7 @@ public final class L2PcInstance extends L2Playable
private void restoreRecipeBook(boolean loadCommon)
{
final String sql = loadCommon ? "SELECT id, type, classIndex FROM character_recipebook WHERE charId=?" : "SELECT id FROM character_recipebook WHERE charId=? AND classIndex=? AND type = 1";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(sql))
{
statement.setInt(1, getObjectId());
@@ -7016,7 +7016,7 @@ public final class L2PcInstance extends L2Playable
private void loadPremiumItemList()
{
final String sql = "SELECT itemNum, itemId, itemCount, itemSender FROM character_premium_items WHERE charId=?";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(sql))
{
statement.setInt(1, getObjectId());
@@ -7040,7 +7040,7 @@ public final class L2PcInstance extends L2Playable
public void updatePremiumItem(int itemNum, long newcount)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE character_premium_items SET itemCount=? WHERE charId=? AND itemNum=? "))
{
statement.setLong(1, newcount);
@@ -7056,7 +7056,7 @@ public final class L2PcInstance extends L2Playable
public void deletePremiumItem(int itemNum)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_premium_items WHERE charId=? AND itemNum=? "))
{
statement.setInt(1, getObjectId());
@@ -7109,7 +7109,7 @@ public final class L2PcInstance extends L2Playable
final long exp = getStat().getBaseExp();
final int level = getStat().getBaseLevel();
final long sp = getStat().getBaseSp();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CHARACTER))
{
statement.setInt(1, level);
@@ -7194,7 +7194,7 @@ public final class L2PcInstance extends L2Playable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CHAR_SUBCLASS))
{
for (SubClass subClass : getSubClasses().values())
@@ -7225,7 +7225,7 @@ public final class L2PcInstance extends L2Playable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE))
{
@@ -7345,7 +7345,7 @@ public final class L2PcInstance extends L2Playable
private void storeItemReuseDelay()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(DELETE_ITEM_REUSE_SAVE);
PreparedStatement ps2 = con.prepareStatement(ADD_ITEM_REUSE_SAVE))
{
@@ -7462,7 +7462,7 @@ public final class L2PcInstance extends L2Playable
final Skill oldSkill = super.removeSkill(skill, true);
if (oldSkill != null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_SKILL_FROM_CHAR))
{
// Remove or update a L2PcInstance skill from the character_skills table of the database
@@ -7505,7 +7505,7 @@ public final class L2PcInstance extends L2Playable
private void storeSkill(Skill newSkill, Skill oldSkill, int newClassIndex)
{
final int classIndex = (newClassIndex > -1) ? newClassIndex : _classIndex;
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if ((oldSkill != null) && (newSkill != null))
{
@@ -7555,7 +7555,7 @@ public final class L2PcInstance extends L2Playable
}
final int classIndex = (newClassIndex > -1) ? newClassIndex : _classIndex;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ADD_NEW_SKILLS))
{
con.setAutoCommit(false);
@@ -7582,7 +7582,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restoreSkills()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR))
{
// Retrieve all skills of this L2PcInstance from the database
@@ -7634,7 +7634,7 @@ public final class L2PcInstance extends L2Playable
@Override
public void restoreEffects()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_SKILL_SAVE))
{
statement.setInt(1, getObjectId());
@@ -7691,7 +7691,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restoreItemReuse()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_ITEM_REUSE_SAVE);
PreparedStatement delete = con.prepareStatement(DELETE_ITEM_REUSE_SAVE))
{
@@ -7762,7 +7762,7 @@ public final class L2PcInstance extends L2Playable
_henna[i - 1] = null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_HENNAS))
{
statement.setInt(1, getObjectId());
@@ -7869,7 +7869,7 @@ public final class L2PcInstance extends L2Playable
_henna[slot - 1] = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_CHAR_HENNA))
{
statement.setInt(1, getObjectId());
@@ -7950,7 +7950,7 @@ public final class L2PcInstance extends L2Playable
// Calculate Henna modifiers of this L2PcInstance
recalcHennaStats();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(ADD_CHAR_HENNA))
{
statement.setInt(1, getObjectId());
@@ -9574,7 +9574,7 @@ public final class L2PcInstance extends L2Playable
newClass.setLevel(Config.BASE_DUALCLASS_LEVEL);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(ADD_CHAR_SUBCLASS))
{
// Store the basic info about this new sub-class.
@@ -9674,7 +9674,7 @@ public final class L2PcInstance extends L2Playable
// Remove after stats are recalculated.
getSubClasses().remove(classIndex);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
@@ -11818,7 +11818,7 @@ public final class L2PcInstance extends L2Playable
{
String req;
req = "UPDATE pets SET fed=? WHERE item_obj_id = ?";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(req))
{
statement.setInt(1, _curFeed);
@@ -11945,7 +11945,7 @@ public final class L2PcInstance extends L2Playable
bookmark.setTag(tag);
bookmark.setName(name);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_TP_BOOKMARK))
{
statement.setInt(1, icon);
@@ -11968,7 +11968,7 @@ public final class L2PcInstance extends L2Playable
{
if (_tpbookmarks.remove(id) != null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_TP_BOOKMARK))
{
statement.setInt(1, getObjectId());
@@ -12111,7 +12111,7 @@ public final class L2PcInstance extends L2Playable
sm.addItemName(20033);
sendPacket(sm);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_TP_BOOKMARK))
{
statement.setInt(1, getObjectId());
@@ -12133,7 +12133,7 @@ public final class L2PcInstance extends L2Playable
public void restoreTeleportBookmark()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_TP_BOOKMARK))
{
statement.setInt(1, getObjectId());
@@ -12345,7 +12345,7 @@ public final class L2PcInstance extends L2Playable
_friendList.clear();
final String sqlQuery = "SELECT friendId FROM character_friends WHERE charId=? AND relation=0";
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(sqlQuery))
{
statement.setInt(1, getObjectId());
@@ -12435,7 +12435,7 @@ public final class L2PcInstance extends L2Playable
{
if (hasManufactureShop())
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement st = con.prepareStatement(DELETE_CHAR_RECIPE_SHOP))
{
@@ -12473,7 +12473,7 @@ public final class L2PcInstance extends L2Playable
_manufactureItems.clear();
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(RESTORE_CHAR_RECIPE_SHOP))
{
statement.setInt(1, getObjectId());
@@ -12891,7 +12891,7 @@ public final class L2PcInstance extends L2Playable
*/
private void restorePetInventoryItems()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT object_id FROM `items` WHERE `owner_id`=? AND (`loc`='PET' OR `loc`='PET_EQUIP') LIMIT 1;"))
{
statement.setInt(1, getObjectId());
@@ -12931,7 +12931,7 @@ public final class L2PcInstance extends L2Playable
*/
private void loadRecommendations()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT rec_have, rec_left FROM character_reco_bonus WHERE charId = ?"))
{
statement.setInt(1, getObjectId());
@@ -12955,7 +12955,7 @@ public final class L2PcInstance extends L2Playable
*/
public void storeRecommendations()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO character_reco_bonus (charId,rec_have,rec_left,time_left) VALUES (?,?,?,?)"))
{
ps.setInt(1, getObjectId());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
index c5b882a533..2a22ce6fa1 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2PetInstance.java
@@ -788,7 +788,7 @@ public class L2PetInstance extends L2Summon
}
// pet control item no longer exists, delete the pet from the db
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id = ?"))
{
statement.setInt(1, _controlObjectId);
@@ -846,7 +846,7 @@ public class L2PetInstance extends L2Summon
private static L2PetInstance restore(L2ItemInstance control, L2NpcTemplate template, L2PcInstance owner)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT item_obj_id, name, level, curHp, curMp, exp, sp, fed FROM pets WHERE item_obj_id=?"))
{
L2PetInstance pet;
@@ -942,7 +942,7 @@ public class L2PetInstance extends L2Summon
req = "UPDATE pets SET name=?,level=?,curHp=?,curMp=?,exp=?,sp=?,fed=?,ownerId=?,restore=? WHERE item_obj_id = ?";
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(req))
{
statement.setString(1, getName());
@@ -992,7 +992,7 @@ public class L2PetInstance extends L2Summon
// Clear list for overwrite
SummonEffectsTable.getInstance().getPetEffects().getOrDefault(getControlObjectId(), Collections.emptyList()).clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(DELETE_SKILL_SAVE);
PreparedStatement ps2 = con.prepareStatement(ADD_SKILL_SAVE))
{
@@ -1067,7 +1067,7 @@ public class L2PetInstance extends L2Summon
@Override
public void restoreEffects()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(RESTORE_SKILL_SAVE);
PreparedStatement ps2 = con.prepareStatement(DELETE_SKILL_SAVE))
{
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java
index 320505de11..8cbf9119b6 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/actor/instance/L2ServitorInstance.java
@@ -288,7 +288,7 @@ public class L2ServitorInstance extends L2Summon implements Runnable
SummonEffectsTable.getInstance().getServitorEffects(getOwner()).getOrDefault(getReferenceSkill(), Collections.emptyList()).clear();
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_SKILL_SAVE))
{
// Delete all current stored effects for summon to avoid dupe
@@ -389,7 +389,7 @@ public class L2ServitorInstance extends L2Summon implements Runnable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (!SummonEffectsTable.getInstance().getServitorEffectsOwner().containsKey(getOwner().getObjectId()) || !SummonEffectsTable.getInstance().getServitorEffectsOwner().get(getOwner().getObjectId()).containsKey(getOwner().getClassIndex()) || !SummonEffectsTable.getInstance().getServitorEffects(getOwner()).containsKey(getReferenceSkill()))
{
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/announce/Announcement.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/announce/Announcement.java
index 4e5aa84b0f..a7117539ad 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/announce/Announcement.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/announce/Announcement.java
@@ -108,7 +108,7 @@ public class Announcement implements IAnnouncement
@Override
public boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
{
ps.setInt(1, _type.ordinal());
@@ -134,7 +134,7 @@ public class Announcement implements IAnnouncement
@Override
public boolean updateMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(UPDATE_QUERY))
{
ps.setInt(1, _type.ordinal());
@@ -154,7 +154,7 @@ public class Announcement implements IAnnouncement
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_QUERY))
{
ps.setInt(1, _id);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java
index 1adc7b039f..21eb44294e 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/announce/AutoAnnouncement.java
@@ -94,7 +94,7 @@ public final class AutoAnnouncement extends Announcement implements Runnable
@Override
public boolean storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
{
st.setInt(1, getType().ordinal());
@@ -123,7 +123,7 @@ public final class AutoAnnouncement extends Announcement implements Runnable
@Override
public boolean updateMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(UPDATE_QUERY))
{
st.setInt(1, getType().ordinal());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/buylist/Product.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/buylist/Product.java
index 8360f7712c..639a9bfa1a 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/buylist/Product.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/buylist/Product.java
@@ -157,7 +157,7 @@ public final class Product
private void save()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO `buylists`(`buylist_id`, `item_id`, `count`, `next_restock_time`) VALUES(?, ?, ?, ?) ON DUPLICATE KEY UPDATE `count` = ?, `next_restock_time` = ?"))
{
statement.setInt(1, _buyListId);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java
index 757b5512d0..5d970e7abd 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/clanhallauction/ClanHallAuction.java
@@ -58,7 +58,7 @@ public class ClanHallAuction
private final void loadBidder()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(LOAD_CLANHALL_BIDDERS))
{
ps.setInt(1, _clanHallId);
@@ -102,7 +102,7 @@ public class ClanHallAuction
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(INSERT_CLANHALL_BIDDER))
{
ps.setInt(1, _clanHallId);
@@ -121,7 +121,7 @@ public class ClanHallAuction
public void removeBid(L2Clan clan)
{
getBids().remove(clan.getId());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_CLANHALL_BIDDER))
{
ps.setInt(1, clan.getId());
@@ -170,7 +170,7 @@ public class ClanHallAuction
clanHall.setOwner(highestBidder.getClan());
getBids().clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(DELETE_CLANHALL_BIDDERS))
{
ps.setInt(1, _clanHallId);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Castle.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Castle.java
index ca9513714d..08284f3f0b 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Castle.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Castle.java
@@ -219,7 +219,7 @@ public final class Castle extends AbstractResidence
public void dbSave()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_functions (castle_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)"))
{
ps.setInt(1, getResidenceId());
@@ -361,7 +361,7 @@ public final class Castle extends AbstractResidence
_treasury += amount;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET treasury = ? WHERE id = ?"))
{
ps.setLong(1, _treasury);
@@ -644,7 +644,7 @@ public final class Castle extends AbstractResidence
@Override
protected void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("SELECT * FROM castle WHERE id = ?");
PreparedStatement ps2 = con.prepareStatement("SELECT clan_id FROM clan_data WHERE hasCastle = ?"))
{
@@ -690,7 +690,7 @@ public final class Castle extends AbstractResidence
/** Load All Functions */
private void loadFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_functions WHERE castle_id = ?"))
{
ps.setInt(1, getResidenceId());
@@ -715,7 +715,7 @@ public final class Castle extends AbstractResidence
public void removeFunction(int functionType)
{
_function.remove(functionType);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_functions WHERE castle_id=? AND type=?"))
{
ps.setInt(1, getResidenceId());
@@ -787,7 +787,7 @@ public final class Castle extends AbstractResidence
// This method loads castle door upgrade data from database
private void loadDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_doorupgrade WHERE castleId=?"))
{
ps.setInt(1, getResidenceId());
@@ -813,7 +813,7 @@ public final class Castle extends AbstractResidence
door.setCurrentHp(door.getCurrentHp());
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_doorupgrade WHERE castleId=?"))
{
ps.setInt(1, getResidenceId());
@@ -838,7 +838,7 @@ public final class Castle extends AbstractResidence
if (save)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_doorupgrade (doorId, ratio, castleId) values (?,?,?)"))
{
ps.setInt(1, doorId);
@@ -865,7 +865,7 @@ public final class Castle extends AbstractResidence
CastleManorManager.getInstance().resetManorData(getResidenceId());
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Need to remove has castle flag from clan_data, should be checked from castle table.
try (PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET hasCastle = 0 WHERE hasCastle = ?"))
@@ -1033,7 +1033,7 @@ public final class Castle extends AbstractResidence
public void updateShowNpcCrest()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET showNpcCrest = ? WHERE id = ?"))
{
ps.setString(1, String.valueOf(_showNpcCrest));
@@ -1077,7 +1077,7 @@ public final class Castle extends AbstractResidence
{
_ticketBuyCount = count;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET ticketBuyCount = ? WHERE id = ?"))
{
ps.setInt(1, _ticketBuyCount);
@@ -1100,7 +1100,7 @@ public final class Castle extends AbstractResidence
{
if (save)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_trapupgrade (castleId, towerIndex, level) values (?,?,?)"))
{
ps.setInt(1, getResidenceId());
@@ -1127,7 +1127,7 @@ public final class Castle extends AbstractResidence
ts.setUpgradeLevel(0);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_trapupgrade WHERE castleId=?"))
{
ps.setInt(1, getResidenceId());
@@ -1208,7 +1208,7 @@ public final class Castle extends AbstractResidence
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE castle SET side = ? WHERE id = ?"))
{
ps.setString(1, side.toString());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/ClanHall.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
index 6fc9b45046..79906bc875 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/ClanHall.java
@@ -100,7 +100,7 @@ public final class ClanHall extends AbstractResidence
@Override
protected void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement loadStatement = con.prepareStatement(LOAD_CLANHALL);
PreparedStatement insertStatement = con.prepareStatement(INSERT_CLANHALL))
{
@@ -133,7 +133,7 @@ public final class ClanHall extends AbstractResidence
public void updateDB()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_CLANHALL))
{
statement.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Couple.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Couple.java
index c40e7d454a..45294842ce 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Couple.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Couple.java
@@ -45,7 +45,7 @@ public class Couple
{
_Id = coupleId;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM mods_wedding WHERE id = ?"))
{
ps.setInt(1, _Id);
@@ -85,7 +85,7 @@ public class Couple
_weddingDate = Calendar.getInstance();
_weddingDate.setTimeInMillis(Calendar.getInstance().getTimeInMillis());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO mods_wedding (id, player1Id, player2Id, married, affianceDate, weddingDate) VALUES (?, ?, ?, ?, ?, ?)"))
{
_Id = IdFactory.getInstance().getNextId();
@@ -105,7 +105,7 @@ public class Couple
public void marry()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE mods_wedding set married = ?, weddingDate = ? where id = ?"))
{
ps.setBoolean(1, true);
@@ -123,7 +123,7 @@ public class Couple
public void divorce()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM mods_wedding WHERE id=?"))
{
ps.setInt(1, _Id);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Fort.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Fort.java
index e6262fdc29..3b29461e3a 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Fort.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Fort.java
@@ -214,7 +214,7 @@ public final class Fort extends AbstractResidence
public void dbSave()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE INTO fort_functions (fort_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)"))
{
ps.setInt(1, getResidenceId());
@@ -487,7 +487,7 @@ public final class Fort extends AbstractResidence
public void saveFortVariables()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET supplyLvL=? WHERE id = ?"))
{
ps.setInt(1, _supplyLvL);
@@ -552,7 +552,7 @@ public final class Fort extends AbstractResidence
@Override
protected void load()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort WHERE id = ?"))
{
ps.setInt(1, getResidenceId());
@@ -613,7 +613,7 @@ public final class Fort extends AbstractResidence
/** Load All Functions */
private void loadFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_functions WHERE fort_id = ?"))
{
ps.setInt(1, getResidenceId());
@@ -638,7 +638,7 @@ public final class Fort extends AbstractResidence
public void removeFunction(int functionType)
{
_function.remove(functionType);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM fort_functions WHERE fort_id=? AND type=?"))
{
ps.setInt(1, getResidenceId());
@@ -730,7 +730,7 @@ public final class Fort extends AbstractResidence
// This method loads fort door upgrade data from database
private void loadDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_doorupgrade WHERE fortId = ?"))
{
ps.setInt(1, getResidenceId());
@@ -750,7 +750,7 @@ public final class Fort extends AbstractResidence
private void removeDoorUpgrade()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM fort_doorupgrade WHERE fortId = ?"))
{
ps.setInt(1, getResidenceId());
@@ -764,7 +764,7 @@ public final class Fort extends AbstractResidence
private void saveDoorUpgrade(int doorId, int hp, int pDef, int mDef)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO fort_doorupgrade (doorId, hp, pDef, mDef) VALUES (?,?,?,?)"))
{
ps.setInt(1, doorId);
@@ -793,7 +793,7 @@ public final class Fort extends AbstractResidence
_lastOwnedTime.setTimeInMillis(0);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET owner=?,lastOwnedTime=?,state=?,castleId=? WHERE id = ?"))
{
ps.setInt(1, clanId);
@@ -998,7 +998,7 @@ public final class Fort extends AbstractResidence
{
_state = state;
_castleId = castleId;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET state=?,castleId=? WHERE id = ?"))
{
ps.setInt(1, _state);
@@ -1130,7 +1130,7 @@ public final class Fort extends AbstractResidence
private void initNpcs()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_spawnlist WHERE fortId = ? AND spawnType = ?"))
{
ps.setInt(1, getResidenceId());
@@ -1159,7 +1159,7 @@ public final class Fort extends AbstractResidence
private void initSiegeNpcs()
{
_siegeNpcs.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, npcId, x, y, z, heading FROM fort_spawnlist WHERE fortId = ? AND spawnType = ? ORDER BY id"))
{
ps.setInt(1, getResidenceId());
@@ -1186,7 +1186,7 @@ public final class Fort extends AbstractResidence
private void initNpcCommanders()
{
_npcCommanders.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, npcId, x, y, z, heading FROM fort_spawnlist WHERE fortId = ? AND spawnType = ? ORDER BY id"))
{
ps.setInt(1, getResidenceId());
@@ -1216,7 +1216,7 @@ public final class Fort extends AbstractResidence
_specialEnvoys.clear();
_envoyCastles.clear();
_availableCastles.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT id, npcId, x, y, z, heading, castleId FROM fort_spawnlist WHERE fortId = ? AND spawnType = ? ORDER BY id"))
{
ps.setInt(1, getResidenceId());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/FortSiege.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/FortSiege.java
index ffba04e6c3..d558045fab 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/FortSiege.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/FortSiege.java
@@ -501,7 +501,7 @@ public class FortSiege implements Siegable
/** Clear all registered siege clans from database for fort */
public void clearSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM fortsiege_clans WHERE fort_id=?"))
{
ps.setInt(1, _fort.getResidenceId());
@@ -785,7 +785,7 @@ public class FortSiege implements Siegable
private void removeSiegeClan(int clanId)
{
final String query = (clanId != 0) ? DELETE_FORT_SIEGECLANS_BY_CLAN_ID : DELETE_FORT_SIEGECLANS;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(query))
{
statement.setInt(1, _fort.getResidenceId());
@@ -999,7 +999,7 @@ public class FortSiege implements Siegable
private void loadSiegeClan()
{
_attackerClans.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT clan_id FROM fortsiege_clans WHERE fort_id=?"))
{
ps.setInt(1, _fort.getResidenceId());
@@ -1057,7 +1057,7 @@ public class FortSiege implements Siegable
/** Save siege date to database. */
private void saveSiegeDate()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE fort SET siegeDate = ? WHERE id = ?"))
{
ps.setLong(1, _fort.getSiegeDate().getTimeInMillis());
@@ -1081,7 +1081,7 @@ public class FortSiege implements Siegable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO fortsiege_clans (clan_id,fort_id) values (?,?)"))
{
statement.setInt(1, clan.getId());
@@ -1146,7 +1146,7 @@ public class FortSiege implements Siegable
public void loadSiegeGuard()
{
_siegeGuards.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT npcId, x, y, z, heading, respawnDelay FROM fort_siege_guards WHERE fortId = ?"))
{
final int fortId = _fort.getResidenceId();
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Hero.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Hero.java
index 924ecead2f..27be59aa41 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Hero.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Hero.java
@@ -114,7 +114,7 @@ public class Hero
_herodiary.clear();
_heroMessage.clear();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s1 = con.createStatement();
ResultSet rset = s1.executeQuery(GET_HEROES);
PreparedStatement ps = con.prepareStatement(GET_CLAN_ALLY);
@@ -211,7 +211,7 @@ public class Hero
*/
public void loadMessage(int charId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT message FROM heroes WHERE charId=?"))
{
statement.setInt(1, charId);
@@ -233,7 +233,7 @@ public class Hero
{
final List _diary = new CopyOnWriteArrayList<>();
int diaryentries = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM heroes_diary WHERE charId=? ORDER BY time ASC"))
{
statement.setInt(1, charId);
@@ -300,7 +300,7 @@ public class Hero
int _losses = 0;
int _draws = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM olympiad_fights WHERE (charOneId=? OR charTwoId=?) AND start ORDER BY start ASC"))
{
statement.setInt(1, charId);
@@ -699,7 +699,7 @@ public class Hero
public void updateHeroes(boolean setDefault)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if (setDefault)
{
@@ -841,7 +841,7 @@ public class Hero
public void setDiaryData(int charId, int action, int param)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO heroes_diary (charId, time, action, param) values(?,?,?,?)"))
{
statement.setInt(1, charId);
@@ -877,7 +877,7 @@ public class Hero
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE heroes SET message=? WHERE charId=?;"))
{
statement.setString(1, _heroMessage.get(charId));
@@ -892,7 +892,7 @@ public class Hero
private void deleteItemsInDb()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(DELETE_ITEMS))
{
statement.execute();
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Siege.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Siege.java
index 2ed07c3d33..9e70d283d4 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Siege.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/entity/Siege.java
@@ -760,7 +760,7 @@ public class Siege implements Siegable
/** Clear all registered siege clans from database for castle */
public void clearSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=?"))
{
statement.setInt(1, _castle.getResidenceId());
@@ -788,7 +788,7 @@ public class Siege implements Siegable
/** Clear all siege clans waiting for approval from database for castle */
public void clearSiegeWaitingClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=? and type = 2"))
{
statement.setInt(1, _castle.getResidenceId());
@@ -972,7 +972,7 @@ public class Siege implements Siegable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=? and clan_id=?"))
{
statement.setInt(1, _castle.getResidenceId());
@@ -1238,7 +1238,7 @@ public class Siege implements Siegable
private void loadSiegeClan()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT clan_id,type FROM siege_clans where castle_id=?"))
{
getAttackerClans().clear();
@@ -1349,7 +1349,7 @@ public class Siege implements Siegable
_scheduledStartSiegeTask = ThreadPool.schedule(new ScheduleStartSiegeTask(_castle), 1000);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE castle SET siegeDate = ?, regTimeEnd = ?, regTimeOver = ? WHERE id = ?"))
{
statement.setLong(1, _castle.getSiegeDate().getTimeInMillis());
@@ -1378,7 +1378,7 @@ public class Siege implements Siegable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
if ((typeId == DEFENDER) || (typeId == DEFENDER_NOT_APPROVED) || (typeId == OWNER))
{
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java
index ac490ba86d..f23e511ede 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/eventengine/EventScheduler.java
@@ -138,7 +138,7 @@ public class EventScheduler
public boolean updateLastRun()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO event_schedulers (eventName, schedulerName, lastRun) VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE eventName = ?, schedulerName = ?, lastRun = ?"))
{
ps.setString(1, _eventManager.getName());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java
index 3185dae127..fc59ec7842 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/eventengine/conditions/HaventRunConditionalScheduler.java
@@ -52,7 +52,7 @@ public class HaventRunConditionalScheduler implements IConditionalEventScheduler
throw new NullPointerException("Scheduler not found: " + _name);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT lastRun FROM event_schedulers WHERE eventName = ? AND schedulerName = ?"))
{
ps.setString(1, _eventManager.getName());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/instancezone/Instance.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/instancezone/Instance.java
index 053ffa54cf..ccef54aad0 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/instancezone/Instance.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/instancezone/Instance.java
@@ -815,7 +815,7 @@ public final class Instance implements IIdentifiable, INamable
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT IGNORE INTO character_instance_time (charId,instanceId,time) VALUES (?,?,?)"))
{
// Save to database
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java
index 8a3ac20ed4..4865f4c0b2 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemauction/ItemAuction.java
@@ -191,7 +191,7 @@ public final class ItemAuction
public final void storeMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO item_auction (auctionId,instanceId,auctionItemId,startingTime,endingTime,auctionStateId) VALUES (?,?,?,?,?,?) ON DUPLICATE KEY UPDATE auctionStateId=?"))
{
statement.setInt(1, _auctionId);
@@ -225,7 +225,7 @@ public final class ItemAuction
final void updatePlayerBidInternal(ItemAuctionBid bid, boolean delete)
{
final String query = delete ? DELETE_ITEM_AUCTION_BID : INSERT_ITEM_AUCTION_BID;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(query))
{
ps.setInt(1, _auctionId);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java
index ec5eb4074e..d388e90796 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemauction/ItemAuctionInstance.java
@@ -161,7 +161,7 @@ public final class ItemAuctionInstance
throw new IllegalArgumentException("No items defined");
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(SELECT_AUCTION_ID_BY_INSTANCE_ID))
{
ps.setInt(1, _instanceId);
@@ -533,7 +533,7 @@ public final class ItemAuctionInstance
private ItemAuction loadAuction(int auctionId) throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
int auctionItemId = 0;
long startingTime = 0;
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java
index 1f0a5ecd17..8652a23a71 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemcontainer/Inventory.java
@@ -1870,7 +1870,7 @@ public abstract class Inventory extends ItemContainer
@Override
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM items WHERE owner_id=? AND (loc=? OR loc=?) ORDER BY loc_data"))
{
ps.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java
index 1501c166e8..9a71ec3c76 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemcontainer/ItemContainer.java
@@ -673,7 +673,7 @@ public abstract class ItemContainer
*/
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM items WHERE owner_id=? AND (loc=?)"))
{
ps.setInt(1, getOwnerId());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java
index 9e94b591e8..09cbc47e3b 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemcontainer/Mail.java
@@ -112,7 +112,7 @@ public class Mail extends ItemContainer
@Override
public void restore()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM items WHERE owner_id=? AND loc=? AND loc_data=?"))
{
statement.setInt(1, _ownerId);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java
index f85059926a..432c0017f8 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/itemcontainer/PcInventory.java
@@ -738,7 +738,7 @@ public class PcInventory extends Inventory
public static int[][] restoreVisibleInventory(int objectId)
{
final int[][] paperdoll = new int[Inventory.PAPERDOLL_TOTALSLOTS][4];
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement2 = con.prepareStatement("SELECT object_id,item_id,loc_data,enchant_level FROM items WHERE owner_id=? AND loc='PAPERDOLL'"))
{
statement2.setInt(1, objectId);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java
index 000d3a0924..c7e109b9d3 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/items/instance/L2ItemInstance.java
@@ -983,7 +983,7 @@ public final class L2ItemInstance extends L2Object
final VariationInstance augment = _augmentation;
_augmentation = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_variations WHERE itemId = ?"))
{
ps.setInt(1, getObjectId());
@@ -1000,7 +1000,7 @@ public final class L2ItemInstance extends L2Object
public void restoreAttributes()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement("SELECT mineralId,option1,option2 FROM item_variations WHERE itemId=?");
PreparedStatement ps2 = con.prepareStatement("SELECT elemType,elemValue FROM item_elementals WHERE itemId=?"))
{
@@ -1041,7 +1041,7 @@ public final class L2ItemInstance extends L2Object
public void updateItemOptions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
updateItemOptions(con);
}
@@ -1069,7 +1069,7 @@ public final class L2ItemInstance extends L2Object
public void updateItemElementals()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
updateItemElements(con);
}
@@ -1231,7 +1231,7 @@ public final class L2ItemInstance extends L2Object
_elementals.remove(type);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_elementals WHERE itemId = ? AND elemType = ?"))
{
ps.setInt(1, getObjectId());
@@ -1256,7 +1256,7 @@ public final class L2ItemInstance extends L2Object
_elementals.clear();
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_elementals WHERE itemId = ?"))
{
ps.setInt(1, getObjectId());
@@ -1588,7 +1588,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE items SET owner_id=?,count=?,loc=?,loc_data=?,enchant_level=?,custom_type1=?,custom_type2=?,mana_left=?,time=? WHERE object_id = ?"))
{
ps.setInt(1, _ownerId);
@@ -1621,7 +1621,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO items (owner_id,item_id,count,loc,loc_data,enchant_level,object_id,custom_type1,custom_type2,mana_left,time) VALUES (?,?,?,?,?,?,?,?,?,?,?)"))
{
ps.setInt(1, _ownerId);
@@ -1669,7 +1669,7 @@ public final class L2ItemInstance extends L2Object
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM items WHERE object_id = ?"))
{
@@ -2183,7 +2183,7 @@ public final class L2ItemInstance extends L2Object
private void removeSpecialAbility(EnsoulOption option)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM item_special_abilities WHERE objectId = ? AND optionId = ?"))
{
ps.setInt(1, getObjectId());
@@ -2237,7 +2237,7 @@ public final class L2ItemInstance extends L2Object
private void restoreSpecialAbilities()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM item_special_abilities WHERE objectId = ? ORDER BY position"))
{
ps.setInt(1, getObjectId());
@@ -2264,7 +2264,7 @@ public final class L2ItemInstance extends L2Object
public void updateSpecialAbilities()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
updateSpecialAbilities(con);
}
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java
index 44b0ac9c43..1ad8f4c201 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/olympiad/Olympiad.java
@@ -142,7 +142,7 @@ public class Olympiad extends ListenersContainer
{
_nobles.clear();
boolean loaded = false;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_LOAD_DATA);
ResultSet rset = statement.executeQuery())
{
@@ -221,7 +221,7 @@ public class Olympiad extends ListenersContainer
}
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_LOAD_NOBLES);
ResultSet rset = statement.executeQuery())
{
@@ -295,7 +295,7 @@ public class Olympiad extends ListenersContainer
{
_noblesRank.clear();
final Map tmpPlace = new HashMap<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(GET_ALL_CLASSIFIED_NOBLESS);
ResultSet rset = statement.executeQuery())
{
@@ -806,7 +806,7 @@ public class Olympiad extends ListenersContainer
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
for (Entry entry : _nobles.entrySet())
{
@@ -878,7 +878,7 @@ public class Olympiad extends ListenersContainer
{
saveNobleData();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_SAVE_DATA))
{
statement.setInt(1, _currentCycle);
@@ -919,7 +919,7 @@ public class Olympiad extends ListenersContainer
protected void updateMonthlyData()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(OLYMPIAD_MONTH_CLEAR);
PreparedStatement ps2 = con.prepareStatement(OLYMPIAD_MONTH_CREATE))
{
@@ -963,7 +963,7 @@ public class Olympiad extends ListenersContainer
final List heroesToBe = new LinkedList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_GET_HEROS))
{
StatsSet hero;
@@ -998,7 +998,7 @@ public class Olympiad extends ListenersContainer
{
final List names = new ArrayList<>();
final String query = Config.ALT_OLY_SHOW_MONTHLY_WINNERS ? ((classId == 132) ? GET_EACH_CLASS_LEADER_SOULHOUND : GET_EACH_CLASS_LEADER) : ((classId == 132) ? GET_EACH_CLASS_LEADER_CURRENT_SOULHOUND : GET_EACH_CLASS_LEADER_CURRENT);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(query))
{
ps.setInt(1, classId);
@@ -1108,7 +1108,7 @@ public class Olympiad extends ListenersContainer
public int getLastNobleOlympiadPoints(int objId)
{
int result = 0;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT olympiad_points FROM olympiad_nobles_eom WHERE charId = ?"))
{
ps.setInt(1, objId);
@@ -1252,7 +1252,7 @@ public class Olympiad extends ListenersContainer
protected void deleteNobles()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(OLYMPIAD_DELETE_ALL))
{
statement.execute();
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java
index 9249ca2223..2824298209 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/olympiad/OlympiadGameNormal.java
@@ -743,7 +743,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
protected static void saveResults(Participant one, Participant two, int winner, long startTime, long fightTime, CompetitionType type)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO olympiad_fights (charOneId, charTwoId, charOneClass, charTwoClass, winner, start, time, classed) values(?,?,?,?,?,?,?,?)"))
{
statement.setInt(1, one.getObjectId());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java
index d73e56cbe8..c805ee421d 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/punishment/PunishmentTask.java
@@ -185,7 +185,7 @@ public class PunishmentTask implements Runnable
{
if (!_isStored)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
{
st.setString(1, _key);
@@ -224,7 +224,7 @@ public class PunishmentTask implements Runnable
{
if (_isStored)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(UPDATE_QUERY))
{
st.setLong(1, System.currentTimeMillis());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java
index 248d5997e4..0dea776f93 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/quest/LongTimeEvent.java
@@ -409,7 +409,7 @@ public class LongTimeEvent extends Quest
}
}
// Update database
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM items WHERE item_id=?"))
{
statement.setInt(1, itemId);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/quest/Quest.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/quest/Quest.java
index 177a86908f..fcf44bfa6f 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/quest/Quest.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/quest/Quest.java
@@ -1568,7 +1568,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void playerEnter(L2PcInstance player)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement invalidQuestData = con.prepareStatement("DELETE FROM character_quests WHERE charId = ? AND name = ?");
PreparedStatement invalidQuestDataVar = con.prepareStatement("DELETE FROM character_quests WHERE charId = ? AND name = ? AND var = ?");
PreparedStatement ps1 = con.prepareStatement("SELECT name, value FROM character_quests WHERE charId = ? AND var = ?"))
@@ -1650,7 +1650,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void createQuestVarInDb(QuestState qs, String var, String value)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_quests (charId,name,var,value) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE value=?"))
{
statement.setInt(1, qs.getPlayer().getObjectId());
@@ -1674,7 +1674,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void updateQuestVarInDb(QuestState qs, String var, String value)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE character_quests SET value=? WHERE charId=? AND name=? AND var = ?"))
{
statement.setString(1, value);
@@ -1696,7 +1696,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void deleteQuestVarInDb(QuestState qs, String var)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_quests WHERE charId=? AND name=? AND var=?"))
{
statement.setInt(1, qs.getPlayer().getObjectId());
@@ -1717,7 +1717,7 @@ public class Quest extends AbstractScript implements IIdentifiable
*/
public static void deleteQuestInDb(QuestState qs, boolean repeatable)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(repeatable ? QUEST_DELETE_FROM_CHAR_QUERY : QUEST_DELETE_FROM_CHAR_QUERY_NON_REPEATABLE_QUERY))
{
ps.setInt(1, qs.getPlayer().getObjectId());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java
index 11c78a1a47..9af2be9039 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/residences/AbstractResidence.java
@@ -126,7 +126,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
protected void initFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT * FROM residence_functions WHERE residenceId = ?"))
{
ps.setInt(1, _residenceId);
@@ -164,7 +164,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
public void addFunction(ResidenceFunction func)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO residence_functions (id, level, expiration, residenceId) VALUES (?, ?, ?, ?) ON DUPLICATE KEY UPDATE level = ?, expiration = ?"))
{
ps.setInt(1, func.getId());
@@ -196,7 +196,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
public void removeFunction(ResidenceFunction func)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM residence_functions WHERE residenceId = ? and id = ?"))
{
ps.setInt(1, _residenceId);
@@ -219,7 +219,7 @@ public abstract class AbstractResidence extends ListenersContainer implements IN
*/
public void removeFunctions()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM residence_functions WHERE residenceId = ?"))
{
ps.setInt(1, _residenceId);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
index 8b91fc77d2..53958bcf5c 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/variables/AccountVariables.java
@@ -50,7 +50,7 @@ public class AccountVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setString(1, _accountName);
@@ -83,7 +83,7 @@ public class AccountVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -120,7 +120,7 @@ public class AccountVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java
index 50fcf2ab6f..5af41a23af 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/variables/ClanVariables.java
@@ -50,7 +50,7 @@ public class ClanVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setInt(1, _objectId);
@@ -83,7 +83,7 @@ public class ClanVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -120,7 +120,7 @@ public class ClanVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java
index c7ba2ff071..048b15a86e 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/variables/ItemVariables.java
@@ -55,7 +55,7 @@ public class ItemVariables extends AbstractVariables
public static boolean hasVariables(int objectId)
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_COUNT))
{
st.setInt(1, objectId);
@@ -79,7 +79,7 @@ public class ItemVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setInt(1, _objectId);
@@ -112,7 +112,7 @@ public class ItemVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -149,7 +149,7 @@ public class ItemVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
index 85508e687b..c677c68971 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/model/variables/PlayerVariables.java
@@ -76,7 +76,7 @@ public class PlayerVariables extends AbstractVariables
public boolean restoreMe()
{
// Restore previous variables.
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement st = con.prepareStatement(SELECT_QUERY))
{
st.setInt(1, _objectId);
@@ -109,7 +109,7 @@ public class PlayerVariables extends AbstractVariables
return false;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
@@ -146,7 +146,7 @@ public class PlayerVariables extends AbstractVariables
@Override
public boolean deleteMe()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
// Clear previous entries.
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/L2GameClient.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/L2GameClient.java
index f1e975876e..fd5baeb233 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/L2GameClient.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/L2GameClient.java
@@ -329,7 +329,7 @@ public final class L2GameClient extends ChannelInboundHandler
}
else
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps2 = con.prepareStatement("UPDATE characters SET deletetime=? WHERE charId=?"))
{
ps2.setLong(1, System.currentTimeMillis() + (Config.DELETE_DAYS * 86400000)); // 24*60*60*1000 = 86400000
@@ -354,7 +354,7 @@ public final class L2GameClient extends ChannelInboundHandler
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("UPDATE characters SET deletetime=0 WHERE charId=?"))
{
statement.setInt(1, objectId);
@@ -377,7 +377,7 @@ public final class L2GameClient extends ChannelInboundHandler
CharNameTable.getInstance().removeName(objid);
- try (Connection con = DatabaseFactory.getInstance().getConnection())
+ try (Connection con = DatabaseFactory.getConnection())
{
try (PreparedStatement ps = con.prepareStatement("DELETE FROM character_contacts WHERE charId=? OR contactId=?"))
{
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
index fad57e47d2..47b144ed9a 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/RequestDestroyItem.java
@@ -164,7 +164,7 @@ public final class RequestDestroyItem implements IClientIncomingPacket
pet.unSummon(activeChar);
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
{
statement.setInt(1, _objectId);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java
index 29ab10a108..a9c8dadb8a 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/RequestPetitionFeedback.java
@@ -62,7 +62,7 @@ public class RequestPetitionFeedback implements IClientIncomingPacket
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_FEEDBACK))
{
statement.setString(1, player.getName());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java
index 213b230d0b..7fad3b21f2 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestAnswerFriendInvite.java
@@ -73,7 +73,7 @@ public final class RequestAnswerFriendInvite implements IClientIncomingPacket
if (_response == 1)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_friends (charId, friendId) VALUES (?, ?), (?, ?)"))
{
statement.setInt(1, requestor.getObjectId());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java
index 2897338b82..69a271f422 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/friend/RequestFriendDel.java
@@ -75,7 +75,7 @@ public final class RequestFriendDel implements IClientIncomingPacket
return;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("DELETE FROM character_friends WHERE (charId=? AND friendId=?) OR (charId=? AND friendId=?)"))
{
statement.setInt(1, activeChar.getObjectId());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java
index 94715a15c1..27668b0d62 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/clientpackets/mentoring/ConfirmMenteeAdd.java
@@ -74,7 +74,7 @@ public class ConfirmMenteeAdd implements IClientIncomingPacket
}
else if (validate(mentor, mentee))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("INSERT INTO character_mentees (charId, mentorId) VALUES (?, ?)"))
{
statement.setInt(1, mentee.getObjectId());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java
index 5d5846ba21..c456c398e0 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/serverpackets/CharSelectionInfo.java
@@ -269,7 +269,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
CharSelectInfoPackage charInfopackage;
final List characterList = new LinkedList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT * FROM characters WHERE account_name=? ORDER BY createDate"))
{
statement.setString(1, loginName);
@@ -302,7 +302,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
private static void loadCharacterSubclassInfo(CharSelectInfoPackage charInfopackage, int ObjectId, int activeClassId)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT exp, sp, level, vitality_points FROM character_subclasses WHERE charId=? AND class_id=? ORDER BY charId"))
{
statement.setInt(1, ObjectId);
@@ -412,7 +412,7 @@ public class CharSelectionInfo implements IClientOutgoingPacket
if (weaponObjId > 0)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT mineralId,option1,option2 FROM item_variations WHERE itemId=?"))
{
statement.setInt(1, weaponObjId);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java
index 14cd41a31e..ebb3f90088 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/network/serverpackets/friend/FriendList.java
@@ -70,7 +70,7 @@ public class FriendList implements IClientOutgoingPacket
if (player1 == null)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement("SELECT char_name, online, classid, level FROM characters WHERE charId = ?"))
{
statement.setInt(1, objId);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java
index 8344576a3e..8876431ff9 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/security/SecondaryPasswordAuth.java
@@ -72,7 +72,7 @@ public class SecondaryPasswordAuth
private void loadPassword()
{
String var, value = null;
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SELECT_PASSWORD))
{
statement.setString(1, _activeClient.getAccountName());
@@ -117,7 +117,7 @@ public class SecondaryPasswordAuth
password = cryptPassword(password);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_PASSWORD))
{
statement.setString(1, _activeClient.getAccountName());
@@ -136,7 +136,7 @@ public class SecondaryPasswordAuth
public boolean insertWrongAttempt(int attempts)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(INSERT_ATTEMPT))
{
statement.setString(1, _activeClient.getAccountName());
@@ -175,7 +175,7 @@ public class SecondaryPasswordAuth
newPassword = cryptPassword(newPassword);
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(UPDATE_PASSWORD))
{
statement.setString(1, newPassword);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
index ca0cef4b3b..a78d28bdc9 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/taskmanager/TaskManager.java
@@ -95,7 +95,7 @@ public final class TaskManager
{
task.onTimeElapsed(this);
lastActivation = System.currentTimeMillis();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[1]))
{
statement.setLong(1, lastActivation);
@@ -182,7 +182,7 @@ public final class TaskManager
private void startAllTasks()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[0]);
ResultSet rset = statement.executeQuery())
{
@@ -314,7 +314,7 @@ public final class TaskManager
private static boolean addUniqueTask(String task, TaskTypes type, String param1, String param2, String param3, long lastActivation)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps1 = con.prepareStatement(SQL_STATEMENTS[2]))
{
ps1.setString(1, task);
@@ -350,7 +350,7 @@ public final class TaskManager
private static boolean addTask(String task, TaskTypes type, String param1, String param2, String param3, long lastActivation)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(SQL_STATEMENTS[3]))
{
statement.setString(1, task);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java
index 5e3e35c6a9..e81b95cba3 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/taskmanager/tasks/TaskBirthday.java
@@ -76,7 +76,7 @@ public class TaskBirthday extends Task
private void checkBirthday(int year, int month, int day)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement statement = con.prepareStatement(QUERY))
{
statement.setString(1, "%-" + getNum(month + 1) + "-" + getNum(day));
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/util/Evolve.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/util/Evolve.java
index 66a22f62fd..f87e33ed8d 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/util/Evolve.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/gameserver/util/Evolve.java
@@ -248,7 +248,7 @@ public final class Evolve
}
// pet control item no longer exists, delete the pet from the db
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM pets WHERE item_obj_id=?"))
{
ps.setInt(1, removedItem.getObjectId());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/loginserver/GameServerTable.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/loginserver/GameServerTable.java
index 1a0713b155..2410f6ede8 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/loginserver/GameServerTable.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/loginserver/GameServerTable.java
@@ -115,7 +115,7 @@ public final class GameServerTable implements IGameXmlReader
*/
private void loadRegisteredGameServers()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement ps = con.createStatement();
ResultSet rs = ps.executeQuery("SELECT * FROM gameservers"))
{
@@ -222,7 +222,7 @@ public final class GameServerTable implements IGameXmlReader
public void registerServerOnDB(byte[] hexId, int id, String externalHost)
{
register(id, new GameServerInfo(id, hexId));
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO gameservers (hexid,server_id,host) values (?,?,?)"))
{
ps.setString(1, hexToString(hexId));
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/loginserver/LoginController.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/loginserver/LoginController.java
index a896c7fd7a..fbee48fc33 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/loginserver/LoginController.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/loginserver/LoginController.java
@@ -176,7 +176,7 @@ public class LoginController
final byte[] raw = password.getBytes(StandardCharsets.UTF_8);
final String hashBase64 = Base64.getEncoder().encodeToString(md.digest(raw));
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(USER_INFO_SELECT))
{
ps.setString(1, Long.toString(System.currentTimeMillis()));
@@ -206,7 +206,7 @@ public class LoginController
return null;
}
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(AUTOCREATE_ACCOUNTS_INSERT))
{
ps.setString(1, login);
@@ -405,7 +405,7 @@ public class LoginController
if (loginOk && (client.getLastServer() != serverId))
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_LAST_SERVER_UPDATE))
{
ps.setInt(1, serverId);
@@ -424,7 +424,7 @@ public class LoginController
public void setAccountAccessLevel(String account, int banLevel)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_ACCESS_LEVEL_UPDATE))
{
ps.setInt(1, banLevel);
@@ -439,7 +439,7 @@ public class LoginController
public void setAccountLastTracert(String account, String pcIp, String hop1, String hop2, String hop3, String hop4)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_IPS_UPDATE))
{
ps.setString(1, pcIp);
@@ -499,7 +499,7 @@ public class LoginController
{
final List ipWhiteList = new ArrayList<>();
final List ipBlackList = new ArrayList<>();
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_IPAUTH_SELECT))
{
ps.setString(1, info.getLogin());
@@ -545,7 +545,7 @@ public class LoginController
client.setAccessLevel(info.getAccessLevel());
client.setLastServer(info.getLastServer());
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(ACCOUNT_INFO_UPDATE))
{
ps.setLong(1, System.currentTimeMillis());
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/loginserver/LoginServer.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/loginserver/LoginServer.java
index 39377afee3..d598992bdf 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/loginserver/LoginServer.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/loginserver/LoginServer.java
@@ -89,7 +89,7 @@ public final class LoginServer
Config.load();
// Prepare Database
- DatabaseFactory.getInstance();
+ DatabaseFactory.init();
try
{
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java
index 69ba99271d..6c73dea27a 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/loginserver/network/gameserverpackets/ChangePassword.java
@@ -78,7 +78,7 @@ public class ChangePassword extends BaseRecievePacket
int passUpdated = 0;
// SQL connection
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("SELECT password FROM accounts WHERE login=?"))
{
ps.setString(1, accountName);
@@ -95,7 +95,7 @@ public class ChangePassword extends BaseRecievePacket
{
final byte[] password = md.digest(newpass.getBytes("UTF-8"));
// SQL connection
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE accounts SET password=? WHERE login=?"))
{
ps.setString(1, Base64.getEncoder().encodeToString(password));
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java
index f9a24a80d8..785946a687 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/loginserver/network/gameserverpackets/RequestTempBan.java
@@ -58,7 +58,7 @@ public class RequestTempBan extends BaseRecievePacket
private void banUser()
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("INSERT INTO account_data VALUES (?, ?, ?) ON DUPLICATE KEY UPDATE value=?"))
{
ps.setString(1, _accountName);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
index 59b0e01835..4fb705c8b1 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/tools/accountmanager/SQLAccountManager.java
@@ -43,6 +43,7 @@ public class SQLAccountManager
{
Server.serverMode = Server.MODE_LOGINSERVER;
Config.load();
+ DatabaseFactory.init();
try (Scanner _scn = new Scanner(System.in))
{
@@ -166,7 +167,7 @@ public class SQLAccountManager
}
q = q.concat(" ORDER BY login ASC");
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement(q);
ResultSet rset = ps.executeQuery())
{
@@ -187,7 +188,7 @@ public class SQLAccountManager
private static void addOrUpdateAccount(String account, String password, String level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("REPLACE accounts(login, password, accessLevel) VALUES (?, ?, ?)"))
{
final MessageDigest md = MessageDigest.getInstance("SHA");
@@ -213,7 +214,7 @@ public class SQLAccountManager
private static void changeAccountLevel(String account, String level)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("UPDATE accounts SET accessLevel = ? WHERE login = ?"))
{
ps.setString(1, level);
@@ -236,7 +237,7 @@ public class SQLAccountManager
private static void deleteAccount(String account)
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM accounts WHERE login = ?"))
{
ps.setString(1, account);
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java
index 4ac531c664..fd25fddae4 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/tools/dbinstaller/console/DBInstallerConsole.java
@@ -34,7 +34,7 @@ public class DBInstallerConsole implements DBOutputInterface
public DBInstallerConsole(String db, String dir) throws Exception
{
- System.out.println("Welcome to L2J DataBase installer");
+ System.out.println("Welcome to DataBase installer");
final Preferences prop = Preferences.userRoot();
RunTasks rt = null;
try (Scanner scn = new Scanner(new CloseShieldedInputStream(System.in)))
diff --git a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
index c90c8127a6..8e5a6bde49 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
+++ b/L2J_Mobius_Classic_2.2_Antharas/java/com/l2jmobius/tools/gsregistering/BaseGameServerRegister.java
@@ -187,6 +187,7 @@ public abstract class BaseGameServerRegister
Server.serverMode = Server.MODE_LOGINSERVER;
Config.load();
+ DatabaseFactory.init();
GameServerTable.getInstance();
_loaded = true;
@@ -215,7 +216,7 @@ public abstract class BaseGameServerRegister
*/
public static void unregisterGameServer(int id) throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
PreparedStatement ps = con.prepareStatement("DELETE FROM gameservers WHERE server_id = ?"))
{
@@ -231,7 +232,7 @@ public abstract class BaseGameServerRegister
*/
public static void unregisterAllGameServers() throws SQLException
{
- try (Connection con = DatabaseFactory.getInstance().getConnection();
+ try (Connection con = DatabaseFactory.getConnection();
Statement s = con.createStatement())
{
s.executeUpdate("DELETE FROM gameservers");
diff --git a/L2J_Mobius_Classic_2.2_Antharas/launcher/Gameserver.launch b/L2J_Mobius_Classic_2.2_Antharas/launcher/Gameserver.launch
index 2ed833faa9..3fcf7a850e 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/launcher/Gameserver.launch
+++ b/L2J_Mobius_Classic_2.2_Antharas/launcher/Gameserver.launch
@@ -7,12 +7,13 @@
-
+
+
diff --git a/L2J_Mobius_Classic_2.2_Antharas/launcher/Loginserver.launch b/L2J_Mobius_Classic_2.2_Antharas/launcher/Loginserver.launch
index 1dc283692d..2ba09893a6 100644
--- a/L2J_Mobius_Classic_2.2_Antharas/launcher/Loginserver.launch
+++ b/L2J_Mobius_Classic_2.2_Antharas/launcher/Loginserver.launch
@@ -7,7 +7,7 @@
-
+
@@ -15,5 +15,6 @@
+