Sync with L2jServer HighFive Jul 25th 2015.
This commit is contained in:
@ -28,7 +28,7 @@ import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.model.AirShipTeleportList;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.VehiclePathPoint;
|
||||
@ -171,7 +171,7 @@ public class AirShipManager
|
||||
|
||||
_airShipsInfo.put(ownerId, info);
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(ADD_DB))
|
||||
{
|
||||
ps.setInt(1, ownerId);
|
||||
@ -267,7 +267,7 @@ public class AirShipManager
|
||||
|
||||
private void load()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement();
|
||||
ResultSet rs = s.executeQuery(LOAD_DB))
|
||||
{
|
||||
@ -298,7 +298,7 @@ public class AirShipManager
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(UPDATE_DB))
|
||||
{
|
||||
ps.setInt(1, info.getInt("fuel"));
|
||||
|
@ -26,7 +26,7 @@ import java.util.Map;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.model.L2Clan;
|
||||
import com.l2jserver.gameserver.model.StatsSet;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
@ -54,7 +54,7 @@ public final class CHSiegeManager
|
||||
|
||||
private final void loadClanHalls()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement();
|
||||
ResultSet rs = s.executeQuery(SQL_LOAD_HALLS))
|
||||
{
|
||||
|
@ -29,7 +29,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.InstanceListManager;
|
||||
import com.l2jserver.gameserver.model.L2Clan;
|
||||
import com.l2jserver.gameserver.model.L2ClanMember;
|
||||
@ -252,7 +252,7 @@ public final class CastleManager implements InstanceListManager
|
||||
}
|
||||
}
|
||||
// else offline-player circlet removal
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM items WHERE owner_id = ? and item_id = ?"))
|
||||
{
|
||||
ps.setInt(1, member.getObjectId());
|
||||
@ -269,7 +269,7 @@ public final class CastleManager implements InstanceListManager
|
||||
@Override
|
||||
public void loadInstances()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement();
|
||||
ResultSet rs = s.executeQuery("SELECT id FROM castle ORDER BY id"))
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.enums.ManorMode;
|
||||
import com.l2jserver.gameserver.model.CropProcure;
|
||||
@ -166,7 +166,7 @@ public final class CastleManorManager implements IXmlReader, IStorable
|
||||
|
||||
private final void loadDb()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement stProduction = con.prepareStatement("SELECT * FROM castle_manor_production WHERE castle_id=?");
|
||||
PreparedStatement stProcure = con.prepareStatement("SELECT * FROM castle_manor_procure WHERE castle_id=?"))
|
||||
{
|
||||
@ -438,7 +438,7 @@ public final class CastleManorManager implements IXmlReader, IStorable
|
||||
_productionNext.put(castleId, list);
|
||||
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement dps = con.prepareStatement("DELETE FROM castle_manor_production WHERE castle_id = ? AND next_period = 1");
|
||||
PreparedStatement ips = con.prepareStatement(INSERT_PRODUCT))
|
||||
{
|
||||
@ -474,7 +474,7 @@ public final class CastleManorManager implements IXmlReader, IStorable
|
||||
_procureNext.put(castleId, list);
|
||||
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement dps = con.prepareStatement("DELETE FROM castle_manor_procure WHERE castle_id = ? AND next_period = 1");
|
||||
PreparedStatement ips = con.prepareStatement(INSERT_CROP))
|
||||
{
|
||||
@ -508,7 +508,7 @@ public final class CastleManorManager implements IXmlReader, IStorable
|
||||
|
||||
public final void updateCurrentProduction(int castleId, Collection<SeedProduction> items)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE castle_manor_production SET amount = ? WHERE castle_id = ? AND seed_id = ? AND next_period = 0"))
|
||||
{
|
||||
for (SeedProduction sp : items)
|
||||
@ -528,7 +528,7 @@ public final class CastleManorManager implements IXmlReader, IStorable
|
||||
|
||||
public final void updateCurrentProcure(int castleId, Collection<CropProcure> items)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE castle_manor_procure SET amount = ? WHERE castle_id = ? AND crop_id = ? AND next_period = 0"))
|
||||
{
|
||||
for (CropProcure sp : items)
|
||||
@ -601,7 +601,7 @@ public final class CastleManorManager implements IXmlReader, IStorable
|
||||
@Override
|
||||
public final boolean storeMe()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ds = con.prepareStatement("DELETE FROM castle_manor_production");
|
||||
PreparedStatement is = con.prepareStatement(INSERT_PRODUCT);
|
||||
PreparedStatement dp = con.prepareStatement("DELETE FROM castle_manor_procure");
|
||||
@ -699,7 +699,7 @@ public final class CastleManorManager implements IXmlReader, IStorable
|
||||
|
||||
if (Config.ALT_MANOR_SAVE_ALL_ACTIONS)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ds = con.prepareStatement("DELETE FROM castle_manor_production WHERE castle_id = ?");
|
||||
PreparedStatement dc = con.prepareStatement("DELETE FROM castle_manor_procure WHERE castle_id = ?"))
|
||||
{
|
||||
|
@ -35,7 +35,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.model.clan.entry.PledgeApplicantInfo;
|
||||
import com.l2jserver.gameserver.model.clan.entry.PledgeRecruitInfo;
|
||||
@ -93,7 +93,7 @@ public class ClanEntryManager
|
||||
|
||||
private final void load()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement();
|
||||
ResultSet rs = s.executeQuery("SELECT * FROM pledge_recruit"))
|
||||
{
|
||||
@ -108,7 +108,7 @@ public class ClanEntryManager
|
||||
_log.warning(getClass().getSimpleName() + ": Exception: ClanEntryManager.load(): " + e.getMessage());
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement();
|
||||
ResultSet rs = s.executeQuery("SELECT a.char_id, a.karma, b.base_class, b.level, b.char_name FROM pledge_waiting_list as a LEFT JOIN characters as b ON a.char_id = b.charId"))
|
||||
{
|
||||
@ -124,7 +124,7 @@ public class ClanEntryManager
|
||||
_log.warning(getClass().getSimpleName() + ": Exception: ClanEntryManager.load(): " + e.getMessage());
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement();
|
||||
ResultSet rs = s.executeQuery("SELECT a.charId, a.clanId, a.karma, a.message, b.base_class, b.level, b.char_name FROM pledge_applicant as a LEFT JOIN characters as b ON a.charId = b.charId"))
|
||||
{
|
||||
@ -170,7 +170,7 @@ public class ClanEntryManager
|
||||
{
|
||||
final Map<Integer, PledgeApplicantInfo> clanApplicantList = _applicantList.get(clanId);
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(DELETE_APPLICANT))
|
||||
{
|
||||
statement.setInt(1, playerId);
|
||||
@ -191,7 +191,7 @@ public class ClanEntryManager
|
||||
{
|
||||
_applicantList.computeIfAbsent(clanId, k -> new ConcurrentHashMap<>()).put(info.getPlayerId(), info);
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(INSERT_APPLICANT))
|
||||
{
|
||||
statement.setInt(1, info.getPlayerId());
|
||||
@ -218,7 +218,7 @@ public class ClanEntryManager
|
||||
{
|
||||
if (!_playerLocked.containsKey(playerId))
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(INSERT_WAITING_LIST))
|
||||
{
|
||||
statement.setInt(1, info.getPlayerId());
|
||||
@ -239,7 +239,7 @@ public class ClanEntryManager
|
||||
{
|
||||
if (_waitingList.containsKey(playerId))
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(DELETE_WAITING_LIST))
|
||||
{
|
||||
statement.setInt(1, playerId);
|
||||
@ -260,7 +260,7 @@ public class ClanEntryManager
|
||||
{
|
||||
if (!_clanList.containsKey(clanId) && !_clanLocked.containsKey(clanId))
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(INSERT_CLAN_RECRUIT))
|
||||
{
|
||||
statement.setInt(1, info.getClanId());
|
||||
@ -282,7 +282,7 @@ public class ClanEntryManager
|
||||
{
|
||||
if (_clanList.containsKey(clanId) && !_clanLocked.containsKey(clanId))
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(UPDATE_CLAN_RECRUIT))
|
||||
{
|
||||
statement.setInt(1, info.getKarma());
|
||||
@ -304,7 +304,7 @@ public class ClanEntryManager
|
||||
{
|
||||
if (_clanList.containsKey(clanId))
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(DELETE_CLAN_RECRUIT))
|
||||
{
|
||||
statement.setInt(1, clanId);
|
||||
|
@ -26,7 +26,7 @@ import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.model.entity.Auction;
|
||||
|
||||
/**
|
||||
@ -100,7 +100,7 @@ public final class ClanHallAuctionManager
|
||||
|
||||
private final void load()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement();
|
||||
ResultSet rs = s.executeQuery("SELECT id FROM auction ORDER BY id"))
|
||||
{
|
||||
@ -165,7 +165,7 @@ public final class ClanHallAuctionManager
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement())
|
||||
{
|
||||
s.executeUpdate("INSERT INTO `auction` VALUES " + ITEM_INIT_DATA[i]);
|
||||
|
@ -27,7 +27,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.data.sql.impl.ClanTable;
|
||||
import com.l2jserver.gameserver.model.L2Clan;
|
||||
import com.l2jserver.gameserver.model.L2Object;
|
||||
@ -64,7 +64,7 @@ public final class ClanHallManager
|
||||
/** Load All Clan Hall */
|
||||
private final void load()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement();
|
||||
ResultSet rs = s.executeQuery("SELECT * FROM clanhall ORDER BY id"))
|
||||
{
|
||||
|
@ -36,7 +36,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.enums.ItemLocation;
|
||||
import com.l2jserver.gameserver.enums.MailType;
|
||||
@ -81,7 +81,7 @@ public final class CommissionManager
|
||||
protected CommissionManager()
|
||||
{
|
||||
final Map<Integer, L2ItemInstance> itemInstances = new HashMap<>();
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
{
|
||||
try (PreparedStatement ps = con.prepareStatement(SELECT_ALL_ITEMS))
|
||||
{
|
||||
@ -255,7 +255,7 @@ public final class CommissionManager
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(INSERT_COMMISSION_ITEM, Statement.RETURN_GENERATED_KEYS))
|
||||
{
|
||||
final Instant startTime = Instant.now();
|
||||
@ -408,7 +408,7 @@ public final class CommissionManager
|
||||
*/
|
||||
private boolean deleteItemFromDB(long commissionId)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(DELETE_COMMISSION_ITEM))
|
||||
{
|
||||
ps.setLong(1, commissionId);
|
||||
|
@ -26,7 +26,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.entity.Couple;
|
||||
@ -53,7 +53,7 @@ public final class CoupleManager
|
||||
|
||||
private final void load()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement ps = con.createStatement();
|
||||
ResultSet rs = ps.executeQuery("SELECT id FROM mods_wedding ORDER BY id"))
|
||||
{
|
||||
|
@ -38,7 +38,7 @@ import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.model.CursedWeapon;
|
||||
import com.l2jserver.gameserver.model.actor.L2Attackable;
|
||||
import com.l2jserver.gameserver.model.actor.L2Character;
|
||||
@ -172,7 +172,7 @@ public final class CursedWeaponsManager
|
||||
|
||||
private final void restore()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement();
|
||||
ResultSet rs = s.executeQuery("SELECT itemId, charId, playerKarma, playerPkKills, nbKills, endTime FROM cursed_weapons"))
|
||||
{
|
||||
@ -197,15 +197,17 @@ public final class CursedWeaponsManager
|
||||
|
||||
private final void controlPlayers()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
// TODO: See comments below...
|
||||
// This entire for loop should NOT be necessary, since it is already handled by
|
||||
// CursedWeapon.endOfLife(). However, if we indeed *need* to duplicate it for safety,
|
||||
// then we'd better make sure that it FULLY cleans up inactive cursed weapons!
|
||||
// Undesired effects result otherwise, such as player with no zariche but with karma
|
||||
// or a lost-child entry in the cursed weapons table, without a corresponding one in items...
|
||||
|
||||
// Retrieve the L2PcInstance from the characters table of the database
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT owner_id FROM items WHERE item_id=?"))
|
||||
{
|
||||
// TODO: See comments below...
|
||||
// This entire for loop should NOT be necessary, since it is already handled by
|
||||
// CursedWeapon.endOfLife(). However, if we indeed *need* to duplicate it for safety,
|
||||
// then we'd better make sure that it FULLY cleans up inactive cursed weapons!
|
||||
// Undesired effects result otherwise, such as player with no zariche but with karma
|
||||
// or a lost-child entry in the cursed weapons table, without a corresponding one in items...
|
||||
for (CursedWeapon cw : _cursedWeapons.values())
|
||||
{
|
||||
if (cw.isActivated())
|
||||
@ -250,6 +252,7 @@ public final class CursedWeaponsManager
|
||||
removeFromDb(itemId);
|
||||
}
|
||||
}
|
||||
ps.clearParameters();
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
@ -368,7 +371,7 @@ public final class CursedWeaponsManager
|
||||
|
||||
public static void removeFromDb(int itemId)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM cursed_weapons WHERE itemId = ?"))
|
||||
{
|
||||
ps.setInt(1, itemId);
|
||||
|
@ -28,7 +28,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
/**
|
||||
@ -48,7 +48,7 @@ public class FactionManager
|
||||
private void loadAll()
|
||||
{
|
||||
_playerFactions.clear();
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement();
|
||||
ResultSet rs = s.executeQuery("SELECT charId, faction FROM characters"))
|
||||
{
|
||||
@ -78,7 +78,7 @@ public class FactionManager
|
||||
return factionId;
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT faction FROM characters WHERE charId=?"))
|
||||
{
|
||||
ps.setInt(1, id);
|
||||
|
@ -29,7 +29,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.datatables.ItemTable;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2NpcInstance;
|
||||
@ -101,7 +101,7 @@ public class FishingChampionshipManager
|
||||
{
|
||||
_enddate = GlobalVariablesManager.getInstance().getLong("fishChampionshipEnd", 0);
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
{
|
||||
PreparedStatement statement = con.prepareStatement(SELECT);
|
||||
ResultSet rs = statement.executeQuery();
|
||||
@ -375,7 +375,7 @@ public class FishingChampionshipManager
|
||||
{
|
||||
GlobalVariablesManager.getInstance().set("fishChampionshipEnd", _enddate);
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
{
|
||||
PreparedStatement statement = con.prepareStatement(DELETE);
|
||||
statement.execute();
|
||||
|
@ -26,7 +26,7 @@ import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.InstanceListManager;
|
||||
import com.l2jserver.gameserver.model.L2Clan;
|
||||
import com.l2jserver.gameserver.model.L2Object;
|
||||
@ -162,7 +162,7 @@ public final class FortManager implements InstanceListManager
|
||||
@Override
|
||||
public void loadInstances()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement();
|
||||
ResultSet rs = s.executeQuery("SELECT id FROM fort ORDER BY id"))
|
||||
{
|
||||
|
@ -28,7 +28,7 @@ import java.util.Map;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.model.L2Spawn;
|
||||
import com.l2jserver.gameserver.model.entity.Fort;
|
||||
|
||||
@ -106,7 +106,7 @@ public final class FortSiegeGuardManager
|
||||
void loadSiegeGuard()
|
||||
{
|
||||
_siegeGuards.clear();
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT npcId, x, y, z, heading, respawnDelay FROM fort_siege_guards WHERE fortId = ?"))
|
||||
{
|
||||
final int fortId = getFort().getResidenceId();
|
||||
|
@ -34,7 +34,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.model.CombatFlag;
|
||||
import com.l2jserver.gameserver.model.FortSiegeSpawn;
|
||||
import com.l2jserver.gameserver.model.L2Clan;
|
||||
@ -88,7 +88,7 @@ public final class FortSiegeManager
|
||||
}
|
||||
|
||||
boolean register = false;
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT clan_id FROM fortsiege_clans where clan_id=? and fort_id=?"))
|
||||
{
|
||||
ps.setInt(1, clan.getId());
|
||||
|
@ -35,7 +35,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.data.xml.impl.DoorData;
|
||||
import com.l2jserver.gameserver.datatables.SpawnTable;
|
||||
@ -406,7 +406,7 @@ public final class FourSepulchersManager
|
||||
{
|
||||
_mysteriousBoxSpawns.clear();
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT id, count, npc_templateid, locx, locy, locz, heading, respawn_delay, key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY id"))
|
||||
{
|
||||
ps.setInt(1, 0);
|
||||
@ -463,7 +463,7 @@ public final class FourSepulchersManager
|
||||
_physicalMonsters.clear();
|
||||
|
||||
int loaded = 0;
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps1 = con.prepareStatement("SELECT Distinct key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY key_npc_id"))
|
||||
{
|
||||
ps1.setInt(1, 1);
|
||||
@ -510,7 +510,7 @@ public final class FourSepulchersManager
|
||||
_magicalMonsters.clear();
|
||||
|
||||
int loaded = 0;
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps1 = con.prepareStatement("SELECT Distinct key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY key_npc_id"))
|
||||
{
|
||||
ps1.setInt(1, 2);
|
||||
@ -559,7 +559,7 @@ public final class FourSepulchersManager
|
||||
_archonSpawned.clear();
|
||||
|
||||
int loaded = 0;
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps1 = con.prepareStatement("SELECT Distinct key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY key_npc_id"))
|
||||
{
|
||||
ps1.setInt(1, 5);
|
||||
@ -610,7 +610,7 @@ public final class FourSepulchersManager
|
||||
_emperorsGraveNpcs.clear();
|
||||
|
||||
int loaded = 0;
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps1 = con.prepareStatement("SELECT Distinct key_npc_id FROM four_sepulchers_spawnlist Where spawntype = ? ORDER BY key_npc_id"))
|
||||
{
|
||||
ps1.setInt(1, 6);
|
||||
|
@ -27,7 +27,7 @@ import java.util.Map.Entry;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.model.variables.AbstractVariables;
|
||||
|
||||
/**
|
||||
@ -52,7 +52,7 @@ public final class GlobalVariablesManager extends AbstractVariables
|
||||
public boolean restoreMe()
|
||||
{
|
||||
// Restore previous variables.
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement st = con.createStatement();
|
||||
ResultSet rset = st.executeQuery(SELECT_QUERY))
|
||||
{
|
||||
@ -83,7 +83,7 @@ public final class GlobalVariablesManager extends AbstractVariables
|
||||
return false;
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement del = con.createStatement();
|
||||
PreparedStatement st = con.prepareStatement(INSERT_QUERY))
|
||||
{
|
||||
@ -115,7 +115,7 @@ public final class GlobalVariablesManager extends AbstractVariables
|
||||
@Override
|
||||
public boolean deleteMe()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement del = con.createStatement())
|
||||
{
|
||||
del.execute(DELETE_QUERY);
|
||||
|
@ -33,7 +33,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jserver.gameserver.instancemanager.tasks.GrandBossManagerStoreTask;
|
||||
@ -75,7 +75,7 @@ public final class GrandBossManager implements IStorable
|
||||
|
||||
private void init()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement();
|
||||
ResultSet rs = s.executeQuery("SELECT * from grandboss_data ORDER BY boss_id"))
|
||||
{
|
||||
@ -129,7 +129,7 @@ public final class GrandBossManager implements IStorable
|
||||
zones.put(zoneId, new ArrayList<>());
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement();
|
||||
ResultSet rs = s.executeQuery("SELECT * from grandboss_list ORDER BY player_id"))
|
||||
{
|
||||
@ -237,10 +237,10 @@ public final class GrandBossManager implements IStorable
|
||||
@Override
|
||||
public boolean storeMe()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement delete = con.prepareStatement(DELETE_GRAND_BOSS_LIST))
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement())
|
||||
{
|
||||
delete.executeUpdate();
|
||||
s.executeUpdate(DELETE_GRAND_BOSS_LIST);
|
||||
|
||||
try (PreparedStatement insert = con.prepareStatement(INSERT_GRAND_BOSS_LIST))
|
||||
{
|
||||
@ -310,7 +310,7 @@ public final class GrandBossManager implements IStorable
|
||||
|
||||
private void updateDb(int bossId, boolean statusOnly)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
{
|
||||
L2GrandBossInstance boss = BOSSES.get(bossId);
|
||||
StatsSet info = _storedInfo.get(bossId);
|
||||
|
@ -30,7 +30,7 @@ import org.w3c.dom.Document;
|
||||
import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.entity.Instance;
|
||||
import com.l2jserver.gameserver.model.instancezone.InstanceWorld;
|
||||
@ -122,7 +122,7 @@ public final class InstanceManager implements IXmlReader
|
||||
restoreInstanceTimes(playerObjId);
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(ADD_INSTANCE_TIME))
|
||||
{
|
||||
ps.setInt(1, playerObjId);
|
||||
@ -144,7 +144,7 @@ public final class InstanceManager implements IXmlReader
|
||||
*/
|
||||
public void deleteInstanceTime(int playerObjId, int id)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(DELETE_INSTANCE_TIME))
|
||||
{
|
||||
ps.setInt(1, playerObjId);
|
||||
@ -168,7 +168,7 @@ public final class InstanceManager implements IXmlReader
|
||||
return; // already restored
|
||||
}
|
||||
_playerInstanceTimes.put(playerObjId, new ConcurrentHashMap<>());
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(RESTORE_INSTANCE_TIMES))
|
||||
{
|
||||
ps.setInt(1, playerObjId);
|
||||
|
@ -37,7 +37,7 @@ import org.w3c.dom.NamedNodeMap;
|
||||
import org.w3c.dom.Node;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.model.itemauction.ItemAuctionInstance;
|
||||
|
||||
/**
|
||||
@ -60,13 +60,13 @@ public final class ItemAuctionManager
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
Statement statement = con.createStatement();
|
||||
ResultSet rset = statement.executeQuery("SELECT auctionId FROM item_auction ORDER BY auctionId DESC LIMIT 0, 1"))
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement();
|
||||
ResultSet rs = s.executeQuery("SELECT auctionId FROM item_auction ORDER BY auctionId DESC LIMIT 0, 1"))
|
||||
{
|
||||
if (rset.next())
|
||||
if (rs.next())
|
||||
{
|
||||
_auctionIds.set(rset.getInt(1) + 1);
|
||||
_auctionIds.set(rs.getInt(1) + 1);
|
||||
}
|
||||
}
|
||||
catch (final SQLException e)
|
||||
@ -138,18 +138,18 @@ public final class ItemAuctionManager
|
||||
|
||||
public static final void deleteAuction(final int auctionId)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
{
|
||||
try (PreparedStatement statement = con.prepareStatement("DELETE FROM item_auction WHERE auctionId=?"))
|
||||
try (PreparedStatement ps = con.prepareStatement("DELETE FROM item_auction WHERE auctionId=?"))
|
||||
{
|
||||
statement.setInt(1, auctionId);
|
||||
statement.execute();
|
||||
ps.setInt(1, auctionId);
|
||||
ps.execute();
|
||||
}
|
||||
|
||||
try (PreparedStatement statement = con.prepareStatement("DELETE FROM item_auction_bid WHERE auctionId=?"))
|
||||
try (PreparedStatement ps = con.prepareStatement("DELETE FROM item_auction_bid WHERE auctionId=?"))
|
||||
{
|
||||
statement.setInt(1, auctionId);
|
||||
statement.execute();
|
||||
ps.setInt(1, auctionId);
|
||||
ps.execute();
|
||||
}
|
||||
}
|
||||
catch (SQLException e)
|
||||
|
@ -29,7 +29,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.ItemsAutoDestroy;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
@ -82,7 +82,7 @@ public final class ItemsOnGroundManager implements Runnable
|
||||
str = "UPDATE itemsonground SET drop_time = ? WHERE drop_time = -1";
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(str))
|
||||
{
|
||||
ps.setLong(1, System.currentTimeMillis());
|
||||
@ -95,7 +95,7 @@ public final class ItemsOnGroundManager implements Runnable
|
||||
}
|
||||
|
||||
// Add items to world
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable FROM itemsonground"))
|
||||
{
|
||||
int count = 0;
|
||||
@ -181,7 +181,7 @@ public final class ItemsOnGroundManager implements Runnable
|
||||
|
||||
public void emptyTable()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement())
|
||||
{
|
||||
s.executeUpdate("DELETE FROM itemsonground");
|
||||
@ -207,8 +207,8 @@ public final class ItemsOnGroundManager implements Runnable
|
||||
return;
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("INSERT INTO itemsonground(object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable) VALUES(?,?,?,?,?,?,?,?,?)"))
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("INSERT INTO itemsonground(object_id,item_id,count,enchant_level,x,y,z,drop_time,equipable) VALUES(?,?,?,?,?,?,?,?,?)"))
|
||||
{
|
||||
for (L2ItemInstance item : _items)
|
||||
{
|
||||
@ -224,17 +224,17 @@ public final class ItemsOnGroundManager implements Runnable
|
||||
|
||||
try
|
||||
{
|
||||
statement.setInt(1, item.getObjectId());
|
||||
statement.setInt(2, item.getId());
|
||||
statement.setLong(3, item.getCount());
|
||||
statement.setInt(4, item.getEnchantLevel());
|
||||
statement.setInt(5, item.getX());
|
||||
statement.setInt(6, item.getY());
|
||||
statement.setInt(7, item.getZ());
|
||||
statement.setLong(8, (item.isProtected() ? -1 : item.getDropTime())); // item is protected or AutoDestroyed
|
||||
statement.setLong(9, (item.isEquipable() ? 1 : 0)); // set equip-able
|
||||
statement.execute();
|
||||
statement.clearParameters();
|
||||
ps.setInt(1, item.getObjectId());
|
||||
ps.setInt(2, item.getId());
|
||||
ps.setLong(3, item.getCount());
|
||||
ps.setInt(4, item.getEnchantLevel());
|
||||
ps.setInt(5, item.getX());
|
||||
ps.setInt(6, item.getY());
|
||||
ps.setInt(7, item.getZ());
|
||||
ps.setLong(8, (item.isProtected() ? -1 : item.getDropTime())); // item is protected or AutoDestroyed
|
||||
ps.setLong(9, (item.isEquipable() ? 1 : 0)); // set equip-able
|
||||
ps.execute();
|
||||
ps.clearParameters();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -31,7 +31,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.idfactory.IdFactory;
|
||||
import com.l2jserver.gameserver.instancemanager.tasks.MessageDeletionTask;
|
||||
@ -58,7 +58,7 @@ public final class MailManager
|
||||
private void load()
|
||||
{
|
||||
int count = 0;
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement ps = con.createStatement();
|
||||
ResultSet rs = ps.executeQuery("SELECT * FROM messages ORDER BY expiration"))
|
||||
{
|
||||
@ -174,7 +174,7 @@ public final class MailManager
|
||||
public void sendMessage(Message msg)
|
||||
{
|
||||
_messages.put(msg.getId(), msg);
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = Message.getStatement(msg, con))
|
||||
{
|
||||
ps.execute();
|
||||
@ -196,7 +196,7 @@ public final class MailManager
|
||||
|
||||
public final void markAsReadInDb(int msgId)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isUnread = 'false' WHERE messageId = ?"))
|
||||
{
|
||||
ps.setInt(1, msgId);
|
||||
@ -210,7 +210,7 @@ public final class MailManager
|
||||
|
||||
public final void markAsDeletedBySenderInDb(int msgId)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isDeletedBySender = 'true' WHERE messageId = ?"))
|
||||
{
|
||||
ps.setInt(1, msgId);
|
||||
@ -224,7 +224,7 @@ public final class MailManager
|
||||
|
||||
public final void markAsDeletedByReceiverInDb(int msgId)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE messages SET isDeletedByReceiver = 'true' WHERE messageId = ?"))
|
||||
{
|
||||
ps.setInt(1, msgId);
|
||||
@ -238,7 +238,7 @@ public final class MailManager
|
||||
|
||||
public final void removeAttachmentsInDb(int msgId)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE messages SET hasAttachments = 'false' WHERE messageId = ?"))
|
||||
{
|
||||
ps.setInt(1, msgId);
|
||||
@ -252,7 +252,7 @@ public final class MailManager
|
||||
|
||||
public final void deleteMessageInDb(int msgId)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM messages WHERE messageId = ?"))
|
||||
{
|
||||
ps.setInt(1, msgId);
|
||||
|
@ -31,7 +31,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.model.L2Mentee;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
@ -56,7 +56,7 @@ public class MentorManager
|
||||
|
||||
private void load()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement statement = con.createStatement();
|
||||
ResultSet rset = statement.executeQuery("SELECT * FROM character_mentees"))
|
||||
{
|
||||
@ -78,7 +78,7 @@ public class MentorManager
|
||||
*/
|
||||
public void deleteMentee(int mentorId, int menteeId)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("DELETE FROM character_mentees WHERE mentorId = ? AND charId = ?"))
|
||||
{
|
||||
statement.setInt(1, mentorId);
|
||||
@ -97,7 +97,7 @@ public class MentorManager
|
||||
*/
|
||||
public void deleteMentor(int mentorId, int menteeId)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("DELETE FROM character_mentees WHERE mentorId = ? AND charId = ?"))
|
||||
{
|
||||
statement.setInt(1, mentorId);
|
||||
|
@ -26,7 +26,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.data.xml.impl.NpcData;
|
||||
import com.l2jserver.gameserver.enums.ItemLocation;
|
||||
import com.l2jserver.gameserver.idfactory.IdFactory;
|
||||
@ -147,7 +147,7 @@ public final class MercTicketManager
|
||||
*/
|
||||
private final void load()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement();
|
||||
ResultSet rs = s.executeQuery("SELECT * FROM castle_siege_guards Where isHired = 1"))
|
||||
{
|
||||
|
@ -25,7 +25,7 @@ import java.sql.SQLException;
|
||||
import java.util.Calendar;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.model.L2World;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
|
||||
@ -38,7 +38,7 @@ public class PremiumManager
|
||||
|
||||
public long getPremiumEndDate(String accountName)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
{
|
||||
PreparedStatement statement = con.prepareStatement("SELECT premium_service,enddate FROM account_premium WHERE account_name=?");
|
||||
statement.setString(1, accountName);
|
||||
@ -72,7 +72,7 @@ public class PremiumManager
|
||||
remainingTime -= System.currentTimeMillis();
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
{
|
||||
Calendar endDate = Calendar.getInstance();
|
||||
endDate.setTimeInMillis(System.currentTimeMillis() + remainingTime);
|
||||
@ -102,7 +102,7 @@ public class PremiumManager
|
||||
public void removePremiumStatus(String accountName)
|
||||
{
|
||||
// TODO: Add check if account exists. XD
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection())
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection())
|
||||
{
|
||||
PreparedStatement statement = con.prepareStatement("INSERT INTO account_premium (account_name,premium_service,enddate) values(?,?,?) ON DUPLICATE KEY UPDATE premium_service = ?, enddate = ?");
|
||||
statement.setString(1, accountName);
|
||||
|
@ -26,7 +26,7 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.model.holders.PunishmentHolder;
|
||||
import com.l2jserver.gameserver.model.punishment.PunishmentAffect;
|
||||
import com.l2jserver.gameserver.model.punishment.PunishmentTask;
|
||||
@ -58,7 +58,7 @@ public final class PunishmentManager
|
||||
int expired = 0;
|
||||
|
||||
// Load punishments.
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement st = con.createStatement();
|
||||
ResultSet rset = st.executeQuery("SELECT * FROM punishments"))
|
||||
{
|
||||
|
@ -22,6 +22,7 @@ import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.Calendar;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
@ -30,7 +31,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.datatables.SpawnTable;
|
||||
import com.l2jserver.gameserver.model.L2Spawn;
|
||||
@ -76,21 +77,21 @@ public class RaidBossSpawnManager
|
||||
_storedInfo.clear();
|
||||
_schedules.clear();
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("SELECT * FROM raidboss_spawnlist ORDER BY boss_id");
|
||||
ResultSet rset = statement.executeQuery())
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement s = con.createStatement();
|
||||
ResultSet rs = s.executeQuery("SELECT * FROM raidboss_spawnlist ORDER BY boss_id"))
|
||||
{
|
||||
while (rset.next())
|
||||
while (rs.next())
|
||||
{
|
||||
final L2Spawn spawnDat = new L2Spawn(rset.getInt("boss_id"));
|
||||
spawnDat.setX(rset.getInt("loc_x"));
|
||||
spawnDat.setY(rset.getInt("loc_y"));
|
||||
spawnDat.setZ(rset.getInt("loc_z"));
|
||||
spawnDat.setAmount(rset.getInt("amount"));
|
||||
spawnDat.setHeading(rset.getInt("heading"));
|
||||
spawnDat.setRespawnDelay(rset.getInt("respawn_delay"), rset.getInt("respawn_random"));
|
||||
final L2Spawn spawnDat = new L2Spawn(rs.getInt("boss_id"));
|
||||
spawnDat.setX(rs.getInt("loc_x"));
|
||||
spawnDat.setY(rs.getInt("loc_y"));
|
||||
spawnDat.setZ(rs.getInt("loc_z"));
|
||||
spawnDat.setAmount(rs.getInt("amount"));
|
||||
spawnDat.setHeading(rs.getInt("heading"));
|
||||
spawnDat.setRespawnDelay(rs.getInt("respawn_delay"), rs.getInt("respawn_random"));
|
||||
|
||||
addNewSpawn(spawnDat, rset.getLong("respawn_time"), rset.getDouble("currentHP"), rset.getDouble("currentMP"), false);
|
||||
addNewSpawn(spawnDat, rs.getLong("respawn_time"), rs.getDouble("currentHP"), rs.getDouble("currentMP"), false);
|
||||
}
|
||||
|
||||
_log.info(getClass().getSimpleName() + ": Loaded " + _bosses.size() + " Instances");
|
||||
@ -98,7 +99,7 @@ public class RaidBossSpawnManager
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
_log.warning(getClass().getSimpleName() + ": Couldnt load raidboss spawnlist table.");
|
||||
_log.warning(getClass().getSimpleName() + ": Couldnt load raidboss_spawnlist table");
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -265,19 +266,19 @@ public class RaidBossSpawnManager
|
||||
|
||||
if (storeInDb)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("INSERT INTO raidboss_spawnlist (boss_id,amount,loc_x,loc_y,loc_z,heading,respawn_time,currentHp,currentMp) VALUES(?,?,?,?,?,?,?,?,?)"))
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("INSERT INTO raidboss_spawnlist (boss_id,amount,loc_x,loc_y,loc_z,heading,respawn_time,currentHp,currentMp) VALUES(?,?,?,?,?,?,?,?,?)"))
|
||||
{
|
||||
statement.setInt(1, spawnDat.getId());
|
||||
statement.setInt(2, spawnDat.getAmount());
|
||||
statement.setInt(3, spawnDat.getX());
|
||||
statement.setInt(4, spawnDat.getY());
|
||||
statement.setInt(5, spawnDat.getZ());
|
||||
statement.setInt(6, spawnDat.getHeading());
|
||||
statement.setLong(7, respawnTime);
|
||||
statement.setDouble(8, currentHP);
|
||||
statement.setDouble(9, currentMP);
|
||||
statement.execute();
|
||||
ps.setInt(1, spawnDat.getId());
|
||||
ps.setInt(2, spawnDat.getAmount());
|
||||
ps.setInt(3, spawnDat.getX());
|
||||
ps.setInt(4, spawnDat.getY());
|
||||
ps.setInt(5, spawnDat.getZ());
|
||||
ps.setInt(6, spawnDat.getHeading());
|
||||
ps.setLong(7, respawnTime);
|
||||
ps.setDouble(8, currentHP);
|
||||
ps.setDouble(9, currentMP);
|
||||
ps.execute();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -326,11 +327,11 @@ public class RaidBossSpawnManager
|
||||
|
||||
if (updateDb)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("DELETE FROM raidboss_spawnlist WHERE boss_id=?"))
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("DELETE FROM raidboss_spawnlist WHERE boss_id=?"))
|
||||
{
|
||||
statement.setInt(1, bossId);
|
||||
statement.execute();
|
||||
ps.setInt(1, bossId);
|
||||
ps.execute();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -345,8 +346,8 @@ public class RaidBossSpawnManager
|
||||
*/
|
||||
private void updateDb()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("UPDATE raidboss_spawnlist SET respawn_time = ?, currentHP = ?, currentMP = ? WHERE boss_id = ?"))
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("UPDATE raidboss_spawnlist SET respawn_time = ?, currentHP = ?, currentMP = ? WHERE boss_id = ?"))
|
||||
{
|
||||
for (Integer bossId : _storedInfo.keySet())
|
||||
{
|
||||
@ -376,16 +377,17 @@ public class RaidBossSpawnManager
|
||||
|
||||
try
|
||||
{
|
||||
statement.setLong(1, info.getLong("respawnTime"));
|
||||
statement.setDouble(2, info.getDouble("currentHP"));
|
||||
statement.setDouble(3, info.getDouble("currentMP"));
|
||||
statement.setInt(4, bossId);
|
||||
statement.executeUpdate();
|
||||
statement.clearParameters();
|
||||
// TODO(Zoey76): Change this to use batch.
|
||||
ps.setLong(1, info.getLong("respawnTime"));
|
||||
ps.setDouble(2, info.getDouble("currentHP"));
|
||||
ps.setDouble(3, info.getDouble("currentMP"));
|
||||
ps.setInt(4, bossId);
|
||||
ps.executeUpdate();
|
||||
ps.clearParameters();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
_log.log(Level.WARNING, getClass().getSimpleName() + ": Couldnt update raidboss spawnlist table " + e.getMessage(), e);
|
||||
_log.log(Level.WARNING, getClass().getSimpleName() + ": Couldnt update raidboss_spawnlist table " + e.getMessage(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.model.L2Spawn;
|
||||
import com.l2jserver.gameserver.model.actor.instance.L2PcInstance;
|
||||
import com.l2jserver.gameserver.model.entity.Castle;
|
||||
@ -106,7 +106,7 @@ public final class SiegeGuardManager
|
||||
*/
|
||||
public void removeMerc(int npcId, int x, int y, int z)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("Delete From castle_siege_guards Where npcId = ? And x = ? AND y = ? AND z = ? AND isHired = 1"))
|
||||
{
|
||||
ps.setInt(1, npcId);
|
||||
@ -126,7 +126,7 @@ public final class SiegeGuardManager
|
||||
*/
|
||||
public void removeMercs()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("Delete From castle_siege_guards Where castleId = ? And isHired = 1"))
|
||||
{
|
||||
ps.setInt(1, getCastle().getResidenceId());
|
||||
@ -192,7 +192,7 @@ public final class SiegeGuardManager
|
||||
*/
|
||||
private void loadSiegeGuard()
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_siege_guards Where castleId = ? And isHired = ?"))
|
||||
{
|
||||
ps.setInt(1, getCastle().getResidenceId());
|
||||
@ -238,18 +238,18 @@ public final class SiegeGuardManager
|
||||
*/
|
||||
private void saveSiegeGuard(int x, int y, int z, int heading, int npcId, int isHire)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("Insert Into castle_siege_guards (castleId, npcId, x, y, z, heading, respawnDelay, isHired) Values (?, ?, ?, ?, ?, ?, ?, ?)"))
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("Insert Into castle_siege_guards (castleId, npcId, x, y, z, heading, respawnDelay, isHired) Values (?, ?, ?, ?, ?, ?, ?, ?)"))
|
||||
{
|
||||
statement.setInt(1, getCastle().getResidenceId());
|
||||
statement.setInt(2, npcId);
|
||||
statement.setInt(3, x);
|
||||
statement.setInt(4, y);
|
||||
statement.setInt(5, z);
|
||||
statement.setInt(6, heading);
|
||||
statement.setInt(7, (isHire == 1 ? 0 : 600));
|
||||
statement.setInt(8, isHire);
|
||||
statement.execute();
|
||||
ps.setInt(1, getCastle().getResidenceId());
|
||||
ps.setInt(2, npcId);
|
||||
ps.setInt(3, x);
|
||||
ps.setInt(4, y);
|
||||
ps.setInt(5, z);
|
||||
ps.setInt(6, heading);
|
||||
ps.setInt(7, (isHire == 1 ? 0 : 600));
|
||||
ps.setInt(8, isHire);
|
||||
ps.execute();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
|
@ -30,7 +30,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.datatables.SkillData;
|
||||
import com.l2jserver.gameserver.model.L2Clan;
|
||||
import com.l2jserver.gameserver.model.L2Object;
|
||||
@ -89,12 +89,12 @@ public final class SiegeManager
|
||||
}
|
||||
|
||||
boolean register = false;
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement("SELECT clan_id FROM siege_clans where clan_id=? and castle_id=?"))
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT clan_id FROM siege_clans where clan_id=? and castle_id=?"))
|
||||
{
|
||||
statement.setInt(1, clan.getId());
|
||||
statement.setInt(2, castleid);
|
||||
try (ResultSet rs = statement.executeQuery())
|
||||
ps.setInt(1, clan.getId());
|
||||
ps.setInt(2, castleid);
|
||||
try (ResultSet rs = ps.executeQuery())
|
||||
{
|
||||
while (rs.next())
|
||||
{
|
||||
@ -278,7 +278,7 @@ public final class SiegeManager
|
||||
|
||||
private final void loadTrapUpgrade(int castleId)
|
||||
{
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement("SELECT * FROM castle_trapupgrade WHERE castleId=?"))
|
||||
{
|
||||
ps.setInt(1, castleId);
|
||||
|
@ -28,7 +28,7 @@ import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import com.l2jserver.Config;
|
||||
import com.l2jserver.L2DatabaseFactory;
|
||||
import com.l2jserver.commons.database.pool.impl.ConnectionFactory;
|
||||
import com.l2jserver.gameserver.ThreadPoolManager;
|
||||
import com.l2jserver.gameserver.model.items.instance.L2ItemInstance;
|
||||
import com.l2jserver.gameserver.network.SystemMessageId;
|
||||
@ -93,13 +93,13 @@ public class Lottery
|
||||
public void increasePrize(long count)
|
||||
{
|
||||
_prize += count;
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(UPDATE_PRICE))
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(UPDATE_PRICE))
|
||||
{
|
||||
statement.setLong(1, getPrize());
|
||||
statement.setLong(2, getPrize());
|
||||
statement.setInt(3, getId());
|
||||
statement.execute();
|
||||
ps.setLong(1, getPrize());
|
||||
ps.setLong(2, getPrize());
|
||||
ps.setInt(3, getId());
|
||||
ps.execute();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
@ -128,7 +128,7 @@ public class Lottery
|
||||
public void run()
|
||||
{
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
Statement statement = con.createStatement();
|
||||
ResultSet rset = statement.executeQuery(SELECT_LAST_LOTTERY))
|
||||
{
|
||||
@ -201,15 +201,15 @@ public class Lottery
|
||||
ThreadPoolManager.getInstance().scheduleGeneral(new stopSellingTickets(), _enddate - System.currentTimeMillis() - (10 * MINUTE));
|
||||
ThreadPoolManager.getInstance().scheduleGeneral(new finishLottery(), _enddate - System.currentTimeMillis());
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(INSERT_LOTTERY))
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(INSERT_LOTTERY))
|
||||
{
|
||||
statement.setInt(1, 1);
|
||||
statement.setInt(2, getId());
|
||||
statement.setLong(3, getEndDate());
|
||||
statement.setLong(4, getPrize());
|
||||
statement.setLong(5, getPrize());
|
||||
statement.execute();
|
||||
ps.setInt(1, 1);
|
||||
ps.setInt(2, getId());
|
||||
ps.setLong(3, getEndDate());
|
||||
ps.setLong(4, getPrize());
|
||||
ps.setLong(5, getPrize());
|
||||
ps.execute();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
@ -307,11 +307,11 @@ public class Lottery
|
||||
int count3 = 0;
|
||||
int count4 = 0;
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(SELECT_LOTTERY_ITEM))
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(SELECT_LOTTERY_ITEM))
|
||||
{
|
||||
statement.setInt(1, getId());
|
||||
try (ResultSet rset = statement.executeQuery())
|
||||
ps.setInt(1, getId());
|
||||
try (ResultSet rset = ps.executeQuery())
|
||||
{
|
||||
while (rset.next())
|
||||
{
|
||||
@ -422,18 +422,18 @@ public class Lottery
|
||||
Broadcast.toAllOnlinePlayers(sm);
|
||||
}
|
||||
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(UPDATE_LOTTERY))
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(UPDATE_LOTTERY))
|
||||
{
|
||||
statement.setLong(1, getPrize());
|
||||
statement.setLong(2, newprize);
|
||||
statement.setInt(3, enchant);
|
||||
statement.setInt(4, type2);
|
||||
statement.setLong(5, prize1);
|
||||
statement.setLong(6, prize2);
|
||||
statement.setLong(7, prize3);
|
||||
statement.setInt(8, getId());
|
||||
statement.execute();
|
||||
ps.setLong(1, getPrize());
|
||||
ps.setLong(2, newprize);
|
||||
ps.setInt(3, enchant);
|
||||
ps.setInt(4, type2);
|
||||
ps.setLong(5, prize1);
|
||||
ps.setLong(6, prize2);
|
||||
ps.setLong(7, prize3);
|
||||
ps.setInt(8, getId());
|
||||
ps.execute();
|
||||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
@ -492,16 +492,16 @@ public class Lottery
|
||||
0,
|
||||
0
|
||||
};
|
||||
try (Connection con = L2DatabaseFactory.getInstance().getConnection();
|
||||
PreparedStatement statement = con.prepareStatement(SELECT_LOTTERY_TICKET))
|
||||
try (Connection con = ConnectionFactory.getInstance().getConnection();
|
||||
PreparedStatement ps = con.prepareStatement(SELECT_LOTTERY_TICKET))
|
||||
{
|
||||
statement.setInt(1, id);
|
||||
try (ResultSet rset = statement.executeQuery())
|
||||
ps.setInt(1, id);
|
||||
try (ResultSet rs = ps.executeQuery())
|
||||
{
|
||||
if (rset.next())
|
||||
if (rs.next())
|
||||
{
|
||||
int curenchant = rset.getInt("number1") & enchant;
|
||||
int curtype2 = rset.getInt("number2") & type2;
|
||||
int curenchant = rs.getInt("number1") & enchant;
|
||||
int curtype2 = rs.getInt("number2") & type2;
|
||||
|
||||
if ((curenchant == 0) && (curtype2 == 0))
|
||||
{
|
||||
@ -532,15 +532,15 @@ public class Lottery
|
||||
break;
|
||||
case 5:
|
||||
res[0] = 1;
|
||||
res[1] = rset.getLong("prize1");
|
||||
res[1] = rs.getLong("prize1");
|
||||
break;
|
||||
case 4:
|
||||
res[0] = 2;
|
||||
res[1] = rset.getLong("prize2");
|
||||
res[1] = rs.getLong("prize2");
|
||||
break;
|
||||
case 3:
|
||||
res[0] = 3;
|
||||
res[1] = rset.getLong("prize3");
|
||||
res[1] = rs.getLong("prize3");
|
||||
break;
|
||||
default:
|
||||
res[0] = 4;
|
||||
|
Reference in New Issue
Block a user