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