Refactored DatabaseFactory.
This commit is contained in:
@@ -31,7 +31,7 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.datatables.SpawnTable;
|
||||
import com.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
@@ -114,7 +114,7 @@ public class AutoSpawnHandler
|
||||
|
||||
private void restoreSpawnData()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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=?"))
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
@@ -79,7 +79,7 @@ public class BlockList
|
||||
|
||||
public void updateBlockMemos()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
for (int target : _updateMemos)
|
||||
{
|
||||
@@ -108,7 +108,7 @@ public class BlockList
|
||||
private static HashMap<Integer, String> loadList(int ObjId)
|
||||
{
|
||||
final HashMap<Integer, String> list = new HashMap<>();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT friendId, memo FROM character_friends WHERE charId=? AND relation=1"))
|
||||
{
|
||||
ps.setInt(1, ObjId);
|
||||
@@ -136,7 +136,7 @@ public class BlockList
|
||||
|
||||
private void removeFromDB(int targetId)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM character_friends WHERE charId=? AND friendId=? AND relation=1"))
|
||||
{
|
||||
ps.setInt(1, _owner.getObjectId());
|
||||
@@ -151,7 +151,7 @@ public class BlockList
|
||||
|
||||
private void persistInDB(int targetId)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("INSERT INTO character_friends (charId, friendId, relation) VALUES (?, ?, 1)"))
|
||||
{
|
||||
ps.setInt(1, _owner.getObjectId());
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.TransformData;
|
||||
import com.l2jmobius.gameserver.datatables.SkillData;
|
||||
@@ -138,7 +138,7 @@ public class CursedWeapon implements INamable
|
||||
// Remove from Db
|
||||
_log.info(_name + " being removed offline.");
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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=?"))
|
||||
{
|
||||
@@ -483,7 +483,7 @@ public class CursedWeapon implements INamable
|
||||
_log.info("CursedWeapon: Saving data to disk.");
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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 (?, ?, ?, ?, ?, ?)"))
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.communitybbs.BB.Forum;
|
||||
import com.l2jmobius.gameserver.communitybbs.Manager.ForumsBBSManager;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
@@ -246,7 +246,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
}
|
||||
else
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE characters SET clan_privs = ? WHERE charId = ?"))
|
||||
{
|
||||
ps.setInt(1, 0);
|
||||
@@ -286,7 +286,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
}
|
||||
else
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE characters SET clan_privs = ? WHERE charId = ?"))
|
||||
{
|
||||
ps.setInt(1, EnumIntBitmask.getAllBitmask(ClanPrivilege.class));
|
||||
@@ -881,7 +881,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
*/
|
||||
public void updateBloodAllianceCountInDB()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET blood_alliance_count=? WHERE clan_id=?"))
|
||||
{
|
||||
ps.setInt(1, getBloodAllianceCount());
|
||||
@@ -925,7 +925,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
*/
|
||||
public void updateBloodOathCountInDB()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET blood_oath_count=? WHERE clan_id=?"))
|
||||
{
|
||||
ps.setInt(1, getBloodOathCount());
|
||||
@@ -943,7 +943,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
*/
|
||||
public void updateClanScoreInDB()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET reputation_score=? WHERE clan_id=?"))
|
||||
{
|
||||
ps.setInt(1, getReputationScore());
|
||||
@@ -972,7 +972,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
*/
|
||||
public void updateClanInDB()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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());
|
||||
@@ -1014,7 +1014,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
*/
|
||||
public void store()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(INSERT_CLAN_DATA))
|
||||
{
|
||||
ps.setInt(1, getId());
|
||||
@@ -1050,7 +1050,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
*/
|
||||
private void removeMemberInDatabase(int playerId, long clanJoinExpiryTime, long clanCreateExpiryTime)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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=?"))
|
||||
@@ -1076,7 +1076,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
|
||||
private void restore()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(SELECT_CLAN_DATA))
|
||||
{
|
||||
ps.setInt(1, getId());
|
||||
@@ -1156,7 +1156,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
|
||||
private void restoreNotice()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT enabled,notice FROM clan_notices WHERE clan_id=?"))
|
||||
{
|
||||
ps.setInt(1, getId());
|
||||
@@ -1187,7 +1187,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
notice = notice.substring(0, MAX_NOTICE_LENGTH - 1);
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_notices (clan_id,notice,enabled) values (?,?,?) ON DUPLICATE KEY UPDATE notice=?,enabled=?"))
|
||||
{
|
||||
ps.setInt(1, getId());
|
||||
@@ -1246,7 +1246,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
|
||||
private void restoreSkills()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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
|
||||
@@ -1369,7 +1369,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
}
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
if (oldSkill != null)
|
||||
{
|
||||
@@ -1805,7 +1805,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
|
||||
private void restoreSubPledges()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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
|
||||
@@ -1905,7 +1905,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
return null;
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_subpledges (clan_id,sub_pledge_id,name,leader_id) values (?,?,?,?)"))
|
||||
{
|
||||
ps.setInt(1, getId());
|
||||
@@ -1993,7 +1993,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
|
||||
public void updateSubPledgeInDB(int pledgeType)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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());
|
||||
@@ -2014,7 +2014,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
|
||||
private void restoreRankPrivs()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT privs,rank,party FROM clan_privs WHERE clan_id=?"))
|
||||
{
|
||||
// Retrieve all skills of this L2PcInstance from the database
|
||||
@@ -2067,7 +2067,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
{
|
||||
_privs.get(rank).setPrivs(privs);
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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
|
||||
@@ -2103,7 +2103,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
{
|
||||
_privs.put(rank, new RankPrivs(rank, privs));
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("INSERT INTO clan_privs (clan_id,rank,party,privs) VALUES (?,?,?,?)"))
|
||||
{
|
||||
// Retrieve all skills of this L2PcInstance from the database
|
||||
@@ -2241,7 +2241,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
|
||||
if (storeInDb)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET auction_bid_at=? WHERE clan_id=?"))
|
||||
{
|
||||
ps.setInt(1, id);
|
||||
@@ -2802,7 +2802,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
|
||||
public void changeLevel(int level)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET clan_level = ? WHERE clan_id = ?"))
|
||||
{
|
||||
ps.setInt(1, level);
|
||||
@@ -2848,7 +2848,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
|
||||
setCrestId(crestId);
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET crest_id = ? WHERE clan_id = ?"))
|
||||
{
|
||||
ps.setInt(1, crestId);
|
||||
@@ -2885,7 +2885,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
allyId = getAllyId();
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(sqlStatement))
|
||||
{
|
||||
ps.setInt(1, crestId);
|
||||
@@ -2931,7 +2931,7 @@ public class L2Clan implements IIdentifiable, INamable
|
||||
|
||||
setCrestLargeId(crestId);
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE clan_data SET crest_large_id = ? WHERE clan_id = ?"))
|
||||
{
|
||||
ps.setInt(1, crestId);
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.sql.SQLException;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.instancemanager.SiegeManager;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
@@ -264,7 +264,7 @@ public class L2ClanMember
|
||||
*/
|
||||
public void updatePledgeType()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE characters SET subpledge=? WHERE charId=?"))
|
||||
{
|
||||
ps.setLong(1, _pledgeType);
|
||||
@@ -313,7 +313,7 @@ public class L2ClanMember
|
||||
*/
|
||||
public void updatePowerGrade()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE characters SET power_grade=? WHERE charId=?"))
|
||||
{
|
||||
ps.setLong(1, _powerGrade);
|
||||
@@ -840,7 +840,7 @@ public class L2ClanMember
|
||||
*/
|
||||
public void saveApprenticeAndSponsor(int apprentice, int sponsor)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE characters SET apprentice=?,sponsor=? WHERE charId=?"))
|
||||
{
|
||||
ps.setInt(1, apprentice);
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.SystemMessageId;
|
||||
@@ -57,7 +57,7 @@ public class L2ContactList
|
||||
{
|
||||
_contacts.clear();
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(QUERY_LOAD))
|
||||
{
|
||||
ps.setInt(1, activeChar.getObjectId());
|
||||
@@ -123,7 +123,7 @@ public class L2ContactList
|
||||
}
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(QUERY_ADD))
|
||||
{
|
||||
ps.setInt(1, activeChar.getObjectId());
|
||||
@@ -160,7 +160,7 @@ public class L2ContactList
|
||||
|
||||
_contacts.remove(name);
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(QUERY_REMOVE))
|
||||
{
|
||||
ps.setInt(1, activeChar.getObjectId());
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.sql.ResultSet;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.network.serverpackets.L2GameServerPacket;
|
||||
|
||||
@@ -49,7 +49,7 @@ public class L2Mentee
|
||||
final L2PcInstance player = getPlayerInstance();
|
||||
if (player == null) // Only if player is offline
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT char_name, level, base_class FROM characters WHERE charId = ?"))
|
||||
{
|
||||
ps.setInt(1, getObjectId());
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.util.StringTokenizer;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.enums.MacroType;
|
||||
import com.l2jmobius.gameserver.enums.MacroUpdateType;
|
||||
import com.l2jmobius.gameserver.enums.ShortcutType;
|
||||
@@ -125,7 +125,7 @@ public class MacroList implements IRestorable
|
||||
|
||||
private void registerMacroInDb(Macro macro)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("INSERT INTO character_macroses (charId,id,icon,name,descr,acronym,commands) values(?,?,?,?,?,?,?)"))
|
||||
{
|
||||
ps.setInt(1, _owner.getObjectId());
|
||||
@@ -161,7 +161,7 @@ public class MacroList implements IRestorable
|
||||
|
||||
private void deleteMacroFromDb(Macro macro)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM character_macroses WHERE charId=? AND id=?"))
|
||||
{
|
||||
ps.setInt(1, _owner.getObjectId());
|
||||
@@ -178,7 +178,7 @@ public class MacroList implements IRestorable
|
||||
public boolean restoreMe()
|
||||
{
|
||||
_macroses.clear();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT charId, id, icon, name, descr, acronym, commands FROM character_macroses WHERE charId=?"))
|
||||
{
|
||||
ps.setInt(1, _owner.getObjectId());
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.TreeMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.enums.ShortcutType;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jmobius.gameserver.model.interfaces.IRestorable;
|
||||
@@ -89,7 +89,7 @@ public class ShortCuts implements IRestorable
|
||||
deleteShortCutFromDb(oldShortCut);
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("REPLACE INTO character_shortcuts (charId,slot,page,type,shortcut_id,level,class_index) values(?,?,?,?,?,?,?)"))
|
||||
{
|
||||
ps.setInt(1, _owner.getObjectId());
|
||||
@@ -209,7 +209,7 @@ public class ShortCuts implements IRestorable
|
||||
*/
|
||||
private void deleteShortCutFromDb(Shortcut shortcut)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM character_shortcuts WHERE charId=? AND slot=? AND page=? AND class_index=?"))
|
||||
{
|
||||
ps.setInt(1, _owner.getObjectId());
|
||||
@@ -228,7 +228,7 @@ public class ShortCuts implements IRestorable
|
||||
public boolean restoreMe()
|
||||
{
|
||||
_shortCuts.clear();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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());
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.UIData;
|
||||
|
||||
/**
|
||||
@@ -104,7 +104,7 @@ public class UIKeysSettings
|
||||
}
|
||||
}
|
||||
query = query.substring(0, query.length() - 1) + "; ";
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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 = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(query))
|
||||
{
|
||||
statement.execute();
|
||||
@@ -146,7 +146,7 @@ public class UIKeysSettings
|
||||
|
||||
_storedCategories = new HashMap<>();
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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 = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT * FROM character_ui_actions WHERE `charId` = ? ORDER BY `cat`, `order`"))
|
||||
{
|
||||
ps.setInt(1, _playerObjId);
|
||||
|
||||
@@ -45,7 +45,7 @@ import java.util.concurrent.locks.ReentrantLock;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.GameTimeController;
|
||||
import com.l2jmobius.gameserver.GeoData;
|
||||
import com.l2jmobius.gameserver.ItemsAutoDestroy;
|
||||
@@ -1397,7 +1397,7 @@ public final class L2PcInstance extends L2Playable
|
||||
|
||||
private void insertNewRecipeData(int recipeId, boolean isDwarf)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("INSERT INTO character_recipebook (charId, id, classIndex, type) values(?,?,?,?)"))
|
||||
{
|
||||
ps.setInt(1, getObjectId());
|
||||
@@ -1414,7 +1414,7 @@ public final class L2PcInstance extends L2Playable
|
||||
|
||||
private void deleteRecipeData(int recipeId, boolean isDwarf)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM character_recipebook WHERE charId=? AND id=? AND classIndex=?"))
|
||||
{
|
||||
ps.setInt(1, getObjectId());
|
||||
@@ -7052,7 +7052,7 @@ public final class L2PcInstance extends L2Playable
|
||||
*/
|
||||
public void updateOnlineStatus()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE characters SET online=?, lastAccess=? WHERE charId=?"))
|
||||
{
|
||||
ps.setInt(1, isOnlineInt());
|
||||
@@ -7072,7 +7072,7 @@ public final class L2PcInstance extends L2Playable
|
||||
*/
|
||||
private boolean createDb()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(INSERT_CHARACTER))
|
||||
{
|
||||
ps.setString(1, _accountName);
|
||||
@@ -7136,7 +7136,7 @@ public final class L2PcInstance extends L2Playable
|
||||
double currentCp = 0;
|
||||
double currentHp = 0;
|
||||
double currentMp = 0;
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(RESTORE_CHARACTER))
|
||||
{
|
||||
// Retrieve the L2PcInstance from the characters table of the database
|
||||
@@ -7470,7 +7470,7 @@ public final class L2PcInstance extends L2Playable
|
||||
*/
|
||||
private static boolean restoreSubClassData(L2PcInstance player)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(RESTORE_CHAR_SUBCLASSES))
|
||||
{
|
||||
ps.setInt(1, player.getObjectId());
|
||||
@@ -7553,7 +7553,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 = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(sql))
|
||||
{
|
||||
ps.setInt(1, getObjectId());
|
||||
@@ -7606,7 +7606,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 = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(sql))
|
||||
{
|
||||
ps.setInt(1, getObjectId());
|
||||
@@ -7630,7 +7630,7 @@ public final class L2PcInstance extends L2Playable
|
||||
|
||||
public void updatePremiumItem(int itemNum, long newcount)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE character_premium_items SET itemCount=? WHERE charId=? AND itemNum=? "))
|
||||
{
|
||||
ps.setLong(1, newcount);
|
||||
@@ -7646,7 +7646,7 @@ public final class L2PcInstance extends L2Playable
|
||||
|
||||
public void deletePremiumItem(int itemNum)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM character_premium_items WHERE charId=? AND itemNum=? "))
|
||||
{
|
||||
ps.setInt(1, getObjectId());
|
||||
@@ -7705,7 +7705,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 = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(UPDATE_CHARACTER))
|
||||
{
|
||||
ps.setInt(1, level);
|
||||
@@ -7793,7 +7793,7 @@ public final class L2PcInstance extends L2Playable
|
||||
}
|
||||
|
||||
// TODO(Zoey76): Refactor this to use batch.
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(UPDATE_CHAR_SUBCLASS))
|
||||
{
|
||||
for (SubClass subClass : getSubClasses().values())
|
||||
@@ -7824,7 +7824,7 @@ public final class L2PcInstance extends L2Playable
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement delete = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||
PreparedStatement statement = con.prepareStatement(ADD_SKILL_SAVE);)
|
||||
{
|
||||
@@ -7927,7 +7927,7 @@ public final class L2PcInstance extends L2Playable
|
||||
|
||||
private void storeItemReuseDelay()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps1 = con.prepareStatement(DELETE_ITEM_REUSE_SAVE);
|
||||
PreparedStatement ps2 = con.prepareStatement(ADD_ITEM_REUSE_SAVE))
|
||||
{
|
||||
@@ -8042,7 +8042,7 @@ public final class L2PcInstance extends L2Playable
|
||||
final Skill oldSkill = super.removeSkill(skill, true);
|
||||
if (oldSkill != null)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(DELETE_SKILL_FROM_CHAR))
|
||||
{
|
||||
// Remove or update a L2PcInstance skill from the character_skills table of the database
|
||||
@@ -8085,7 +8085,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 = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
if ((oldSkill != null) && (newSkill != null))
|
||||
{
|
||||
@@ -8133,7 +8133,7 @@ public final class L2PcInstance extends L2Playable
|
||||
}
|
||||
|
||||
final int classIndex = (newClassIndex > -1) ? newClassIndex : _classIndex;
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(ADD_NEW_SKILLS))
|
||||
{
|
||||
con.setAutoCommit(false);
|
||||
@@ -8159,7 +8159,7 @@ public final class L2PcInstance extends L2Playable
|
||||
*/
|
||||
private void restoreSkills()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(RESTORE_SKILLS_FOR_CHAR))
|
||||
{
|
||||
// Retrieve all skills of this L2PcInstance from the database
|
||||
@@ -8210,7 +8210,7 @@ public final class L2PcInstance extends L2Playable
|
||||
@Override
|
||||
public void restoreEffects()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(RESTORE_SKILL_SAVE))
|
||||
{
|
||||
ps.setInt(1, getObjectId());
|
||||
@@ -8267,7 +8267,7 @@ public final class L2PcInstance extends L2Playable
|
||||
*/
|
||||
private void restoreItemReuse()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(RESTORE_ITEM_REUSE_SAVE);
|
||||
PreparedStatement delete = con.prepareStatement(DELETE_ITEM_REUSE_SAVE);)
|
||||
{
|
||||
@@ -8338,7 +8338,7 @@ public final class L2PcInstance extends L2Playable
|
||||
_henna[i] = null;
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(RESTORE_CHAR_HENNAS))
|
||||
{
|
||||
ps.setInt(1, getObjectId());
|
||||
@@ -8426,7 +8426,7 @@ public final class L2PcInstance extends L2Playable
|
||||
|
||||
_henna[slot] = null;
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(DELETE_CHAR_HENNA))
|
||||
{
|
||||
ps.setInt(1, getObjectId());
|
||||
@@ -8500,7 +8500,7 @@ public final class L2PcInstance extends L2Playable
|
||||
}
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(ADD_CHAR_HENNA))
|
||||
{
|
||||
ps.setInt(1, getObjectId());
|
||||
@@ -10534,7 +10534,7 @@ public final class L2PcInstance extends L2Playable
|
||||
newClass.setLevel(Config.BASE_DUALCLASS_LEVEL);
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(ADD_CHAR_SUBCLASS))
|
||||
{
|
||||
// Store the basic info about this new sub-class.
|
||||
@@ -10601,7 +10601,7 @@ public final class L2PcInstance extends L2Playable
|
||||
|
||||
try
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement deleteHennas = con.prepareStatement(DELETE_CHAR_HENNAS);
|
||||
PreparedStatement deleteShortcuts = con.prepareStatement(DELETE_CHAR_SHORTCUTS);
|
||||
PreparedStatement deleteSkillReuse = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||
@@ -13298,7 +13298,7 @@ public final class L2PcInstance extends L2Playable
|
||||
if ((_controlItemId != 0) && (petId != 0))
|
||||
{
|
||||
final String req = "UPDATE pets SET fed=? WHERE item_obj_id = ?";
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(req))
|
||||
{
|
||||
ps.setInt(1, getCurrentFeed());
|
||||
@@ -13450,7 +13450,7 @@ public final class L2PcInstance extends L2Playable
|
||||
bookmark.setTag(tag);
|
||||
bookmark.setName(name);
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(UPDATE_TP_BOOKMARK))
|
||||
{
|
||||
ps.setInt(1, icon);
|
||||
@@ -13473,7 +13473,7 @@ public final class L2PcInstance extends L2Playable
|
||||
{
|
||||
if (_tpbookmarks.remove(id) != null)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(DELETE_TP_BOOKMARK))
|
||||
{
|
||||
ps.setInt(1, getObjectId());
|
||||
@@ -13616,7 +13616,7 @@ public final class L2PcInstance extends L2Playable
|
||||
sm.addItemName(20033);
|
||||
sendPacket(sm);
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(INSERT_TP_BOOKMARK))
|
||||
{
|
||||
ps.setInt(1, getObjectId());
|
||||
@@ -13638,7 +13638,7 @@ public final class L2PcInstance extends L2Playable
|
||||
|
||||
public void restoreTeleportBookmark()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(RESTORE_TP_BOOKMARK))
|
||||
{
|
||||
ps.setInt(1, getObjectId());
|
||||
@@ -13869,7 +13869,7 @@ public final class L2PcInstance extends L2Playable
|
||||
public void updateMemos()
|
||||
{
|
||||
final String sqlQuery = "UPDATE character_friends SET memo=? WHERE charId=? AND friendId=? AND relation=0";
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
for (int target : _updateMemos)
|
||||
{
|
||||
@@ -13901,7 +13901,7 @@ public final class L2PcInstance extends L2Playable
|
||||
_friendList.clear();
|
||||
|
||||
final String sqlQuery = "SELECT friendId, memo FROM character_friends WHERE charId=? AND relation=0";
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(sqlQuery))
|
||||
{
|
||||
ps.setInt(1, getObjectId());
|
||||
@@ -13949,7 +13949,7 @@ public final class L2PcInstance extends L2Playable
|
||||
final Friend friend = _friendList.get(friendId);
|
||||
int bClassId = 0;
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT * FROM characters WHERE charId=?");)
|
||||
{
|
||||
ps.setInt(1, friendId);
|
||||
@@ -13974,7 +13974,7 @@ public final class L2PcInstance extends L2Playable
|
||||
}
|
||||
if (friend.getClassId() != bClassId)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT level FROM character_subclasses WHERE charId=? AND class_id=?");)
|
||||
{
|
||||
ps.setInt(1, friendId);
|
||||
@@ -13997,7 +13997,7 @@ public final class L2PcInstance extends L2Playable
|
||||
}
|
||||
if (friend.getClanId() != 0)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT * FROM clan_data WHERE clan_id=?");)
|
||||
{
|
||||
ps.setInt(1, friend.getClanId());
|
||||
@@ -14088,7 +14088,7 @@ public final class L2PcInstance extends L2Playable
|
||||
{
|
||||
if (hasManufactureShop())
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
try (PreparedStatement st = con.prepareStatement(DELETE_CHAR_RECIPE_SHOP))
|
||||
{
|
||||
@@ -14126,7 +14126,7 @@ public final class L2PcInstance extends L2Playable
|
||||
_manufactureItems.clear();
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(RESTORE_CHAR_RECIPE_SHOP))
|
||||
{
|
||||
ps.setInt(1, getObjectId());
|
||||
@@ -14579,7 +14579,7 @@ public final class L2PcInstance extends L2Playable
|
||||
*/
|
||||
private void restorePetInventoryItems()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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());
|
||||
@@ -14619,7 +14619,7 @@ public final class L2PcInstance extends L2Playable
|
||||
*/
|
||||
private void loadRecommendations()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT rec_have,rec_left,time_left FROM character_reco_bonus WHERE charId=? LIMIT 1"))
|
||||
{
|
||||
ps.setInt(1, getObjectId());
|
||||
@@ -14643,7 +14643,7 @@ public final class L2PcInstance extends L2Playable
|
||||
*/
|
||||
public void storeRecommendations()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("REPLACE INTO character_reco_bonus (charId,rec_have,rec_left,time_left) VALUES (?,?,?,?)"))
|
||||
{
|
||||
ps.setInt(1, getObjectId());
|
||||
@@ -14703,7 +14703,7 @@ public final class L2PcInstance extends L2Playable
|
||||
private static void restorePremiumSystemData(L2PcInstance player, String account)
|
||||
{
|
||||
boolean success = false;
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
final PreparedStatement ps = con.prepareStatement(RESTORE_PREMIUMSERVICE);
|
||||
ps.setString(1, account);
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharSummonTable;
|
||||
@@ -793,7 +793,7 @@ public class L2PetInstance extends L2Summon
|
||||
}
|
||||
|
||||
// pet control item no longer exists, delete the pet from the db
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM pets WHERE item_obj_id = ?"))
|
||||
{
|
||||
ps.setInt(1, getControlObjectId());
|
||||
@@ -851,7 +851,7 @@ public class L2PetInstance extends L2Summon
|
||||
|
||||
private static L2PetInstance restore(L2ItemInstance control, L2NpcTemplate template, L2PcInstance owner)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT item_obj_id, name, level, curHp, curMp, exp, sp, fed FROM pets WHERE item_obj_id=?"))
|
||||
{
|
||||
L2PetInstance pet;
|
||||
@@ -952,7 +952,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 = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(req))
|
||||
{
|
||||
ps.setString(1, getName());
|
||||
@@ -1002,7 +1002,7 @@ public class L2PetInstance extends L2Summon
|
||||
// Clear list for overwrite
|
||||
SummonEffectsTable.getInstance().clearPetEffects(getControlObjectId());
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps1 = con.prepareStatement(DELETE_SKILL_SAVE);
|
||||
PreparedStatement ps2 = con.prepareStatement(ADD_SKILL_SAVE))
|
||||
{
|
||||
@@ -1069,7 +1069,7 @@ public class L2PetInstance extends L2Summon
|
||||
@Override
|
||||
public void restoreEffects()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps1 = con.prepareStatement(RESTORE_SKILL_SAVE);
|
||||
PreparedStatement ps2 = con.prepareStatement(DELETE_SKILL_SAVE))
|
||||
{
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.ai.CtrlIntention;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharSummonTable;
|
||||
@@ -224,7 +224,7 @@ public class L2ServitorInstance extends L2Summon implements Runnable
|
||||
// Clear list for overwrite
|
||||
SummonEffectsTable.getInstance().clearServitorEffects(getOwner(), getReferenceSkill());
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(DELETE_SKILL_SAVE))
|
||||
{
|
||||
// Delete all current stored effects for summon to avoid dupe
|
||||
@@ -302,7 +302,7 @@ public class L2ServitorInstance extends L2Summon implements Runnable
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
if (!SummonEffectsTable.getInstance().containsSkill(getOwner(), getReferenceSkill()))
|
||||
{
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.sql.Statement;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
@@ -108,7 +108,7 @@ public class Announcement implements IAnnouncement
|
||||
@Override
|
||||
public boolean storeMe()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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 = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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 = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(DELETE_QUERY))
|
||||
{
|
||||
ps.setInt(1, _id);
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.util.Broadcast;
|
||||
|
||||
@@ -94,7 +94,7 @@ public final class AutoAnnouncement extends Announcement implements Runnable
|
||||
@Override
|
||||
public boolean storeMe()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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 = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(UPDATE_QUERY))
|
||||
{
|
||||
ps.setInt(1, getType().ordinal());
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.concurrent.atomic.AtomicLong;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.model.items.L2Item;
|
||||
|
||||
@@ -159,7 +159,7 @@ public final class Product
|
||||
|
||||
private void save()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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, getBuyListId());
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jmobius.gameserver.enums.AuctionItemType;
|
||||
@@ -162,7 +162,7 @@ public class Auction
|
||||
/** Load auctions */
|
||||
private void load()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("Select * from auction where id = ?"))
|
||||
{
|
||||
ps.setInt(1, getId());
|
||||
@@ -197,7 +197,7 @@ public class Auction
|
||||
_highestBidderName = "";
|
||||
_highestBidderMaxBid = 0;
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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, getId());
|
||||
@@ -246,7 +246,7 @@ public class Auction
|
||||
/** Save Auction Data End */
|
||||
private void saveAuctionDate()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("Update auction set endDate = ? where id = ?"))
|
||||
{
|
||||
ps.setLong(1, _endDate);
|
||||
@@ -344,7 +344,7 @@ public class Auction
|
||||
*/
|
||||
private void updateInDB(L2PcInstance bidder, long bid)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
if (_bidders.get(bidder.getClanId()) != null)
|
||||
{
|
||||
@@ -401,7 +401,7 @@ public class Auction
|
||||
/** Remove bids */
|
||||
private void removeBids()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM auction_bid WHERE auctionId=?"))
|
||||
{
|
||||
ps.setInt(1, getId());
|
||||
@@ -434,7 +434,7 @@ public class Auction
|
||||
public void deleteAuctionFromDB()
|
||||
{
|
||||
ClanHallAuctionManager.getInstance().getAuctions().remove(this);
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM auction WHERE itemId=?"))
|
||||
{
|
||||
ps.setInt(1, _itemId);
|
||||
@@ -490,7 +490,7 @@ public class Auction
|
||||
*/
|
||||
public synchronized void cancelBid(int bidder)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM auction_bid WHERE auctionId=? AND bidderId=?"))
|
||||
{
|
||||
ps.setInt(1, getId());
|
||||
@@ -519,7 +519,7 @@ public class Auction
|
||||
public void confirmAuction()
|
||||
{
|
||||
ClanHallAuctionManager.getInstance().getAuctions().add(this);
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("INSERT INTO auction (id, sellerId, sellerName, sellerClanName, itemType, itemId, itemObjectId, itemName, itemQuantity, startingBid, currentBid, endDate) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)"))
|
||||
{
|
||||
ps.setInt(1, getId());
|
||||
|
||||
@@ -29,7 +29,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.CastleData;
|
||||
@@ -219,7 +219,7 @@ public final class Castle extends AbstractResidence
|
||||
|
||||
public void dbSave()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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
|
||||
}
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE castle SET treasury = ? WHERE id = ?"))
|
||||
{
|
||||
ps.setLong(1, getTreasury());
|
||||
@@ -622,7 +622,7 @@ public final class Castle extends AbstractResidence
|
||||
@Override
|
||||
protected void load()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps1 = con.prepareStatement("SELECT * FROM castle WHERE id = ?");
|
||||
PreparedStatement ps2 = con.prepareStatement("SELECT clan_id FROM clan_data WHERE hasCastle = ?"))
|
||||
{
|
||||
@@ -669,7 +669,7 @@ public final class Castle extends AbstractResidence
|
||||
/** Load All Functions */
|
||||
private void loadFunctions()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_functions WHERE castle_id = ?"))
|
||||
{
|
||||
ps.setInt(1, getResidenceId());
|
||||
@@ -694,7 +694,7 @@ public final class Castle extends AbstractResidence
|
||||
public void removeFunction(int functionType)
|
||||
{
|
||||
_function.remove(functionType);
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_functions WHERE castle_id=? AND type=?"))
|
||||
{
|
||||
ps.setInt(1, getResidenceId());
|
||||
@@ -769,7 +769,7 @@ public final class Castle extends AbstractResidence
|
||||
// This method loads castle door upgrade data from database
|
||||
private void loadDoorUpgrade()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_doorupgrade WHERE castleId=?"))
|
||||
{
|
||||
ps.setInt(1, getResidenceId());
|
||||
@@ -795,7 +795,7 @@ public final class Castle extends AbstractResidence
|
||||
door.setCurrentHp(door.getCurrentHp());
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_doorupgrade WHERE castleId=?"))
|
||||
{
|
||||
ps.setInt(1, getResidenceId());
|
||||
@@ -820,7 +820,7 @@ public final class Castle extends AbstractResidence
|
||||
|
||||
if (save)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_doorupgrade (doorId, ratio, castleId) values (?,?,?)"))
|
||||
{
|
||||
ps.setInt(1, doorId);
|
||||
@@ -847,7 +847,7 @@ public final class Castle extends AbstractResidence
|
||||
CastleManorManager.getInstance().resetManorData(getResidenceId());
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().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 = ?"))
|
||||
@@ -1026,7 +1026,7 @@ public final class Castle extends AbstractResidence
|
||||
|
||||
public void updateShowNpcCrest()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE castle SET showNpcCrest = ? WHERE id = ?"))
|
||||
{
|
||||
ps.setString(1, String.valueOf(getShowNpcCrest()));
|
||||
@@ -1070,7 +1070,7 @@ public final class Castle extends AbstractResidence
|
||||
{
|
||||
_ticketBuyCount = count;
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE castle SET ticketBuyCount = ? WHERE id = ?"))
|
||||
{
|
||||
ps.setInt(1, _ticketBuyCount);
|
||||
@@ -1093,7 +1093,7 @@ public final class Castle extends AbstractResidence
|
||||
{
|
||||
if (save)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("REPLACE INTO castle_trapupgrade (castleId, towerIndex, level) values (?,?,?)"))
|
||||
{
|
||||
ps.setInt(1, getResidenceId());
|
||||
@@ -1120,7 +1120,7 @@ public final class Castle extends AbstractResidence
|
||||
ts.setUpgradeLevel(0);
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM castle_trapupgrade WHERE castleId=?"))
|
||||
{
|
||||
ps.setInt(1, getResidenceId());
|
||||
@@ -1210,7 +1210,7 @@ public final class Castle extends AbstractResidence
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE castle SET side = ? WHERE id = ?"))
|
||||
{
|
||||
ps.setString(1, side.toString());
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
@@ -185,7 +185,7 @@ public abstract class ClanHall
|
||||
|
||||
public void dbSave()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("REPLACE INTO clanhall_functions (hall_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)"))
|
||||
{
|
||||
ps.setInt(1, getId());
|
||||
@@ -443,7 +443,7 @@ public abstract class ClanHall
|
||||
/** Load All Functions */
|
||||
protected void loadFunctions()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT * FROM clanhall_functions WHERE hall_id = ?"))
|
||||
{
|
||||
ps.setInt(1, getId());
|
||||
@@ -468,7 +468,7 @@ public abstract class ClanHall
|
||||
public void removeFunction(int functionType)
|
||||
{
|
||||
_functions.remove(functionType);
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM clanhall_functions WHERE hall_id=? AND type=?"))
|
||||
{
|
||||
ps.setInt(1, getId());
|
||||
|
||||
@@ -23,7 +23,7 @@ import java.util.Calendar;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
@@ -45,7 +45,7 @@ public class Couple
|
||||
{
|
||||
_Id = coupleId;
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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 = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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 = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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 = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM mods_wedding WHERE id=?"))
|
||||
{
|
||||
ps.setInt(1, _Id);
|
||||
|
||||
@@ -34,7 +34,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.FortUpdater;
|
||||
import com.l2jmobius.gameserver.FortUpdater.UpdaterType;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
@@ -219,7 +219,7 @@ public final class Fort extends AbstractResidence
|
||||
|
||||
public void dbSave()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("REPLACE INTO fort_functions (fort_id, type, lvl, lease, rate, endTime) VALUES (?,?,?,?,?,?)"))
|
||||
{
|
||||
ps.setInt(1, getResidenceId());
|
||||
@@ -492,7 +492,7 @@ public final class Fort extends AbstractResidence
|
||||
|
||||
public void saveFortVariables()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE fort SET supplyLvL=? WHERE id = ?"))
|
||||
{
|
||||
ps.setInt(1, _supplyLvL);
|
||||
@@ -559,7 +559,7 @@ public final class Fort extends AbstractResidence
|
||||
@Override
|
||||
protected void load()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort WHERE id = ?"))
|
||||
{
|
||||
ps.setInt(1, getResidenceId());
|
||||
@@ -620,7 +620,7 @@ public final class Fort extends AbstractResidence
|
||||
/** Load All Functions */
|
||||
private void loadFunctions()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_functions WHERE fort_id = ?"))
|
||||
{
|
||||
ps.setInt(1, getResidenceId());
|
||||
@@ -645,7 +645,7 @@ public final class Fort extends AbstractResidence
|
||||
public void removeFunction(int functionType)
|
||||
{
|
||||
_function.remove(functionType);
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM fort_functions WHERE fort_id=? AND type=?"))
|
||||
{
|
||||
ps.setInt(1, getResidenceId());
|
||||
@@ -747,7 +747,7 @@ public final class Fort extends AbstractResidence
|
||||
// This method loads fort door upgrade data from database
|
||||
private void loadDoorUpgrade()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_doorupgrade WHERE fortId = ?"))
|
||||
{
|
||||
ps.setInt(1, getResidenceId());
|
||||
@@ -767,7 +767,7 @@ public final class Fort extends AbstractResidence
|
||||
|
||||
private void removeDoorUpgrade()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM fort_doorupgrade WHERE fortId = ?"))
|
||||
{
|
||||
ps.setInt(1, getResidenceId());
|
||||
@@ -781,7 +781,7 @@ public final class Fort extends AbstractResidence
|
||||
|
||||
private void saveDoorUpgrade(int doorId, int hp, int pDef, int mDef)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("INSERT INTO fort_doorupgrade (doorId, hp, pDef, mDef) VALUES (?,?,?,?)"))
|
||||
{
|
||||
ps.setInt(1, doorId);
|
||||
@@ -810,7 +810,7 @@ public final class Fort extends AbstractResidence
|
||||
_lastOwnedTime.setTimeInMillis(0);
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE fort SET owner=?,lastOwnedTime=?,state=?,castleId=? WHERE id = ?"))
|
||||
{
|
||||
ps.setInt(1, clanId);
|
||||
@@ -1022,7 +1022,7 @@ public final class Fort extends AbstractResidence
|
||||
{
|
||||
_state = state;
|
||||
_castleId = castleId;
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE fort SET state=?,castleId=? WHERE id = ?"))
|
||||
{
|
||||
ps.setInt(1, getFortState());
|
||||
@@ -1154,7 +1154,7 @@ public final class Fort extends AbstractResidence
|
||||
|
||||
private void initNpcs()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT * FROM fort_spawnlist WHERE fortId = ? AND spawnType = ?"))
|
||||
{
|
||||
ps.setInt(1, getResidenceId());
|
||||
@@ -1185,7 +1185,7 @@ public final class Fort extends AbstractResidence
|
||||
private void initSiegeNpcs()
|
||||
{
|
||||
_siegeNpcs.clear();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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());
|
||||
@@ -1214,7 +1214,7 @@ public final class Fort extends AbstractResidence
|
||||
private void initNpcCommanders()
|
||||
{
|
||||
_npcCommanders.clear();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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());
|
||||
@@ -1246,7 +1246,7 @@ public final class Fort extends AbstractResidence
|
||||
_specialEnvoys.clear();
|
||||
_envoyCastles.clear();
|
||||
_availableCastles.clear();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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());
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jmobius.gameserver.enums.ChatType;
|
||||
@@ -493,7 +493,7 @@ public class FortSiege implements Siegable
|
||||
/** Clear all registered siege clans from database for fort */
|
||||
public void clearSiegeClan()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM fortsiege_clans WHERE fort_id=?"))
|
||||
{
|
||||
ps.setInt(1, getFort().getResidenceId());
|
||||
@@ -768,7 +768,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 = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(query))
|
||||
{
|
||||
ps.setInt(1, getFort().getResidenceId());
|
||||
@@ -982,7 +982,7 @@ public class FortSiege implements Siegable
|
||||
private void loadSiegeClan()
|
||||
{
|
||||
getAttackerClans().clear();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT clan_id FROM fortsiege_clans WHERE fort_id=?"))
|
||||
{
|
||||
ps.setInt(1, getFort().getResidenceId());
|
||||
@@ -1043,7 +1043,7 @@ public class FortSiege implements Siegable
|
||||
/** Save siege date to database. */
|
||||
private void saveSiegeDate()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE fort SET siegeDate = ? WHERE id = ?"))
|
||||
{
|
||||
ps.setLong(1, getSiegeDate().getTimeInMillis());
|
||||
@@ -1067,7 +1067,7 @@ public class FortSiege implements Siegable
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("INSERT INTO fortsiege_clans (clan_id,fort_id) values (?,?)"))
|
||||
{
|
||||
ps.setInt(1, clan.getId());
|
||||
|
||||
@@ -33,7 +33,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.cache.HtmCache;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
@@ -108,7 +108,7 @@ public class Hero
|
||||
HERO_DIARY.clear();
|
||||
HERO_MESSAGE.clear();
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
Statement s1 = con.createStatement();
|
||||
ResultSet rset = s1.executeQuery(GET_HEROES);
|
||||
PreparedStatement ps = con.prepareStatement(GET_CLAN_ALLY);
|
||||
@@ -206,7 +206,7 @@ public class Hero
|
||||
*/
|
||||
public void loadMessage(int charId)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT message FROM heroes WHERE charId=?"))
|
||||
{
|
||||
ps.setInt(1, charId);
|
||||
@@ -228,7 +228,7 @@ public class Hero
|
||||
{
|
||||
final List<StatsSet> diary = new ArrayList<>();
|
||||
int diaryentries = 0;
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT * FROM heroes_diary WHERE charId=? ORDER BY time ASC"))
|
||||
{
|
||||
ps.setInt(1, charId);
|
||||
@@ -295,7 +295,7 @@ public class Hero
|
||||
int _losses = 0;
|
||||
int _draws = 0;
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT * FROM olympiad_fights WHERE (charOneId=? OR charTwoId=?) AND start<? ORDER BY start ASC"))
|
||||
{
|
||||
ps.setInt(1, charId);
|
||||
@@ -692,7 +692,7 @@ public class Hero
|
||||
|
||||
public void updateHeroes(boolean setDefault)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
if (setDefault)
|
||||
{
|
||||
@@ -823,7 +823,7 @@ public class Hero
|
||||
|
||||
public void setDiaryData(int charId, int action, int param)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("INSERT INTO heroes_diary (charId, time, action, param) values(?,?,?,?)"))
|
||||
{
|
||||
ps.setInt(1, charId);
|
||||
@@ -859,7 +859,7 @@ public class Hero
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE heroes SET message=? WHERE charId=?;"))
|
||||
{
|
||||
ps.setString(1, HERO_MESSAGE.get(charId));
|
||||
@@ -874,7 +874,7 @@ public class Hero
|
||||
|
||||
private void deleteItemsInDb()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement())
|
||||
{
|
||||
s.executeUpdate(DELETE_ITEMS);
|
||||
|
||||
@@ -31,7 +31,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.SiegeScheduleData;
|
||||
@@ -771,7 +771,7 @@ public class Siege implements Siegable
|
||||
/** Clear all registered siege clans from database for castle */
|
||||
public void clearSiegeClan()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=?"))
|
||||
{
|
||||
ps.setInt(1, getCastle().getResidenceId());
|
||||
@@ -799,7 +799,7 @@ public class Siege implements Siegable
|
||||
/** Clear all siege clans waiting for approval from database for castle */
|
||||
public void clearSiegeWaitingClan()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=? and type = 2"))
|
||||
{
|
||||
ps.setInt(1, getCastle().getResidenceId());
|
||||
@@ -1026,7 +1026,7 @@ public class Siege implements Siegable
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM siege_clans WHERE castle_id=? and clan_id=?"))
|
||||
{
|
||||
ps.setInt(1, getCastle().getResidenceId());
|
||||
@@ -1291,7 +1291,7 @@ public class Siege implements Siegable
|
||||
/** Load siege clans. */
|
||||
private void loadSiegeClan()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT clan_id,type FROM siege_clans where castle_id=?"))
|
||||
{
|
||||
getAttackerClans().clear();
|
||||
@@ -1402,7 +1402,7 @@ public class Siege implements Siegable
|
||||
_scheduledStartSiegeTask = ThreadPoolManager.getInstance().scheduleGeneral(new Siege.ScheduleStartSiegeTask(getCastle()), 1000);
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE castle SET siegeDate = ?, regTimeEnd = ?, regTimeOver = ? WHERE id = ?"))
|
||||
{
|
||||
ps.setLong(1, getSiegeDate().getTimeInMillis());
|
||||
@@ -1431,7 +1431,7 @@ public class Siege implements Siegable
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
if ((typeId == DEFENDER) || (typeId == DEFENDER_NOT_APPROVED) || (typeId == OWNER))
|
||||
{
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.sql.PreparedStatement;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jmobius.gameserver.instancemanager.ClanHallAuctionManager;
|
||||
@@ -215,7 +215,7 @@ public final class AuctionableHall extends ClanHall
|
||||
@Override
|
||||
public final void updateDb()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE clanhall SET ownerId=?, paidUntil=?, paid=? WHERE id=?"))
|
||||
{
|
||||
ps.setInt(1, getOwnerId());
|
||||
|
||||
@@ -28,7 +28,7 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jmobius.gameserver.enums.ChatType;
|
||||
@@ -91,7 +91,7 @@ public abstract class ClanHallSiegeEngine extends Quest implements Siegable
|
||||
|
||||
public void loadAttackers()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(SQL_LOAD_ATTACKERS))
|
||||
{
|
||||
ps.setInt(1, _hall.getId());
|
||||
@@ -113,7 +113,7 @@ public abstract class ClanHallSiegeEngine extends Quest implements Siegable
|
||||
|
||||
public final void saveAttackers()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM clanhall_siege_attackers WHERE clanhall_id = ?"))
|
||||
{
|
||||
ps.setInt(1, _hall.getId());
|
||||
@@ -145,7 +145,7 @@ public abstract class ClanHallSiegeEngine extends Quest implements Siegable
|
||||
if (_guards == null)
|
||||
{
|
||||
_guards = new ArrayList<>();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(SQL_LOAD_GUARDS))
|
||||
{
|
||||
ps.setInt(1, _hall.getId());
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.sql.PreparedStatement;
|
||||
import java.util.Calendar;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.enums.SiegeClanType;
|
||||
import com.l2jmobius.gameserver.model.L2Clan;
|
||||
import com.l2jmobius.gameserver.model.L2SiegeClan;
|
||||
@@ -130,7 +130,7 @@ public final class SiegableHall extends ClanHall
|
||||
@Override
|
||||
public final void updateDb()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(SQL_SAVE))
|
||||
{
|
||||
ps.setInt(1, getOwnerId());
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.ItemAuctionManager;
|
||||
import com.l2jmobius.gameserver.model.ItemInfo;
|
||||
@@ -192,7 +192,7 @@ public final class ItemAuction
|
||||
|
||||
public final void storeMe()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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(final ItemAuctionBid bid, final boolean delete)
|
||||
{
|
||||
final String query = delete ? DELETE_ITEM_AUCTION_BID : INSERT_ITEM_AUCTION_BID;
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(query))
|
||||
{
|
||||
ps.setInt(1, _auctionId);
|
||||
|
||||
@@ -39,7 +39,7 @@ import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.data.sql.impl.CharNameTable;
|
||||
import com.l2jmobius.gameserver.enums.ItemLocation;
|
||||
@@ -162,7 +162,7 @@ public final class ItemAuctionInstance
|
||||
throw new IllegalArgumentException("No items defined");
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(SELECT_AUCTION_ID_BY_INSTANCE_ID))
|
||||
{
|
||||
ps.setInt(1, _instanceId);
|
||||
@@ -537,7 +537,7 @@ public final class ItemAuctionInstance
|
||||
|
||||
private final ItemAuction loadAuction(final int auctionId) throws SQLException
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
int auctionItemId = 0;
|
||||
long startingTime = 0;
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.ArmorSetsData;
|
||||
import com.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import com.l2jmobius.gameserver.enums.ItemLocation;
|
||||
@@ -2085,7 +2085,7 @@ public abstract class Inventory extends ItemContainer
|
||||
@Override
|
||||
public void restore()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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=? OR loc=?) ORDER BY loc_data"))
|
||||
{
|
||||
ps.setInt(1, getOwnerId());
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.GameTimeController;
|
||||
import com.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import com.l2jmobius.gameserver.enums.ItemLocation;
|
||||
@@ -705,7 +705,7 @@ public abstract class ItemContainer
|
||||
*/
|
||||
public void restore()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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());
|
||||
|
||||
@@ -21,7 +21,7 @@ import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import com.l2jmobius.gameserver.idfactory.IdFactory;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
@@ -116,7 +116,7 @@ public class Mail extends ItemContainer
|
||||
@Override
|
||||
public void restore()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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, getOwnerId());
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.datatables.ItemTable;
|
||||
import com.l2jmobius.gameserver.enums.ItemLocation;
|
||||
import com.l2jmobius.gameserver.model.TradeItem;
|
||||
@@ -878,7 +878,7 @@ public class PcInventory extends Inventory
|
||||
public static int[][] restoreVisibleInventory(int objectId)
|
||||
{
|
||||
final int[][] paperdoll = new int[Inventory.PAPERDOLL_TOTALSLOTS][4];
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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);
|
||||
|
||||
@@ -32,7 +32,7 @@ import java.util.logging.LogRecord;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.GeoData;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.data.xml.impl.AppearanceItemData;
|
||||
@@ -924,7 +924,7 @@ public final class L2ItemInstance extends L2Object
|
||||
}
|
||||
|
||||
_augmentation = augmentation;
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
updateItemAttributes(con);
|
||||
}
|
||||
@@ -950,7 +950,7 @@ public final class L2ItemInstance extends L2Object
|
||||
final L2Augmentation augment = _augmentation;
|
||||
_augmentation = null;
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM item_attributes WHERE itemId = ?"))
|
||||
{
|
||||
ps.setInt(1, getObjectId());
|
||||
@@ -967,7 +967,7 @@ public final class L2ItemInstance extends L2Object
|
||||
|
||||
public void restoreAttributes()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps1 = con.prepareStatement("SELECT augAttributes FROM item_attributes WHERE itemId=?");
|
||||
PreparedStatement ps2 = con.prepareStatement("SELECT elemType,elemValue FROM item_elementals WHERE itemId=?"))
|
||||
{
|
||||
@@ -1177,7 +1177,7 @@ public final class L2ItemInstance extends L2Object
|
||||
_elementals[0] = new Elementals(element, value);
|
||||
}
|
||||
}
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
updateItemElements(con);
|
||||
}
|
||||
@@ -1195,7 +1195,7 @@ public final class L2ItemInstance extends L2Object
|
||||
public void setElementAttr(byte element, int value)
|
||||
{
|
||||
applyAttribute(element, value);
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
updateItemElements(con);
|
||||
}
|
||||
@@ -1232,7 +1232,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 = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(query))
|
||||
{
|
||||
if (element != -1)
|
||||
@@ -1669,7 +1669,7 @@ public final class L2ItemInstance extends L2Object
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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);
|
||||
@@ -1704,7 +1704,7 @@ public final class L2ItemInstance extends L2Object
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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);
|
||||
@@ -1750,7 +1750,7 @@ public final class L2ItemInstance extends L2Object
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
try (PreparedStatement ps = con.prepareStatement("DELETE FROM items WHERE object_id = ?"))
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ import java.util.logging.LogRecord;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.AntiFeedManager;
|
||||
import com.l2jmobius.gameserver.instancemanager.ZoneManager;
|
||||
@@ -176,7 +176,7 @@ public class Olympiad extends ListenersContainer
|
||||
{
|
||||
NOBLES.clear();
|
||||
boolean loaded = false;
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement();
|
||||
ResultSet rset = s.executeQuery(OLYMPIAD_LOAD_DATA))
|
||||
{
|
||||
@@ -254,7 +254,7 @@ public class Olympiad extends ListenersContainer
|
||||
}
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement();
|
||||
ResultSet rset = s.executeQuery(OLYMPIAD_LOAD_NOBLES))
|
||||
{
|
||||
@@ -322,7 +322,7 @@ public class Olympiad extends ListenersContainer
|
||||
{
|
||||
NOBLES_RANK.clear();
|
||||
final Map<Integer, Integer> tmpPlace = new HashMap<>();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
Statement statement = con.createStatement();
|
||||
ResultSet rset = statement.executeQuery(GET_ALL_CLASSIFIED_NOBLESS))
|
||||
{
|
||||
@@ -721,7 +721,7 @@ public class Olympiad extends ListenersContainer
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
for (Entry<Integer, StatsSet> entry : NOBLES.entrySet())
|
||||
{
|
||||
@@ -793,7 +793,7 @@ public class Olympiad extends ListenersContainer
|
||||
{
|
||||
saveNobleData();
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(OLYMPIAD_SAVE_DATA))
|
||||
{
|
||||
ps.setInt(1, _currentCycle);
|
||||
@@ -834,7 +834,7 @@ public class Olympiad extends ListenersContainer
|
||||
|
||||
protected void updateMonthlyData()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
Statement s1 = con.createStatement();
|
||||
Statement s2 = con.createStatement())
|
||||
{
|
||||
@@ -881,7 +881,7 @@ public class Olympiad extends ListenersContainer
|
||||
_logResults.log(record);
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(OLYMPIAD_GET_HEROS))
|
||||
{
|
||||
StatsSet hero;
|
||||
@@ -1014,7 +1014,7 @@ public class Olympiad extends ListenersContainer
|
||||
{
|
||||
final List<String> 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 = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(query))
|
||||
{
|
||||
ps.setInt(1, classId);
|
||||
@@ -1102,7 +1102,7 @@ public class Olympiad extends ListenersContainer
|
||||
public int getLastNobleOlympiadPoints(int objId)
|
||||
{
|
||||
int result = 0;
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT olympiad_points FROM olympiad_nobles_eom WHERE charId = ?"))
|
||||
{
|
||||
ps.setInt(1, objId);
|
||||
@@ -1246,7 +1246,7 @@ public class Olympiad extends ListenersContainer
|
||||
|
||||
protected void deleteNobles()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement())
|
||||
{
|
||||
s.executeUpdate(OLYMPIAD_DELETE_ALL);
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.LogRecord;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.Location;
|
||||
import com.l2jmobius.gameserver.model.actor.L2Character;
|
||||
@@ -791,7 +791,7 @@ public abstract class OlympiadGameNormal extends AbstractOlympiadGame
|
||||
|
||||
protected static final void saveResults(Participant one, Participant two, int winner, long startTime, long fightTime, CompetitionType type)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("INSERT INTO olympiad_fights (charOneId, charTwoId, charOneClass, charTwoClass, winner, start, time, classed) values(?,?,?,?,?,?,?,?)"))
|
||||
{
|
||||
ps.setInt(1, one.getObjectId());
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.ThreadPoolManager;
|
||||
import com.l2jmobius.gameserver.handler.IPunishmentHandler;
|
||||
import com.l2jmobius.gameserver.handler.PunishmentHandler;
|
||||
@@ -182,7 +182,7 @@ public class PunishmentTask implements Runnable
|
||||
{
|
||||
if (!_isStored)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(INSERT_QUERY, Statement.RETURN_GENERATED_KEYS))
|
||||
{
|
||||
ps.setString(1, _key);
|
||||
@@ -221,7 +221,7 @@ public class PunishmentTask implements Runnable
|
||||
{
|
||||
if (_isStored)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(UPDATE_QUERY))
|
||||
{
|
||||
ps.setLong(1, System.currentTimeMillis());
|
||||
|
||||
@@ -36,7 +36,7 @@ import java.util.logging.Level;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.cache.HtmCache;
|
||||
import com.l2jmobius.gameserver.enums.CategoryType;
|
||||
import com.l2jmobius.gameserver.enums.Race;
|
||||
@@ -1512,7 +1512,7 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
*/
|
||||
public static final void playerEnter(L2PcInstance player)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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 = ?"))
|
||||
@@ -1601,7 +1601,7 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
*/
|
||||
public final void saveGlobalQuestVar(String var, String value)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("REPLACE INTO quest_global_data (quest_name,var,value) VALUES (?,?,?)"))
|
||||
{
|
||||
ps.setString(1, getName());
|
||||
@@ -1627,7 +1627,7 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
public final String loadGlobalQuestVar(String var)
|
||||
{
|
||||
String result = "";
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT value FROM quest_global_data WHERE quest_name = ? AND var = ?"))
|
||||
{
|
||||
ps.setString(1, getName());
|
||||
@@ -1653,7 +1653,7 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
*/
|
||||
public final void deleteGlobalQuestVar(String var)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM quest_global_data WHERE quest_name = ? AND var = ?"))
|
||||
{
|
||||
ps.setString(1, getName());
|
||||
@@ -1671,7 +1671,7 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
*/
|
||||
public final void deleteAllGlobalQuestVars()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM quest_global_data WHERE quest_name = ?"))
|
||||
{
|
||||
ps.setString(1, getName());
|
||||
@@ -1691,7 +1691,7 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
*/
|
||||
public static void createQuestVarInDb(QuestState qs, String var, String value)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("INSERT INTO character_quests (charId,name,var,value) VALUES (?,?,?,?) ON DUPLICATE KEY UPDATE value=?"))
|
||||
{
|
||||
ps.setInt(1, qs.getPlayer().getObjectId());
|
||||
@@ -1715,7 +1715,7 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
*/
|
||||
public static void updateQuestVarInDb(QuestState qs, String var, String value)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE character_quests SET value=? WHERE charId=? AND name=? AND var = ?"))
|
||||
{
|
||||
ps.setString(1, value);
|
||||
@@ -1737,7 +1737,7 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
*/
|
||||
public static void deleteQuestVarInDb(QuestState qs, String var)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM character_quests WHERE charId=? AND name=? AND var=?"))
|
||||
{
|
||||
ps.setInt(1, qs.getPlayer().getObjectId());
|
||||
@@ -1758,7 +1758,7 @@ public class Quest extends AbstractScript implements IIdentifiable
|
||||
*/
|
||||
public static void deleteQuestInDb(QuestState qs, boolean repeatable)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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());
|
||||
|
||||
@@ -26,7 +26,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.Config;
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.enums.QuestSound;
|
||||
import com.l2jmobius.gameserver.enums.QuestType;
|
||||
import com.l2jmobius.gameserver.instancemanager.PcCafePointsManager;
|
||||
@@ -399,7 +399,7 @@ public final class QuestState
|
||||
// TODO: these methods should not be here, they could be used by other classes to save some variables, but they can't because they require to create a QuestState first.
|
||||
public final void saveGlobalQuestVar(String var, String value)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("REPLACE INTO character_quest_global_data (charId, var, value) VALUES (?, ?, ?)"))
|
||||
{
|
||||
ps.setInt(1, _player.getObjectId());
|
||||
@@ -426,7 +426,7 @@ public final class QuestState
|
||||
public final String getGlobalQuestVar(String var)
|
||||
{
|
||||
String result = "";
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT value FROM character_quest_global_data WHERE charId = ? AND var = ?"))
|
||||
{
|
||||
ps.setInt(1, _player.getObjectId());
|
||||
@@ -452,7 +452,7 @@ public final class QuestState
|
||||
*/
|
||||
public final void deleteGlobalQuestVar(String var)
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM character_quest_global_data WHERE charId = ? AND var = ?"))
|
||||
{
|
||||
ps.setInt(1, _player.getObjectId());
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.Map.Entry;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
@@ -50,7 +50,7 @@ public class AccountVariables extends AbstractVariables
|
||||
public boolean restoreMe()
|
||||
{
|
||||
// Restore previous variables.
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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 = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().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 = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
// Clear previous entries.
|
||||
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.Map.Entry;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
|
||||
/**
|
||||
* @author UnAfraid
|
||||
@@ -55,7 +55,7 @@ public class ItemVariables extends AbstractVariables
|
||||
public static boolean hasVariables(int objectId)
|
||||
{
|
||||
// Restore previous variables.
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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 = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().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 = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().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 = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
// Clear previous entries.
|
||||
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
|
||||
|
||||
@@ -24,7 +24,7 @@ import java.util.Map.Entry;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jmobius.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jmobius.commons.database.DatabaseFactory;
|
||||
import com.l2jmobius.gameserver.model.L2World;
|
||||
import com.l2jmobius.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
@@ -52,7 +52,7 @@ public class PlayerVariables extends AbstractVariables
|
||||
public boolean restoreMe()
|
||||
{
|
||||
// Restore previous variables.
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(SELECT_QUERY))
|
||||
{
|
||||
ps.setInt(1, _objectId);
|
||||
@@ -85,7 +85,7 @@ public class PlayerVariables extends AbstractVariables
|
||||
return false;
|
||||
}
|
||||
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
// Clear previous entries.
|
||||
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
|
||||
@@ -122,7 +122,7 @@ public class PlayerVariables extends AbstractVariables
|
||||
@Override
|
||||
public boolean deleteMe()
|
||||
{
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
try (Connection con = DatabaseFactory.getInstance().getConnection())
|
||||
{
|
||||
// Clear previous entries.
|
||||
try (PreparedStatement st = con.prepareStatement(DELETE_QUERY))
|
||||
|
||||
Reference in New Issue
Block a user