From 101cd6b114e672003a5e5f92102026c36bc956ed Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Fri, 16 Jan 2015 21:34:05 -0800 Subject: [PATCH] minor fixes --- .../java/com/intellectualcrafters/plot/api/PlotAPI.java | 3 ++- .../plot/database/PlotMeConverter.java | 1 + .../com/intellectualcrafters/plot/database/SQLManager.java | 3 +-- .../com/intellectualcrafters/plot/flag/FlagManager.java | 7 ++++++- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java index 8b985a9d2..162ae122d 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java @@ -22,6 +22,7 @@ package com.intellectualcrafters.plot.api; import java.util.ArrayList; +import java.util.Arrays; import java.util.Set; import org.bukkit.Bukkit; @@ -460,7 +461,7 @@ import com.intellectualcrafters.plot.util.UUIDHandler; } } } - return (Plot[]) pPlots.toArray(); + return pPlots.toArray(new Plot[pPlots.size()]); } /** 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 d00f14dd7..ad28b7131 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/PlotMeConverter.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/PlotMeConverter.java @@ -240,6 +240,7 @@ public class PlotMeConverter { } sendMessage("Creating plot DB"); + Thread.sleep(1000); DBFunc.createPlots(createdPlots); sendMessage("Creating settings/helpers DB"); DBFunc.createAllSettingsAndHelpers(createdPlots); 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 b6eaf8067..df682467f 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java @@ -88,7 +88,7 @@ public class SQLManager implements AbstractDB { // schedule reconnect if (PlotMain.getMySQL() != null) { - Bukkit.getScheduler().scheduleSyncRepeatingTask(PlotMain.getMain(), new Runnable() { + Bukkit.getScheduler().runTaskTimer(PlotMain.getMain(), new Runnable() { @Override public void run() { try { @@ -283,7 +283,6 @@ public class SQLManager implements AbstractDB { stmt.executeUpdate(); stmt.close(); } catch (final Exception e) { - e.printStackTrace(); PlotMain.sendConsoleSenderMessage("&6[WARN] "+"Could not bulk save. Conversion may be slower..."); try { for (Plot plot : plots) { diff --git a/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java b/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java index 0c47becc2..4400e99cd 100644 --- a/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java +++ b/PlotSquared/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java @@ -71,7 +71,9 @@ import com.intellectualcrafters.plot.object.PlotWorld; */ public static Flag getPlotFlag(Plot plot, String flag) { ArrayList flags = new ArrayList<>(); - flags.addAll(plot.settings.flags); + if (plot.settings.flags != null && plot.settings.flags.size() > 0) { + flags.addAll(plot.settings.flags); + } PlotWorld plotworld = PlotMain.getWorldSettings(plot.world); if (plotworld != null && plotworld.DEFAULT_FLAGS != null && plotworld.DEFAULT_FLAGS.length > 0) { flags.addAll(Arrays.asList(plotworld.DEFAULT_FLAGS)); @@ -91,6 +93,9 @@ import com.intellectualcrafters.plot.object.PlotWorld; * @return */ public static Flag getPlotFlagAbs(Plot plot, String flag) { + if (plot.settings.flags == null || plot.settings.flags.size() == 0) { + return null; + } for (final Flag myflag : plot.settings.flags) { if (myflag.getKey().equals(flag)) { return myflag;