diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index f29e00c05..b193b6e5f 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,12 +1,22 @@ -# Bug report template (Follow this template unless you are making a feature request.) -**Debug paste link**: +# Bug report template + + + +**Debug paste link:** + + +**Description of the problem:** + + +**How to replicate:** + + +**Checklist**: + +- [] I included a `/plot debugpaste` link +- [] I made sure there are no duplicates of this report [(Use Search)](https://github.com/IntellectualSites/PlotSquared/issues?utf8=%E2%9C%93&q=is%3Aissue) +- [] I made sure I am using an up-to-date version of PlotSquared +- [] I Made sure the bug/error is not caused by any other plugin -**Description of the problem:** -**How to replicate**: -Make sure you've completed the following steps (put an X between of brackets): -- [] Include `/plot debugpaste` -- [] Made sure there aren't duplicates of this report [(Use Search)](https://github.com/IntellectualSites/PlotSquared/issues?utf8=%E2%9C%93&q=is%3Aissue) -- [] Made sure you're using an up-to-date version of PlotSquared -- [] Made sure the bug/error isn't caused by any other plugin diff --git a/Core/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java b/Core/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java index fb46885c6..34cea9087 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java @@ -223,12 +223,12 @@ public class MainCommand extends Command { // Trim command args = Arrays.copyOfRange(args, 1, args.length); } - if (args.length >= 2 && args[0].charAt(0) == '-') { + if (args.length >= 2 && !args[0].isEmpty() && args[0].charAt(0) == '-') { switch (args[0].substring(1)) { case "f": confirm = new RunnableVal3() { @Override - public void run(final Command cmd, final Runnable success, final Runnable failure) { + public void run(Command cmd, Runnable success, Runnable failure) { if (EconHandler.manager != null) { PlotArea area = player.getApplicablePlotArea(); if (area != null) { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java b/Core/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java index 2877970ff..6ac643606 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java @@ -163,6 +163,13 @@ public class SQLManager implements AbstractDB { } public boolean isValid() { + try { + if (connection.isClosed()) { + return false; + } + } catch (SQLException e) { + return false; + } try (PreparedStatement stmt = this.connection.prepareStatement("SELECT 1")) { stmt.executeQuery(); return true; @@ -2934,13 +2941,8 @@ public class SQLManager implements AbstractDB { @Override public void validateAllPlots(Set toValidate) { - try { - if (this.connection.isClosed() || this.closed) { - this.closed = false; - this.connection = this.database.forceConnection(); - } - } catch (ClassNotFoundException | SQLException e) { - e.printStackTrace(); + if (!isValid()) { + reconnect(); } PS.debug("$1All DB transactions during this session are being validated (This may take a while if corrections need to be made)"); commit(); diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java b/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java index 49678b1f3..74746c172 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java @@ -29,6 +29,7 @@ import com.intellectualcrafters.plot.util.block.LocalBlockQueue; import com.intellectualcrafters.plot.util.expiry.ExpireManager; import com.intellectualcrafters.plot.util.expiry.PlotAnalysis; import com.plotsquared.listener.PlotListener; + import java.awt.geom.Area; import java.awt.geom.PathIterator; import java.awt.geom.Rectangle2D; @@ -46,7 +47,6 @@ import java.util.Map.Entry; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; -import java.util.concurrent.atomic.AtomicInteger; /** * The plot class
@@ -767,7 +767,6 @@ public class Plot { @Override public void run() { if (queue.isEmpty()) { - AtomicInteger finished = new AtomicInteger(0); Runnable run = new Runnable() { @Override public void run() { diff --git a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotArea.java b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotArea.java index b260949c4..19ce0c29f 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/object/PlotArea.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/object/PlotArea.java @@ -21,6 +21,7 @@ import com.intellectualcrafters.plot.util.block.LocalBlockQueue; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; @@ -464,11 +465,14 @@ public abstract class PlotArea { } public Set getPlotsAbs(final UUID uuid) { + if (uuid == null) { + return Collections.emptySet(); + } final HashSet myPlots = new HashSet<>(); foreachPlotAbs(new RunnableVal() { @Override public void run(Plot value) { - if (value.owner.equals(uuid)) { + if (uuid.equals(value.owner)) { myPlots.add(value); } }