mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-01-19 16:59:36 +01:00
We're going to try Async conversion again...
This commit is contained in:
parent
e6d682fd5a
commit
2e85dded3d
@ -68,7 +68,7 @@ public class PlotMeConverter {
|
|||||||
|
|
||||||
public void runAsync() throws Exception {
|
public void runAsync() throws Exception {
|
||||||
// We have to make it wait a couple of seconds
|
// We have to make it wait a couple of seconds
|
||||||
Bukkit.getScheduler().runTaskLater(this.plugin, new Runnable() {
|
Bukkit.getScheduler().runTaskLaterAsynchronously(this.plugin, new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
@ -260,7 +260,12 @@ public class SQLManager implements AbstractDB {
|
|||||||
final Plot plot = plots.get(i);
|
final Plot plot = plots.get(i);
|
||||||
stmt.setInt((i * 4) + 1, plot.id.x);
|
stmt.setInt((i * 4) + 1, plot.id.x);
|
||||||
stmt.setInt((i * 4) + 2, plot.id.y);
|
stmt.setInt((i * 4) + 2, plot.id.y);
|
||||||
|
try {
|
||||||
stmt.setString((i * 4) + 3, plot.owner.toString());
|
stmt.setString((i * 4) + 3, plot.owner.toString());
|
||||||
|
}
|
||||||
|
catch (Exception e) {
|
||||||
|
stmt.setString((i * 4) + 3, DBFunc.everyone.toString());
|
||||||
|
}
|
||||||
stmt.setString((i * 4) + 4, plot.world);
|
stmt.setString((i * 4) + 4, plot.world);
|
||||||
}
|
}
|
||||||
stmt.executeUpdate();
|
stmt.executeUpdate();
|
||||||
@ -292,20 +297,25 @@ public class SQLManager implements AbstractDB {
|
|||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void createPlot(final Plot plot) {
|
public void createPlot(final Plot plot) {
|
||||||
|
runTask(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
PreparedStatement stmt = null;
|
PreparedStatement stmt = null;
|
||||||
try {
|
try {
|
||||||
stmt = this.connection.prepareStatement(this.CREATE_PLOT);
|
stmt = SQLManager.this.connection.prepareStatement(SQLManager.this.CREATE_PLOT);
|
||||||
stmt.setInt(1, plot.id.x);
|
stmt.setInt(1, plot.id.x);
|
||||||
stmt.setInt(2, plot.id.y);
|
stmt.setInt(2, plot.id.y);
|
||||||
stmt.setString(3, plot.owner.toString());
|
stmt.setString(3, plot.owner.toString());
|
||||||
stmt.setString(4, plot.world);
|
stmt.setString(4, plot.world);
|
||||||
stmt.executeUpdate();
|
stmt.executeUpdate();
|
||||||
stmt.close();
|
stmt.close();
|
||||||
} catch (final SQLException e) {
|
} catch (final Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
PlotMain.sendConsoleSenderMessage("&c[ERROR] "+"Failed to save plot " + plot.id);
|
PlotMain.sendConsoleSenderMessage("&c[ERROR] "+"Failed to save plot " + plot.id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create tables
|
* Create tables
|
||||||
|
Loading…
x
Reference in New Issue
Block a user