mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-08 09:54:04 +01:00
parent
e208d7f72a
commit
8e3407505a
@ -304,7 +304,16 @@ public class SQLManager implements AbstractDB {
|
||||
}
|
||||
Runnable task = getGlobalTasks().remove();
|
||||
if (task != null) {
|
||||
try {
|
||||
task.run();
|
||||
} catch (Throwable e) {
|
||||
PS.debug("============ DATABASE ERROR ============");
|
||||
PS.debug("There was an error updating the database.");
|
||||
PS.debug(" - It will be correct on shutdown");
|
||||
PS.debug("========================================");
|
||||
e.printStackTrace();
|
||||
PS.debug("========================================");
|
||||
}
|
||||
}
|
||||
commit();
|
||||
return true;
|
||||
@ -320,6 +329,7 @@ public class SQLManager implements AbstractDB {
|
||||
UniqueStatement task = null;
|
||||
UniqueStatement lastTask = null;
|
||||
for (Entry<Plot, Queue<UniqueStatement>> entry : this.plotTasks.entrySet()) {
|
||||
try {
|
||||
Plot plot = entry.getKey();
|
||||
if (this.plotTasks.get(plot).isEmpty()) {
|
||||
this.plotTasks.remove(plot);
|
||||
@ -340,6 +350,14 @@ public class SQLManager implements AbstractDB {
|
||||
task.addBatch(statement);
|
||||
}
|
||||
lastTask = task;
|
||||
} catch (Throwable e) {
|
||||
PS.debug("============ DATABASE ERROR ============");
|
||||
PS.debug("There was an error updating the database.");
|
||||
PS.debug(" - It will be correct on shutdown");
|
||||
PS.debug("========================================");
|
||||
e.printStackTrace();
|
||||
PS.debug("========================================");
|
||||
}
|
||||
}
|
||||
if (statement != null && task != null) {
|
||||
task.execute(statement);
|
||||
@ -356,6 +374,7 @@ public class SQLManager implements AbstractDB {
|
||||
UniqueStatement task = null;
|
||||
UniqueStatement lastTask = null;
|
||||
for (Entry<UUID, Queue<UniqueStatement>> entry : this.playerTasks.entrySet()) {
|
||||
try {
|
||||
UUID uuid = entry.getKey();
|
||||
if (this.playerTasks.get(uuid).isEmpty()) {
|
||||
this.playerTasks.remove(uuid);
|
||||
@ -376,6 +395,14 @@ public class SQLManager implements AbstractDB {
|
||||
task.addBatch(statement);
|
||||
}
|
||||
lastTask = task;
|
||||
} catch (Throwable e) {
|
||||
PS.debug("============ DATABASE ERROR ============");
|
||||
PS.debug("There was an error updating the database.");
|
||||
PS.debug(" - It will be correct on shutdown");
|
||||
PS.debug("========================================");
|
||||
e.printStackTrace();
|
||||
PS.debug("========================================");
|
||||
}
|
||||
}
|
||||
if (statement != null && task != null) {
|
||||
task.execute(statement);
|
||||
@ -392,6 +419,7 @@ public class SQLManager implements AbstractDB {
|
||||
UniqueStatement task = null;
|
||||
UniqueStatement lastTask = null;
|
||||
for (Entry<PlotCluster, Queue<UniqueStatement>> entry : this.clusterTasks.entrySet()) {
|
||||
try {
|
||||
PlotCluster cluster = entry.getKey();
|
||||
if (this.clusterTasks.get(cluster).isEmpty()) {
|
||||
this.clusterTasks.remove(cluster);
|
||||
@ -412,6 +440,14 @@ public class SQLManager implements AbstractDB {
|
||||
task.addBatch(statement);
|
||||
}
|
||||
lastTask = task;
|
||||
} catch (Throwable e) {
|
||||
PS.debug("============ DATABASE ERROR ============");
|
||||
PS.debug("There was an error updating the database.");
|
||||
PS.debug(" - It will be correct on shutdown");
|
||||
PS.debug("========================================");
|
||||
e.printStackTrace();
|
||||
PS.debug("========================================");
|
||||
}
|
||||
}
|
||||
if (statement != null && task != null) {
|
||||
task.execute(statement);
|
||||
@ -433,8 +469,13 @@ public class SQLManager implements AbstractDB {
|
||||
if (!this.plotTasks.isEmpty()) {
|
||||
this.plotTasks.clear();
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
} catch (Throwable e) {
|
||||
PS.debug("============ DATABASE ERROR ============");
|
||||
PS.debug("There was an error updating the database.");
|
||||
PS.debug(" - It will be correct on shutdown");
|
||||
PS.debug("========================================");
|
||||
e.printStackTrace();
|
||||
PS.debug("========================================");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -993,9 +1034,11 @@ public class SQLManager implements AbstractDB {
|
||||
|
||||
@Override
|
||||
public void createPlotAndSettings(final Plot plot, Runnable whenDone) {
|
||||
System.out.println("Create plot!");
|
||||
addPlotTask(plot, new UniqueStatement("createPlotAndSettings_" + plot.hashCode()) {
|
||||
@Override
|
||||
public void set(PreparedStatement stmt) throws SQLException {
|
||||
System.out.println("Set and run!");
|
||||
stmt.setInt(1, plot.getId().x);
|
||||
stmt.setInt(2, plot.getId().y);
|
||||
stmt.setString(3, plot.owner.toString());
|
||||
|
Loading…
Reference in New Issue
Block a user