diff --git a/src/main/java/com/intellectualcrafters/plot/PS.java b/src/main/java/com/intellectualcrafters/plot/PS.java
index 895c8d6b9..090228f0d 100644
--- a/src/main/java/com/intellectualcrafters/plot/PS.java
+++ b/src/main/java/com/intellectualcrafters/plot/PS.java
@@ -1,5 +1,38 @@
package com.intellectualcrafters.plot;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.nio.file.Files;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Objects;
+import java.util.Set;
+import java.util.UUID;
+import java.util.regex.Pattern;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
+
import com.intellectualcrafters.configuration.ConfigurationSection;
import com.intellectualcrafters.configuration.MemorySection;
import com.intellectualcrafters.configuration.file.YamlConfiguration;
@@ -55,39 +88,6 @@ import com.intellectualcrafters.plot.util.area.QuadMap;
import com.plotsquared.listener.WESubscriber;
import com.sk89q.worldedit.WorldEdit;
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.net.MalformedURLException;
-import java.net.URISyntaxException;
-import java.net.URL;
-import java.net.URLConnection;
-import java.nio.file.Files;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.ArrayDeque;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.Objects;
-import java.util.Set;
-import java.util.UUID;
-import java.util.regex.Pattern;
-import java.util.zip.ZipEntry;
-import java.util.zip.ZipInputStream;
-
/**
* An implementation of the core,
* with a static getter for easy access
@@ -1260,6 +1260,18 @@ public class PS {
return new HashSet<>(myplots);
}
+ /**
+ * Use {@link #hasPlotArea(String)}
+ * Note: Worlds may have more than one plot area
+ * @deprecated
+ * @param world
+ * @return
+ */
+ @Deprecated
+ public boolean isPlotWorld(String world) {
+ return plotareamap.containsKey(world);
+ }
+
/**
* Check if a plot world
* @param world
diff --git a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java
index 8149b3059..7f557c730 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java
@@ -20,6 +20,16 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.util;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.UUID;
+import java.util.regex.Matcher;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
@@ -38,21 +48,24 @@ import com.intellectualcrafters.plot.object.PseudoRandom;
import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.object.RunnableVal;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.UUID;
-import java.util.regex.Matcher;
-
/**
* plot functions
*
*/
public class MainUtil {
+
+ /**
+ *
+ * @deprecated
+ * @param loc
+ * @return
+ */
+ @Deprecated
+ public static PlotId getPlotId(Location loc) {
+ PlotArea area = loc.getPlotArea();
+ return area == null ? null : area.getPlotManager().getPlotId(area, loc.getX(), loc.getY(), loc.getZ());
+ }
+
/**
* If the NMS code for sending chunk updates is functional
* - E.g. If using an older version of Bukkit, or before the plugin is updated to 1.5
diff --git a/src/main/java/com/intellectualcrafters/plot/util/ReflectionUtils.java b/src/main/java/com/intellectualcrafters/plot/util/ReflectionUtils.java
index 0f95ff3b0..79e637c4a 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/ReflectionUtils.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/ReflectionUtils.java
@@ -24,6 +24,7 @@ import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@@ -51,6 +52,36 @@ public class ReflectionUtils {
}
}
+ public static Method findMethod(Class> clazz, boolean isStatic, Class> returnType, Class... types) {
+ System.out.println("CLASS: " + clazz + " | " + isStatic + " | " + returnType + " | " + types.length);
+ loop: for (Method method : clazz.getMethods()) {
+ Class> result = method.getReturnType();
+ Class>[] param = method.getParameterTypes();
+ int paramCount = param.length;
+ boolean stc = Modifier.isStatic(method.getModifiers());
+ if (stc == isStatic && result == returnType && types.length == paramCount) {
+ for (int i = 0; i < types.length; i++) {
+ if (types[i] != param[i]) {
+ continue loop;
+ }
+ }
+ method.setAccessible(true);
+ return method;
+ }
+ }
+ throw new RuntimeException("no such method");
+ }
+
+ public static Field findField(Class> clazz, Class> fieldClass) {
+ for (Field field : clazz.getFields()) {
+ if (field.getClass() == fieldClass) {
+ field.setAccessible(true);
+ return field;
+ }
+ }
+ return null;
+ }
+
public static List getStaticFields(Class clazz) {
ArrayList list = new ArrayList();
try {
diff --git a/src/main/java/com/plotsquared/sponge/listener/MainListener.java b/src/main/java/com/plotsquared/sponge/listener/MainListener.java
index bdeeb8f7e..63436c476 100644
--- a/src/main/java/com/plotsquared/sponge/listener/MainListener.java
+++ b/src/main/java/com/plotsquared/sponge/listener/MainListener.java
@@ -716,7 +716,7 @@ public class MainListener {
if (plotworld == null) {
return;
}
- final PlotManager plotManager = PS.get().getPlotManager(PS.get().getPlot(plotworld, plotworld.getMin()));
+ final PlotManager plotManager = plotworld.getPlotManager();
final PlotId id = plotManager.getPlotId(plotworld, x2, 0, MathMan.roundInt(to.getZ()));
final Plot lastPlot = (Plot) pp.getMeta("lastplot");
if (id == null) {
@@ -772,7 +772,7 @@ public class MainListener {
if (plotworld == null) {
return;
}
- final PlotManager plotManager = PS.get().getPlot(plotworld, plotworld.getMin()).getManager();
+ final PlotManager plotManager = plotworld.getPlotManager();
final PlotId id = plotManager.getPlotId(plotworld, x2, 0, z2);
final Plot lastPlot = pp.getMeta("lastplot");
if (id == null) {
diff --git a/src/main/java/com/plotsquared/sponge/util/block/FastChunk.java b/src/main/java/com/plotsquared/sponge/util/block/FastChunk.java
new file mode 100644
index 000000000..4fc514d20
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/util/block/FastChunk.java
@@ -0,0 +1,5 @@
+package com.plotsquared.sponge.util.block;
+
+public class FastChunk {
+
+}