mirror of
				https://github.com/IntellectualSites/PlotSquared.git
				synced 2025-10-31 01:23:44 +01:00 
			
		
		
		
	stuff
This commit is contained in:
		| @@ -7,8 +7,6 @@ import java.io.FileOutputStream; | |||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
| import java.io.InputStream; | import java.io.InputStream; | ||||||
| import java.io.InputStreamReader; | import java.io.InputStreamReader; | ||||||
| import java.lang.reflect.Array; |  | ||||||
| import java.net.URI; |  | ||||||
| import java.net.URL; | import java.net.URL; | ||||||
| import java.net.URLConnection; | import java.net.URLConnection; | ||||||
| import java.nio.file.Files; | import java.nio.file.Files; | ||||||
| @@ -23,12 +21,12 @@ import java.util.Comparator; | |||||||
| import java.util.HashMap; | import java.util.HashMap; | ||||||
| import java.util.HashSet; | import java.util.HashSet; | ||||||
| import java.util.LinkedHashMap; | import java.util.LinkedHashMap; | ||||||
| import java.util.LinkedHashSet; |  | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.Map; | import java.util.Map; | ||||||
| import java.util.Map.Entry; | 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.regex.Pattern; | import java.util.regex.Pattern; | ||||||
| import java.util.zip.ZipEntry; | import java.util.zip.ZipEntry; | ||||||
| import java.util.zip.ZipInputStream; | import java.util.zip.ZipInputStream; | ||||||
| @@ -115,7 +113,7 @@ public class PS { | |||||||
|     private int[] VERSION = null; |     private int[] VERSION = null; | ||||||
|     private String LAST_VERSION; |     private String LAST_VERSION; | ||||||
|     private boolean LOADING_WORLD = false; |     private boolean LOADING_WORLD = false; | ||||||
|     private LinkedHashMap<String, HashMap<PlotId, Plot>> plots; |     private ConcurrentHashMap<String, ConcurrentHashMap<PlotId, Plot>> plots; | ||||||
|     private Database database; |     private Database database; | ||||||
|     private Connection connection; |     private Connection connection; | ||||||
|     private Thread thread; |     private Thread thread; | ||||||
| @@ -354,7 +352,7 @@ public class PS { | |||||||
|     public void updatePlot(final Plot plot) { |     public void updatePlot(final Plot plot) { | ||||||
|         final String world = plot.world; |         final String world = plot.world; | ||||||
|         if (!plots.containsKey(world)) { |         if (!plots.containsKey(world)) { | ||||||
|             plots.put(world, new HashMap<PlotId, Plot>()); |             plots.put(world, new ConcurrentHashMap<PlotId, Plot>()); | ||||||
|         } |         } | ||||||
|         plots.get(world).put(plot.id, plot); |         plots.get(world).put(plot.id, plot); | ||||||
|     } |     } | ||||||
| @@ -386,7 +384,7 @@ public class PS { | |||||||
|         plotworlds.put(world, plotworld); |         plotworlds.put(world, plotworld); | ||||||
|         plotmanagers.put(world, manager); |         plotmanagers.put(world, manager); | ||||||
|         if (!plots.containsKey(world)) { |         if (!plots.containsKey(world)) { | ||||||
|             plots.put(world, new HashMap<PlotId, Plot>()); |             plots.put(world, new ConcurrentHashMap<PlotId, Plot>()); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -418,7 +416,8 @@ public class PS { | |||||||
|      * |      * | ||||||
|      * @return HashMap containing the world name, and another map with the plot id and the plot object |      * @return HashMap containing the world name, and another map with the plot id and the plot object | ||||||
|      */ |      */ | ||||||
|     public HashMap<String, HashMap<PlotId, Plot>> getAllPlotsRaw() { |     @Deprecated | ||||||
|  |     public ConcurrentHashMap<String, ConcurrentHashMap<PlotId, Plot>> getAllPlotsRaw() { | ||||||
|         return plots; |         return plots; | ||||||
|     } |     } | ||||||
|      |      | ||||||
| @@ -429,7 +428,7 @@ public class PS { | |||||||
|      */ |      */ | ||||||
|     public Set<Plot> getPlots(PlotFilter... filters) { |     public Set<Plot> getPlots(PlotFilter... filters) { | ||||||
|         HashSet<Plot> set = new HashSet<>(); |         HashSet<Plot> set = new HashSet<>(); | ||||||
|         for (Entry<String, HashMap<PlotId, Plot>> entry : plots.entrySet()) { |         for (Entry<String, ConcurrentHashMap<PlotId, Plot>> entry : plots.entrySet()) { | ||||||
|             for (PlotFilter filter : filters) { |             for (PlotFilter filter : filters) { | ||||||
|                 if (!filter.allowsWorld(entry.getKey())) { |                 if (!filter.allowsWorld(entry.getKey())) { | ||||||
|                     continue; |                     continue; | ||||||
| @@ -455,7 +454,8 @@ public class PS { | |||||||
|      * @see #getAllPlotsRaw() to get the raw plot object |      * @see #getAllPlotsRaw() to get the raw plot object | ||||||
|      * @param plots |      * @param plots | ||||||
|      */ |      */ | ||||||
|     public void setAllPlotsRaw(final LinkedHashMap<String, HashMap<PlotId, Plot>> plots) { |     @Deprecated | ||||||
|  |     public void setAllPlotsRaw(final ConcurrentHashMap<String, ConcurrentHashMap<PlotId, Plot>> plots) { | ||||||
|         this.plots = plots; |         this.plots = plots; | ||||||
|     } |     } | ||||||
|  |  | ||||||
| @@ -465,13 +465,19 @@ public class PS { | |||||||
|      * @return Set of Plot |      * @return Set of Plot | ||||||
|      */ |      */ | ||||||
|     public Set<Plot> getPlots() { |     public Set<Plot> getPlots() { | ||||||
|         final ArrayList<Plot> newplots = new ArrayList<>(); |         int size = 0; | ||||||
|         for (final Entry<String, HashMap<PlotId, Plot>> entry : plots.entrySet()) { |         for (Entry<String, ConcurrentHashMap<PlotId, Plot>> entry : plots.entrySet()) { | ||||||
|             if (isPlotWorld(entry.getKey())) { |             if (isPlotWorld(entry.getKey())) { | ||||||
|                 newplots.addAll(entry.getValue().values()); |                 size += entry.getValue().size(); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         return new LinkedHashSet<>(newplots); |         Set<Plot> result = new HashSet<>(size); | ||||||
|  |         for (Entry<String, ConcurrentHashMap<PlotId, Plot>> entry : plots.entrySet()) { | ||||||
|  |             if (isPlotWorld(entry.getKey())) { | ||||||
|  |                 result.addAll(entry.getValue().values()); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |         return result; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -480,12 +486,17 @@ public class PS { | |||||||
|      * @return set of plot |      * @return set of plot | ||||||
|      * @see #setAllPlotsRaw(LinkedHashMap) to set the raw plot object |      * @see #setAllPlotsRaw(LinkedHashMap) to set the raw plot object | ||||||
|      */ |      */ | ||||||
|  |     @Deprecated | ||||||
|     public Set<Plot> getPlotsRaw() { |     public Set<Plot> getPlotsRaw() { | ||||||
|         final ArrayList<Plot> newplots = new ArrayList<>(); |         int size = 0; | ||||||
|         for (final Entry<String, HashMap<PlotId, Plot>> entry : plots.entrySet()) { |         for (Entry<String, ConcurrentHashMap<PlotId, Plot>> entry : plots.entrySet()) { | ||||||
|             newplots.addAll(entry.getValue().values()); |             size += entry.getValue().size(); | ||||||
|         } |         } | ||||||
|         return new LinkedHashSet<>(newplots); |         Set<Plot> result = new HashSet<>(size); | ||||||
|  |         for (Entry<String, ConcurrentHashMap<PlotId, Plot>> entry : plots.entrySet()) { | ||||||
|  |             result.addAll(entry.getValue().values()); | ||||||
|  |         } | ||||||
|  |         return result; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -493,17 +504,20 @@ public class PS { | |||||||
|      * Sort a collection of plots by the hashcode (assumes that all plots are in the same world) |      * Sort a collection of plots by the hashcode (assumes that all plots are in the same world) | ||||||
|      * @param plots |      * @param plots | ||||||
|      * @return ArrayList of plot |      * @return ArrayList of plot | ||||||
|  |      * @deprecated use sortPlot | ||||||
|      */ |      */ | ||||||
|     @Deprecated |     @Deprecated | ||||||
|     public ArrayList<Plot> sortPlots(Collection<Plot> plots) { |     public ArrayList<Plot> sortPlots(Collection<Plot> plots) { | ||||||
|         return sortPlotsByWorld(plots); |         return sortPlots(plots, SortType.DISTANCE_FROM_ORIGIN, null); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Sort plots by hashcode |      * Sort plots by hashcode | ||||||
|      * @param plots |      * @param plots | ||||||
|      * @return |      * @return | ||||||
|  |      * @deprecated Unchecked, please use {@link #sortPlots(Collection, SortType, String)} which has additional checks before calling this | ||||||
|      */ |      */ | ||||||
|  |     @Deprecated | ||||||
|     public ArrayList<Plot> sortPlotsByHash(Collection<Plot> plots) { |     public ArrayList<Plot> sortPlotsByHash(Collection<Plot> plots) { | ||||||
|         int hardmax = 256000; |         int hardmax = 256000; | ||||||
|         int max = 0; |         int max = 0; | ||||||
| @@ -545,6 +559,13 @@ public class PS { | |||||||
|         return result; |         return result; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     /** | ||||||
|  |      * Sort plots by creation timestamp | ||||||
|  |      * @param input | ||||||
|  |      * @deprecated Unchecked, use {@link #sortPlots(Collection, SortType, String)} instead which will call this after checks | ||||||
|  |      * @return | ||||||
|  |      */ | ||||||
|  |     @Deprecated | ||||||
|     public static ArrayList<Plot> sortPlotsByTimestamp(Collection<Plot> input) { |     public static ArrayList<Plot> sortPlotsByTimestamp(Collection<Plot> input) { | ||||||
|         List<Plot> list; |         List<Plot> list; | ||||||
|         if (input instanceof ArrayList<?>) { |         if (input instanceof ArrayList<?>) { | ||||||
| @@ -720,6 +741,10 @@ public class PS { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     /** | ||||||
|  |      * @deprecated Unchecked, use {@link #sortPlots(Collection, SortType, String)} instead which will in turn call this | ||||||
|  |      * @param input | ||||||
|  |      */ | ||||||
|     public static void sortPlotsByHash(Plot[] input) { |     public static void sortPlotsByHash(Plot[] input) { | ||||||
|         final int SIZE = 100; |         final int SIZE = 100; | ||||||
|         List<Plot>[] bucket = new ArrayList[SIZE]; |         List<Plot>[] bucket = new ArrayList[SIZE]; | ||||||
| @@ -748,6 +773,12 @@ public class PS { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     /** | ||||||
|  |      * Sort plots by timestamp | ||||||
|  |      * @param input | ||||||
|  |      * @deprecated Unchecked, use {@link #sortPlots(Collection, SortType, String)} instead which will in turn call this | ||||||
|  |      */ | ||||||
|  |     @Deprecated | ||||||
|     public static void sortPlotsByTimestamp(Plot[] input) { |     public static void sortPlotsByTimestamp(Plot[] input) { | ||||||
|         final int SIZE = 100; |         final int SIZE = 100; | ||||||
|         List<Plot>[] bucket = new ArrayList[SIZE]; |         List<Plot>[] bucket = new ArrayList[SIZE]; | ||||||
| @@ -776,25 +807,26 @@ public class PS { | |||||||
|         } |         } | ||||||
|     } |     } | ||||||
|      |      | ||||||
|  |     public enum SortType { CREATION_DATE, DISTANCE_FROM_ORIGIN; } | ||||||
|  |      | ||||||
|     /** |     /** | ||||||
|      * Sort a collection of plots by world (with a priority world), then by hashcode |      * Sort a collection of plots by world (with a priority world), then by hashcode | ||||||
|      * @param plots |      * @param plots | ||||||
|      * @param priorityWorld - Use "world" or "gibberish" if you don't care |      * @param type The sorting method to use for each world (timestamp, or hash) | ||||||
|      * @see #sortPlotsByWorld(Collection) to sort plots by world, then by hashcode |      * @param priorityWorld - Use null, "world" or "gibberish" if you want default world order | ||||||
|      * @see #sortPlots(Collection) to sort plots just by hashcode |  | ||||||
|      * @return ArrayList of plot |      * @return ArrayList of plot | ||||||
|      */ |      */ | ||||||
|     public ArrayList<Plot> sortPlots(Collection<Plot> plots, final String priorityWorld) { |     public ArrayList<Plot> sortPlots(Collection<Plot> plots, final SortType type, final String priorityWorld) { | ||||||
|         // group by world |         // group by world | ||||||
|         // sort each |         // sort each | ||||||
|         HashMap<String, Collection<Plot>> map = new HashMap<>(); |         HashMap<String, Collection<Plot>> map = new HashMap<>(); | ||||||
|         ArrayList<String> worlds = new ArrayList<String>(getPlotWorlds()); |         ArrayList<String> worlds = new ArrayList<String>(getPlotWorlds()); | ||||||
|         int totalSize = 0; |         int totalSize = 0; | ||||||
|         for (Entry<String, HashMap<PlotId, Plot>> entry : this.plots.entrySet()) { |         for (Entry<String, ConcurrentHashMap<PlotId, Plot>> entry : this.plots.entrySet()) { | ||||||
|             totalSize += entry.getValue().size(); |             totalSize += entry.getValue().size(); | ||||||
|         } |         } | ||||||
|         if (plots.size() == totalSize) { |         if (plots.size() == totalSize) { | ||||||
|             for (Entry<String, HashMap<PlotId, Plot>> entry : this.plots.entrySet()) { |             for (Entry<String, ConcurrentHashMap<PlotId, Plot>> entry : this.plots.entrySet()) { | ||||||
|                 map.put(entry.getKey(), entry.getValue().values()); |                 map.put(entry.getKey(), entry.getValue().values()); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
| @@ -826,7 +858,17 @@ public class PS { | |||||||
|         }); |         }); | ||||||
|         ArrayList<Plot> toReturn = new ArrayList<Plot>(plots.size()); |         ArrayList<Plot> toReturn = new ArrayList<Plot>(plots.size()); | ||||||
|         for (String world : worlds) { |         for (String world : worlds) { | ||||||
|             toReturn.addAll(sortPlotsByHash(map.get(world))); |             switch (type) { | ||||||
|  |                 case CREATION_DATE: | ||||||
|  |                     toReturn.addAll(sortPlotsByTimestamp(map.get(world))); | ||||||
|  |                     break; | ||||||
|  |                 case DISTANCE_FROM_ORIGIN: | ||||||
|  |                     toReturn.addAll(sortPlotsByHash(map.get(world))); | ||||||
|  |                     break; | ||||||
|  |                 default: | ||||||
|  |                     break; | ||||||
|  |                  | ||||||
|  |             } | ||||||
|         } |         } | ||||||
|         return toReturn; |         return toReturn; | ||||||
|     } |     } | ||||||
| @@ -835,10 +877,10 @@ public class PS { | |||||||
|     /** |     /** | ||||||
|      * Sort a collection of plots by world, then by hashcode |      * Sort a collection of plots by world, then by hashcode | ||||||
|      * @param plots |      * @param plots | ||||||
|      * @see #sortPlots(Collection, String) to sort with a specific priority world |      * @deprecated Use #sortPlots(Collection, String) instead | ||||||
|      * @see #sortPlots(Collection) to sort plots just by hashcode |  | ||||||
|      * @return ArrayList of plot |      * @return ArrayList of plot | ||||||
|      */ |      */ | ||||||
|  |     @Deprecated | ||||||
|     public ArrayList<Plot> sortPlotsByWorld(Collection<Plot> plots) { |     public ArrayList<Plot> sortPlotsByWorld(Collection<Plot> plots) { | ||||||
|         ArrayList<Plot> newPlots = new ArrayList<>(); |         ArrayList<Plot> newPlots = new ArrayList<>(); | ||||||
|         ArrayList<String> worlds = new ArrayList<>(this.plots.keySet()); |         ArrayList<String> worlds = new ArrayList<>(this.plots.keySet()); | ||||||
| @@ -928,16 +970,25 @@ public class PS { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     private String lastWorld; | ||||||
|  |     private Map<PlotId, Plot> lastMap; | ||||||
|  |      | ||||||
|     /** |     /** | ||||||
|      * Get a map of the plots for a world |      * Get a map of the plots for a world | ||||||
|      * @param world |      * @param world | ||||||
|      * @return HashMap of PlotId to Plot |      * @return HashMap of PlotId to Plot | ||||||
|      */ |      */ | ||||||
|     public HashMap<PlotId, Plot> getPlots(final String world) { |     @Deprecated | ||||||
|         if (plots.containsKey(world)) { |     public Map<PlotId, Plot> getPlots(final String world) { | ||||||
|             return plots.get(world); |         if (world == lastWorld) { | ||||||
|  |             return lastMap; | ||||||
|         } |         } | ||||||
|         return new HashMap<>(); |         lastWorld = world; | ||||||
|  |         if (plots.containsKey(world)) { | ||||||
|  |             lastMap = plots.get(world); | ||||||
|  |             return lastMap; | ||||||
|  |         } | ||||||
|  |         return new ConcurrentHashMap<>(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -984,7 +1035,7 @@ public class PS { | |||||||
|         if (callEvent) { |         if (callEvent) { | ||||||
|             EventUtil.manager.callDelete(world, id); |             EventUtil.manager.callDelete(world, id); | ||||||
|         } |         } | ||||||
|         HashMap<PlotId, Plot> allPlots = plots.get(world); |         ConcurrentHashMap<PlotId, Plot> allPlots = plots.get(world); | ||||||
|         if (allPlots == null) { |         if (allPlots == null) { | ||||||
|             return false; |             return false; | ||||||
|         } |         } | ||||||
| @@ -1377,6 +1428,10 @@ public class PS { | |||||||
|      */ |      */ | ||||||
|     public void disable() { |     public void disable() { | ||||||
|         try { |         try { | ||||||
|  |             // Validate that all data in the db is correct | ||||||
|  |             DBFunc.validatePlots(getPlotsRaw()); | ||||||
|  |              | ||||||
|  |             // Close the connection | ||||||
|             database.closeConnection(); |             database.closeConnection(); | ||||||
|             UUIDHandler.handleShutdown(); |             UUIDHandler.handleShutdown(); | ||||||
|         } catch (NullPointerException | SQLException e) { |         } catch (NullPointerException | SQLException e) { | ||||||
| @@ -1584,6 +1639,7 @@ public class PS { | |||||||
|         options.put("uuid.read-from-disk", Settings.UUID_FROM_DISK); |         options.put("uuid.read-from-disk", Settings.UUID_FROM_DISK); | ||||||
|          |          | ||||||
|         // Mob stuff |         // Mob stuff | ||||||
|  |         options.put("kill_road_vehicles", Settings.KILL_ROAD_VEHICLES); | ||||||
|         options.put("kill_road_mobs", Settings.KILL_ROAD_MOBS_DEFAULT); |         options.put("kill_road_mobs", Settings.KILL_ROAD_MOBS_DEFAULT); | ||||||
|         options.put("mob_pathfinding", Settings.MOB_PATHFINDING_DEFAULT); |         options.put("mob_pathfinding", Settings.MOB_PATHFINDING_DEFAULT); | ||||||
|          |          | ||||||
| @@ -1702,6 +1758,7 @@ public class PS { | |||||||
|          |          | ||||||
|         // Mob stuff |         // Mob stuff | ||||||
|         Settings.KILL_ROAD_MOBS = config.getBoolean("kill_road_mobs"); |         Settings.KILL_ROAD_MOBS = config.getBoolean("kill_road_mobs"); | ||||||
|  |         Settings.KILL_ROAD_VEHICLES = config.getBoolean("kill_road_vehicles"); | ||||||
|         Settings.MOB_PATHFINDING = config.getBoolean("mob_pathfinding"); |         Settings.MOB_PATHFINDING = config.getBoolean("mob_pathfinding"); | ||||||
|          |          | ||||||
|         // Clearing + Expiry |         // Clearing + Expiry | ||||||
|   | |||||||
| @@ -225,7 +225,7 @@ public class Auto extends SubCommand { | |||||||
|                             Claim.claimPlot(plr, plot, teleport, true); |                             Claim.claimPlot(plr, plot, teleport, true); | ||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|                     if (!MainUtil.mergePlots(worldname, MainUtil.getPlotSelectionIds(start, end), true)) { |                     if (!MainUtil.mergePlots(worldname, MainUtil.getPlotSelectionIds(start, end), true, true)) { | ||||||
|                         return false; |                         return false; | ||||||
|                     } |                     } | ||||||
|                     br = true; |                     br = true; | ||||||
|   | |||||||
| @@ -40,8 +40,6 @@ import javax.script.ScriptEngineManager; | |||||||
| import javax.script.ScriptException; | import javax.script.ScriptException; | ||||||
| import javax.script.SimpleScriptContext; | import javax.script.SimpleScriptContext; | ||||||
|  |  | ||||||
| import org.bukkit.ChatColor; |  | ||||||
|  |  | ||||||
| import com.google.common.io.Files; | import com.google.common.io.Files; | ||||||
| import com.intellectualcrafters.plot.PS; | import com.intellectualcrafters.plot.PS; | ||||||
| import com.intellectualcrafters.plot.config.C; | import com.intellectualcrafters.plot.config.C; | ||||||
|   | |||||||
| @@ -23,6 +23,7 @@ package com.intellectualcrafters.plot.commands; | |||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
|  |  | ||||||
| import com.intellectualcrafters.plot.PS; | import com.intellectualcrafters.plot.PS; | ||||||
|  | import com.intellectualcrafters.plot.PS.SortType; | ||||||
| import com.intellectualcrafters.plot.config.C; | import com.intellectualcrafters.plot.config.C; | ||||||
| import com.intellectualcrafters.plot.object.Plot; | import com.intellectualcrafters.plot.object.Plot; | ||||||
| import com.intellectualcrafters.plot.object.PlotPlayer; | import com.intellectualcrafters.plot.object.PlotPlayer; | ||||||
| @@ -51,7 +52,7 @@ public class Home extends SubCommand { | |||||||
|     @Override |     @Override | ||||||
|     public boolean onCommand(final PlotPlayer plr, String[] args) { |     public boolean onCommand(final PlotPlayer plr, String[] args) { | ||||||
|          |          | ||||||
|         final ArrayList<Plot> plots = PS.get().sortPlotsByWorld(PS.get().getPlots(plr)); |         final ArrayList<Plot> plots = PS.get().sortPlots(PS.get().getPlots(plr), SortType.CREATION_DATE, null); | ||||||
|         if (plots.size() == 1) { |         if (plots.size() == 1) { | ||||||
|             MainUtil.teleportPlayer(plr, plr.getLocation(), plots.get(0)); |             MainUtil.teleportPlayer(plr, plr.getLocation(), plots.get(0)); | ||||||
|             return true; |             return true; | ||||||
|   | |||||||
| @@ -20,21 +20,12 @@ | |||||||
| //////////////////////////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||||||
| package com.intellectualcrafters.plot.commands; | package com.intellectualcrafters.plot.commands; | ||||||
|  |  | ||||||
| import java.io.BufferedReader; |  | ||||||
| import java.io.InputStreamReader; |  | ||||||
| import java.net.URL; |  | ||||||
| import java.net.URLConnection; |  | ||||||
| import java.util.ArrayList; |  | ||||||
| import java.util.UUID; | import java.util.UUID; | ||||||
|  |  | ||||||
| import com.intellectualcrafters.plot.PS; |  | ||||||
| import com.intellectualcrafters.plot.config.C; | import com.intellectualcrafters.plot.config.C; | ||||||
| import com.intellectualcrafters.plot.object.OfflinePlotPlayer; | import com.intellectualcrafters.plot.object.OfflinePlotPlayer; | ||||||
| import com.intellectualcrafters.plot.object.PlotPlayer; | import com.intellectualcrafters.plot.object.PlotPlayer; | ||||||
| import com.intellectualcrafters.plot.util.EconHandler; |  | ||||||
| import com.intellectualcrafters.plot.util.MainUtil; | import com.intellectualcrafters.plot.util.MainUtil; | ||||||
| import com.intellectualcrafters.plot.util.StringMan; |  | ||||||
| import com.intellectualcrafters.plot.util.TaskManager; |  | ||||||
| import com.intellectualcrafters.plot.util.UUIDHandler; | import com.intellectualcrafters.plot.util.UUIDHandler; | ||||||
| import com.plotsquared.general.commands.Argument; | import com.plotsquared.general.commands.Argument; | ||||||
| import com.plotsquared.general.commands.CommandDeclaration; | import com.plotsquared.general.commands.CommandDeclaration; | ||||||
|   | |||||||
| @@ -38,7 +38,6 @@ import com.intellectualcrafters.plot.util.MainUtil; | |||||||
| import com.intellectualcrafters.plot.util.Permissions; | import com.intellectualcrafters.plot.util.Permissions; | ||||||
| import com.intellectualcrafters.plot.util.StringMan; | import com.intellectualcrafters.plot.util.StringMan; | ||||||
| import com.intellectualcrafters.plot.util.UUIDHandler; | import com.intellectualcrafters.plot.util.UUIDHandler; | ||||||
| import com.plotsquared.general.commands.Argument; |  | ||||||
| import com.plotsquared.general.commands.CommandDeclaration; | import com.plotsquared.general.commands.CommandDeclaration; | ||||||
|  |  | ||||||
| @CommandDeclaration( | @CommandDeclaration( | ||||||
| @@ -212,7 +211,7 @@ public class Merge extends SubCommand { | |||||||
|                                 return; |                                 return; | ||||||
|                             } |                             } | ||||||
|                             MainUtil.sendMessage(plr, C.SUCCESS_MERGE); |                             MainUtil.sendMessage(plr, C.SUCCESS_MERGE); | ||||||
|                             MainUtil.mergePlots(world, plots, true); |                             MainUtil.mergePlots(world, plots, true, true); | ||||||
|                             MainUtil.setSign(UUIDHandler.getName(plot.owner), plot); |                             MainUtil.setSign(UUIDHandler.getName(plot.owner), plot); | ||||||
|                         } |                         } | ||||||
|                         MainUtil.sendMessage(accepter, C.MERGE_ACCEPTED); |                         MainUtil.sendMessage(accepter, C.MERGE_ACCEPTED); | ||||||
| @@ -241,7 +240,7 @@ public class Merge extends SubCommand { | |||||||
|             return false; |             return false; | ||||||
|         } |         } | ||||||
|         MainUtil.sendMessage(plr, C.SUCCESS_MERGE); |         MainUtil.sendMessage(plr, C.SUCCESS_MERGE); | ||||||
|         MainUtil.mergePlots(world, plots, true); |         MainUtil.mergePlots(world, plots, true, true); | ||||||
|         MainUtil.setSign(UUIDHandler.getName(plot.owner), plot); |         MainUtil.setSign(UUIDHandler.getName(plot.owner), plot); | ||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -23,7 +23,7 @@ package com.intellectualcrafters.plot.commands; | |||||||
| import java.net.URL; | import java.net.URL; | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.Collection; | import java.util.Collection; | ||||||
| import java.util.HashMap; | import java.util.Map; | ||||||
| import java.util.UUID; | import java.util.UUID; | ||||||
|  |  | ||||||
| import com.intellectualcrafters.plot.PS; | import com.intellectualcrafters.plot.PS; | ||||||
| @@ -181,7 +181,7 @@ public class SchematicCmd extends SubCommand { | |||||||
|                     MainUtil.sendMessage(null, "&cNeed world arg. Use &7/plots sch exportall <world>"); |                     MainUtil.sendMessage(null, "&cNeed world arg. Use &7/plots sch exportall <world>"); | ||||||
|                     return false; |                     return false; | ||||||
|                 } |                 } | ||||||
|                 final HashMap<PlotId, Plot> plotmap = PS.get().getPlots(args[1]); |                 final Map<PlotId, Plot> plotmap = PS.get().getPlots(args[1]); | ||||||
|                 if ((plotmap == null) || (plotmap.size() == 0)) { |                 if ((plotmap == null) || (plotmap.size() == 0)) { | ||||||
|                     MainUtil.sendMessage(plr, "&cInvalid world. Use &7/plots sch exportall <world>"); |                     MainUtil.sendMessage(plr, "&cInvalid world. Use &7/plots sch exportall <world>"); | ||||||
|                     return false; |                     return false; | ||||||
|   | |||||||
| @@ -25,6 +25,7 @@ import java.util.List; | |||||||
| import java.util.UUID; | import java.util.UUID; | ||||||
|  |  | ||||||
| import com.intellectualcrafters.plot.PS; | import com.intellectualcrafters.plot.PS; | ||||||
|  | import com.intellectualcrafters.plot.PS.SortType; | ||||||
| import com.intellectualcrafters.plot.config.C; | import com.intellectualcrafters.plot.config.C; | ||||||
| import com.intellectualcrafters.plot.object.Plot; | import com.intellectualcrafters.plot.object.Plot; | ||||||
| import com.intellectualcrafters.plot.object.PlotPlayer; | import com.intellectualcrafters.plot.object.PlotPlayer; | ||||||
| @@ -67,10 +68,10 @@ public class Visit extends SubCommand { | |||||||
|         UUID user = UUIDHandler.getCachedUUID(args[0], null); |         UUID user = UUIDHandler.getCachedUUID(args[0], null); | ||||||
|         if (user != null ) { |         if (user != null ) { | ||||||
|             // do plots by username |             // do plots by username | ||||||
|             plots = PS.get().sortPlots(PS.get().getPlots(user), null); |             plots = PS.get().sortPlots(PS.get().getPlots(user), SortType.CREATION_DATE, null); | ||||||
|         } else if (PS.get().isPlotWorld(args[0])) { |         } else if (PS.get().isPlotWorld(args[0])) { | ||||||
|             // do plots by world |             // do plots by world | ||||||
|             plots = PS.get().sortPlots(PS.get().getPlots(args[0]).values(), null); |             plots = PS.get().sortPlots(PS.get().getPlots(args[0]).values(), SortType.CREATION_DATE, null); | ||||||
|         } |         } | ||||||
|         else { |         else { | ||||||
|             Plot plot = MainUtil.getPlotFromString(plr, args[0], true); |             Plot plot = MainUtil.getPlotFromString(plr, args[0], true); | ||||||
|   | |||||||
| @@ -20,7 +20,6 @@ | |||||||
| //////////////////////////////////////////////////////////////////////////////////////////////////// | //////////////////////////////////////////////////////////////////////////////////////////////////// | ||||||
| package com.intellectualcrafters.plot.commands; | package com.intellectualcrafters.plot.commands; | ||||||
|  |  | ||||||
| import com.intellectualcrafters.plot.PS; |  | ||||||
| import com.intellectualcrafters.plot.config.C; | import com.intellectualcrafters.plot.config.C; | ||||||
| import com.intellectualcrafters.plot.object.PlotPlayer; | import com.intellectualcrafters.plot.object.PlotPlayer; | ||||||
| import com.intellectualcrafters.plot.util.MainUtil; | import com.intellectualcrafters.plot.util.MainUtil; | ||||||
|   | |||||||
| @@ -30,6 +30,7 @@ import java.util.UUID; | |||||||
| import org.bukkit.ChatColor; | import org.bukkit.ChatColor; | ||||||
|  |  | ||||||
| import com.intellectualcrafters.plot.PS; | import com.intellectualcrafters.plot.PS; | ||||||
|  | import com.intellectualcrafters.plot.PS.SortType; | ||||||
| import com.intellectualcrafters.plot.config.C; | import com.intellectualcrafters.plot.config.C; | ||||||
| import com.intellectualcrafters.plot.config.Settings; | import com.intellectualcrafters.plot.config.Settings; | ||||||
| import com.intellectualcrafters.plot.flag.Flag; | import com.intellectualcrafters.plot.flag.Flag; | ||||||
| @@ -303,7 +304,7 @@ public class list extends SubCommand { | |||||||
|      |      | ||||||
|     public void displayPlots(PlotPlayer player, List<Plot> plots, int pageSize, int page, String world, String[] args, boolean sort) { |     public void displayPlots(PlotPlayer player, List<Plot> plots, int pageSize, int page, String world, String[] args, boolean sort) { | ||||||
|         if (sort) { |         if (sort) { | ||||||
|             plots = PS.get().sortPlots(plots, world); |             plots = PS.get().sortPlots(plots, SortType.CREATION_DATE, world); | ||||||
|         } |         } | ||||||
|         if (page < 0) { |         if (page < 0) { | ||||||
|             page = 0; |             page = 0; | ||||||
|   | |||||||
| @@ -25,9 +25,9 @@ import java.util.ArrayList; | |||||||
| import java.util.Collection; | import java.util.Collection; | ||||||
| import java.util.HashMap; | import java.util.HashMap; | ||||||
| import java.util.HashSet; | import java.util.HashSet; | ||||||
| import java.util.LinkedHashMap; |  | ||||||
| import java.util.Set; | import java.util.Set; | ||||||
| import java.util.UUID; | import java.util.UUID; | ||||||
|  | import java.util.concurrent.ConcurrentHashMap; | ||||||
|  |  | ||||||
| import com.intellectualcrafters.plot.flag.Flag; | import com.intellectualcrafters.plot.flag.Flag; | ||||||
| import com.intellectualcrafters.plot.object.Plot; | import com.intellectualcrafters.plot.object.Plot; | ||||||
| @@ -119,7 +119,12 @@ public interface AbstractDB { | |||||||
|     /** |     /** | ||||||
|      * @return A linked hashmap containing all plots |      * @return A linked hashmap containing all plots | ||||||
|      */ |      */ | ||||||
|     LinkedHashMap<String, HashMap<PlotId, Plot>> getPlots(); |     ConcurrentHashMap<String, ConcurrentHashMap<PlotId, Plot>> getPlots(); | ||||||
|  |      | ||||||
|  |     /** | ||||||
|  |      *  | ||||||
|  |      */ | ||||||
|  |     void validateAllPlots(Set<Plot> toValidate); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * @return A hashmap containing all plot clusters |      * @return A hashmap containing all plot clusters | ||||||
|   | |||||||
| @@ -27,9 +27,9 @@ import java.util.ArrayList; | |||||||
| import java.util.Collection; | import java.util.Collection; | ||||||
| import java.util.HashMap; | import java.util.HashMap; | ||||||
| import java.util.HashSet; | import java.util.HashSet; | ||||||
| import java.util.LinkedHashMap; |  | ||||||
| import java.util.Set; | import java.util.Set; | ||||||
| import java.util.UUID; | import java.util.UUID; | ||||||
|  | import java.util.concurrent.ConcurrentHashMap; | ||||||
|  |  | ||||||
| import com.intellectualcrafters.plot.flag.Flag; | import com.intellectualcrafters.plot.flag.Flag; | ||||||
| import com.intellectualcrafters.plot.object.Plot; | import com.intellectualcrafters.plot.object.Plot; | ||||||
| @@ -56,11 +56,16 @@ public class DBFunc { | |||||||
|     public static AbstractDB dbManager; |     public static AbstractDB dbManager; | ||||||
|  |  | ||||||
|     public static void movePlot(final Plot originalPlot, final Plot newPlot) { |     public static void movePlot(final Plot originalPlot, final Plot newPlot) { | ||||||
|         if (originalPlot.temp || newPlot.temp) { |         if (originalPlot.temp != -1 || newPlot.temp != -1) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         dbManager.movePlot(originalPlot, newPlot); |         dbManager.movePlot(originalPlot, newPlot); | ||||||
|     } |     } | ||||||
|  |      | ||||||
|  |     public static void validatePlots(Set<Plot> plots) { | ||||||
|  |         dbManager.validateAllPlots(plots); | ||||||
|  |     } | ||||||
|  |      | ||||||
|     /** |     /** | ||||||
|      * Check if a resultset contains a column |      * Check if a resultset contains a column | ||||||
|      * @param rs |      * @param rs | ||||||
| @@ -90,7 +95,7 @@ public class DBFunc { | |||||||
|      * @param uuid New Owner |      * @param uuid New Owner | ||||||
|      */ |      */ | ||||||
|     public static void setOwner(final Plot plot, final UUID uuid) { |     public static void setOwner(final Plot plot, final UUID uuid) { | ||||||
|         if (plot.temp) { |         if (plot.temp != -1) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         dbManager.setOwner(plot, uuid); |         dbManager.setOwner(plot, uuid); | ||||||
| @@ -111,7 +116,7 @@ public class DBFunc { | |||||||
|      * @param plot Plot to create |      * @param plot Plot to create | ||||||
|      */ |      */ | ||||||
|     public static void createPlot(final Plot plot) { |     public static void createPlot(final Plot plot) { | ||||||
|         if (plot.temp) { |         if (plot.temp != -1) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         dbManager.createPlot(plot); |         dbManager.createPlot(plot); | ||||||
| @@ -123,7 +128,7 @@ public class DBFunc { | |||||||
|      * @param plot Plot to create |      * @param plot Plot to create | ||||||
|      */ |      */ | ||||||
|     public static void createPlotAndSettings(final Plot plot) { |     public static void createPlotAndSettings(final Plot plot) { | ||||||
|         if (plot.temp) { |         if (plot.temp != -1) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         dbManager.createPlotAndSettings(plot); |         dbManager.createPlotAndSettings(plot); | ||||||
| @@ -144,7 +149,7 @@ public class DBFunc { | |||||||
|      * @param plot Plot to delete |      * @param plot Plot to delete | ||||||
|      */ |      */ | ||||||
|     public static void delete(final Plot plot) { |     public static void delete(final Plot plot) { | ||||||
|         if (plot.temp) { |         if (plot.temp != -1) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         dbManager.delete(plot); |         dbManager.delete(plot); | ||||||
| @@ -161,7 +166,7 @@ public class DBFunc { | |||||||
|      * @param plot Plot Object |      * @param plot Plot Object | ||||||
|      */ |      */ | ||||||
|     public static void createPlotSettings(final int id, final Plot plot) { |     public static void createPlotSettings(final int id, final Plot plot) { | ||||||
|         if (plot.temp) { |         if (plot.temp != -1) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         dbManager.createPlotSettings(id, plot); |         dbManager.createPlotSettings(id, plot); | ||||||
| @@ -192,19 +197,19 @@ public class DBFunc { | |||||||
|     /** |     /** | ||||||
|      * @return Plots |      * @return Plots | ||||||
|      */ |      */ | ||||||
|     public static LinkedHashMap<String, HashMap<PlotId, Plot>> getPlots() { |     public static ConcurrentHashMap<String, ConcurrentHashMap<PlotId, Plot>> getPlots() { | ||||||
|         return dbManager.getPlots(); |         return dbManager.getPlots(); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public static void setMerged(final Plot plot, final boolean[] merged) { |     public static void setMerged(final Plot plot, final boolean[] merged) { | ||||||
|         if (plot.temp) { |         if (plot.temp != -1) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         dbManager.setMerged(plot, merged); |         dbManager.setMerged(plot, merged); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public static void setFlags(final Plot plot, final Collection<Flag> flags) { |     public static void setFlags(final Plot plot, final Collection<Flag> flags) { | ||||||
|         if (plot.temp) { |         if (plot.temp != -1) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         dbManager.setFlags(plot, flags); |         dbManager.setFlags(plot, flags); | ||||||
| @@ -219,7 +224,7 @@ public class DBFunc { | |||||||
|      * @param alias |      * @param alias | ||||||
|      */ |      */ | ||||||
|     public static void setAlias(final Plot plot, final String alias) { |     public static void setAlias(final Plot plot, final String alias) { | ||||||
|         if (plot.temp) { |         if (plot.temp != -1) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         dbManager.setAlias(plot, alias); |         dbManager.setAlias(plot, alias); | ||||||
| @@ -238,7 +243,7 @@ public class DBFunc { | |||||||
|      * @param position |      * @param position | ||||||
|      */ |      */ | ||||||
|     public static void setPosition(final Plot plot, final String position) { |     public static void setPosition(final Plot plot, final String position) { | ||||||
|         if (plot.temp) { |         if (plot.temp != -1) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         dbManager.setPosition(plot, position); |         dbManager.setPosition(plot, position); | ||||||
| @@ -258,14 +263,14 @@ public class DBFunc { | |||||||
|      * @param comment |      * @param comment | ||||||
|      */ |      */ | ||||||
|     public static void removeComment(final Plot plot, final PlotComment comment) { |     public static void removeComment(final Plot plot, final PlotComment comment) { | ||||||
|         if (plot != null && plot.temp) { |         if (plot != null && plot.temp != -1) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         dbManager.removeComment(plot, comment); |         dbManager.removeComment(plot, comment); | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     public static void clearInbox(final Plot plot, final String inbox) { |     public static void clearInbox(final Plot plot, final String inbox) { | ||||||
|         if (plot != null && plot.temp) { |         if (plot != null && plot.temp != -1) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         dbManager.clearInbox(plot, inbox); |         dbManager.clearInbox(plot, inbox); | ||||||
| @@ -276,7 +281,7 @@ public class DBFunc { | |||||||
|      * @param comment |      * @param comment | ||||||
|      */ |      */ | ||||||
|     public static void setComment(final Plot plot, final PlotComment comment) { |     public static void setComment(final Plot plot, final PlotComment comment) { | ||||||
|         if (plot != null && plot.temp) { |         if (plot != null && plot.temp != -1) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         dbManager.setComment(plot, comment); |         dbManager.setComment(plot, comment); | ||||||
| @@ -286,7 +291,7 @@ public class DBFunc { | |||||||
|      * @param plot |      * @param plot | ||||||
|      */ |      */ | ||||||
|     public static void getComments(final Plot plot, final String inbox, RunnableVal whenDone) { |     public static void getComments(final Plot plot, final String inbox, RunnableVal whenDone) { | ||||||
|         if (plot != null && plot.temp) { |         if (plot != null && plot.temp != -1) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         dbManager.getComments(plot, inbox, whenDone); |         dbManager.getComments(plot, inbox, whenDone); | ||||||
| @@ -297,7 +302,7 @@ public class DBFunc { | |||||||
|      * @param uuid |      * @param uuid | ||||||
|      */ |      */ | ||||||
|     public static void removeTrusted(final Plot plot, final UUID uuid) { |     public static void removeTrusted(final Plot plot, final UUID uuid) { | ||||||
|         if (plot.temp) { |         if (plot.temp != -1) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         dbManager.removeTrusted(plot, uuid); |         dbManager.removeTrusted(plot, uuid); | ||||||
| @@ -332,7 +337,7 @@ public class DBFunc { | |||||||
|      * @param uuid |      * @param uuid | ||||||
|      */ |      */ | ||||||
|     public static void removeMember(final Plot plot, final UUID uuid) { |     public static void removeMember(final Plot plot, final UUID uuid) { | ||||||
|         if (plot.temp) { |         if (plot.temp != -1) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         dbManager.removeMember(plot, uuid); |         dbManager.removeMember(plot, uuid); | ||||||
| @@ -353,7 +358,7 @@ public class DBFunc { | |||||||
|      * @param uuid |      * @param uuid | ||||||
|      */ |      */ | ||||||
|     public static void setTrusted(final Plot plot, final UUID uuid) { |     public static void setTrusted(final Plot plot, final UUID uuid) { | ||||||
|         if (plot.temp) { |         if (plot.temp != -1) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         dbManager.setTrusted(plot, uuid); |         dbManager.setTrusted(plot, uuid); | ||||||
| @@ -369,7 +374,7 @@ public class DBFunc { | |||||||
|      * @param uuid |      * @param uuid | ||||||
|      */ |      */ | ||||||
|     public static void setMember(final Plot plot, final UUID uuid) { |     public static void setMember(final Plot plot, final UUID uuid) { | ||||||
|         if (plot.temp) { |         if (plot.temp != -1) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         dbManager.setMember(plot, uuid); |         dbManager.setMember(plot, uuid); | ||||||
| @@ -385,7 +390,7 @@ public class DBFunc { | |||||||
|      * @param uuid |      * @param uuid | ||||||
|      */ |      */ | ||||||
|     public static void removeDenied(final Plot plot, final UUID uuid) { |     public static void removeDenied(final Plot plot, final UUID uuid) { | ||||||
|         if (plot.temp) { |         if (plot.temp != -1) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         dbManager.removeDenied(plot, uuid); |         dbManager.removeDenied(plot, uuid); | ||||||
| @@ -397,21 +402,21 @@ public class DBFunc { | |||||||
|      * @param uuid |      * @param uuid | ||||||
|      */ |      */ | ||||||
|     public static void setDenied(final Plot plot, final UUID uuid) { |     public static void setDenied(final Plot plot, final UUID uuid) { | ||||||
|         if (plot.temp) { |         if (plot.temp != -1) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         dbManager.setDenied(plot, uuid); |         dbManager.setDenied(plot, uuid); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     public static HashMap<UUID, Integer> getRatings(final Plot plot) { |     public static HashMap<UUID, Integer> getRatings(final Plot plot) { | ||||||
|         if (plot.temp) { |         if (plot.temp != -1) { | ||||||
|             return new HashMap<>(); |             return new HashMap<>(); | ||||||
|         } |         } | ||||||
|         return dbManager.getRatings(plot); |         return dbManager.getRatings(plot); | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     public static void setRating(Plot plot, UUID rater, int value) { |     public static void setRating(Plot plot, UUID rater, int value) { | ||||||
|         if (plot.temp) { |         if (plot.temp != -1) { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
|         dbManager.setRating(plot, rater, value); |         dbManager.setRating(plot, rater, value); | ||||||
|   | |||||||
| @@ -36,6 +36,7 @@ import java.util.LinkedHashMap; | |||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.Set; | import java.util.Set; | ||||||
| import java.util.UUID; | import java.util.UUID; | ||||||
|  | import java.util.concurrent.ConcurrentHashMap; | ||||||
|  |  | ||||||
| import com.intellectualcrafters.plot.PS; | import com.intellectualcrafters.plot.PS; | ||||||
| import com.intellectualcrafters.plot.config.Settings; | import com.intellectualcrafters.plot.config.Settings; | ||||||
| @@ -909,8 +910,8 @@ public class SQLManager implements AbstractDB { | |||||||
|      * Load all plots, helpers, denied, trusted, and every setting from DB into a hashmap |      * Load all plots, helpers, denied, trusted, and every setting from DB into a hashmap | ||||||
|      */ |      */ | ||||||
|     @Override |     @Override | ||||||
|     public LinkedHashMap<String, HashMap<PlotId, Plot>> getPlots() { |     public ConcurrentHashMap<String, ConcurrentHashMap<PlotId, Plot>> getPlots() { | ||||||
|         final LinkedHashMap<String, HashMap<PlotId, Plot>> newplots = new LinkedHashMap<>(); |         final ConcurrentHashMap<String, ConcurrentHashMap<PlotId, Plot>> newplots = new ConcurrentHashMap(); | ||||||
|         final HashMap<Integer, Plot> plots = new HashMap<>(); |         final HashMap<Integer, Plot> plots = new HashMap<>(); | ||||||
|         Statement stmt = null; |         Statement stmt = null; | ||||||
|         try { |         try { | ||||||
| @@ -959,7 +960,7 @@ public class SQLManager implements AbstractDB { | |||||||
|                 else { |                 else { | ||||||
|                     time = timestamp.getTime(); |                     time = timestamp.getTime(); | ||||||
|                 } |                 } | ||||||
|                 p = new Plot(plot_id, user, new HashSet<UUID>(), new HashSet<UUID>(), new HashSet<UUID>(), "", null, null, worldname, new boolean[]{false, false, false, false}, time); |                 p = new Plot(plot_id, user, new HashSet<UUID>(), new HashSet<UUID>(), new HashSet<UUID>(), "", null, null, worldname, new boolean[]{false, false, false, false}, time, id); | ||||||
|                 plots.put(id, p); |                 plots.put(id, p); | ||||||
|             } |             } | ||||||
|             if (Settings.CACHE_RATINGS) { |             if (Settings.CACHE_RATINGS) { | ||||||
| @@ -1051,7 +1052,7 @@ public class SQLManager implements AbstractDB { | |||||||
|                 if (plot != null) { |                 if (plot != null) { | ||||||
|                     plots.remove(id); |                     plots.remove(id); | ||||||
|                     if (!newplots.containsKey(plot.world)) { |                     if (!newplots.containsKey(plot.world)) { | ||||||
|                         newplots.put(plot.world, new HashMap<PlotId, Plot>()); |                         newplots.put(plot.world, new ConcurrentHashMap<PlotId, Plot>()); | ||||||
|                     } |                     } | ||||||
|                     newplots.get(plot.world).put(plot.id, plot); |                     newplots.get(plot.world).put(plot.id, plot); | ||||||
|                     final String alias = r.getString("alias"); |                     final String alias = r.getString("alias"); | ||||||
| @@ -2263,4 +2264,49 @@ public class SQLManager implements AbstractDB { | |||||||
|             this.settings = settings; |             this.settings = settings; | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public void validateAllPlots(Set<Plot> toValidate) { | ||||||
|  | //        ConcurrentHashMap<String, ConcurrentHashMap<PlotId, Plot>> database = getPlots(); | ||||||
|  | //         | ||||||
|  | //        ArrayList<Plot> toCreate = new ArrayList<>(); | ||||||
|  | //        ArrayList<UUID> toTrust1 = new ArrayList<>(); | ||||||
|  | //        ArrayList<Plot> toTrust2 = new ArrayList<>(); | ||||||
|  | //         | ||||||
|  | //        for (Plot plot : plots) { | ||||||
|  | //            if (plot.temp) { | ||||||
|  | //                continue; | ||||||
|  | //            } | ||||||
|  | //            ConcurrentHashMap<PlotId, Plot> worldplots = database.get(plot.world); | ||||||
|  | //            if (worldplots == null) { | ||||||
|  | //                toCreate.add(plot); | ||||||
|  | //                continue; | ||||||
|  | //            } | ||||||
|  | //            Plot dataplot = worldplots.get(plot.id); | ||||||
|  | //            if (dataplot == null) { | ||||||
|  | //                toCreate.add(plot); | ||||||
|  | //                continue; | ||||||
|  | //            } | ||||||
|  | //            // owner | ||||||
|  | //            if (!plot.owner.equals(dataplot)) { | ||||||
|  | //                toSet.add(plot); | ||||||
|  | //                continue; | ||||||
|  | //            } | ||||||
|  | //            plot. | ||||||
|  | //            // trusted | ||||||
|  | //            if (!plot.getTrusted().equals(dataplot.trusted)) { | ||||||
|  | //                toSet.add(plot); | ||||||
|  | //                continue; | ||||||
|  | //            } | ||||||
|  | //            if (!plot.getMembers().equals(dataplot.members)) { | ||||||
|  | //                toSet.add(plot); | ||||||
|  | //                continue; | ||||||
|  | //            } | ||||||
|  | //            if (!plot.getDenied().equals(dataplot.denied)) { | ||||||
|  | //                toSet.add(plot); | ||||||
|  | //                continue; | ||||||
|  | //            } | ||||||
|  | //            ssettings = plot.getSettings(); | ||||||
|  | //        } | ||||||
|  |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -19,7 +19,6 @@ import com.intellectualcrafters.plot.object.PlotLoc; | |||||||
| import com.intellectualcrafters.plot.object.PlotManager; | import com.intellectualcrafters.plot.object.PlotManager; | ||||||
| import com.intellectualcrafters.plot.object.PlotWorld; | import com.intellectualcrafters.plot.object.PlotWorld; | ||||||
| import com.intellectualcrafters.plot.object.RunnableVal; | import com.intellectualcrafters.plot.object.RunnableVal; | ||||||
| import com.intellectualcrafters.plot.util.BlockManager; |  | ||||||
| import com.intellectualcrafters.plot.util.ChunkManager; | import com.intellectualcrafters.plot.util.ChunkManager; | ||||||
| import com.intellectualcrafters.plot.util.MainUtil; | import com.intellectualcrafters.plot.util.MainUtil; | ||||||
| import com.intellectualcrafters.plot.util.SchematicHandler; | import com.intellectualcrafters.plot.util.SchematicHandler; | ||||||
|   | |||||||
| @@ -27,8 +27,6 @@ import java.util.List; | |||||||
| import java.util.Map.Entry; | import java.util.Map.Entry; | ||||||
| import java.util.UUID; | import java.util.UUID; | ||||||
|  |  | ||||||
| import javax.annotation.concurrent.ThreadSafe; |  | ||||||
|  |  | ||||||
| import com.intellectualcrafters.plot.PS; | import com.intellectualcrafters.plot.PS; | ||||||
| import com.intellectualcrafters.plot.config.Configuration; | import com.intellectualcrafters.plot.config.Configuration; | ||||||
| import com.intellectualcrafters.plot.database.DBFunc; | import com.intellectualcrafters.plot.database.DBFunc; | ||||||
| @@ -103,9 +101,13 @@ public class Plot { | |||||||
|      */ |      */ | ||||||
|     public boolean countsTowardsMax = true; |     public boolean countsTowardsMax = true; | ||||||
|     /** |     /** | ||||||
|      * If this plot is temporary i.e. not stored in the DB |      * Represents whatever the database manager needs it to: <br> | ||||||
|  |      *  - A value of -1 usually indicates the plot will not be stored in the DB<br> | ||||||
|  |      *  - A value of 0 usually indicates that the DB manager hasn't set a value<br> | ||||||
|  |      * @deprecated magical | ||||||
|      */ |      */ | ||||||
|     public final boolean temp; |     @Deprecated | ||||||
|  |     public int temp; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Constructor for a new plot |      * Constructor for a new plot | ||||||
| @@ -118,7 +120,6 @@ public class Plot { | |||||||
|         this.world = world; |         this.world = world; | ||||||
|         this.id = id; |         this.id = id; | ||||||
|         this.owner = owner; |         this.owner = owner; | ||||||
|         this.temp = false; |  | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     /** |     /** | ||||||
| @@ -129,7 +130,7 @@ public class Plot { | |||||||
|      * @param owner |      * @param owner | ||||||
|      * @param temp |      * @param temp | ||||||
|      */ |      */ | ||||||
|     public Plot(String world, PlotId id, UUID owner, boolean temp) { |     public Plot(String world, PlotId id, UUID owner, int temp) { | ||||||
|         this.world = world; |         this.world = world; | ||||||
|         this.id = id; |         this.id = id; | ||||||
|         this.owner = owner; |         this.owner = owner; | ||||||
| @@ -145,7 +146,7 @@ public class Plot { | |||||||
|      * @param denied |      * @param denied | ||||||
|      * @param merged |      * @param merged | ||||||
|      */ |      */ | ||||||
|     public Plot(final PlotId id, final UUID owner, final HashSet<UUID> trusted, final HashSet<UUID> members, final HashSet<UUID> denied, final String alias, final BlockLoc position, final Collection<Flag> flags, final String world, final boolean[] merged, final long timestamp) { |     public Plot(final PlotId id, final UUID owner, final HashSet<UUID> trusted, final HashSet<UUID> members, final HashSet<UUID> denied, final String alias, final BlockLoc position, final Collection<Flag> flags, final String world, final boolean[] merged, final long timestamp, final int temp) { | ||||||
|         this.id = id; |         this.id = id; | ||||||
|         this.world = world; |         this.world = world; | ||||||
|         this.owner = owner; |         this.owner = owner; | ||||||
| @@ -162,7 +163,6 @@ public class Plot { | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         this.timestamp = timestamp; |         this.timestamp = timestamp; | ||||||
|         this.temp = false; |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|   | |||||||
| @@ -126,7 +126,7 @@ public abstract class ChunkManager { | |||||||
|      */ |      */ | ||||||
|     public abstract boolean regenerateRegion(final Location pos1, final Location pos2, final Runnable whenDone); |     public abstract boolean regenerateRegion(final Location pos1, final Location pos2, final Runnable whenDone); | ||||||
|  |  | ||||||
|     public abstract void clearAllEntities(final Plot plot); |     public abstract void clearAllEntities(final Location pos1, final Location pos2); | ||||||
|      |      | ||||||
|     public abstract void swap(String world, PlotId id, PlotId plotid); |     public abstract void swap(String world, PlotId id, PlotId plotid); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,7 +3,6 @@ package com.intellectualcrafters.plot.util; | |||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.HashMap; | import java.util.HashMap; | ||||||
| import java.util.HashSet; | import java.util.HashSet; | ||||||
| import java.util.Map.Entry; |  | ||||||
| import java.util.Random; | import java.util.Random; | ||||||
|  |  | ||||||
| import org.bukkit.Bukkit; | import org.bukkit.Bukkit; | ||||||
|   | |||||||
| @@ -24,12 +24,12 @@ import java.util.ArrayList; | |||||||
| import java.util.Arrays; | import java.util.Arrays; | ||||||
| import java.util.HashMap; | import java.util.HashMap; | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  | import java.util.Map; | ||||||
| import java.util.Map.Entry; | import java.util.Map.Entry; | ||||||
| import java.util.UUID; | import java.util.UUID; | ||||||
|  |  | ||||||
| import com.intellectualcrafters.plot.PS; | import com.intellectualcrafters.plot.PS; | ||||||
| import com.intellectualcrafters.plot.config.C; | import com.intellectualcrafters.plot.config.C; | ||||||
| import com.intellectualcrafters.plot.config.Configuration; |  | ||||||
| import com.intellectualcrafters.plot.config.Settings; | import com.intellectualcrafters.plot.config.Settings; | ||||||
| import com.intellectualcrafters.plot.database.DBFunc; | import com.intellectualcrafters.plot.database.DBFunc; | ||||||
| import com.intellectualcrafters.plot.object.BlockLoc; | import com.intellectualcrafters.plot.object.BlockLoc; | ||||||
| @@ -289,7 +289,7 @@ public class MainUtil { | |||||||
|                 MainUtil.sendMessage(player, C.REMOVED_BALANCE, cost + ""); |                 MainUtil.sendMessage(player, C.REMOVED_BALANCE, cost + ""); | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         return MainUtil.mergePlots(world, plotIds, true); |         return MainUtil.mergePlots(world, plotIds, true, true); | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     public static boolean unlinkPlot(final Plot plot) { |     public static boolean unlinkPlot(final Plot plot) { | ||||||
| @@ -620,10 +620,13 @@ public class MainUtil { | |||||||
|      * |      * | ||||||
|      * @return boolean (success) |      * @return boolean (success) | ||||||
|      */ |      */ | ||||||
|     public static boolean mergePlots(final String world, final ArrayList<PlotId> plotIds, final boolean removeRoads) { |     public static boolean mergePlots(final String world, final ArrayList<PlotId> plotIds, final boolean removeRoads, final boolean updateDatabase) { | ||||||
|         if (plotIds.size() < 2) { |         if (plotIds.size() < 2) { | ||||||
|             return false; |             return false; | ||||||
|         } |         } | ||||||
|  |          | ||||||
|  | //        merged plots set db before finished merging | ||||||
|  |          | ||||||
|         final PlotId pos1 = plotIds.get(0); |         final PlotId pos1 = plotIds.get(0); | ||||||
|         final PlotId pos2 = plotIds.get(plotIds.size() - 1); |         final PlotId pos2 = plotIds.get(plotIds.size() - 1); | ||||||
|         final PlotManager manager = PS.get().getPlotManager(world); |         final PlotManager manager = PS.get().getPlotManager(world); | ||||||
| @@ -676,14 +679,16 @@ public class MainUtil { | |||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         for (int x = pos1.x; x <= pos2.x; x++) { |         manager.finishPlotMerge(plotworld, plotIds); | ||||||
|             for (int y = pos1.y; y <= pos2.y; y++) { |         if (updateDatabase) { | ||||||
|                 final PlotId id = new PlotId(x, y); |             for (int x = pos1.x; x <= pos2.x; x++) { | ||||||
|                 final Plot plot = PS.get().getPlots(world).get(id); |                 for (int y = pos1.y; y <= pos2.y; y++) { | ||||||
|                 DBFunc.setMerged(plot, plot.getSettings().getMerged()); |                     final PlotId id = new PlotId(x, y); | ||||||
|  |                     final Plot plot = PS.get().getPlots(world).get(id); | ||||||
|  |                     DBFunc.setMerged(plot, plot.getSettings().getMerged()); | ||||||
|  |                 } | ||||||
|             } |             } | ||||||
|         } |         } | ||||||
|         manager.finishPlotMerge(plotworld, plotIds); |  | ||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
|      |      | ||||||
| @@ -744,7 +749,7 @@ public class MainUtil { | |||||||
|      |      | ||||||
|     /** |     /** | ||||||
|      * Merges 2 plots Removes the road inbetween <br> - Assumes the first plot parameter is lower <br> - Assumes neither |      * Merges 2 plots Removes the road inbetween <br> - Assumes the first plot parameter is lower <br> - Assumes neither | ||||||
|      * are a Mega-plot <br> - Assumes plots are directly next to each other <br> - Saves to DB |      * are a Mega-plot <br> - Assumes plots are directly next to each other <br> - Does not save to DB | ||||||
|      * |      * | ||||||
|      * @param world |      * @param world | ||||||
|      * @param lesserPlot |      * @param lesserPlot | ||||||
| @@ -840,6 +845,7 @@ public class MainUtil { | |||||||
|         ArrayList<PlotId> plots; |         ArrayList<PlotId> plots; | ||||||
|         boolean merge = true; |         boolean merge = true; | ||||||
|         int count = 0; |         int count = 0; | ||||||
|  |         ArrayList<PlotId> toUpdate = new ArrayList<>(); | ||||||
|         while (merge) { |         while (merge) { | ||||||
|             if (count > 16) { |             if (count > 16) { | ||||||
|                 break; |                 break; | ||||||
| @@ -849,38 +855,46 @@ public class MainUtil { | |||||||
|             final PlotId top = getTopPlot(plot).id; |             final PlotId top = getTopPlot(plot).id; | ||||||
|             plots = getPlotSelectionIds(new PlotId(bot.x, bot.y - 1), new PlotId(top.x, top.y)); |             plots = getPlotSelectionIds(new PlotId(bot.x, bot.y - 1), new PlotId(top.x, top.y)); | ||||||
|             if (ownsPlots(plot.world, plots, uuid, 0)) { |             if (ownsPlots(plot.world, plots, uuid, 0)) { | ||||||
|                 final boolean result = mergePlots(plot.world, plots, removeRoads); |                 final boolean result = mergePlots(plot.world, plots, removeRoads, false); | ||||||
|                 if (result) { |                 if (result) { | ||||||
|  |                     toUpdate.addAll(plots); | ||||||
|                     merge = true; |                     merge = true; | ||||||
|                     continue; |                     continue; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             plots = getPlotSelectionIds(new PlotId(bot.x, bot.y), new PlotId(top.x + 1, top.y)); |             plots = getPlotSelectionIds(new PlotId(bot.x, bot.y), new PlotId(top.x + 1, top.y)); | ||||||
|             if (ownsPlots(plot.world, plots, uuid, 1)) { |             if (ownsPlots(plot.world, plots, uuid, 1)) { | ||||||
|                 final boolean result = mergePlots(plot.world, plots, removeRoads); |                 final boolean result = mergePlots(plot.world, plots, removeRoads, false); | ||||||
|                 if (result) { |                 if (result) { | ||||||
|  |                     toUpdate.addAll(plots); | ||||||
|                     merge = true; |                     merge = true; | ||||||
|                     continue; |                     continue; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             plots = getPlotSelectionIds(new PlotId(bot.x, bot.y), new PlotId(top.x, top.y + 1)); |             plots = getPlotSelectionIds(new PlotId(bot.x, bot.y), new PlotId(top.x, top.y + 1)); | ||||||
|             if (ownsPlots(plot.world, plots, uuid, 2)) { |             if (ownsPlots(plot.world, plots, uuid, 2)) { | ||||||
|                 final boolean result = mergePlots(plot.world, plots, removeRoads); |                 final boolean result = mergePlots(plot.world, plots, removeRoads, false); | ||||||
|                 if (result) { |                 if (result) { | ||||||
|  |                     toUpdate.addAll(plots); | ||||||
|                     merge = true; |                     merge = true; | ||||||
|                     continue; |                     continue; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             plots = getPlotSelectionIds(new PlotId(bot.x - 1, bot.y), new PlotId(top.x, top.y)); |             plots = getPlotSelectionIds(new PlotId(bot.x - 1, bot.y), new PlotId(top.x, top.y)); | ||||||
|             if (ownsPlots(plot.world, plots, uuid, 3)) { |             if (ownsPlots(plot.world, plots, uuid, 3)) { | ||||||
|                 final boolean result = mergePlots(plot.world, plots, removeRoads); |                 final boolean result = mergePlots(plot.world, plots, removeRoads, false); | ||||||
|                 if (result) { |                 if (result) { | ||||||
|  |                     toUpdate.addAll(plots); | ||||||
|                     merge = true; |                     merge = true; | ||||||
|                     continue; |                     continue; | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             merge = false; |             merge = false; | ||||||
|         } |         } | ||||||
|  |         for (PlotId id : toUpdate) { | ||||||
|  |             Plot update = getPlot(plot.world, id); | ||||||
|  |             DBFunc.setMerged(plot, plot.getSettings().getMerged()); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     private static boolean ownsPlots(final String world, final ArrayList<PlotId> plots, final UUID uuid, final int dir) { |     private static boolean ownsPlots(final String world, final ArrayList<PlotId> plots, final UUID uuid, final int dir) { | ||||||
| @@ -944,7 +958,7 @@ public class MainUtil { | |||||||
|      */ |      */ | ||||||
|     public static Plot createPlotAbs(final UUID uuid, final Plot plot) { |     public static Plot createPlotAbs(final UUID uuid, final Plot plot) { | ||||||
|         final String w = plot.world; |         final String w = plot.world; | ||||||
|         HashMap<PlotId, Plot> plots = PS.get().getPlots(plot.world); |         Map<PlotId, Plot> plots = PS.get().getPlots(plot.world); | ||||||
|         Plot p = plots.get(plot.id); |         Plot p = plots.get(plot.id); | ||||||
|         if (p != null) { |         if (p != null) { | ||||||
|             return p; |             return p; | ||||||
| @@ -985,9 +999,12 @@ public class MainUtil { | |||||||
|         if (runners.containsKey(plot)) { |         if (runners.containsKey(plot)) { | ||||||
|             return false; |             return false; | ||||||
|         } |         } | ||||||
|         ChunkManager.manager.clearAllEntities(plot); |         long start = System.currentTimeMillis(); | ||||||
|  |         ChunkManager.manager.clearAllEntities(plot.getBottom().add(1, 0, 1), plot.getTop()); | ||||||
|  |         if (isDelete) { | ||||||
|  |             removeSign(plot); | ||||||
|  |         } | ||||||
|         clear(plot, isDelete, whenDone); |         clear(plot, isDelete, whenDone); | ||||||
|         removeSign(plot); |  | ||||||
|         return true; |         return true; | ||||||
|     } |     } | ||||||
|  |  | ||||||
|   | |||||||
| @@ -67,6 +67,7 @@ public class SetBlockQueue { | |||||||
|                                 TaskManager.runTask(runnable); |                                 TaskManager.runTask(runnable); | ||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
|  |                         lastInt = -1; | ||||||
|                         lastBlock = null; |                         lastBlock = null; | ||||||
|                         runnables = null; |                         runnables = null; | ||||||
|                         blocks = new HashMap<>(); |                         blocks = new HashMap<>(); | ||||||
| @@ -75,8 +76,8 @@ public class SetBlockQueue { | |||||||
|                         return; |                         return; | ||||||
|                     } |                     } | ||||||
|                     long newLast = System.currentTimeMillis(); |                     long newLast = System.currentTimeMillis(); | ||||||
|                     last = Math.max(newLast - 100, last); |                     last = Math.max(newLast - 50, last); | ||||||
|                     while (blocks.size() > 0 && (System.currentTimeMillis() - last < 100 + allocate)) { |                     while (blocks.size() > 0 && (System.currentTimeMillis() - last < 50 + allocate)) { | ||||||
|                         if (locked) { |                         if (locked) { | ||||||
|                             return; |                             return; | ||||||
|                         } |                         } | ||||||
| @@ -129,7 +130,7 @@ public class SetBlockQueue { | |||||||
|                         } |                         } | ||||||
|                     } |                     } | ||||||
|                 } |                 } | ||||||
|             }, 2); |             }, 1); | ||||||
|             TaskManager.tasks.put(current, task); |             TaskManager.tasks.put(current, task); | ||||||
|             running = true; |             running = true; | ||||||
|         } |         } | ||||||
|   | |||||||
| @@ -16,8 +16,6 @@ import org.bukkit.entity.Entity; | |||||||
| import org.bukkit.entity.Player; | import org.bukkit.entity.Player; | ||||||
| import org.bukkit.event.Listener; | import org.bukkit.event.Listener; | ||||||
| import org.bukkit.generator.ChunkGenerator; | import org.bukkit.generator.ChunkGenerator; | ||||||
| import org.bukkit.metadata.MetadataValue; |  | ||||||
| import org.bukkit.metadata.MetadataValueAdapter; |  | ||||||
| import org.bukkit.plugin.Plugin; | import org.bukkit.plugin.Plugin; | ||||||
| import org.bukkit.plugin.java.JavaPlugin; | import org.bukkit.plugin.java.JavaPlugin; | ||||||
|  |  | ||||||
| @@ -200,98 +198,107 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain { | |||||||
|                 for (final PlotWorld pw : PS.get().getPlotWorldObjects()) { |                 for (final PlotWorld pw : PS.get().getPlotWorldObjects()) { | ||||||
|                     world = Bukkit.getWorld(pw.worldname); |                     world = Bukkit.getWorld(pw.worldname); | ||||||
|                     try { |                     try { | ||||||
|                     for (Entity entity : world.getEntities()) { |                         for (Entity entity : world.getEntities()) { | ||||||
|                         switch (entity.getType()) { |                             switch (entity.getType()) { | ||||||
|                             case EGG: |                                 case EGG: | ||||||
|                             case ENDER_CRYSTAL: |                                 case ENDER_CRYSTAL: | ||||||
|                             case COMPLEX_PART: |                                 case COMPLEX_PART: | ||||||
|                             case ARMOR_STAND: |                                 case ARMOR_STAND: | ||||||
|                             case FISHING_HOOK: |                                 case FISHING_HOOK: | ||||||
|                             case ENDER_SIGNAL: |                                 case ENDER_SIGNAL: | ||||||
|                             case EXPERIENCE_ORB: |                                 case EXPERIENCE_ORB: | ||||||
|                             case LEASH_HITCH: |                                 case LEASH_HITCH: | ||||||
|                             case FIREWORK: |                                 case FIREWORK: | ||||||
|                             case WEATHER: |                                 case WEATHER: | ||||||
|                             case LIGHTNING: |                                 case LIGHTNING: | ||||||
|                             case WITHER_SKULL: |                                 case WITHER_SKULL: | ||||||
|                             case UNKNOWN: |                                 case UNKNOWN: | ||||||
|                             case ITEM_FRAME: |                                 case ITEM_FRAME: | ||||||
|                             case PAINTING: |                                 case PAINTING: | ||||||
|                             case PLAYER: { |                                 case PLAYER: { | ||||||
|                                 // non moving / unremovable |                                     // non moving / unremovable | ||||||
|                                 continue; |                                     continue; | ||||||
|                             } |                                 } | ||||||
|                             case THROWN_EXP_BOTTLE: |                                 case THROWN_EXP_BOTTLE: | ||||||
|                             case SPLASH_POTION: |                                 case SPLASH_POTION: | ||||||
|                             case SNOWBALL: |                                 case SNOWBALL: | ||||||
|                             case ENDER_PEARL: |                                 case ENDER_PEARL: | ||||||
|                             case ARROW: { |                                 case ARROW: { | ||||||
|                                 // managed elsewhere | projectile |                                     // managed elsewhere | projectile | ||||||
|                                 continue; |                                     continue; | ||||||
|                             } |                                 } | ||||||
|                             case MINECART: |                                 case MINECART: | ||||||
|                             case MINECART_CHEST: |                                 case MINECART_CHEST: | ||||||
|                             case MINECART_COMMAND: |                                 case MINECART_COMMAND: | ||||||
|                             case MINECART_FURNACE: |                                 case MINECART_FURNACE: | ||||||
|                             case MINECART_HOPPER: |                                 case MINECART_HOPPER: | ||||||
|                             case MINECART_MOB_SPAWNER: |                                 case MINECART_MOB_SPAWNER: | ||||||
|                             case MINECART_TNT: |                                 case MINECART_TNT: | ||||||
|                             case BOAT: { |                                 case BOAT: { | ||||||
|                                 // vehicle |                                     if (!Settings.KILL_ROAD_VEHICLES) { | ||||||
|                                 continue; |                                         continue; | ||||||
|                             } |                                     } | ||||||
|                             case SMALL_FIREBALL: |                                     Location loc = entity.getLocation(); | ||||||
|                             case FIREBALL: |                                     if (MainUtil.isPlotRoad(BukkitUtil.getLocation(loc))) { | ||||||
|                             case DROPPED_ITEM: { |                                         entity.remove(); | ||||||
|                                 // dropped item |                                     } | ||||||
|                                 continue; |                                     break; | ||||||
|                             } |                                 } | ||||||
|                             case PRIMED_TNT: |                                 case SMALL_FIREBALL: | ||||||
|                             case FALLING_BLOCK:  { |                                 case FIREBALL: | ||||||
|                                 // managed elsewhere |                                 case DROPPED_ITEM: { | ||||||
|                                 continue; |                                     // dropped item | ||||||
|                             } |                                     continue; | ||||||
|                             case BAT: |                                 } | ||||||
|                             case BLAZE: |                                 case PRIMED_TNT: | ||||||
|                             case CAVE_SPIDER: |                                 case FALLING_BLOCK:  { | ||||||
|                             case CHICKEN: |                                     // managed elsewhere | ||||||
|                             case COW: |                                     continue; | ||||||
|                             case CREEPER: |                                 } | ||||||
|                             case ENDERMAN: |                                 case BAT: | ||||||
|                             case ENDERMITE: |                                 case BLAZE: | ||||||
|                             case ENDER_DRAGON: |                                 case CAVE_SPIDER: | ||||||
|                             case GHAST: |                                 case CHICKEN: | ||||||
|                             case GIANT: |                                 case COW: | ||||||
|                             case GUARDIAN: |                                 case CREEPER: | ||||||
|                             case HORSE: |                                 case ENDERMAN: | ||||||
|                             case IRON_GOLEM: |                                 case ENDERMITE: | ||||||
|                             case MAGMA_CUBE: |                                 case ENDER_DRAGON: | ||||||
|                             case MUSHROOM_COW: |                                 case GHAST: | ||||||
|                             case OCELOT: |                                 case GIANT: | ||||||
|                             case PIG: |                                 case GUARDIAN: | ||||||
|                             case PIG_ZOMBIE: |                                 case HORSE: | ||||||
|                             case RABBIT: |                                 case IRON_GOLEM: | ||||||
|                             case SHEEP: |                                 case MAGMA_CUBE: | ||||||
|                             case SILVERFISH: |                                 case MUSHROOM_COW: | ||||||
|                             case SKELETON: |                                 case OCELOT: | ||||||
|                             case SLIME: |                                 case PIG: | ||||||
|                             case SNOWMAN: |                                 case PIG_ZOMBIE: | ||||||
|                             case SPIDER: |                                 case RABBIT: | ||||||
|                             case SQUID: |                                 case SHEEP: | ||||||
|                             case VILLAGER: |                                 case SILVERFISH: | ||||||
|                             case WITCH: |                                 case SKELETON: | ||||||
|                             case WITHER: |                                 case SLIME: | ||||||
|                             case WOLF: |                                 case SNOWMAN: | ||||||
|                             case ZOMBIE: |                                 case SPIDER: | ||||||
|                             default: { |                                 case SQUID: | ||||||
|                                 Location loc = entity.getLocation(); |                                 case VILLAGER: | ||||||
|                                 if (MainUtil.isPlotRoad(BukkitUtil.getLocation(loc))) { |                                 case WITCH: | ||||||
|                                     entity.remove(); |                                 case WITHER: | ||||||
|  |                                 case WOLF: | ||||||
|  |                                 case ZOMBIE: | ||||||
|  |                                 default: { | ||||||
|  |                                     if (!Settings.KILL_ROAD_MOBS) { | ||||||
|  |                                         continue; | ||||||
|  |                                     } | ||||||
|  |                                     Location loc = entity.getLocation(); | ||||||
|  |                                     if (MainUtil.isPlotRoad(BukkitUtil.getLocation(loc))) { | ||||||
|  |                                         entity.remove(); | ||||||
|  |                                     } | ||||||
|  |                                     break; | ||||||
|                                 } |                                 } | ||||||
|                                 break; |  | ||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
|                     } |  | ||||||
|                     } catch (final Throwable e) { |                     } catch (final Throwable e) { | ||||||
|                         ++this.error; |                         ++this.error; | ||||||
|                     } finally { |                     } finally { | ||||||
|   | |||||||
| @@ -19,7 +19,6 @@ import com.intellectualcrafters.plot.object.PlotId; | |||||||
| import com.intellectualcrafters.plot.object.PlotLoc; | import com.intellectualcrafters.plot.object.PlotLoc; | ||||||
| import com.intellectualcrafters.plot.object.PlotManager; | import com.intellectualcrafters.plot.object.PlotManager; | ||||||
| import com.intellectualcrafters.plot.object.PlotWorld; | import com.intellectualcrafters.plot.object.PlotWorld; | ||||||
| import com.intellectualcrafters.plot.object.RegionWrapper; |  | ||||||
| import com.intellectualcrafters.plot.util.ChunkManager; | import com.intellectualcrafters.plot.util.ChunkManager; | ||||||
| import com.intellectualcrafters.plot.util.MainUtil; | import com.intellectualcrafters.plot.util.MainUtil; | ||||||
| import com.intellectualcrafters.plot.util.TaskManager; | import com.intellectualcrafters.plot.util.TaskManager; | ||||||
|   | |||||||
| @@ -1,9 +1,5 @@ | |||||||
| package com.plotsquared.bukkit.listeners; | package com.plotsquared.bukkit.listeners; | ||||||
|  |  | ||||||
| import java.util.Set; |  | ||||||
|  |  | ||||||
| import org.bukkit.Bukkit; |  | ||||||
| import org.bukkit.ChatColor; |  | ||||||
| import org.bukkit.entity.Player; | import org.bukkit.entity.Player; | ||||||
| import org.bukkit.event.EventHandler; | import org.bukkit.event.EventHandler; | ||||||
| import org.bukkit.event.EventPriority; | import org.bukkit.event.EventPriority; | ||||||
|   | |||||||
| @@ -7,7 +7,6 @@ import java.util.HashMap; | |||||||
| import java.util.HashSet; | import java.util.HashSet; | ||||||
| import java.util.List; | import java.util.List; | ||||||
| import java.util.Random; | import java.util.Random; | ||||||
| import java.util.concurrent.atomic.AtomicInteger; |  | ||||||
|  |  | ||||||
| import org.bukkit.Bukkit; | import org.bukkit.Bukkit; | ||||||
| import org.bukkit.Chunk; | import org.bukkit.Chunk; | ||||||
| @@ -44,7 +43,6 @@ import org.bukkit.entity.Vehicle; | |||||||
| import org.bukkit.generator.BlockPopulator; | import org.bukkit.generator.BlockPopulator; | ||||||
| import org.bukkit.inventory.InventoryHolder; | import org.bukkit.inventory.InventoryHolder; | ||||||
| import org.bukkit.inventory.ItemStack; | import org.bukkit.inventory.ItemStack; | ||||||
| import org.bukkit.plugin.Plugin; |  | ||||||
|  |  | ||||||
| import com.intellectualcrafters.plot.PS; | import com.intellectualcrafters.plot.PS; | ||||||
| import com.intellectualcrafters.plot.object.BlockLoc; | import com.intellectualcrafters.plot.object.BlockLoc; | ||||||
| @@ -63,7 +61,6 @@ import com.intellectualcrafters.plot.util.ClusterManager; | |||||||
| import com.intellectualcrafters.plot.util.MainUtil; | import com.intellectualcrafters.plot.util.MainUtil; | ||||||
| import com.intellectualcrafters.plot.util.SetBlockQueue.ChunkWrapper; | import com.intellectualcrafters.plot.util.SetBlockQueue.ChunkWrapper; | ||||||
| import com.intellectualcrafters.plot.util.TaskManager; | import com.intellectualcrafters.plot.util.TaskManager; | ||||||
| import com.plotsquared.bukkit.BukkitMain; |  | ||||||
| import com.plotsquared.bukkit.generator.AugmentedPopulator; | import com.plotsquared.bukkit.generator.AugmentedPopulator; | ||||||
| import com.plotsquared.bukkit.object.entity.EntityWrapper; | import com.plotsquared.bukkit.object.entity.EntityWrapper; | ||||||
|  |  | ||||||
| @@ -907,19 +904,28 @@ public class BukkitChunkManager extends ChunkManager { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public void clearAllEntities(final Plot plot) { |     public void clearAllEntities(final Location pos1, final Location pos2) { | ||||||
|         final List<Entity> entities = BukkitUtil.getEntities(plot.world); |         final String world = pos1.getWorld(); | ||||||
|  |         final List<Entity> entities = BukkitUtil.getEntities(world); | ||||||
|  |         final int bx = pos1.getX(); | ||||||
|  |         final int bz = pos1.getZ(); | ||||||
|  |         final int tx = pos2.getX(); | ||||||
|  |         final int tz = pos2.getZ(); | ||||||
|         for (final Entity entity : entities) { |         for (final Entity entity : entities) { | ||||||
|             final PlotId id = MainUtil.getPlotId(BukkitUtil.getLocation(entity)); |             if (entity instanceof Player) { | ||||||
|             if (plot.id.equals(id)) { |                 final Player player = (Player) entity; | ||||||
|                 if (entity instanceof Player) { |                 final PlotPlayer pp = BukkitUtil.getPlayer(player); | ||||||
|                     final Player player = (Player) entity; |                 Plot plot = pp.getCurrentPlot(); | ||||||
|                     final PlotPlayer pp = BukkitUtil.getPlayer(player); |                 if (plot != null) { | ||||||
|                     final Location plotHome = MainUtil.getDefaultHome(plot); |                     final Location plotHome = MainUtil.getDefaultHome(plot); | ||||||
|                     if (pp.getLocation().getY() <= plotHome.getY()) { |                     if (pp.getLocation().getY() <= plotHome.getY()) { | ||||||
|                         pp.teleport(plotHome); |                         pp.teleport(plotHome); | ||||||
|                     } |                     } | ||||||
|                 } else { |                 } | ||||||
|  |             } | ||||||
|  |             else { | ||||||
|  |                 org.bukkit.Location loc = entity.getLocation(); | ||||||
|  |                 if (loc.getX() >= bx && loc.getX() <= tx && loc.getZ() >= bz && loc.getZ() <= tz) { | ||||||
|                     entity.remove(); |                     entity.remove(); | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
| @@ -997,8 +1003,13 @@ public class BukkitChunkManager extends ChunkManager { | |||||||
|         final Location top2 = MainUtil.getPlotTopLoc(worldname, pos2); |         final Location top2 = MainUtil.getPlotTopLoc(worldname, pos2); | ||||||
|         swap(worldname, bot1, top1, bot2, top2); |         swap(worldname, bot1, top1, bot2, top2); | ||||||
|  |  | ||||||
|         clearAllEntities(MainUtil.getPlot(worldname, pos1)); |         Plot plot1 = MainUtil.getPlot(worldname, pos1); | ||||||
|         clearAllEntities(MainUtil.getPlot(worldname, pos2)); |         Plot plot2 = MainUtil.getPlot(worldname, pos2); | ||||||
|  |          | ||||||
|  |         // TODO clear all entities | ||||||
|  |          | ||||||
|  |         clearAllEntities(plot1.getBottom().add(1, 0, 1), plot1.getTop()); | ||||||
|  |         clearAllEntities(plot2.getBottom().add(1, 0, 1), plot2.getTop()); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|   | |||||||
| @@ -11,10 +11,8 @@ import org.bukkit.command.CommandSender; | |||||||
| import org.bukkit.command.TabCompleter; | import org.bukkit.command.TabCompleter; | ||||||
| import org.bukkit.entity.Player; | import org.bukkit.entity.Player; | ||||||
|  |  | ||||||
| import com.intellectualcrafters.plot.commands.Cluster; |  | ||||||
| import com.intellectualcrafters.plot.commands.DebugUUID; | import com.intellectualcrafters.plot.commands.DebugUUID; | ||||||
| import com.intellectualcrafters.plot.commands.MainCommand; | import com.intellectualcrafters.plot.commands.MainCommand; | ||||||
| import com.intellectualcrafters.plot.config.Settings; |  | ||||||
| import com.intellectualcrafters.plot.object.ConsolePlayer; | import com.intellectualcrafters.plot.object.ConsolePlayer; | ||||||
| import com.intellectualcrafters.plot.object.PlotPlayer; | import com.intellectualcrafters.plot.object.PlotPlayer; | ||||||
| import com.intellectualcrafters.plot.util.StringComparison; | import com.intellectualcrafters.plot.util.StringComparison; | ||||||
|   | |||||||
| @@ -7,12 +7,10 @@ import org.bukkit.Bukkit; | |||||||
| import org.bukkit.World; | import org.bukkit.World; | ||||||
| import org.bukkit.plugin.RegisteredServiceProvider; | import org.bukkit.plugin.RegisteredServiceProvider; | ||||||
|  |  | ||||||
| import com.intellectualcrafters.plot.PS; |  | ||||||
| import com.intellectualcrafters.plot.object.OfflinePlotPlayer; | import com.intellectualcrafters.plot.object.OfflinePlotPlayer; | ||||||
| import com.intellectualcrafters.plot.object.PlotPlayer; | import com.intellectualcrafters.plot.object.PlotPlayer; | ||||||
| import com.intellectualcrafters.plot.util.EconHandler; | import com.intellectualcrafters.plot.util.EconHandler; | ||||||
| import com.plotsquared.bukkit.object.BukkitOfflinePlayer; | import com.plotsquared.bukkit.object.BukkitOfflinePlayer; | ||||||
| import com.plotsquared.bukkit.object.BukkitPlayer; |  | ||||||
|  |  | ||||||
| public class BukkitEconHandler extends EconHandler { | public class BukkitEconHandler extends EconHandler { | ||||||
|      |      | ||||||
|   | |||||||
| @@ -6,7 +6,6 @@ import java.util.List; | |||||||
| import java.util.Random; | import java.util.Random; | ||||||
|  |  | ||||||
| import org.bukkit.Bukkit; | import org.bukkit.Bukkit; | ||||||
| import org.bukkit.Chunk; |  | ||||||
| import org.bukkit.Material; | import org.bukkit.Material; | ||||||
| import org.bukkit.World; | import org.bukkit.World; | ||||||
| import org.bukkit.block.Biome; | import org.bukkit.block.Biome; | ||||||
|   | |||||||
| @@ -6,8 +6,6 @@ import org.bukkit.Chunk; | |||||||
| import org.bukkit.World; | import org.bukkit.World; | ||||||
| import org.bukkit.block.Block; | import org.bukkit.block.Block; | ||||||
|  |  | ||||||
| import com.intellectualcrafters.plot.util.MainUtil; |  | ||||||
|  |  | ||||||
| public class SetBlockSlow extends BukkitSetBlockManager { | public class SetBlockSlow extends BukkitSetBlockManager { | ||||||
|     @Override |     @Override | ||||||
|     public void set(final World world, final int x, final int y, final int z, final int id, final byte data) { |     public void set(final World world, final int x, final int y, final int z, final int id, final byte data) { | ||||||
|   | |||||||
| @@ -4,7 +4,6 @@ import java.io.File; | |||||||
|  |  | ||||||
| import org.bukkit.Bukkit; | import org.bukkit.Bukkit; | ||||||
|  |  | ||||||
| import com.intellectualcrafters.plot.PS; |  | ||||||
| import com.intellectualcrafters.plot.object.Location; | import com.intellectualcrafters.plot.object.Location; | ||||||
| import com.intellectualcrafters.plot.object.PlotId; | import com.intellectualcrafters.plot.object.PlotId; | ||||||
| import com.intellectualcrafters.plot.util.MainUtil; | import com.intellectualcrafters.plot.util.MainUtil; | ||||||
|   | |||||||
| @@ -1,6 +1,5 @@ | |||||||
| package com.plotsquared.sponge; | package com.plotsquared.sponge; | ||||||
|  |  | ||||||
| import org.bukkit.block.Block; |  | ||||||
| import org.spongepowered.api.block.BlockState; | import org.spongepowered.api.block.BlockState; | ||||||
| import org.spongepowered.api.block.BlockTypes; | import org.spongepowered.api.block.BlockTypes; | ||||||
| import org.spongepowered.api.world.World; | import org.spongepowered.api.world.World; | ||||||
| @@ -11,7 +10,6 @@ import com.intellectualcrafters.plot.object.Plot; | |||||||
| import com.intellectualcrafters.plot.object.PlotAnalysis; | import com.intellectualcrafters.plot.object.PlotAnalysis; | ||||||
| import com.intellectualcrafters.plot.object.PlotBlock; | import com.intellectualcrafters.plot.object.PlotBlock; | ||||||
| import com.intellectualcrafters.plot.object.RunnableVal; | import com.intellectualcrafters.plot.object.RunnableVal; | ||||||
| import com.plotsquared.bukkit.util.BukkitUtil; |  | ||||||
| import com.plotsquared.sponge.util.SpongeUtil; | import com.plotsquared.sponge.util.SpongeUtil; | ||||||
|  |  | ||||||
| public class SpongeHybridUtils extends HybridUtils { | public class SpongeHybridUtils extends HybridUtils { | ||||||
|   | |||||||
| @@ -17,14 +17,12 @@ import java.util.concurrent.ConcurrentHashMap; | |||||||
| import org.slf4j.Logger; | import org.slf4j.Logger; | ||||||
| import org.spongepowered.api.CatalogType; | import org.spongepowered.api.CatalogType; | ||||||
| import org.spongepowered.api.Game; | import org.spongepowered.api.Game; | ||||||
| import org.spongepowered.api.Platform; |  | ||||||
| import org.spongepowered.api.Server; | import org.spongepowered.api.Server; | ||||||
| import org.spongepowered.api.block.BlockState; | import org.spongepowered.api.block.BlockState; | ||||||
| import org.spongepowered.api.block.BlockType; | import org.spongepowered.api.block.BlockType; | ||||||
| import org.spongepowered.api.block.BlockTypes; | import org.spongepowered.api.block.BlockTypes; | ||||||
| import org.spongepowered.api.data.manipulator.block.StoneData; | import org.spongepowered.api.data.manipulator.block.StoneData; | ||||||
| import org.spongepowered.api.entity.player.Player; | import org.spongepowered.api.entity.player.Player; | ||||||
| import org.spongepowered.api.entity.player.gamemode.GameModes; |  | ||||||
| import org.spongepowered.api.event.Subscribe; | import org.spongepowered.api.event.Subscribe; | ||||||
| import org.spongepowered.api.event.entity.player.PlayerChatEvent; | import org.spongepowered.api.event.entity.player.PlayerChatEvent; | ||||||
| import org.spongepowered.api.event.state.PreInitializationEvent; | import org.spongepowered.api.event.state.PreInitializationEvent; | ||||||
| @@ -521,7 +519,7 @@ public class SpongeMain implements IPlotMain, PluginContainer { | |||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public void registerCommands() { |     public void registerCommands() { | ||||||
|         getGame().getCommandDispatcher().register(plugin, new SpongeCommand(), "plots", "p", "plot", "ps", "plotsquared", "p2"); |         getGame().getCommandDispatcher().register(plugin, new SpongeCommand(), "plots", "p", "plot", "ps", "plotsquared", "p2", "2"); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|   | |||||||
| @@ -14,7 +14,6 @@ import com.intellectualcrafters.jnbt.ListTag; | |||||||
| import com.intellectualcrafters.jnbt.ShortTag; | import com.intellectualcrafters.jnbt.ShortTag; | ||||||
| import com.intellectualcrafters.jnbt.StringTag; | import com.intellectualcrafters.jnbt.StringTag; | ||||||
| import com.intellectualcrafters.jnbt.Tag; | import com.intellectualcrafters.jnbt.Tag; | ||||||
| import com.intellectualcrafters.plot.PS; |  | ||||||
| import com.intellectualcrafters.plot.object.ChunkLoc; | import com.intellectualcrafters.plot.object.ChunkLoc; | ||||||
| import com.intellectualcrafters.plot.object.Location; | import com.intellectualcrafters.plot.object.Location; | ||||||
| import com.intellectualcrafters.plot.object.PlotBlock; | import com.intellectualcrafters.plot.object.PlotBlock; | ||||||
|   | |||||||
| @@ -16,7 +16,6 @@ import org.spongepowered.api.world.gen.Populator; | |||||||
| import org.spongepowered.api.world.gen.WorldGenerator; | import org.spongepowered.api.world.gen.WorldGenerator; | ||||||
|  |  | ||||||
| import com.flowpowered.math.vector.Vector3i; | import com.flowpowered.math.vector.Vector3i; | ||||||
| import com.intellectualcrafters.plot.PS; |  | ||||||
| import com.intellectualcrafters.plot.object.Location; | import com.intellectualcrafters.plot.object.Location; | ||||||
| import com.intellectualcrafters.plot.object.PlotBlock; | import com.intellectualcrafters.plot.object.PlotBlock; | ||||||
| import com.intellectualcrafters.plot.object.PlotCluster; | import com.intellectualcrafters.plot.object.PlotCluster; | ||||||
|   | |||||||
| @@ -7,7 +7,6 @@ import org.spongepowered.api.world.extent.MutableBlockVolume; | |||||||
| import org.spongepowered.api.world.gen.GeneratorPopulator; | import org.spongepowered.api.world.gen.GeneratorPopulator; | ||||||
|  |  | ||||||
| import com.flowpowered.math.vector.Vector3i; | import com.flowpowered.math.vector.Vector3i; | ||||||
| import com.intellectualcrafters.plot.PS; |  | ||||||
| import com.intellectualcrafters.plot.object.PseudoRandom; | import com.intellectualcrafters.plot.object.PseudoRandom; | ||||||
| import com.intellectualcrafters.plot.object.RegionWrapper; | import com.intellectualcrafters.plot.object.RegionWrapper; | ||||||
| import com.intellectualcrafters.plot.util.ChunkManager; | import com.intellectualcrafters.plot.util.ChunkManager; | ||||||
|   | |||||||
| @@ -5,7 +5,6 @@ import org.spongepowered.api.world.WorldCreationSettings; | |||||||
| import org.spongepowered.api.world.gen.WorldGenerator; | import org.spongepowered.api.world.gen.WorldGenerator; | ||||||
| import org.spongepowered.api.world.gen.WorldGeneratorModifier; | import org.spongepowered.api.world.gen.WorldGeneratorModifier; | ||||||
|  |  | ||||||
| import com.intellectualcrafters.plot.PS; |  | ||||||
| import com.intellectualcrafters.plot.object.PlotCluster; | import com.intellectualcrafters.plot.object.PlotCluster; | ||||||
| import com.intellectualcrafters.plot.object.PlotWorld; | import com.intellectualcrafters.plot.object.PlotWorld; | ||||||
| import com.intellectualcrafters.plot.util.ClusterManager; | import com.intellectualcrafters.plot.util.ClusterManager; | ||||||
|   | |||||||
| @@ -20,7 +20,6 @@ import java.util.UUID; | |||||||
|  |  | ||||||
| import org.spongepowered.api.block.BlockState; | import org.spongepowered.api.block.BlockState; | ||||||
| import org.spongepowered.api.entity.Entity; | import org.spongepowered.api.entity.Entity; | ||||||
| import org.spongepowered.api.entity.EntityType; |  | ||||||
| import org.spongepowered.api.entity.EntityTypes; | import org.spongepowered.api.entity.EntityTypes; | ||||||
| import org.spongepowered.api.entity.player.Player; | import org.spongepowered.api.entity.player.Player; | ||||||
| import org.spongepowered.api.event.Subscribe; | import org.spongepowered.api.event.Subscribe; | ||||||
|   | |||||||
| @@ -102,12 +102,6 @@ public class SpongeChunkManager extends ChunkManager { | |||||||
|         return false; |         return false; | ||||||
|     } |     } | ||||||
|      |      | ||||||
|     @Override |  | ||||||
|     public void clearAllEntities(Plot plot) { |  | ||||||
|         // TODO Auto-generated method stub |  | ||||||
|          |  | ||||||
|     } |  | ||||||
|      |  | ||||||
|     @Override |     @Override | ||||||
|     public void swap(String world, PlotId id, PlotId plotid) { |     public void swap(String world, PlotId id, PlotId plotid) { | ||||||
|         // TODO Auto-generated method stub |         // TODO Auto-generated method stub | ||||||
| @@ -120,4 +114,10 @@ public class SpongeChunkManager extends ChunkManager { | |||||||
|          |          | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public void clearAllEntities(Location pos1, Location pos2) { | ||||||
|  |         // TODO Auto-generated method stub | ||||||
|  |          | ||||||
|  |     } | ||||||
|  |      | ||||||
| } | } | ||||||
|   | |||||||
| @@ -11,7 +11,7 @@ database: false | |||||||
| commands: | commands: | ||||||
|   plots: |   plots: | ||||||
|     description: PlotSquared PlotSquared command. |     description: PlotSquared PlotSquared command. | ||||||
|     aliases: [p,plot,ps,plotsquared,p2] |     aliases: [p,plot,ps,plotsquared,p2,2] | ||||||
|     permission: plots.use |     permission: plots.use | ||||||
|     permission-message: "You are lacking the permission node 'plots.use'" |     permission-message: "You are lacking the permission node 'plots.use'" | ||||||
| permissions: | permissions: | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user
	 boy0001
					boy0001