diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/PlotMeConverter.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/PlotMeConverter.java index fb60ba5a4..119b222df 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/PlotMeConverter.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/PlotMeConverter.java @@ -68,7 +68,7 @@ public class PlotMeConverter { public void runAsync() throws Exception { // 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 public void run() { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java index 6e0a7d0c6..0da376be7 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java @@ -260,7 +260,12 @@ public class SQLManager implements AbstractDB { final Plot plot = plots.get(i); stmt.setInt((i * 4) + 1, plot.id.x); stmt.setInt((i * 4) + 2, plot.id.y); - stmt.setString((i * 4) + 3, plot.owner.toString()); + try { + 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.executeUpdate(); @@ -292,19 +297,24 @@ public class SQLManager implements AbstractDB { */ @Override public void createPlot(final Plot plot) { - PreparedStatement stmt = null; - try { - stmt = this.connection.prepareStatement(this.CREATE_PLOT); - stmt.setInt(1, plot.id.x); - stmt.setInt(2, plot.id.y); - stmt.setString(3, plot.owner.toString()); - stmt.setString(4, plot.world); - stmt.executeUpdate(); - stmt.close(); - } catch (final SQLException e) { - e.printStackTrace(); - PlotMain.sendConsoleSenderMessage("&c[ERROR] "+"Failed to save plot " + plot.id); - } + runTask(new Runnable() { + @Override + public void run() { + PreparedStatement stmt = null; + try { + stmt = SQLManager.this.connection.prepareStatement(SQLManager.this.CREATE_PLOT); + stmt.setInt(1, plot.id.x); + stmt.setInt(2, plot.id.y); + stmt.setString(3, plot.owner.toString()); + stmt.setString(4, plot.world); + stmt.executeUpdate(); + stmt.close(); + } catch (final Exception e) { + e.printStackTrace(); + PlotMain.sendConsoleSenderMessage("&c[ERROR] "+"Failed to save plot " + plot.id); + } + } + }); } /**