This commit is contained in:
Sauilitired 2016-01-17 13:19:14 +01:00
parent faa9c10364
commit adfd0e6674
2 changed files with 20 additions and 40 deletions

View File

@ -1,14 +1,15 @@
package com.intellectualcrafters.plot.object;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.UUIDHandler;
import org.bukkit.Bukkit;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
public class PlotHandler {
public static HashSet<UUID> getOwners(final Plot plot) {
@ -41,7 +42,11 @@ public class PlotHandler {
if (!plot.isMerged()) {
return false;
}
for (Plot current : MainUtil.getConnectedPlots(plot)) {
Set<Plot> plots;
synchronized (Bukkit.getServer()) {
plots = MainUtil.getConnectedPlots(plot);
}
for (Plot current : plots) {
if (current.owner.equals(uuid)) {
return true;
}

View File

@ -20,23 +20,6 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.util;
import java.nio.charset.StandardCharsets;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
import com.google.common.collect.BiMap;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
@ -44,24 +27,16 @@ import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.object.BlockLoc;
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.ConsolePlayer;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.object.PlotCluster;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotManager;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PlotSettings;
import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.object.PseudoRandom;
import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.object.StringWrapper;
import com.intellectualcrafters.plot.object.*;
import com.plotsquared.listener.PlotListener;
import java.nio.charset.StandardCharsets;
import java.util.*;
import java.util.Map.Entry;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.regex.Matcher;
/**
* plot functions
*
@ -2415,7 +2390,7 @@ public class MainUtil {
public static HashSet<Plot> connected_cache;
public static HashSet<RegionWrapper> regions_cache;
public static HashSet<Plot> getConnectedPlots(Plot plot) {
public static synchronized HashSet<Plot> getConnectedPlots(Plot plot) {
if (plot == null) {
return null;
}