Initialize clans after connection is closed.
This commit is contained in:
@@ -76,30 +76,34 @@ public class ClanTable
|
|||||||
ForumsBBSManager.getInstance().initRoot();
|
ForumsBBSManager.getInstance().initRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
L2Clan clan;
|
// Get all clan ids.
|
||||||
// Count the clans
|
final List<Integer> cids = new ArrayList<>();
|
||||||
int clanCount = 0;
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
Statement s = con.createStatement();
|
Statement s = con.createStatement();
|
||||||
ResultSet rs = s.executeQuery("SELECT clan_id FROM clan_data"))
|
ResultSet rs = s.executeQuery("SELECT clan_id FROM clan_data"))
|
||||||
{
|
{
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
final int clanId = rs.getInt("clan_id");
|
cids.add(rs.getInt("clan_id"));
|
||||||
_clans.put(clanId, new L2Clan(clanId));
|
|
||||||
clan = getClan(clanId);
|
|
||||||
if (clan.getDissolvingExpiryTime() != 0)
|
|
||||||
{
|
|
||||||
scheduleRemoveClan(clan.getId());
|
|
||||||
}
|
|
||||||
clanCount++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.SEVERE, "Error restoring ClanTable.", e);
|
LOGGER.log(Level.SEVERE, "Error restoring ClanTable.", e);
|
||||||
}
|
}
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Restored " + clanCount + " clans from the database.");
|
|
||||||
|
// Create clans.
|
||||||
|
for (int cid : cids)
|
||||||
|
{
|
||||||
|
final L2Clan clan = new L2Clan(cid);
|
||||||
|
_clans.put(cid, clan);
|
||||||
|
if (clan.getDissolvingExpiryTime() != 0)
|
||||||
|
{
|
||||||
|
scheduleRemoveClan(clan.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOGGER.info(getClass().getSimpleName() + ": Restored " + cids.size() + " clans from the database.");
|
||||||
allianceCheck();
|
allianceCheck();
|
||||||
restorewars();
|
restorewars();
|
||||||
}
|
}
|
||||||
|
@@ -76,30 +76,34 @@ public class ClanTable
|
|||||||
ForumsBBSManager.getInstance().initRoot();
|
ForumsBBSManager.getInstance().initRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
L2Clan clan;
|
// Get all clan ids.
|
||||||
// Count the clans
|
final List<Integer> cids = new ArrayList<>();
|
||||||
int clanCount = 0;
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
Statement s = con.createStatement();
|
Statement s = con.createStatement();
|
||||||
ResultSet rs = s.executeQuery("SELECT clan_id FROM clan_data"))
|
ResultSet rs = s.executeQuery("SELECT clan_id FROM clan_data"))
|
||||||
{
|
{
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
final int clanId = rs.getInt("clan_id");
|
cids.add(rs.getInt("clan_id"));
|
||||||
_clans.put(clanId, new L2Clan(clanId));
|
|
||||||
clan = getClan(clanId);
|
|
||||||
if (clan.getDissolvingExpiryTime() != 0)
|
|
||||||
{
|
|
||||||
scheduleRemoveClan(clan.getId());
|
|
||||||
}
|
|
||||||
clanCount++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.SEVERE, "Error restoring ClanTable.", e);
|
LOGGER.log(Level.SEVERE, "Error restoring ClanTable.", e);
|
||||||
}
|
}
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Restored " + clanCount + " clans from the database.");
|
|
||||||
|
// Create clans.
|
||||||
|
for (int cid : cids)
|
||||||
|
{
|
||||||
|
final L2Clan clan = new L2Clan(cid);
|
||||||
|
_clans.put(cid, clan);
|
||||||
|
if (clan.getDissolvingExpiryTime() != 0)
|
||||||
|
{
|
||||||
|
scheduleRemoveClan(clan.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOGGER.info(getClass().getSimpleName() + ": Restored " + cids.size() + " clans from the database.");
|
||||||
allianceCheck();
|
allianceCheck();
|
||||||
restorewars();
|
restorewars();
|
||||||
}
|
}
|
||||||
|
@@ -77,30 +77,34 @@ public class ClanTable
|
|||||||
ForumsBBSManager.getInstance().initRoot();
|
ForumsBBSManager.getInstance().initRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
L2Clan clan;
|
// Get all clan ids.
|
||||||
// Count the clans
|
final List<Integer> cids = new ArrayList<>();
|
||||||
int clanCount = 0;
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
Statement s = con.createStatement();
|
Statement s = con.createStatement();
|
||||||
ResultSet rs = s.executeQuery("SELECT clan_id FROM clan_data"))
|
ResultSet rs = s.executeQuery("SELECT clan_id FROM clan_data"))
|
||||||
{
|
{
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
final int clanId = rs.getInt("clan_id");
|
cids.add(rs.getInt("clan_id"));
|
||||||
_clans.put(clanId, new L2Clan(clanId));
|
|
||||||
clan = getClan(clanId);
|
|
||||||
if (clan.getDissolvingExpiryTime() != 0)
|
|
||||||
{
|
|
||||||
scheduleRemoveClan(clan.getId());
|
|
||||||
}
|
|
||||||
clanCount++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.SEVERE, "Error restoring ClanTable.", e);
|
LOGGER.log(Level.SEVERE, "Error restoring ClanTable.", e);
|
||||||
}
|
}
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Restored " + clanCount + " clans from the database.");
|
|
||||||
|
// Create clans.
|
||||||
|
for (int cid : cids)
|
||||||
|
{
|
||||||
|
final L2Clan clan = new L2Clan(cid);
|
||||||
|
_clans.put(cid, clan);
|
||||||
|
if (clan.getDissolvingExpiryTime() != 0)
|
||||||
|
{
|
||||||
|
scheduleRemoveClan(clan.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOGGER.info(getClass().getSimpleName() + ": Restored " + cids.size() + " clans from the database.");
|
||||||
allianceCheck();
|
allianceCheck();
|
||||||
restorewars();
|
restorewars();
|
||||||
}
|
}
|
||||||
|
@@ -77,30 +77,34 @@ public class ClanTable
|
|||||||
ForumsBBSManager.getInstance().initRoot();
|
ForumsBBSManager.getInstance().initRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
L2Clan clan;
|
// Get all clan ids.
|
||||||
// Count the clans
|
final List<Integer> cids = new ArrayList<>();
|
||||||
int clanCount = 0;
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
Statement s = con.createStatement();
|
Statement s = con.createStatement();
|
||||||
ResultSet rs = s.executeQuery("SELECT clan_id FROM clan_data"))
|
ResultSet rs = s.executeQuery("SELECT clan_id FROM clan_data"))
|
||||||
{
|
{
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
final int clanId = rs.getInt("clan_id");
|
cids.add(rs.getInt("clan_id"));
|
||||||
_clans.put(clanId, new L2Clan(clanId));
|
|
||||||
clan = getClan(clanId);
|
|
||||||
if (clan.getDissolvingExpiryTime() != 0)
|
|
||||||
{
|
|
||||||
scheduleRemoveClan(clan.getId());
|
|
||||||
}
|
|
||||||
clanCount++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.SEVERE, "Error restoring ClanTable.", e);
|
LOGGER.log(Level.SEVERE, "Error restoring ClanTable.", e);
|
||||||
}
|
}
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Restored " + clanCount + " clans from the database.");
|
|
||||||
|
// Initialize clans.
|
||||||
|
for (int cid : cids)
|
||||||
|
{
|
||||||
|
final L2Clan clan = new L2Clan(cid);
|
||||||
|
_clans.put(cid, clan);
|
||||||
|
if (clan.getDissolvingExpiryTime() != 0)
|
||||||
|
{
|
||||||
|
scheduleRemoveClan(clan.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOGGER.info(getClass().getSimpleName() + ": Restored " + cids.size() + " clans from the database.");
|
||||||
allianceCheck();
|
allianceCheck();
|
||||||
restorewars();
|
restorewars();
|
||||||
}
|
}
|
||||||
|
@@ -78,30 +78,34 @@ public class ClanTable
|
|||||||
ForumsBBSManager.getInstance().initRoot();
|
ForumsBBSManager.getInstance().initRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
L2Clan clan;
|
// Get all clan ids.
|
||||||
// Count the clans
|
final List<Integer> cids = new ArrayList<>();
|
||||||
int clanCount = 0;
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
Statement s = con.createStatement();
|
Statement s = con.createStatement();
|
||||||
ResultSet rs = s.executeQuery("SELECT clan_id FROM clan_data"))
|
ResultSet rs = s.executeQuery("SELECT clan_id FROM clan_data"))
|
||||||
{
|
{
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
final int clanId = rs.getInt("clan_id");
|
cids.add(rs.getInt("clan_id"));
|
||||||
_clans.put(clanId, new L2Clan(clanId));
|
|
||||||
clan = getClan(clanId);
|
|
||||||
if (clan.getDissolvingExpiryTime() != 0)
|
|
||||||
{
|
|
||||||
scheduleRemoveClan(clan.getId());
|
|
||||||
}
|
|
||||||
clanCount++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.SEVERE, "Error restoring ClanTable.", e);
|
LOGGER.log(Level.SEVERE, "Error restoring ClanTable.", e);
|
||||||
}
|
}
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Restored " + clanCount + " clans from the database.");
|
|
||||||
|
// Create clans.
|
||||||
|
for (int cid : cids)
|
||||||
|
{
|
||||||
|
final L2Clan clan = new L2Clan(cid);
|
||||||
|
_clans.put(cid, clan);
|
||||||
|
if (clan.getDissolvingExpiryTime() != 0)
|
||||||
|
{
|
||||||
|
scheduleRemoveClan(clan.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOGGER.info(getClass().getSimpleName() + ": Restored " + cids.size() + " clans from the database.");
|
||||||
allianceCheck();
|
allianceCheck();
|
||||||
restorewars();
|
restorewars();
|
||||||
}
|
}
|
||||||
|
@@ -77,30 +77,34 @@ public class ClanTable
|
|||||||
ForumsBBSManager.getInstance().initRoot();
|
ForumsBBSManager.getInstance().initRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
L2Clan clan;
|
// Get all clan ids.
|
||||||
// Count the clans
|
final List<Integer> cids = new ArrayList<>();
|
||||||
int clanCount = 0;
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
Statement s = con.createStatement();
|
Statement s = con.createStatement();
|
||||||
ResultSet rs = s.executeQuery("SELECT clan_id FROM clan_data"))
|
ResultSet rs = s.executeQuery("SELECT clan_id FROM clan_data"))
|
||||||
{
|
{
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
final int clanId = rs.getInt("clan_id");
|
cids.add(rs.getInt("clan_id"));
|
||||||
_clans.put(clanId, new L2Clan(clanId));
|
|
||||||
clan = getClan(clanId);
|
|
||||||
if (clan.getDissolvingExpiryTime() != 0)
|
|
||||||
{
|
|
||||||
scheduleRemoveClan(clan.getId());
|
|
||||||
}
|
|
||||||
clanCount++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.SEVERE, "Error restoring ClanTable.", e);
|
LOGGER.log(Level.SEVERE, "Error restoring ClanTable.", e);
|
||||||
}
|
}
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Restored " + clanCount + " clans from the database.");
|
|
||||||
|
// Create clans.
|
||||||
|
for (int cid : cids)
|
||||||
|
{
|
||||||
|
final L2Clan clan = new L2Clan(cid);
|
||||||
|
_clans.put(cid, clan);
|
||||||
|
if (clan.getDissolvingExpiryTime() != 0)
|
||||||
|
{
|
||||||
|
scheduleRemoveClan(clan.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOGGER.info(getClass().getSimpleName() + ": Restored " + cids.size() + " clans from the database.");
|
||||||
allianceCheck();
|
allianceCheck();
|
||||||
restorewars();
|
restorewars();
|
||||||
}
|
}
|
||||||
|
@@ -77,30 +77,34 @@ public class ClanTable
|
|||||||
ForumsBBSManager.getInstance().initRoot();
|
ForumsBBSManager.getInstance().initRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
L2Clan clan;
|
// Get all clan ids.
|
||||||
// Count the clans
|
final List<Integer> cids = new ArrayList<>();
|
||||||
int clanCount = 0;
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
Statement s = con.createStatement();
|
Statement s = con.createStatement();
|
||||||
ResultSet rs = s.executeQuery("SELECT clan_id FROM clan_data"))
|
ResultSet rs = s.executeQuery("SELECT clan_id FROM clan_data"))
|
||||||
{
|
{
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
final int clanId = rs.getInt("clan_id");
|
cids.add(rs.getInt("clan_id"));
|
||||||
_clans.put(clanId, new L2Clan(clanId));
|
|
||||||
clan = getClan(clanId);
|
|
||||||
if (clan.getDissolvingExpiryTime() != 0)
|
|
||||||
{
|
|
||||||
scheduleRemoveClan(clan.getId());
|
|
||||||
}
|
|
||||||
clanCount++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.SEVERE, "Error restoring ClanTable.", e);
|
LOGGER.log(Level.SEVERE, "Error restoring ClanTable.", e);
|
||||||
}
|
}
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Restored " + clanCount + " clans from the database.");
|
|
||||||
|
// Create clans.
|
||||||
|
for (int cid : cids)
|
||||||
|
{
|
||||||
|
final L2Clan clan = new L2Clan(cid);
|
||||||
|
_clans.put(cid, clan);
|
||||||
|
if (clan.getDissolvingExpiryTime() != 0)
|
||||||
|
{
|
||||||
|
scheduleRemoveClan(clan.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOGGER.info(getClass().getSimpleName() + ": Restored " + cids.size() + " clans from the database.");
|
||||||
allianceCheck();
|
allianceCheck();
|
||||||
restorewars();
|
restorewars();
|
||||||
}
|
}
|
||||||
|
@@ -77,30 +77,34 @@ public class ClanTable
|
|||||||
ForumsBBSManager.getInstance().initRoot();
|
ForumsBBSManager.getInstance().initRoot();
|
||||||
}
|
}
|
||||||
|
|
||||||
L2Clan clan;
|
// Get all clan ids.
|
||||||
// Count the clans
|
final List<Integer> cids = new ArrayList<>();
|
||||||
int clanCount = 0;
|
|
||||||
try (Connection con = DatabaseFactory.getConnection();
|
try (Connection con = DatabaseFactory.getConnection();
|
||||||
Statement s = con.createStatement();
|
Statement s = con.createStatement();
|
||||||
ResultSet rs = s.executeQuery("SELECT clan_id FROM clan_data"))
|
ResultSet rs = s.executeQuery("SELECT clan_id FROM clan_data"))
|
||||||
{
|
{
|
||||||
while (rs.next())
|
while (rs.next())
|
||||||
{
|
{
|
||||||
final int clanId = rs.getInt("clan_id");
|
cids.add(rs.getInt("clan_id"));
|
||||||
_clans.put(clanId, new L2Clan(clanId));
|
|
||||||
clan = getClan(clanId);
|
|
||||||
if (clan.getDissolvingExpiryTime() != 0)
|
|
||||||
{
|
|
||||||
scheduleRemoveClan(clan.getId());
|
|
||||||
}
|
|
||||||
clanCount++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
LOGGER.log(Level.SEVERE, "Error restoring ClanTable.", e);
|
LOGGER.log(Level.SEVERE, "Error restoring ClanTable.", e);
|
||||||
}
|
}
|
||||||
LOGGER.info(getClass().getSimpleName() + ": Restored " + clanCount + " clans from the database.");
|
|
||||||
|
// Create clans.
|
||||||
|
for (int cid : cids)
|
||||||
|
{
|
||||||
|
final L2Clan clan = new L2Clan(cid);
|
||||||
|
_clans.put(cid, clan);
|
||||||
|
if (clan.getDissolvingExpiryTime() != 0)
|
||||||
|
{
|
||||||
|
scheduleRemoveClan(clan.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LOGGER.info(getClass().getSimpleName() + ": Restored " + cids.size() + " clans from the database.");
|
||||||
allianceCheck();
|
allianceCheck();
|
||||||
restorewars();
|
restorewars();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user