Merge remote-tracking branch 'origin/master'

# Conflicts:
#	Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java
This commit is contained in:
Jesse Boyd 2016-12-15 17:42:51 +11:00
commit a843203ca3
No known key found for this signature in database
GPG Key ID: 59F1DE6293AF6E1F
5 changed files with 36 additions and 21 deletions

View File

@ -1,12 +1,22 @@
# Bug report template (Follow this template unless you are making a feature request.) # Bug report template
**Debug paste link**: <!--- In order to create a valid issue report you have to follow this template. -->
<!--- Incomplete reports might be marked as invalid. -->
<!--- You may remove it if you are posting a feature request. -->
**Debug paste link:**
<!--- Enter /plot debugpaste in game or in your console and copy the output here -->
**Description of the problem:**
**How to replicate:**
<!--- If you can reproduce the issue please tell us as detailed as possible step by step how to do that -->
**Checklist**:
<!-- Make sure you have completed the following steps (put an "X" between of brackets): -->
- [] 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

View File

@ -223,12 +223,12 @@ public class MainCommand extends Command {
// Trim command // Trim command
args = Arrays.copyOfRange(args, 1, args.length); 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)) { switch (args[0].substring(1)) {
case "f": case "f":
confirm = new RunnableVal3<Command, Runnable, Runnable>() { confirm = new RunnableVal3<Command, Runnable, Runnable>() {
@Override @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) { if (EconHandler.manager != null) {
PlotArea area = player.getApplicablePlotArea(); PlotArea area = player.getApplicablePlotArea();
if (area != null) { if (area != null) {

View File

@ -163,6 +163,13 @@ public class SQLManager implements AbstractDB {
} }
public boolean isValid() { public boolean isValid() {
try {
if (connection.isClosed()) {
return false;
}
} catch (SQLException e) {
return false;
}
try (PreparedStatement stmt = this.connection.prepareStatement("SELECT 1")) { try (PreparedStatement stmt = this.connection.prepareStatement("SELECT 1")) {
stmt.executeQuery(); stmt.executeQuery();
return true; return true;
@ -2934,13 +2941,8 @@ public class SQLManager implements AbstractDB {
@Override @Override
public void validateAllPlots(Set<Plot> toValidate) { public void validateAllPlots(Set<Plot> toValidate) {
try { if (!isValid()) {
if (this.connection.isClosed() || this.closed) { reconnect();
this.closed = false;
this.connection = this.database.forceConnection();
}
} catch (ClassNotFoundException | SQLException e) {
e.printStackTrace();
} }
PS.debug("$1All DB transactions during this session are being validated (This may take a while if corrections need to be made)"); PS.debug("$1All DB transactions during this session are being validated (This may take a while if corrections need to be made)");
commit(); commit();

View File

@ -29,6 +29,7 @@ import com.intellectualcrafters.plot.util.block.LocalBlockQueue;
import com.intellectualcrafters.plot.util.expiry.ExpireManager; import com.intellectualcrafters.plot.util.expiry.ExpireManager;
import com.intellectualcrafters.plot.util.expiry.PlotAnalysis; import com.intellectualcrafters.plot.util.expiry.PlotAnalysis;
import com.plotsquared.listener.PlotListener; import com.plotsquared.listener.PlotListener;
import java.awt.geom.Area; import java.awt.geom.Area;
import java.awt.geom.PathIterator; import java.awt.geom.PathIterator;
import java.awt.geom.Rectangle2D; import java.awt.geom.Rectangle2D;
@ -46,7 +47,6 @@ import java.util.Map.Entry;
import java.util.Set; import java.util.Set;
import java.util.UUID; import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
/** /**
* The plot class<br> * The plot class<br>
@ -767,7 +767,6 @@ public class Plot {
@Override @Override
public void run() { public void run() {
if (queue.isEmpty()) { if (queue.isEmpty()) {
AtomicInteger finished = new AtomicInteger(0);
Runnable run = new Runnable() { Runnable run = new Runnable() {
@Override @Override
public void run() { public void run() {

View File

@ -21,6 +21,7 @@ import com.intellectualcrafters.plot.util.block.LocalBlockQueue;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.Collections;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
@ -464,11 +465,14 @@ public abstract class PlotArea {
} }
public Set<Plot> getPlotsAbs(final UUID uuid) { public Set<Plot> getPlotsAbs(final UUID uuid) {
if (uuid == null) {
return Collections.emptySet();
}
final HashSet<Plot> myPlots = new HashSet<>(); final HashSet<Plot> myPlots = new HashSet<>();
foreachPlotAbs(new RunnableVal<Plot>() { foreachPlotAbs(new RunnableVal<Plot>() {
@Override @Override
public void run(Plot value) { public void run(Plot value) {
if (value.owner.equals(uuid)) { if (uuid.equals(value.owner)) {
myPlots.add(value); myPlots.add(value);
} }
} }