mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2025-06-25 10:14:42 +02:00
Merge remote-tracking branch 'origin/master'
# Conflicts: # Core/src/main/java/com/intellectualcrafters/plot/object/Plot.java
This commit is contained in:
@ -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<Command, Runnable, Runnable>() {
|
||||
@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) {
|
||||
|
@ -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<Plot> 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();
|
||||
|
@ -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<br>
|
||||
@ -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() {
|
||||
|
@ -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<Plot> getPlotsAbs(final UUID uuid) {
|
||||
if (uuid == null) {
|
||||
return Collections.emptySet();
|
||||
}
|
||||
final HashSet<Plot> myPlots = new HashSet<>();
|
||||
foreachPlotAbs(new RunnableVal<Plot>() {
|
||||
@Override
|
||||
public void run(Plot value) {
|
||||
if (value.owner.equals(uuid)) {
|
||||
if (uuid.equals(value.owner)) {
|
||||
myPlots.add(value);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user