diff --git a/pom.xml b/pom.xml
index 7377de277..1d0607571 100644
--- a/pom.xml
+++ b/pom.xml
@@ -134,7 +134,7 @@
org.spongepowered
spongeapi
- 2.1-20150716.174735-128
+ 2.1-SNAPSHOT
org.bukkit
diff --git a/src/main/java/com/intellectualcrafters/configuration/MemorySection.java b/src/main/java/com/intellectualcrafters/configuration/MemorySection.java
index 2affed2a7..2c3bc0f4c 100644
--- a/src/main/java/com/intellectualcrafters/configuration/MemorySection.java
+++ b/src/main/java/com/intellectualcrafters/configuration/MemorySection.java
@@ -1,6 +1,11 @@
package com.intellectualcrafters.configuration;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
/**
* A type of {@link ConfigurationSection} that is stored in memory.
diff --git a/src/main/java/com/intellectualcrafters/configuration/file/FileConfiguration.java b/src/main/java/com/intellectualcrafters/configuration/file/FileConfiguration.java
index 5167892bf..171374deb 100644
--- a/src/main/java/com/intellectualcrafters/configuration/file/FileConfiguration.java
+++ b/src/main/java/com/intellectualcrafters/configuration/file/FileConfiguration.java
@@ -1,13 +1,24 @@
package com.intellectualcrafters.configuration.file;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
+import java.io.Reader;
+import java.io.Writer;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+
+import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
+
import com.intellectualcrafters.configuration.Configuration;
import com.intellectualcrafters.configuration.InvalidConfigurationException;
import com.intellectualcrafters.configuration.MemoryConfiguration;
-import org.yaml.snakeyaml.external.biz.base64Coder.Base64Coder;
-
-import java.io.*;
-import java.nio.charset.Charset;
-import java.nio.charset.StandardCharsets;
/**
* This is a base class for all File based implementations of {@link
diff --git a/src/main/java/com/intellectualcrafters/configuration/file/YamlConfiguration.java b/src/main/java/com/intellectualcrafters/configuration/file/YamlConfiguration.java
index 289e93caa..d1277be62 100644
--- a/src/main/java/com/intellectualcrafters/configuration/file/YamlConfiguration.java
+++ b/src/main/java/com/intellectualcrafters/configuration/file/YamlConfiguration.java
@@ -1,14 +1,5 @@
package com.intellectualcrafters.configuration.file;
-import com.intellectualcrafters.configuration.Configuration;
-import com.intellectualcrafters.configuration.ConfigurationSection;
-import com.intellectualcrafters.configuration.InvalidConfigurationException;
-import com.intellectualcrafters.plot.PS;
-import org.yaml.snakeyaml.DumperOptions;
-import org.yaml.snakeyaml.Yaml;
-import org.yaml.snakeyaml.error.YAMLException;
-import org.yaml.snakeyaml.representer.Representer;
-
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
@@ -17,6 +8,16 @@ import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.Map;
+import org.yaml.snakeyaml.DumperOptions;
+import org.yaml.snakeyaml.Yaml;
+import org.yaml.snakeyaml.error.YAMLException;
+import org.yaml.snakeyaml.representer.Representer;
+
+import com.intellectualcrafters.configuration.Configuration;
+import com.intellectualcrafters.configuration.ConfigurationSection;
+import com.intellectualcrafters.configuration.InvalidConfigurationException;
+import com.intellectualcrafters.plot.PS;
+
/**
* An implementation of {@link Configuration} which saves all files in Yaml.
* Note that this implementation is not synchronized.
@@ -186,11 +187,11 @@ public class YamlConfiguration extends FileConfiguration {
dest = new File(file.getAbsolutePath() + "_broken_" + i++);
}
Files.copy( file.toPath(), dest.toPath() , StandardCopyOption.REPLACE_EXISTING);
- PS.log("&dCould not read: &7" + file);
- PS.log("&drenamed to: &7" + dest.getName());
- PS.log("&c============ Full stacktrace ============");
+ PS.debug("&dCould not read: &7" + file);
+ PS.debug("&drenamed to: &7" + dest.getName());
+ PS.debug("&c============ Full stacktrace ============");
ex.printStackTrace();
- PS.log("&c=========================================");
+ PS.debug("&c=========================================");
} catch (IOException e) {
e.printStackTrace();
}
@@ -222,11 +223,11 @@ public class YamlConfiguration extends FileConfiguration {
try {
config.load(stream);
} catch (IOException ex) {
- PS.log("Cannot load configuration from stream");
+ PS.debug("Cannot load configuration from stream");
ex.printStackTrace();
} catch (InvalidConfigurationException ex) {
ex.printStackTrace();
- PS.log("Cannot load configuration from stream");
+ PS.debug("Cannot load configuration from stream");
}
return config;
@@ -252,10 +253,10 @@ public class YamlConfiguration extends FileConfiguration {
try {
config.load(reader);
} catch (IOException ex) {
- PS.log("Cannot load configuration from stream");
+ PS.debug("Cannot load configuration from stream");
ex.printStackTrace();
} catch (InvalidConfigurationException ex) {
- PS.log("Cannot load configuration from stream");
+ PS.debug("Cannot load configuration from stream");
ex.printStackTrace();
}
diff --git a/src/main/java/com/intellectualcrafters/configuration/file/YamlConstructor.java b/src/main/java/com/intellectualcrafters/configuration/file/YamlConstructor.java
index 1c2f9f1bb..5a8b41732 100644
--- a/src/main/java/com/intellectualcrafters/configuration/file/YamlConstructor.java
+++ b/src/main/java/com/intellectualcrafters/configuration/file/YamlConstructor.java
@@ -1,13 +1,14 @@
package com.intellectualcrafters.configuration.file;
-import com.intellectualcrafters.configuration.serialization.ConfigurationSerialization;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
import org.yaml.snakeyaml.constructor.SafeConstructor;
import org.yaml.snakeyaml.error.YAMLException;
import org.yaml.snakeyaml.nodes.Node;
import org.yaml.snakeyaml.nodes.Tag;
-import java.util.LinkedHashMap;
-import java.util.Map;
+import com.intellectualcrafters.configuration.serialization.ConfigurationSerialization;
public class YamlConstructor extends SafeConstructor {
diff --git a/src/main/java/com/intellectualcrafters/configuration/file/YamlRepresenter.java b/src/main/java/com/intellectualcrafters/configuration/file/YamlRepresenter.java
index d055246da..d4ef6da29 100644
--- a/src/main/java/com/intellectualcrafters/configuration/file/YamlRepresenter.java
+++ b/src/main/java/com/intellectualcrafters/configuration/file/YamlRepresenter.java
@@ -1,13 +1,14 @@
package com.intellectualcrafters.configuration.file;
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+import org.yaml.snakeyaml.nodes.Node;
+import org.yaml.snakeyaml.representer.Representer;
+
import com.intellectualcrafters.configuration.ConfigurationSection;
import com.intellectualcrafters.configuration.serialization.ConfigurationSerializable;
import com.intellectualcrafters.configuration.serialization.ConfigurationSerialization;
-import org.yaml.snakeyaml.nodes.Node;
-import org.yaml.snakeyaml.representer.Representer;
-
-import java.util.LinkedHashMap;
-import java.util.Map;
public class YamlRepresenter extends Representer {
diff --git a/src/main/java/com/intellectualcrafters/configuration/serialization/ConfigurationSerialization.java b/src/main/java/com/intellectualcrafters/configuration/serialization/ConfigurationSerialization.java
index 2ccc1c7f4..db59bff3f 100644
--- a/src/main/java/com/intellectualcrafters/configuration/serialization/ConfigurationSerialization.java
+++ b/src/main/java/com/intellectualcrafters/configuration/serialization/ConfigurationSerialization.java
@@ -1,7 +1,5 @@
package com.intellectualcrafters.configuration.serialization;
-import com.intellectualcrafters.configuration.Configuration;
-
import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
@@ -11,6 +9,8 @@ import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
+import com.intellectualcrafters.configuration.Configuration;
+
/**
* Utility class for storing and retrieving classes for {@link Configuration}.
*/
diff --git a/src/main/java/com/intellectualcrafters/jnbt/CompoundTagBuilder.java b/src/main/java/com/intellectualcrafters/jnbt/CompoundTagBuilder.java
index d1e11b254..3036481f2 100644
--- a/src/main/java/com/intellectualcrafters/jnbt/CompoundTagBuilder.java
+++ b/src/main/java/com/intellectualcrafters/jnbt/CompoundTagBuilder.java
@@ -1,10 +1,10 @@
package com.intellectualcrafters.jnbt;
+import static com.google.common.base.Preconditions.checkNotNull;
+
import java.util.HashMap;
import java.util.Map;
-import static com.google.common.base.Preconditions.checkNotNull;
-
/**
* Helps create compound tags.
*/
diff --git a/src/main/java/com/intellectualcrafters/jnbt/ListTag.java b/src/main/java/com/intellectualcrafters/jnbt/ListTag.java
index 0a742dd98..5a0cd5faf 100644
--- a/src/main/java/com/intellectualcrafters/jnbt/ListTag.java
+++ b/src/main/java/com/intellectualcrafters/jnbt/ListTag.java
@@ -1,11 +1,11 @@
package com.intellectualcrafters.jnbt;
+import static com.google.common.base.Preconditions.checkNotNull;
+
import java.util.Collections;
import java.util.List;
import java.util.NoSuchElementException;
-import static com.google.common.base.Preconditions.checkNotNull;
-
/**
* The {@code TAG_List} tag.
diff --git a/src/main/java/com/intellectualcrafters/jnbt/ListTagBuilder.java b/src/main/java/com/intellectualcrafters/jnbt/ListTagBuilder.java
index 6c438eaa6..af94f866d 100644
--- a/src/main/java/com/intellectualcrafters/jnbt/ListTagBuilder.java
+++ b/src/main/java/com/intellectualcrafters/jnbt/ListTagBuilder.java
@@ -1,12 +1,12 @@
package com.intellectualcrafters.jnbt;
+import static com.google.common.base.Preconditions.checkNotNull;
+
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
-import static com.google.common.base.Preconditions.checkNotNull;
-
/**
* Helps create list tags.
*/
diff --git a/src/main/java/com/intellectualcrafters/json/JSONObject.java b/src/main/java/com/intellectualcrafters/json/JSONObject.java
index bc8590363..3cac13db7 100644
--- a/src/main/java/com/intellectualcrafters/json/JSONObject.java
+++ b/src/main/java/com/intellectualcrafters/json/JSONObject.java
@@ -6,8 +6,15 @@ import java.io.Writer;
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.lang.reflect.Modifier;
-import java.util.*;
+import java.util.Collection;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Locale;
+import java.util.Map;
import java.util.Map.Entry;
+import java.util.ResourceBundle;
+import java.util.Set;
/**
* A JSONObject is an unordered collection of name/value pairs. Its external form is a string wrapped in curly braces
diff --git a/src/main/java/com/intellectualcrafters/json/JSONTokener.java b/src/main/java/com/intellectualcrafters/json/JSONTokener.java
index cc96356e8..0c86068ea 100644
--- a/src/main/java/com/intellectualcrafters/json/JSONTokener.java
+++ b/src/main/java/com/intellectualcrafters/json/JSONTokener.java
@@ -1,6 +1,11 @@
package com.intellectualcrafters.json;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.Reader;
+import java.io.StringReader;
/**
* A JSONTokener takes a source string and extracts characters and tokens from it. It is used by the JSONObject and
diff --git a/src/main/java/com/intellectualcrafters/plot/IPlotMain.java b/src/main/java/com/intellectualcrafters/plot/IPlotMain.java
index ad8a2faa8..3e16674cc 100644
--- a/src/main/java/com/intellectualcrafters/plot/IPlotMain.java
+++ b/src/main/java/com/intellectualcrafters/plot/IPlotMain.java
@@ -1,14 +1,20 @@
package com.intellectualcrafters.plot;
-import com.intellectualcrafters.plot.config.C;
+import java.io.File;
+
import com.intellectualcrafters.plot.generator.HybridUtils;
import com.intellectualcrafters.plot.generator.PlotGenerator;
import com.intellectualcrafters.plot.object.PlotPlayer;
-import com.intellectualcrafters.plot.util.*;
-import com.plotsquared.listener.APlotListener;
-
-import java.io.File;
-import java.util.UUID;
+import com.intellectualcrafters.plot.util.AbstractTitle;
+import com.intellectualcrafters.plot.util.BlockManager;
+import com.intellectualcrafters.plot.util.ChunkManager;
+import com.intellectualcrafters.plot.util.EconHandler;
+import com.intellectualcrafters.plot.util.EventUtil;
+import com.intellectualcrafters.plot.util.InventoryUtil;
+import com.intellectualcrafters.plot.util.SchematicHandler;
+import com.intellectualcrafters.plot.util.SetupUtils;
+import com.intellectualcrafters.plot.util.TaskManager;
+import com.intellectualcrafters.plot.util.UUIDHandlerImplementation;
public interface IPlotMain {
@@ -42,7 +48,13 @@ public interface IPlotMain {
* @return
*/
int[] getServerVersion();
-
+
+ /**
+ * Get the schematic handler
+ * @return
+ */
+ SchematicHandler initSchematicHandler();
+
/**
* The task manager will run and manage minecraft tasks
* @return
@@ -168,13 +180,6 @@ public interface IPlotMain {
*/
PlotGenerator> getGenerator(String world, String name);
- /**
- * Get the PlotListener class for this implementation
- * (We should try to make this generic so we don't need this)
- * @return
- */
- APlotListener initPlotListener();
-
/**
* Register the chunk processor which will clean out chunks that have too many blockstates or entities
*/
@@ -185,15 +190,15 @@ public interface IPlotMain {
*/
void registerWorldEvents();
- /**
- * This class is currently really empty, but player related stuff can go in here
- * @return
- */
- PlayerManager initPlayerManager();
-
/**
* Get the name of the server
* @return
*/
String getServerName();
+
+ /**
+ * Get the class that will manage player titles
+ * @return
+ */
+ AbstractTitle initTitleManager();
}
diff --git a/src/main/java/com/intellectualcrafters/plot/PS.java b/src/main/java/com/intellectualcrafters/plot/PS.java
index 29c5f7c8a..be60c6b81 100644
--- a/src/main/java/com/intellectualcrafters/plot/PS.java
+++ b/src/main/java/com/intellectualcrafters/plot/PS.java
@@ -1,33 +1,85 @@
package com.intellectualcrafters.plot;
-import com.intellectualcrafters.configuration.ConfigurationSection;
-import com.intellectualcrafters.configuration.file.YamlConfiguration;
-import com.intellectualcrafters.plot.config.C;
-import com.intellectualcrafters.plot.config.Configuration;
-import com.intellectualcrafters.plot.config.Settings;
-import com.intellectualcrafters.plot.database.*;
-import com.intellectualcrafters.plot.flag.AbstractFlag;
-import com.intellectualcrafters.plot.flag.FlagManager;
-import com.intellectualcrafters.plot.flag.FlagValue;
-import com.intellectualcrafters.plot.generator.*;
-import com.intellectualcrafters.plot.object.*;
-import com.intellectualcrafters.plot.util.*;
-import com.plotsquared.listener.APlotListener;
-import com.sk89q.worldedit.bukkit.WorldEditPlugin;
-
-import java.io.*;
+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.URL;
import java.net.URLConnection;
import java.nio.file.Files;
import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
-import java.util.*;
+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.LinkedHashMap;
+import java.util.LinkedHashSet;
+import java.util.List;
+import java.util.Map;
import java.util.Map.Entry;
+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.file.YamlConfiguration;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.config.Configuration;
+import com.intellectualcrafters.plot.config.Settings;
+import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.database.Database;
+import com.intellectualcrafters.plot.database.MySQL;
+import com.intellectualcrafters.plot.database.SQLManager;
+import com.intellectualcrafters.plot.database.SQLite;
+import com.intellectualcrafters.plot.flag.AbstractFlag;
+import com.intellectualcrafters.plot.flag.FlagManager;
+import com.intellectualcrafters.plot.flag.FlagValue;
+import com.intellectualcrafters.plot.generator.ClassicPlotWorld;
+import com.intellectualcrafters.plot.generator.HybridPlotWorld;
+import com.intellectualcrafters.plot.generator.HybridUtils;
+import com.intellectualcrafters.plot.generator.PlotGenerator;
+import com.intellectualcrafters.plot.generator.SquarePlotManager;
+import com.intellectualcrafters.plot.generator.SquarePlotWorld;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotAnalysis;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.object.PlotCluster;
+import com.intellectualcrafters.plot.object.PlotFilter;
+import com.intellectualcrafters.plot.object.PlotHandler;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotManager;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.util.AbstractTitle;
+import com.intellectualcrafters.plot.util.BlockManager;
+import com.intellectualcrafters.plot.util.ChunkManager;
+import com.intellectualcrafters.plot.util.ClusterManager;
+import com.intellectualcrafters.plot.util.CommentManager;
+import com.intellectualcrafters.plot.util.EconHandler;
+import com.intellectualcrafters.plot.util.EventUtil;
+import com.intellectualcrafters.plot.util.ExpireManager;
+import com.intellectualcrafters.plot.util.InventoryUtil;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.MathMan;
+import com.intellectualcrafters.plot.util.PlotGamemode;
+import com.intellectualcrafters.plot.util.PlotWeather;
+import com.intellectualcrafters.plot.util.SchematicHandler;
+import com.intellectualcrafters.plot.util.SetupUtils;
+import com.intellectualcrafters.plot.util.StringMan;
+import com.intellectualcrafters.plot.util.TaskManager;
+import com.intellectualcrafters.plot.util.UUIDHandler;
+import com.sk89q.worldedit.bukkit.WorldEditPlugin;
+
/**
* An implementation of the core,
* with a static getter for easy access
@@ -143,11 +195,11 @@ public class PS {
BlockManager.manager = IMP.initBlockManager();
// Set chunk
ChunkManager.manager = IMP.initChunkManager();
- // Plot listener
- APlotListener.manager = IMP.initPlotListener();
- // Player manager
- PlayerManager.manager = IMP.initPlayerManager();
-
+ // Schematic handler
+ SchematicHandler.manager = IMP.initSchematicHandler();
+ // Titles
+ AbstractTitle.TITLE_CLASS = IMP.initTitleManager();
+
// Check for updates
TaskManager.runTaskAsync(new Runnable() {
@Override
@@ -248,6 +300,18 @@ public class PS {
public static void log(final String message) {
get().IMP.log(message);
}
+
+ /**
+ * Log a message to the IPlotMain logger
+ *
+ * @param message Message to log
+ * @see IPlotMain#log(String)
+ */
+ public static void debug(final String message) {
+ if (Settings.DEBUG) {
+ get().IMP.log(message);
+ }
+ }
/**
* Get the database object
@@ -724,7 +788,7 @@ public class PS {
* @param world The world to load
* @param generator The generator for that world, or null if no generator
*/
- public void loadWorld(final String world, PlotGenerator generator) {
+ public void loadWorld(final String world, PlotGenerator> generator) {
PlotWorld plotWorld = getPlotWorld(world);
if (plotWorld != null) {
if (generator != null) {
@@ -733,7 +797,7 @@ public class PS {
return;
}
final Set worlds = (config.contains("worlds") ? config.getConfigurationSection("worlds").getKeys(false) : new HashSet());
- final PlotGenerator plotGenerator;
+ final PlotGenerator> plotGenerator;
final PlotManager plotManager;
final String path = "worlds." + world;
if (!LOADING_WORLD && (generator.isFull())) {
@@ -981,18 +1045,18 @@ public class PS {
stream.close();
in.close();
if (new_ver == null || !canUpdate(cur_ver, new_ver)) {
- PS.log("&7PlotSquared is already up to date!");
+ PS.debug("&7PlotSquared is already up to date!");
return null;
}
if (link == null) {
- PS.log("&dCould not check for updates");
- PS.log("&7 - Manually check for updates: " + url);
+ PS.debug("&dCould not check for updates");
+ PS.debug("&7 - Manually check for updates: " + url);
return null;
}
return link;
} catch (Exception e) {
- PS.log("&dCould not check for updates");
- PS.log("&7 - Manually check for updates: " + url);
+ PS.debug("&dCould not check for updates");
+ PS.debug("&7 - Manually check for updates: " + url);
return null;
}
}
@@ -1205,20 +1269,23 @@ public class PS {
FlagManager.addFlag(new AbstractFlag("ice-met", new FlagValue.BooleanValue()));
FlagManager.addFlag(new AbstractFlag("gamemode") {
- public String parseValueRaw(final String value) {
- switch (value) {
- case "creative":
- case "c":
- case "1":
- return "creative";
+ public PlotGamemode parseValueRaw(final String value) {
+ switch (value.toLowerCase()) {
case "survival":
case "s":
case "0":
- return "survival";
+ return PlotGamemode.SURVIVAL;
+ case "creative":
+ case "c":
+ case "1":
+ return PlotGamemode.CREATIVE;
case "adventure":
case "a":
case "2":
- return "adventure";
+ return PlotGamemode.ADVENTURE;
+ case "spectator":
+ case "3":
+ return PlotGamemode.SPECTATOR;
default:
return null;
}
@@ -1226,26 +1293,25 @@ public class PS {
public String getValueDesc() {
- return "Flag value must be a gamemode: 'creative' , 'survival' or 'adventure'";
+ return "Flag value must be a gamemode: 'creative' , 'survival', 'adventure' or 'spectator'";
}
});
FlagManager.addFlag(new AbstractFlag("price", new FlagValue.UnsignedDoubleValue()));
FlagManager.addFlag(new AbstractFlag("time", new FlagValue.LongValue()));
FlagManager.addFlag(new AbstractFlag("weather") {
- public String parseValueRaw(final String value) {
+ public PlotWeather parseValueRaw(final String value) {
switch (value) {
case "rain":
case "storm":
case "on":
- return "rain";
case "lightning":
case "thunder":
- return "thunder";
+ return PlotWeather.RAIN;
case "clear":
case "off":
case "sun":
- return "clear";
+ return PlotWeather.CLEAR;
default:
return null;
}
diff --git a/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java b/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java
index 88c978c1d..ae195a051 100644
--- a/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java
+++ b/src/main/java/com/intellectualcrafters/plot/api/PlotAPI.java
@@ -21,6 +21,15 @@
package com.intellectualcrafters.plot.api;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Set;
+
+import org.bukkit.Location;
+import org.bukkit.World;
+import org.bukkit.entity.Player;
+import org.bukkit.plugin.java.JavaPlugin;
+
import com.intellectualcrafters.configuration.file.YamlConfiguration;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.commands.MainCommand;
@@ -28,19 +37,21 @@ import com.intellectualcrafters.plot.commands.SubCommand;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.flag.AbstractFlag;
import com.intellectualcrafters.plot.flag.FlagManager;
-import com.intellectualcrafters.plot.object.*;
-import com.intellectualcrafters.plot.util.*;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotManager;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.util.BlockManager;
+import com.intellectualcrafters.plot.util.ChunkManager;
+import com.intellectualcrafters.plot.util.ClusterManager;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.Permissions;
+import com.intellectualcrafters.plot.util.SchematicHandler;
+import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
import com.plotsquared.bukkit.util.bukkit.BukkitSetBlockManager;
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
-import org.bukkit.Location;
-import org.bukkit.World;
-import org.bukkit.entity.Player;
-import org.bukkit.plugin.java.JavaPlugin;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Set;
/**
* PlotSquared API
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Add.java b/src/main/java/com/intellectualcrafters/plot/commands/Add.java
index cf3c51bb1..d4fae324a 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Add.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Add.java
@@ -20,6 +20,8 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.UUID;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
@@ -34,8 +36,6 @@ import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
import com.plotsquared.general.commands.Argument;
import com.plotsquared.general.commands.CommandDeclaration;
-import java.util.UUID;
-
@CommandDeclaration(
command = "add",
aliases = {"a"},
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Auto.java b/src/main/java/com/intellectualcrafters/plot/commands/Auto.java
index 3593557bf..03fa8438c 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Auto.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Auto.java
@@ -23,7 +23,12 @@ package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
-import com.intellectualcrafters.plot.object.*;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotCluster;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.util.ClusterManager;
import com.intellectualcrafters.plot.util.EconHandler;
import com.intellectualcrafters.plot.util.MainUtil;
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Buy.java b/src/main/java/com/intellectualcrafters/plot/commands/Buy.java
index ba15951ee..db6ef3fa9 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Buy.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Buy.java
@@ -26,7 +26,12 @@ import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager;
-import com.intellectualcrafters.plot.object.*;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotHandler;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.util.EconHandler;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.UUIDHandler;
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Claim.java b/src/main/java/com/intellectualcrafters/plot/commands/Claim.java
index 6a58d8c03..8a669d28e 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Claim.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Claim.java
@@ -23,8 +23,16 @@ package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
-import com.intellectualcrafters.plot.object.*;
-import com.intellectualcrafters.plot.util.*;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.object.RunnableVal;
+import com.intellectualcrafters.plot.util.EconHandler;
+import com.intellectualcrafters.plot.util.EventUtil;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.Permissions;
+import com.intellectualcrafters.plot.util.SchematicHandler;
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
import com.plotsquared.general.commands.CommandDeclaration;
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Clear.java b/src/main/java/com/intellectualcrafters/plot/commands/Clear.java
index 3b59c8da0..256f25a0e 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Clear.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Clear.java
@@ -20,6 +20,8 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.Set;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
@@ -27,11 +29,13 @@ import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotPlayer;
-import com.intellectualcrafters.plot.util.*;
+import com.intellectualcrafters.plot.util.CmdConfirm;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.Permissions;
+import com.intellectualcrafters.plot.util.TaskManager;
+import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.CommandDeclaration;
-import java.util.Set;
-
@CommandDeclaration(
command = "clear",
description = "Clear a plot",
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java b/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java
index 1e8bc4e5c..2c2712c01 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Cluster.java
@@ -20,22 +20,34 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.UUID;
+
+import org.bukkit.generator.ChunkGenerator;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
-import com.intellectualcrafters.plot.object.*;
-import com.intellectualcrafters.plot.util.*;
+import com.intellectualcrafters.plot.object.BlockLoc;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotCluster;
+import com.intellectualcrafters.plot.object.PlotClusterId;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.util.ClusterManager;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.Permissions;
+import com.intellectualcrafters.plot.util.SetupUtils;
+import com.intellectualcrafters.plot.util.StringMan;
+import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.bukkit.generator.AugmentedPopulator;
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
import com.plotsquared.bukkit.generator.HybridGen;
import com.plotsquared.general.commands.CommandDeclaration;
-import org.bukkit.generator.ChunkGenerator;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.UUID;
-
@CommandDeclaration(
command = "cluster",
aliases = {"clusters"},
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Comment.java b/src/main/java/com/intellectualcrafters/plot/commands/Comment.java
index dd2c6bde8..d53d7d1d6 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Comment.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Comment.java
@@ -20,6 +20,8 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.Arrays;
+
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
@@ -29,12 +31,9 @@ import com.intellectualcrafters.plot.object.comment.CommentInbox;
import com.intellectualcrafters.plot.object.comment.PlotComment;
import com.intellectualcrafters.plot.util.CommentManager;
import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.StringMan;
import com.plotsquared.general.commands.CommandDeclaration;
-import org.apache.commons.lang.StringUtils;
-
-import java.util.Arrays;
-
@CommandDeclaration(
command = "comment",
aliases = {"msg"},
@@ -48,12 +47,12 @@ public class Comment extends SubCommand {
@Override
public boolean onCommand(PlotPlayer player, String[] args) {
if (args.length < 2) {
- sendMessage(player, C.COMMENT_SYNTAX, StringUtils.join(CommentManager.inboxes.keySet(),"|"));
+ sendMessage(player, C.COMMENT_SYNTAX, StringMan.join(CommentManager.inboxes.keySet(),"|"));
return false;
}
CommentInbox inbox = CommentManager.inboxes.get(args[0].toLowerCase());
if (inbox == null) {
- sendMessage(player, C.COMMENT_SYNTAX, StringUtils.join(CommentManager.inboxes.keySet(),"|"));
+ sendMessage(player, C.COMMENT_SYNTAX, StringMan.join(CommentManager.inboxes.keySet(),"|"));
return false;
}
Plot plot;
@@ -62,7 +61,7 @@ public class Comment extends SubCommand {
int index;
if (id != null) {
if (args.length < 4) {
- sendMessage(player, C.COMMENT_SYNTAX, StringUtils.join(CommentManager.inboxes.keySet(),"|"));
+ sendMessage(player, C.COMMENT_SYNTAX, StringMan.join(CommentManager.inboxes.keySet(),"|"));
return false;
}
index = 2;
@@ -76,12 +75,12 @@ public class Comment extends SubCommand {
sendMessage(player, C.NO_PERM_INBOX, "");
return false;
}
- String message = StringUtils.join(Arrays.copyOfRange(args,index, args.length), " ");
+ String message = StringMan.join(Arrays.copyOfRange(args,index, args.length), " ");
PlotComment comment = new PlotComment(loc.getWorld(), id, message, player.getName(), inbox.toString(), System.currentTimeMillis());
boolean result = inbox.addComment(plot, comment);
if (!result) {
sendMessage(player, C.NO_PLOT_INBOX, "");
- sendMessage(player, C.COMMENT_SYNTAX, StringUtils.join(CommentManager.inboxes.keySet(),"|"));
+ sendMessage(player, C.COMMENT_SYNTAX, StringMan.join(CommentManager.inboxes.keySet(),"|"));
return false;
}
sendMessage(player, C.COMMENT_ADDED);
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Condense.java b/src/main/java/com/intellectualcrafters/plot/commands/Condense.java
index b6f0d84db..7092f126e 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Condense.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Condense.java
@@ -20,17 +20,20 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.MathMan;
import com.plotsquared.general.commands.CommandDeclaration;
-import org.apache.commons.lang.StringUtils;
-
-import java.util.*;
-import java.util.Set;
@CommandDeclaration(
command = "condense",
@@ -43,10 +46,6 @@ public class Condense extends SubCommand {
public static boolean TASK = false;
- public static void sendMessage(final String message) {
- PS.log("&3PlotSquared -> Plot condense&8: &7" + message);
- }
-
@Override
public boolean onCommand(final PlotPlayer plr, String ... args) {
if ((args.length != 2) && (args.length != 3)) {
@@ -72,7 +71,7 @@ public class Condense extends SubCommand {
MainUtil.sendMessage(plr, "/plot condense " + worldname + " start ");
return false;
}
- if (!StringUtils.isNumeric(args[2])) {
+ if (!MathMan.isInteger(args[2])) {
MainUtil.sendMessage(plr, "INVALID RADIUS");
return false;
}
@@ -102,7 +101,7 @@ public class Condense extends SubCommand {
@Override
public void run() {
if (!TASK) {
- sendMessage("CONDENSE TASK CANCELLED");
+ MainUtil.sendMessage(plr, "CONDENSE TASK CANCELLED");
return;
}
to_move.remove(0);
@@ -130,16 +129,16 @@ public class Condense extends SubCommand {
free.remove(0);
}
if (to_move.size() == 0) {
- sendMessage("TASK COMPLETE. PLEASE VERIFY THAT NO NEW PLOTS HAVE BEEN CLAIMED DURING TASK.");
+ MainUtil.sendMessage(plr, "TASK COMPLETE. PLEASE VERIFY THAT NO NEW PLOTS HAVE BEEN CLAIMED DURING TASK.");
TASK = false;
return;
}
if (free.size() == 0) {
- sendMessage("TASK FAILED. NO FREE PLOTS FOUND!");
+ MainUtil.sendMessage(plr, "TASK FAILED. NO FREE PLOTS FOUND!");
TASK = false;
return;
}
- sendMessage("MOVING " + to_move.get(0) + " to " + free.get(0));
+ MainUtil.sendMessage(plr, "MOVING " + to_move.get(0) + " to " + free.get(0));
MainUtil.move(MainUtil.getPlot(worldname, to_move.get(0)), MainUtil.getPlot(worldname, free.get(0)), this);
}
});
@@ -161,7 +160,7 @@ public class Condense extends SubCommand {
MainUtil.sendMessage(plr, "/plot condense " + worldname + " info ");
return false;
}
- if (!StringUtils.isNumeric(args[2])) {
+ if (!MathMan.isInteger(args[2])) {
MainUtil.sendMessage(plr, "INVALID RADIUS");
return false;
}
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Database.java b/src/main/java/com/intellectualcrafters/plot/commands/Database.java
index 1a63e67c1..fc64eaef4 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Database.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Database.java
@@ -1,5 +1,10 @@
package com.intellectualcrafters.plot.commands;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.UUID;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.database.MySQL;
import com.intellectualcrafters.plot.database.SQLManager;
@@ -11,11 +16,6 @@ import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.CommandDeclaration;
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.ArrayList;
-import java.util.UUID;
-
@CommandDeclaration(
command = "database",
aliases = {"convert"},
@@ -30,7 +30,7 @@ public class Database extends SubCommand {
private static boolean sendMessageU(final UUID uuid, final String msg) {
if (uuid == null) {
- PS.log(msg);
+ PS.debug(msg);
} else {
final PlotPlayer p = UUIDHandler.getPlayer(uuid);
if ((p != null) && p.isOnline()) {
@@ -127,11 +127,7 @@ public class Database extends SubCommand {
}
private boolean sendMessage(final PlotPlayer player, final String msg) {
- if (player == null) {
- PS.log(msg);
- } else {
- MainUtil.sendMessage(player, msg);
- }
+ MainUtil.sendMessage(player, msg);
return true;
}
}
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugAllowUnsafe.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugAllowUnsafe.java
index ccdcc6c12..07138829d 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/DebugAllowUnsafe.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugAllowUnsafe.java
@@ -1,13 +1,13 @@
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.config.C;
-import com.intellectualcrafters.plot.object.PlotPlayer;
-import com.plotsquared.general.commands.CommandDeclaration;
-
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.plotsquared.general.commands.CommandDeclaration;
+
@CommandDeclaration(
command = "debugallowunsafe",
description = "Allow unsafe actions until toggled off",
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java
index 86ed50d52..646d7e00d 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugClaimTest.java
@@ -20,17 +20,28 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.ArrayList;
+import java.util.UUID;
+
import com.google.common.collect.BiMap;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
-import com.intellectualcrafters.plot.object.*;
-import com.intellectualcrafters.plot.util.*;
+import com.intellectualcrafters.plot.object.ChunkLoc;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotManager;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.object.StringWrapper;
+import com.intellectualcrafters.plot.util.BlockManager;
+import com.intellectualcrafters.plot.util.ChunkManager;
+import com.intellectualcrafters.plot.util.EventUtil;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.CommandDeclaration;
-import java.util.ArrayList;
-import java.util.UUID;
-
@CommandDeclaration(
command = "debugclaimtest",
description = "If you accidentally delete your database, this command will attempt to restore all plots based on the data from plot sighs. Execution time may vary",
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java
index e3ac427c6..a510f3b00 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugExec.java
@@ -20,23 +20,36 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.config.C;
-import com.intellectualcrafters.plot.flag.FlagManager;
-import com.intellectualcrafters.plot.generator.HybridUtils;
-import com.intellectualcrafters.plot.object.*;
-import com.intellectualcrafters.plot.util.*;
-import com.plotsquared.bukkit.util.BukkitHybridUtils;
-import com.plotsquared.general.commands.CommandDeclaration;
-
-import org.apache.commons.lang.StringUtils;
-import org.bukkit.Bukkit;
-
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.sql.Timestamp;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
+import com.intellectualcrafters.plot.util.StringMan;
+import org.bukkit.Bukkit;
+
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.flag.FlagManager;
+import com.intellectualcrafters.plot.generator.HybridUtils;
+import com.intellectualcrafters.plot.object.ChunkLoc;
+import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotAnalysis;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.RunnableVal;
+import com.intellectualcrafters.plot.util.BlockManager;
+import com.intellectualcrafters.plot.util.ChunkManager;
+import com.intellectualcrafters.plot.util.ExpireManager;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.UUIDHandler;
+import com.plotsquared.bukkit.util.BukkitHybridUtils;
+import com.plotsquared.general.commands.CommandDeclaration;
@CommandDeclaration(
command = "debugexec",
@@ -93,7 +106,7 @@ public class DebugExec extends SubCommand {
PlotAnalysis.calcOptimalModifiers(new Runnable() {
@Override
public void run() {
- PS.log("$1Thank you for calibrating PlotSquared plot expiry");
+ MainUtil.sendMessage(player, "$1Thank you for calibrating PlotSquared plot expiry");
}
}, threshold);
return true;
@@ -122,7 +135,7 @@ public class DebugExec extends SubCommand {
}
case "start-rgar": {
if (args.length != 2) {
- PS.log("&cInvalid syntax: /plot debugexec start-rgar ");
+ MainUtil.sendMessage(player, "&cInvalid syntax: /plot debugexec start-rgar ");
return false;
}
boolean result;
@@ -137,26 +150,26 @@ public class DebugExec extends SubCommand {
result = HybridUtils.manager.scheduleRoadUpdate(args[1], 0);
}
if (!result) {
- PS.log("&cCannot schedule mass schematic update! (Is one already in progress?)");
+ MainUtil.sendMessage(player, "&cCannot schedule mass schematic update! (Is one already in progress?)");
return false;
}
return true;
}
case "stop-rgar": {
if (((BukkitHybridUtils)(HybridUtils.manager)).task == 0) {
- PS.log("&cTASK NOT RUNNING!");
+ MainUtil.sendMessage(player, "&cTASK NOT RUNNING!");
return false;
}
((BukkitHybridUtils)(HybridUtils.manager)).task = 0;
Bukkit.getScheduler().cancelTask(((BukkitHybridUtils)(HybridUtils.manager)).task);
- PS.log("&cCancelling task...");
+ MainUtil.sendMessage(player, "&cCancelling task...");
while (BukkitHybridUtils.chunks.size() > 0) {
ChunkLoc chunk = BukkitHybridUtils.chunks.get(0);
BukkitHybridUtils.chunks.remove(0);
HybridUtils.manager.regenerateRoad(BukkitHybridUtils.world, chunk, 0);
ChunkManager.manager.unloadChunk(BukkitHybridUtils.world, chunk, true, true);
}
- PS.log("&cCancelled!");
+ MainUtil.sendMessage(player, "&cCancelled!");
return true;
}
case "start-expire": {
@@ -261,7 +274,7 @@ public class DebugExec extends SubCommand {
}
}
}
- MainUtil.sendMessage(player, "Possible sub commands: /plot debugexec <" + StringUtils.join(allowed_params, "|") + ">");
+ MainUtil.sendMessage(player, "Possible sub commands: /plot debugexec <" + StringMan.join(allowed_params, "|") + ">");
return true;
}
}
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugFixFlags.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugFixFlags.java
index 9f853f429..86c03de01 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/DebugFixFlags.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugFixFlags.java
@@ -20,6 +20,10 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map.Entry;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
@@ -32,10 +36,6 @@ import com.intellectualcrafters.plot.util.MainUtil;
import com.plotsquared.general.commands.Argument;
import com.plotsquared.general.commands.CommandDeclaration;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map.Entry;
-
@CommandDeclaration(
command = "debugfixflags",
usage = "/plot debugfixflags ",
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugLoadTest.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugLoadTest.java
index 1e25364c9..6a7f22ad4 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/DebugLoadTest.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugLoadTest.java
@@ -20,13 +20,13 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.lang.reflect.Field;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.plotsquared.general.commands.CommandDeclaration;
-import java.lang.reflect.Field;
-
@CommandDeclaration(
command = "debugloadtest",
permission = "plots.debugloadtest",
@@ -44,9 +44,9 @@ public class DebugLoadTest extends SubCommand {
fPlots.setAccessible(true);
fPlots.set(null, DBFunc.getPlots());
} catch (final Exception e) {
- PS.log("&3===FAILED&3===");
+ PS.debug("&3===FAILED&3===");
e.printStackTrace();
- PS.log("&3===END OF STACKTRACE===");
+ PS.debug("&3===END OF STACKTRACE===");
}
return true;
}
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugPaste.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugPaste.java
index 49f88c653..32593bcc5 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/DebugPaste.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugPaste.java
@@ -1,5 +1,11 @@
package com.intellectualcrafters.plot.commands;
+import java.io.File;
+import java.io.IOException;
+
+import org.bukkit.Bukkit;
+import org.bukkit.plugin.Plugin;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotPlayer;
@@ -7,11 +13,6 @@ import com.intellectualcrafters.plot.util.HastebinUtility;
import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.bukkit.BukkitMain;
import com.plotsquared.general.commands.CommandDeclaration;
-import org.bukkit.Bukkit;
-import org.bukkit.plugin.Plugin;
-
-import java.io.File;
-import java.io.IOException;
@CommandDeclaration(
command = "debugpaste",
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java
index fb43aa9d3..a645a6900 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugSaveTest.java
@@ -20,6 +20,8 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.ArrayList;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Plot;
@@ -27,8 +29,6 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil;
import com.plotsquared.general.commands.CommandDeclaration;
-import java.util.ArrayList;
-
@CommandDeclaration(
command = "debugsavetest",
permission = "plots.debugsavetest",
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/DebugUUID.java b/src/main/java/com/intellectualcrafters/plot/commands/DebugUUID.java
index 88e108843..f9120701b 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/DebugUUID.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/DebugUUID.java
@@ -20,6 +20,16 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.io.File;
+import java.io.FilenameFilter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map.Entry;
+import java.util.UUID;
+
+import org.bukkit.Bukkit;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
@@ -30,24 +40,14 @@ import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.StringWrapper;
import com.intellectualcrafters.plot.util.MainUtil;
-import com.intellectualcrafters.plot.util.PlayerManager;
import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler;
+import com.intellectualcrafters.plot.uuid.UUIDWrapper;
import com.plotsquared.bukkit.uuid.DefaultUUIDWrapper;
import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper;
import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
-import com.intellectualcrafters.plot.uuid.UUIDWrapper;
import com.plotsquared.general.commands.Argument;
import com.plotsquared.general.commands.CommandDeclaration;
-import org.bukkit.Bukkit;
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map.Entry;
-import java.util.UUID;
@CommandDeclaration(
command = "uuidconvert",
@@ -115,7 +115,9 @@ public class DebugUUID extends SubCommand {
MainUtil.sendConsoleMessage("&6Beginning UUID mode conversion");
MainUtil.sendConsoleMessage("&7 - Disconnecting players");
for (PlotPlayer user : UUIDHandler.getPlayers().values()) {
- PlayerManager.manager.kickPlayer(user, "PlotSquared UUID conversion has been initiated. You may reconnect when finished.");
+ for (PlotPlayer pp : UUIDHandler.getPlayers().values()) {
+ pp.kick("PlotSquared UUID conversion has been initiated. You may reconnect when finished.");
+ }
}
MainUtil.sendConsoleMessage("&7 - Initializing map");
@@ -145,7 +147,7 @@ public class DebugUUID extends SubCommand {
final UUID uuid = UUID.fromString(s);
uuids.add(uuid);
} catch (final Exception e) {
- PS.log(C.PREFIX.s() + "Invalid playerdata: " + current);
+ MainUtil.sendMessage(plr, C.PREFIX.s() + "Invalid playerdata: " + current);
}
}
}
@@ -176,7 +178,7 @@ public class DebugUUID extends SubCommand {
uCReverse.put(uuid2, uuid);
}
} catch (final Throwable e) {
- PS.log(C.PREFIX.s() + "&6Invalid playerdata: " + uuid.toString() + ".dat");
+ MainUtil.sendMessage(plr, C.PREFIX.s() + "&6Invalid playerdata: " + uuid.toString() + ".dat");
}
}
for (final String name : names) {
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Delete.java b/src/main/java/com/intellectualcrafters/plot/commands/Delete.java
index 1fd5f16b9..3f074685b 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Delete.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Delete.java
@@ -27,7 +27,12 @@ import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PlotWorld;
-import com.intellectualcrafters.plot.util.*;
+import com.intellectualcrafters.plot.util.CmdConfirm;
+import com.intellectualcrafters.plot.util.EconHandler;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.Permissions;
+import com.intellectualcrafters.plot.util.TaskManager;
+import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.CommandDeclaration;
@CommandDeclaration(
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Deny.java b/src/main/java/com/intellectualcrafters/plot/commands/Deny.java
index 8c494d264..f78dfc633 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Deny.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Deny.java
@@ -20,18 +20,22 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.UUID;
+
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
-import com.intellectualcrafters.plot.util.*;
+import com.intellectualcrafters.plot.util.BlockManager;
+import com.intellectualcrafters.plot.util.EventUtil;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.Permissions;
+import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
import com.plotsquared.general.commands.Argument;
import com.plotsquared.general.commands.CommandDeclaration;
-import java.util.UUID;
-
@CommandDeclaration(
command = "deny",
aliases = {"d"},
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Download.java b/src/main/java/com/intellectualcrafters/plot/commands/Download.java
index 738530f48..9255cb5d5 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Download.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Download.java
@@ -1,5 +1,7 @@
package com.intellectualcrafters.plot.commands;
+import java.net.URL;
+
import com.intellectualcrafters.jnbt.CompoundTag;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
@@ -13,8 +15,6 @@ import com.intellectualcrafters.plot.util.SchematicHandler;
import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.general.commands.CommandDeclaration;
-import java.net.URL;
-
@CommandDeclaration(
command = "download",
aliases = {"dl"},
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java b/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java
index 149d2f934..525388248 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/FlagCmd.java
@@ -20,6 +20,12 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+
+import com.intellectualcrafters.plot.util.StringMan;
+
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.flag.AbstractFlag;
@@ -32,11 +38,6 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions;
import com.plotsquared.general.commands.CommandDeclaration;
-import org.apache.commons.lang.StringUtils;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
@CommandDeclaration(
command = "flag",
@@ -122,7 +123,7 @@ public class FlagCmd extends SubCommand {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
return false;
}
- final String value = StringUtils.join(Arrays.copyOfRange(args, 2, args.length), " ");
+ final String value = StringMan.join(Arrays.copyOfRange(args, 2, args.length), " ");
final Object parsed = af.parseValueRaw(value);
if (parsed == null) {
MainUtil.sendMessage(player, "&c" + af.getValueDesc());
@@ -161,7 +162,7 @@ public class FlagCmd extends SubCommand {
return false;
}
if ((args.length == 3) && flag.getAbstractFlag().isList()) {
- final String value = StringUtils.join(Arrays.copyOfRange(args, 2, args.length), " ");
+ final String value = StringMan.join(Arrays.copyOfRange(args, 2, args.length), " ");
((FlagValue.ListValue) flag.getAbstractFlag().value).remove(flag.getValue(), value);
DBFunc.setFlags(plot, plot.getSettings().flags.values());
} else {
@@ -192,7 +193,7 @@ public class FlagCmd extends SubCommand {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
return false;
}
- final String value = StringUtils.join(Arrays.copyOfRange(args, 2, args.length), " ");
+ final String value = StringMan.join(Arrays.copyOfRange(args, 2, args.length), " ");
final Object parsed = af.parseValueRaw(value);
if (parsed == null) {
MainUtil.sendMessage(player, "&c" + af.getValueDesc());
@@ -233,7 +234,7 @@ public class FlagCmd extends SubCommand {
String message = "";
String prefix = "";
for (final String flag : flags.keySet()) {
- message += prefix + "&6" + flag + ": &7" + StringUtils.join(flags.get(flag), ", ");
+ message += prefix + "&6" + flag + ": &7" + StringMan.join(flags.get(flag), ", ");
prefix = "\n";
}
MainUtil.sendMessage(player, message);
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Help.java b/src/main/java/com/intellectualcrafters/plot/commands/Help.java
index f8956af2a..e29b2cf60 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Help.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Help.java
@@ -13,7 +13,6 @@ import com.plotsquared.general.commands.CommandDeclaration;
@CommandDeclaration(
command = "help",
description = "Get this help menu",
- permission = "",
aliases = {"he"},
category = CommandCategory.INFO
)
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Home.java b/src/main/java/com/intellectualcrafters/plot/commands/Home.java
index 9f614d26c..82d6e7ca7 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Home.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Home.java
@@ -20,6 +20,8 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.ArrayList;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot;
@@ -27,8 +29,6 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil;
import com.plotsquared.general.commands.CommandDeclaration;
-import java.util.ArrayList;
-
@CommandDeclaration(
command = "home",
aliases = {"h"},
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java b/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java
index c9c027951..05a43718d 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Inbox.java
@@ -20,6 +20,11 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.ArrayList;
+import java.util.List;
+
+import com.intellectualcrafters.plot.util.StringMan;
+
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
@@ -31,11 +36,6 @@ import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.StringMan;
import com.plotsquared.general.commands.CommandDeclaration;
-import org.apache.commons.lang.StringUtils;
-
-import java.util.ArrayList;
-import java.util.List;
-
@CommandDeclaration(
command = "inbox",
description = "Review the comments for a plot",
@@ -128,7 +128,7 @@ public class Inbox extends SubCommand {
}
final CommentInbox inbox = CommentManager.inboxes.get(args[0].toLowerCase());
if (inbox == null) {
- sendMessage(player, C.INVALID_INBOX, StringUtils.join(CommentManager.inboxes.keySet(),", "));
+ sendMessage(player, C.INVALID_INBOX, StringMan.join(CommentManager.inboxes.keySet(),", "));
return false;
}
player.setMeta("inbox:" + inbox.toString(), System.currentTimeMillis());
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Info.java b/src/main/java/com/intellectualcrafters/plot/commands/Info.java
index 203d9651e..4ac7b18c5 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Info.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Info.java
@@ -20,6 +20,14 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.UUID;
+import java.util.regex.Matcher;
+
+import com.intellectualcrafters.plot.util.StringMan;
+
+import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
@@ -31,18 +39,13 @@ import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotInventory;
import com.intellectualcrafters.plot.object.PlotItemStack;
import com.intellectualcrafters.plot.object.PlotPlayer;
-import com.intellectualcrafters.plot.util.*;
+import com.intellectualcrafters.plot.util.BlockManager;
+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.plotsquared.general.commands.CommandDeclaration;
-import org.apache.commons.lang.StringUtils;
-import org.bukkit.Material;
-import org.bukkit.inventory.ItemStack;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.UUID;
-import java.util.regex.Matcher;
-
@CommandDeclaration(
command = "info",
aliases = {"i"},
@@ -221,7 +224,7 @@ public class Info extends SubCommand {
Flag descriptionFlag = FlagManager.getPlotFlag(plot, "description");
final String description = descriptionFlag == null ? C.NONE.s() : descriptionFlag.getValueString();
- final String flags = StringMan.replaceFromMap("$2" + (StringUtils.join(FlagManager.getPlotFlags(plot.world, plot.getSettings(), true).values(), "").length() > 0 ? StringUtils.join(FlagManager.getPlotFlags(plot.world, plot.getSettings(), true).values(), "$1, $2") : C.NONE.s()), C.replacements);
+ final String flags = StringMan.replaceFromMap("$2" + (StringMan.join(FlagManager.getPlotFlags(plot.world, plot.getSettings(), true).values(), "").length() > 0 ? StringMan.join(FlagManager.getPlotFlags(plot.world, plot.getSettings(), true).values(), "$1, $2") : C.NONE.s()), C.replacements);
final boolean build = plot.isAdded(player.getUUID());
String owner = plot.owner == null ? "unowned" : getPlayerList(plot.getOwners());
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Load.java b/src/main/java/com/intellectualcrafters/plot/commands/Load.java
index c4a1085b7..438326fa1 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Load.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Load.java
@@ -1,5 +1,9 @@
package com.intellectualcrafters.plot.commands;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
@@ -14,10 +18,6 @@ import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.general.commands.CommandDeclaration;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.List;
-
@CommandDeclaration(
command = "load",
aliases = {"restore"},
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java b/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java
index 18bcb74f3..a19264eb4 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/MainCommand.java
@@ -20,9 +20,13 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
-import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.ConsolePlayer;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId;
@@ -37,12 +41,6 @@ import com.plotsquared.general.commands.Command;
import com.plotsquared.general.commands.CommandHandlingOutput;
import com.plotsquared.general.commands.CommandManager;
-import java.text.NumberFormat;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Iterator;
-import java.util.List;
-
/**
* PlotSquared command class
*
@@ -61,39 +59,68 @@ public class MainCommand extends CommandManager {
private MainCommand() {
super(null, new ArrayList>());
- List toAdd = new ArrayList<>(Arrays.asList(
- new Buy(), new Save(), new Load(),
- new Template(), new Download(),
- new Update(), new Template(),
- new Setup(), new DebugUUID(),
- new DebugFill(), new DebugSaveTest(),
- new DebugLoadTest(), new CreateRoadSchematic(),
- new DebugAllowUnsafe(), new RegenAllRoads(),
- new DebugClear(), new Claim(),
- new Auto(), new Home(), new Visit(),
- new TP(), new Set(), new Toggle(),
- new Clear(), new Delete(), new SetOwner(),
- new Trust(), new Add(), new Deny(),
- new Untrust(), new Remove(), new Undeny(),
- new Info(), new list(), new Help(),
- new Debug(), new SchematicCmd(), new plugin(),
- new Purge(), new Reload(), new Merge(),
- new DebugPaste(), new Unlink(), new Kick(),
- new Rate(), new DebugClaimTest(), new Inbox(),
- new Comment(), new Database(), new Swap(),
- new MusicSubcommand(), new DebugRoadRegen(),
- new Trust(), new DebugExec(), new FlagCmd(),
- new Target(), new DebugFixFlags(), new Move(),
- new Condense(), new Condense(), new Copy(),
- new Chat()));
- if (Settings.ENABLE_CLUSTERS) {
- toAdd.add(new Cluster());
- }
- for (final SubCommand cmd : toAdd) {
- if (!createCommand(cmd)) {
- PS.log("Failed to create command: " + cmd.getClass());
- }
- }
+ createCommand(new Buy());
+ createCommand(new Save());
+ createCommand(new Load());
+ createCommand(new Template());
+ createCommand(new Download());
+ createCommand(new Update());
+ createCommand(new Template());
+ createCommand(new Setup());
+// createCommand(new DebugUUID());
+ createCommand(new DebugFill());
+ createCommand(new DebugSaveTest());
+ createCommand(new DebugLoadTest());
+ createCommand(new CreateRoadSchematic());
+ createCommand(new DebugAllowUnsafe());
+ createCommand(new RegenAllRoads());
+ createCommand(new DebugClear());
+ createCommand(new Claim());
+ createCommand(new Auto());
+ createCommand(new Home());
+ createCommand(new Visit());
+ createCommand(new TP());
+ createCommand(new Set());
+ createCommand(new Toggle());
+ createCommand(new Clear());
+ createCommand(new Delete());
+ createCommand(new SetOwner());
+ createCommand(new Trust());
+ createCommand(new Add());
+ createCommand(new Deny());
+ createCommand(new Untrust());
+ createCommand(new Remove());
+ createCommand(new Undeny());
+ createCommand(new Info());
+ createCommand(new list());
+ createCommand(new Help());
+ createCommand(new Debug());
+ createCommand(new SchematicCmd());
+ createCommand(new plugin());
+ createCommand(new Purge());
+ createCommand(new Reload());
+ createCommand(new Merge());
+ createCommand(new DebugPaste());
+ createCommand(new Unlink());
+ createCommand(new Kick());
+ createCommand(new Rate());
+ createCommand(new DebugClaimTest());
+ createCommand(new Inbox());
+ createCommand(new Comment());
+ createCommand(new Database());
+ createCommand(new Swap());
+ createCommand(new MusicSubcommand());
+ createCommand(new DebugRoadRegen());
+ createCommand(new Trust());
+ createCommand(new DebugExec());
+ createCommand(new FlagCmd());
+ createCommand(new Target());
+ createCommand(new DebugFixFlags());
+ createCommand(new Move());
+ createCommand(new Condense());
+ createCommand(new Condense());
+ createCommand(new Copy());
+ createCommand(new Chat());
}
public static boolean no_permission(final PlotPlayer player, final String permission) {
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Merge.java b/src/main/java/com/intellectualcrafters/plot/commands/Merge.java
index ade105c94..949373d40 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Merge.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Merge.java
@@ -20,18 +20,28 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.config.C;
-import com.intellectualcrafters.plot.object.*;
-import com.intellectualcrafters.plot.util.*;
-import com.plotsquared.general.commands.Argument;
-import com.plotsquared.general.commands.CommandDeclaration;
-import org.apache.commons.lang.StringUtils;
-
import java.util.ArrayList;
import java.util.HashSet;
import java.util.UUID;
+import com.intellectualcrafters.plot.util.StringMan;
+
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.util.CmdConfirm;
+import com.intellectualcrafters.plot.util.EconHandler;
+import com.intellectualcrafters.plot.util.EventUtil;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.Permissions;
+import com.intellectualcrafters.plot.util.UUIDHandler;
+import com.plotsquared.general.commands.Argument;
+import com.plotsquared.general.commands.CommandDeclaration;
+
@CommandDeclaration(
command = "merge",
aliases = {"m"},
@@ -91,7 +101,7 @@ public class Merge extends SubCommand {
return false;
}
if (args.length < 1) {
- MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringUtils.join(values, C.BLOCK_LIST_SEPARATER.s()));
+ MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringMan.join(values, C.BLOCK_LIST_SEPARATER.s()));
MainUtil.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(loc.getYaw())));
return false;
}
@@ -103,7 +113,7 @@ public class Merge extends SubCommand {
}
}
if (direction == -1) {
- MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringUtils.join(values, C.BLOCK_LIST_SEPARATER.s()));
+ MainUtil.sendMessage(plr, C.SUBCOMMAND_SET_OPTIONS_HEADER.s() + StringMan.join(values, C.BLOCK_LIST_SEPARATER.s()));
MainUtil.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(loc.getYaw())));
return false;
}
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Move.java b/src/main/java/com/intellectualcrafters/plot/commands/Move.java
index cc35dd5e4..3e4a4076b 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Move.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Move.java
@@ -22,7 +22,11 @@ package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
-import com.intellectualcrafters.plot.object.*;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions;
import com.plotsquared.general.commands.Argument;
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java b/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java
index 2a7adbb02..f5385fde6 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/MusicSubcommand.java
@@ -23,7 +23,12 @@ package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager;
-import com.intellectualcrafters.plot.object.*;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.object.PlotInventory;
+import com.intellectualcrafters.plot.object.PlotItemStack;
+import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.MainUtil;
import com.plotsquared.general.commands.CommandDeclaration;
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Purge.java b/src/main/java/com/intellectualcrafters/plot/commands/Purge.java
index db5b1d9f1..795e362dc 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Purge.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Purge.java
@@ -20,6 +20,11 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.UUID;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
@@ -30,11 +35,6 @@ import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.CommandDeclaration;
-import java.util.Collection;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.UUID;
-
@CommandDeclaration(
command = "purge",
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Rate.java b/src/main/java/com/intellectualcrafters/plot/commands/Rate.java
index 881b2ffbf..93d592be4 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Rate.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Rate.java
@@ -20,25 +20,33 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.config.C;
-import com.intellectualcrafters.plot.config.Settings;
-import com.intellectualcrafters.plot.database.DBFunc;
-import com.intellectualcrafters.plot.object.*;
-import com.intellectualcrafters.plot.util.MainUtil;
-import com.intellectualcrafters.plot.util.TaskManager;
-import com.plotsquared.bukkit.events.PlotRateEvent;
-import com.plotsquared.general.commands.CommandDeclaration;
-import org.apache.commons.lang.StringUtils;
-import org.apache.commons.lang.mutable.MutableInt;
-import org.bukkit.Bukkit;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Map.Entry;
import java.util.UUID;
+import com.intellectualcrafters.plot.util.StringMan;
+
+import org.apache.commons.lang.mutable.MutableInt;
+import org.bukkit.Bukkit;
+
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.config.Settings;
+import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotInventory;
+import com.intellectualcrafters.plot.object.PlotItemStack;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.Rating;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.MathMan;
+import com.intellectualcrafters.plot.util.TaskManager;
+import com.plotsquared.bukkit.events.PlotRateEvent;
+import com.plotsquared.general.commands.CommandDeclaration;
+
@CommandDeclaration(
command = "rate",
permission = "plots.rate",
@@ -118,13 +126,11 @@ public class Rate extends SubCommand {
// handle ratings
int rV = rating.intValue();
// CALL THE EVENT
- PlotRateEvent rateEvent = new PlotRateEvent(player, rV, plot);
+ PlotRateEvent rateEvent = new PlotRateEvent(player, new Rating(rV), plot);
Bukkit.getPluginManager().callEvent(rateEvent);
// DONE CALLING THE EVENT
- // get new rating
- rV = rateEvent.getRating();
// set rating
- plot.getSettings().ratings.put(player.getUUID(), rV);
+ plot.getSettings().ratings.put(player.getUUID(), rateEvent.getRating().getAggregate());
DBFunc.setRating(plot, player.getUUID(), rV);
sendMessage(player, C.RATING_APPLIED, plot.getId().toString());
sendMessage(player, C.RATING_APPLIED, plot.getId().toString());
@@ -134,15 +140,15 @@ public class Rate extends SubCommand {
return false;
}
};
- inventory.setItem(0, new PlotItemStack(35, (short) 12, 0, "0/8", null));
- inventory.setItem(1, new PlotItemStack(35, (short) 14, 1, "1/8", null));
- inventory.setItem(2, new PlotItemStack(35, (short) 1, 2, "2/8", null));
- inventory.setItem(3, new PlotItemStack(35, (short) 4, 3, "3/8", null));
- inventory.setItem(4, new PlotItemStack(35, (short) 5, 4, "4/8", null));
- inventory.setItem(5, new PlotItemStack(35, (short) 9, 5, "5/8", null));
- inventory.setItem(6, new PlotItemStack(35, (short) 11, 6, "6/8", null));
- inventory.setItem(7, new PlotItemStack(35, (short) 10, 7, "7/8", null));
- inventory.setItem(8, new PlotItemStack(35, (short) 2, 8, "8/8", null));
+ inventory.setItem(0, new PlotItemStack(35, (short) 12, 0, "0/8"));
+ inventory.setItem(1, new PlotItemStack(35, (short) 14, 1, "1/8"));
+ inventory.setItem(2, new PlotItemStack(35, (short) 1, 2, "2/8"));
+ inventory.setItem(3, new PlotItemStack(35, (short) 4, 3, "3/8"));
+ inventory.setItem(4, new PlotItemStack(35, (short) 5, 4, "4/8"));
+ inventory.setItem(5, new PlotItemStack(35, (short) 9, 5, "5/8"));
+ inventory.setItem(6, new PlotItemStack(35, (short) 11, 6, "6/8"));
+ inventory.setItem(7, new PlotItemStack(35, (short) 10, 7, "7/8"));
+ inventory.setItem(8, new PlotItemStack(35, (short) 2, 8, "8/8"));
inventory.openInventory();
}
};
@@ -169,7 +175,7 @@ public class Rate extends SubCommand {
}
final int rating;
- if (StringUtils.isNumeric(arg) && arg.length() < 3 && arg.length() > 0) {
+ if (MathMan.isInteger(arg) && arg.length() < 3 && arg.length() > 0) {
rating = Integer.parseInt(arg);
if (rating > 10) {
sendMessage(player, C.RATING_NOT_VALID);
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/RegenAllRoads.java b/src/main/java/com/intellectualcrafters/plot/commands/RegenAllRoads.java
index 714de1c64..f46d5dc8b 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/RegenAllRoads.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/RegenAllRoads.java
@@ -20,6 +20,8 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.List;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.generator.HybridPlotManager;
@@ -32,8 +34,6 @@ import com.intellectualcrafters.plot.util.MainUtil;
import com.plotsquared.general.commands.Argument;
import com.plotsquared.general.commands.CommandDeclaration;
-import java.util.List;
-
@CommandDeclaration(
command = "regenallroads",
description = "Regenerate all roads in the map using the set road schematic",
@@ -70,13 +70,13 @@ public class RegenAllRoads extends SubCommand {
return false;
}
final List chunks = ChunkManager.manager.getChunkChunks(name);
- PS.log("&cIf no schematic is set, the following will not do anything");
- PS.log("&7 - To set a schematic, stand in a plot and use &c/plot createroadschematic");
- PS.log("&6Potential chunks to update: &7" + (chunks.size() * 1024));
- PS.log("&6Estimated time: &7" + (chunks.size()) + " seconds");
+ MainUtil.sendMessage(plr, "&cIf no schematic is set, the following will not do anything");
+ MainUtil.sendMessage(plr, "&7 - To set a schematic, stand in a plot and use &c/plot createroadschematic");
+ MainUtil.sendMessage(plr, "&6Potential chunks to update: &7" + (chunks.size() * 1024));
+ MainUtil.sendMessage(plr, "&6Estimated time: &7" + (chunks.size()) + " seconds");
final boolean result = HybridUtils.manager.scheduleRoadUpdate(name, height);
if (!result) {
- PS.log("&cCannot schedule mass schematic update! (Is one already in progress?)");
+ MainUtil.sendMessage(plr, "&cCannot schedule mass schematic update! (Is one already in progress?)");
return false;
}
return true;
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Remove.java b/src/main/java/com/intellectualcrafters/plot/commands/Remove.java
index 4226d98bf..f1f567dd8 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Remove.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Remove.java
@@ -20,6 +20,10 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.UUID;
+
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
@@ -31,10 +35,6 @@ import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
import com.plotsquared.general.commands.Argument;
import com.plotsquared.general.commands.CommandDeclaration;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.UUID;
-
@CommandDeclaration(
command = "remove",
aliases = {"r"},
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Save.java b/src/main/java/com/intellectualcrafters/plot/commands/Save.java
index c6256ea59..fc10a75f4 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Save.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Save.java
@@ -1,5 +1,9 @@
package com.intellectualcrafters.plot.commands;
+import java.net.URL;
+import java.util.List;
+import java.util.UUID;
+
import com.intellectualcrafters.jnbt.CompoundTag;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
@@ -14,10 +18,6 @@ import com.intellectualcrafters.plot.util.SchematicHandler;
import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.general.commands.CommandDeclaration;
-import java.net.URL;
-import java.util.List;
-import java.util.UUID;
-
@CommandDeclaration(
command = "save",
aliases = {"backup"},
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java b/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java
index 967ef1ea5..a8e1aa946 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/SchematicCmd.java
@@ -20,10 +20,21 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.UUID;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
-import com.intellectualcrafters.plot.object.*;
+import com.intellectualcrafters.plot.object.ConsolePlayer;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.SchematicHandler;
@@ -31,12 +42,6 @@ import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.general.commands.CommandDeclaration;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.UUID;
-
// TODO Add sub-subcommands
@CommandDeclaration(
@@ -193,8 +198,8 @@ public class SchematicCmd extends SubCommand {
return false;
}
else {
- PS.log("&3PlotSquared&8->&3Schemaitc&8: &7Mass export has started. This may take a while.");
- PS.log("&3PlotSquared&8->&3Schemaitc&8: &7Found &c" + plotmap.size() + "&7 plots...");
+ MainUtil.sendMessage(plr, "&3PlotSquared&8->&3Schemaitc&8: &7Mass export has started. This may take a while.");
+ MainUtil.sendMessage(plr, "&3PlotSquared&8->&3Schemaitc&8: &7Found &c" + plotmap.size() + "&7 plots...");
}
break;
}
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Set.java b/src/main/java/com/intellectualcrafters/plot/commands/Set.java
index bdbad1ea9..81dd1cdc9 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Set.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Set.java
@@ -20,22 +20,35 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import com.intellectualcrafters.plot.util.StringMan;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Configuration;
import com.intellectualcrafters.plot.flag.AbstractFlag;
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager;
-import com.intellectualcrafters.plot.object.*;
-import com.intellectualcrafters.plot.util.*;
+import com.intellectualcrafters.plot.object.BlockLoc;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.object.PlotManager;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.object.StringWrapper;
+import com.intellectualcrafters.plot.util.BlockManager;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.Permissions;
+import com.intellectualcrafters.plot.util.SetBlockQueue;
+import com.intellectualcrafters.plot.util.StringComparison;
+import com.intellectualcrafters.plot.util.StringMan;
+import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.CommandDeclaration;
-import com.plotsquared.listener.APlotListener;
-
-import org.apache.commons.lang.StringUtils;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import com.plotsquared.listener.PlotListener;
// TODO Make sub-subcommands
@@ -86,8 +99,8 @@ public class Set extends SubCommand {
}
if (args[0].equalsIgnoreCase("flag")) {
if (args.length < 2) {
- final String message = StringMan.replaceFromMap("$2" + (StringUtils.join(FlagManager.getFlags(plr), "$1, $2")), C.replacements);
- // final String message = StringUtils.join(FlagManager.getFlags(plr), "&c, &6");
+ final String message = StringMan.replaceFromMap("$2" + (StringMan.join(FlagManager.getFlags(plr), "$1, $2")), C.replacements);
+ // final String message = StringMan.join(FlagManager.getFlags(plr), "&c, &6");
MainUtil.sendMessage(plr, C.NEED_KEY.s().replaceAll("%values%", message));
return false;
}
@@ -116,11 +129,11 @@ public class Set extends SubCommand {
return false;
}
MainUtil.sendMessage(plr, C.FLAG_REMOVED);
- APlotListener.manager.plotEntry(plr, plot);
+ PlotListener.plotEntry(plr, plot);
return true;
}
try {
- final String value = StringUtils.join(Arrays.copyOfRange(args, 2, args.length), " ");
+ final String value = StringMan.join(Arrays.copyOfRange(args, 2, args.length), " ");
final Object parsed_value = af.parseValueRaw(value);
if (parsed_value == null) {
MainUtil.sendMessage(plr, af.getValueDesc());
@@ -133,7 +146,7 @@ public class Set extends SubCommand {
return false;
}
MainUtil.sendMessage(plr, C.FLAG_ADDED);
- APlotListener.manager.plotEntry(plr, plot);
+ PlotListener.plotEntry(plr, plot);
return true;
} catch (final Exception e) {
MainUtil.sendMessage(plr, "&c" + e.getMessage());
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java b/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java
index d8ca3b2e3..616639f11 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/SetOwner.java
@@ -20,6 +20,9 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.ArrayList;
+import java.util.UUID;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
@@ -34,9 +37,6 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.Argument;
import com.plotsquared.general.commands.CommandDeclaration;
-import java.util.ArrayList;
-import java.util.UUID;
-
@CommandDeclaration(
command = "setowner",
permission = "plots.set.owner",
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Setup.java b/src/main/java/com/intellectualcrafters/plot/commands/Setup.java
index f0a44ca41..9f4af6dc3 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Setup.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Setup.java
@@ -20,6 +20,13 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Map.Entry;
+
+import com.intellectualcrafters.plot.util.StringMan;
+
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.ConfigurationNode;
import com.intellectualcrafters.plot.config.Settings;
@@ -29,18 +36,8 @@ import com.intellectualcrafters.plot.object.SetupObject;
import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.SetupUtils;
-import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
-import com.plotsquared.bukkit.generator.HybridGen;
import com.plotsquared.general.commands.CommandDeclaration;
-import org.apache.commons.lang.StringUtils;
-import org.bukkit.generator.ChunkGenerator;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import java.util.Map.Entry;
-
@CommandDeclaration(
command = "setup",
permission = "plots.admin.command.setup",
@@ -104,7 +101,7 @@ public class Setup extends SubCommand {
case 0: { // choose generator
if ((args.length != 1) || !SetupUtils.generators.containsKey(args[0])) {
final String prefix = "\n&8 - &7";
- MainUtil.sendMessage(plr, "&cYou must choose a generator!" + prefix + StringUtils.join(SetupUtils.generators.keySet(), prefix).replaceAll("PlotSquared", "&2PlotSquared"));
+ MainUtil.sendMessage(plr, "&cYou must choose a generator!" + prefix + StringMan.join(SetupUtils.generators.keySet(), prefix).replaceAll("PlotSquared", "&2PlotSquared"));
sendMessage(plr, C.SETUP_INIT);
return false;
}
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Swap.java b/src/main/java/com/intellectualcrafters/plot/commands/Swap.java
index 7e5ceb03c..edcdbbd70 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Swap.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Swap.java
@@ -20,16 +20,21 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.ArrayList;
+
import com.intellectualcrafters.plot.config.C;
-import com.intellectualcrafters.plot.object.*;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotCluster;
+import com.intellectualcrafters.plot.object.PlotClusterId;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.ChunkManager;
import com.intellectualcrafters.plot.util.ClusterManager;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions;
import com.plotsquared.general.commands.CommandDeclaration;
-import java.util.ArrayList;
-
@CommandDeclaration(
command = "swap",
description = "Swap two plots",
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/TP.java b/src/main/java/com/intellectualcrafters/plot/commands/TP.java
index c87a473aa..5de0a1572 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/TP.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/TP.java
@@ -20,6 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Location;
@@ -28,10 +29,10 @@ import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.MathMan;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.Argument;
import com.plotsquared.general.commands.CommandDeclaration;
-import org.apache.commons.lang.StringUtils;
@CommandDeclaration(
command = "tp",
@@ -84,7 +85,7 @@ public class TP extends SubCommand {
int index = 0;
if (a.contains(";")) {
final String[] split = a.split(";");
- if ((split[1].length() > 0) && StringUtils.isNumeric(split[1])) {
+ if ((split[1].length() > 0) && MathMan.isInteger(split[1])) {
index = Integer.parseInt(split[1]);
}
a = split[0];
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Template.java b/src/main/java/com/intellectualcrafters/plot/commands/Template.java
index 7f074e3ce..946ce5a84 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Template.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Template.java
@@ -20,18 +20,6 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.configuration.ConfigurationSection;
-import com.intellectualcrafters.configuration.file.YamlConfiguration;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.config.C;
-import com.intellectualcrafters.plot.config.ConfigurationNode;
-import com.intellectualcrafters.plot.object.*;
-import com.intellectualcrafters.plot.util.BlockManager;
-import com.intellectualcrafters.plot.util.MainUtil;
-import com.intellectualcrafters.plot.util.SetupUtils;
-import com.intellectualcrafters.plot.util.TaskManager;
-import com.plotsquared.general.commands.CommandDeclaration;
-
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
@@ -41,6 +29,22 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;
+import com.intellectualcrafters.configuration.ConfigurationSection;
+import com.intellectualcrafters.configuration.file.YamlConfiguration;
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.config.ConfigurationNode;
+import com.intellectualcrafters.plot.object.FileBytes;
+import com.intellectualcrafters.plot.object.PlotManager;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.object.SetupObject;
+import com.intellectualcrafters.plot.util.BlockManager;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.SetupUtils;
+import com.intellectualcrafters.plot.util.TaskManager;
+import com.plotsquared.general.commands.CommandDeclaration;
+
@CommandDeclaration(
command = "template",
permission = "plots.admin",
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Trim.java b/src/main/java/com/intellectualcrafters/plot/commands/Trim.java
index b8d4fdaad..9d5ff0f27 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Trim.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Trim.java
@@ -20,15 +20,6 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.config.C;
-import com.intellectualcrafters.plot.object.*;
-import com.intellectualcrafters.plot.util.BlockManager;
-import com.intellectualcrafters.plot.util.ChunkManager;
-import com.intellectualcrafters.plot.util.MainUtil;
-import com.intellectualcrafters.plot.util.TaskManager;
-import com.plotsquared.general.commands.CommandDeclaration;
-
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -37,6 +28,19 @@ import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.util.HashSet;
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.object.ChunkLoc;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.util.BlockManager;
+import com.intellectualcrafters.plot.util.ChunkManager;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.TaskManager;
+import com.plotsquared.general.commands.CommandDeclaration;
+
@CommandDeclaration(
command = "trim",
permission = "plots.admin",
@@ -72,7 +76,7 @@ public class Trim extends SubCommand {
final ChunkLoc loc = new ChunkLoc(x, z);
empty.add(loc);
} catch (final Exception e) {
- PS.log("INVALID MCA: " + name);
+ PS.debug("INVALID MCA: " + name);
}
} else {
final Path path = Paths.get(file.getPath());
@@ -89,7 +93,7 @@ public class Trim extends SubCommand {
final ChunkLoc loc = new ChunkLoc(x, z);
empty.add(loc);
} catch (final Exception e) {
- PS.log("INVALID MCA: " + name);
+ PS.debug("INVALID MCA: " + name);
}
}
} catch (final Exception e) {
@@ -156,7 +160,7 @@ public class Trim extends SubCommand {
}
public static void sendMessage(final String message) {
- PS.log("&3PlotSquared -> World trim&8: &7" + message);
+ PS.debug("&3PlotSquared -> World trim&8: &7" + message);
}
public PlotId getId(final String id) {
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Trust.java b/src/main/java/com/intellectualcrafters/plot/commands/Trust.java
index c9f3f25ac..e5c69c597 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Trust.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Trust.java
@@ -20,6 +20,8 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.UUID;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
@@ -34,8 +36,6 @@ import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
import com.plotsquared.general.commands.Argument;
import com.plotsquared.general.commands.CommandDeclaration;
-import java.util.UUID;
-
@CommandDeclaration(
command = "trust",
aliases = {"t"},
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Undeny.java b/src/main/java/com/intellectualcrafters/plot/commands/Undeny.java
index 134b41e62..6a9d82764 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Undeny.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Undeny.java
@@ -20,6 +20,9 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.ArrayList;
+import java.util.UUID;
+
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
@@ -31,9 +34,6 @@ import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
import com.plotsquared.general.commands.Argument;
import com.plotsquared.general.commands.CommandDeclaration;
-import java.util.ArrayList;
-import java.util.UUID;
-
@CommandDeclaration(
command = "undeny",
aliases = {"ud"},
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Untrust.java b/src/main/java/com/intellectualcrafters/plot/commands/Untrust.java
index 5d8448d11..766a012d1 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Untrust.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Untrust.java
@@ -20,6 +20,9 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.ArrayList;
+import java.util.UUID;
+
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
@@ -30,9 +33,6 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.Argument;
import com.plotsquared.general.commands.CommandDeclaration;
-import java.util.ArrayList;
-import java.util.UUID;
-
// UNTRUST("untrust", "ut"),
@CommandDeclaration(
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Update.java b/src/main/java/com/intellectualcrafters/plot/commands/Update.java
index ca5c6d5f0..7fa7ccbc1 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Update.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Update.java
@@ -20,15 +20,15 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.net.MalformedURLException;
+import java.net.URL;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil;
import com.plotsquared.general.commands.CommandDeclaration;
-import java.net.MalformedURLException;
-import java.net.URL;
-
@CommandDeclaration(
command = "update",
permission = "plots.admin",
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Visit.java b/src/main/java/com/intellectualcrafters/plot/commands/Visit.java
index 5eae851ed..a039c9936 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/Visit.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/Visit.java
@@ -20,6 +20,10 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.UUID;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot;
@@ -30,10 +34,6 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.Argument;
import com.plotsquared.general.commands.CommandDeclaration;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.UUID;
-
@CommandDeclaration(
command = "visit",
permission = "plots.visit",
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/list.java b/src/main/java/com/intellectualcrafters/plot/commands/list.java
index 55a774f71..b3b7e007d 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/list.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/list.java
@@ -20,6 +20,16 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.UUID;
+
+import com.intellectualcrafters.plot.util.StringMan;
+import org.bukkit.ChatColor;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
@@ -29,17 +39,15 @@ import com.intellectualcrafters.plot.object.ConsolePlayer;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.Rating;
-import com.intellectualcrafters.plot.util.*;
+import com.intellectualcrafters.plot.util.EconHandler;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.Permissions;
+import com.intellectualcrafters.plot.util.StringComparison;
+import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.bukkit.object.BukkitPlayer;
import com.plotsquared.bukkit.util.bukkit.chat.FancyMessage;
import com.plotsquared.general.commands.CommandDeclaration;
-import org.apache.commons.lang.StringUtils;
-import org.bukkit.ChatColor;
-
-import java.util.*;
-import java.util.Map.Entry;
-
@CommandDeclaration(
command = "list",
aliases = {"l"},
@@ -357,7 +365,7 @@ public class list extends SubCommand {
ChatColor.translateAlternateColorCodes('&',
C.PLOT_INFO_MEMBERS.s().replaceAll("%members%", Info.getPlayerList(plot.getMembers())))))
.color(ChatColor.GOLD);
- String strFlags = StringUtils.join(plot.getSettings().flags.values(), ",");
+ String strFlags = StringMan.join(plot.getSettings().flags.values(), ",");
if (strFlags.length() == 0) {
strFlags = C.NONE.s();
}
diff --git a/src/main/java/com/intellectualcrafters/plot/commands/plugin.java b/src/main/java/com/intellectualcrafters/plot/commands/plugin.java
index 798924a71..5c3e71a14 100644
--- a/src/main/java/com/intellectualcrafters/plot/commands/plugin.java
+++ b/src/main/java/com/intellectualcrafters/plot/commands/plugin.java
@@ -20,17 +20,17 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.object.PlotPlayer;
-import com.intellectualcrafters.plot.util.TaskManager;
-import com.plotsquared.general.commands.CommandDeclaration;
-
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.URL;
import java.net.URLConnection;
import java.util.ArrayList;
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.util.TaskManager;
+import com.plotsquared.general.commands.CommandDeclaration;
+
@CommandDeclaration(
command = "plugin",
permission = "plots.use",
diff --git a/src/main/java/com/intellectualcrafters/plot/config/C.java b/src/main/java/com/intellectualcrafters/plot/config/C.java
index 83cc1d34a..ddfcf754e 100644
--- a/src/main/java/com/intellectualcrafters/plot/config/C.java
+++ b/src/main/java/com/intellectualcrafters/plot/config/C.java
@@ -20,16 +20,20 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.config;
+import java.io.File;
+import java.util.EnumSet;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.Set;
+
import com.intellectualcrafters.configuration.ConfigurationSection;
import com.intellectualcrafters.configuration.file.YamlConfiguration;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.StringMan;
import com.plotsquared.general.commands.CommandCaller;
-import org.bukkit.ChatColor;
-
-import java.io.File;
-import java.util.*;
/**
* Captions class.
@@ -377,6 +381,7 @@ public enum C {
* Info
*/
NONE("None", "Info"),
+ UNKNOWN("Unknown", "Info"),
PLOT_UNOWNED("$2The current plot must have an owner to perform this action", "Info"),
PLOT_INFO_UNCLAIMED("$2Plot $1%s$2 is not yet claimed", "Info"),
PLOT_INFO_HEADER("$3&m---------&r $1INFO $3&m---------", false, "Info"),
@@ -672,13 +677,8 @@ public enum C {
return this.prefix;
}
- /**
- * @return translated and color decoded
- *
- * @see org.bukkit.ChatColor#translateAlternateColorCodes(char, String)
- */
- public String translated() {
- return ChatColor.translateAlternateColorCodes('&', this.s());
+ public String formatted() {
+ return StringMan.replaceFromMap(s(), replacements);
}
public String getCat() {
diff --git a/src/main/java/com/intellectualcrafters/plot/config/Configuration.java b/src/main/java/com/intellectualcrafters/plot/config/Configuration.java
index b5715c208..a7af67992 100644
--- a/src/main/java/com/intellectualcrafters/plot/config/Configuration.java
+++ b/src/main/java/com/intellectualcrafters/plot/config/Configuration.java
@@ -20,12 +20,12 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.config;
+import java.util.ArrayList;
+
import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.StringComparison;
-import java.util.ArrayList;
-
/**
* Main Configuration Utility
*
diff --git a/src/main/java/com/intellectualcrafters/plot/config/ConfigurationNode.java b/src/main/java/com/intellectualcrafters/plot/config/ConfigurationNode.java
index 3fb6d5952..c6bb2259e 100644
--- a/src/main/java/com/intellectualcrafters/plot/config/ConfigurationNode.java
+++ b/src/main/java/com/intellectualcrafters/plot/config/ConfigurationNode.java
@@ -20,14 +20,14 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.config;
-import com.intellectualcrafters.plot.config.Configuration.SettingValue;
-import com.intellectualcrafters.plot.object.PlotBlock;
-import com.intellectualcrafters.plot.util.StringMan;
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
+import com.intellectualcrafters.plot.config.Configuration.SettingValue;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.util.StringMan;
+
/**
* Configuration Node
*
diff --git a/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java b/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java
index 083030c13..41c71c73d 100644
--- a/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java
+++ b/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java
@@ -20,12 +20,22 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.database;
-import com.intellectualcrafters.plot.flag.Flag;
-import com.intellectualcrafters.plot.object.*;
-import com.intellectualcrafters.plot.object.comment.PlotComment;
-
import java.sql.SQLException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.Set;
+import java.util.UUID;
+
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotCluster;
+import com.intellectualcrafters.plot.object.PlotClusterId;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.RunnableVal;
+import com.intellectualcrafters.plot.object.comment.PlotComment;
/**
* @author Citymonstret
diff --git a/src/main/java/com/intellectualcrafters/plot/database/DBFunc.java b/src/main/java/com/intellectualcrafters/plot/database/DBFunc.java
index a994566f2..df7da0c27 100644
--- a/src/main/java/com/intellectualcrafters/plot/database/DBFunc.java
+++ b/src/main/java/com/intellectualcrafters/plot/database/DBFunc.java
@@ -20,14 +20,24 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.database;
-import com.intellectualcrafters.plot.flag.Flag;
-import com.intellectualcrafters.plot.object.*;
-import com.intellectualcrafters.plot.object.comment.PlotComment;
-
import java.sql.ResultSet;
import java.sql.ResultSetMetaData;
import java.sql.SQLException;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.LinkedHashMap;
+import java.util.Set;
+import java.util.UUID;
+
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotCluster;
+import com.intellectualcrafters.plot.object.PlotClusterId;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.RunnableVal;
+import com.intellectualcrafters.plot.object.comment.PlotComment;
/**
* DB Functions
diff --git a/src/main/java/com/intellectualcrafters/plot/database/MySQL.java b/src/main/java/com/intellectualcrafters/plot/database/MySQL.java
index 5f973aefa..60119f692 100644
--- a/src/main/java/com/intellectualcrafters/plot/database/MySQL.java
+++ b/src/main/java/com/intellectualcrafters/plot/database/MySQL.java
@@ -20,7 +20,11 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.database;
-import java.sql.*;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
/**
* Connects to and uses a MySQL database
diff --git a/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java b/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java
index a216c24bc..394e37f9b 100644
--- a/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java
+++ b/src/main/java/com/intellectualcrafters/plot/database/SQLManager.java
@@ -20,19 +20,38 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.database;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.sql.Timestamp;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager;
-import com.intellectualcrafters.plot.object.*;
+import com.intellectualcrafters.plot.object.BlockLoc;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotCluster;
+import com.intellectualcrafters.plot.object.PlotClusterId;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotSettings;
+import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.object.comment.PlotComment;
import com.intellectualcrafters.plot.util.ClusterManager;
import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.TaskManager;
-import org.bukkit.block.Biome;
-
-import java.sql.*;
-import java.util.*;
/**
* @author Citymonstret
@@ -111,7 +130,7 @@ public class SQLManager implements AbstractDB {
statement.close();
} catch (final SQLException e) {
e.printStackTrace();
- PS.log("&c[ERROR] " + "Could not set owner for plot " + plot.id);
+ PS.debug("&c[ERROR] " + "Could not set owner for plot " + plot.id);
}
}
});
@@ -200,7 +219,7 @@ public class SQLManager implements AbstractDB {
}
catch (SQLException e) {
e.printStackTrace();
- PS.log("&7[WARN] " + "Failed to set all helpers for plots");
+ PS.debug("&7[WARN] " + "Failed to set all helpers for plots");
try {
connection.commit();
connection.setAutoCommit(true);
@@ -212,7 +231,7 @@ public class SQLManager implements AbstractDB {
});
} catch (Exception e) {
e.printStackTrace();
- PS.log("&7[WARN] " + "Failed to set all helpers for plots");
+ PS.debug("&7[WARN] " + "Failed to set all helpers for plots");
try {
connection.commit();
connection.setAutoCommit(true);
@@ -369,7 +388,7 @@ public class SQLManager implements AbstractDB {
last = subList.size();
preparedStmt.addBatch();
}
- PS.log("&aBatch 1: " + count + " | " + objList.get(0).getClass().getCanonicalName());
+ PS.debug("&aBatch 1: " + count + " | " + objList.get(0).getClass().getCanonicalName());
preparedStmt.executeBatch();
preparedStmt.clearParameters();
preparedStmt.close();
@@ -378,7 +397,7 @@ public class SQLManager implements AbstractDB {
} catch (Exception e) {
if (Settings.DB.USE_MYSQL) {
e.printStackTrace();
- PS.log("&cERROR 1: " + " | " + objList.get(0).getClass().getCanonicalName());
+ PS.debug("&cERROR 1: " + " | " + objList.get(0).getClass().getCanonicalName());
}
}
try {
@@ -410,14 +429,14 @@ public class SQLManager implements AbstractDB {
last = subList.size();
preparedStmt.addBatch();
}
- PS.log("&aBatch 2: " + count + " | " + objList.get(0).getClass().getCanonicalName());
+ PS.debug("&aBatch 2: " + count + " | " + objList.get(0).getClass().getCanonicalName());
preparedStmt.executeBatch();
preparedStmt.clearParameters();
preparedStmt.close();
} catch (Exception e) {
e.printStackTrace();
- PS.log("&cERROR 2: " + " | " + objList.get(0).getClass().getCanonicalName());
- PS.log("&6[WARN] " + "Could not bulk save!");
+ PS.debug("&cERROR 2: " + " | " + objList.get(0).getClass().getCanonicalName());
+ PS.debug("&6[WARN] " + "Could not bulk save!");
try {
PreparedStatement preparedStmt = null;
String nonBulk = mod.getCreateSQL();
@@ -427,15 +446,15 @@ public class SQLManager implements AbstractDB {
mod.setSQL(preparedStmt, obj);
preparedStmt.addBatch();
} catch (final Exception e3) {
- PS.log("&c[ERROR] " + "Failed to save " + obj + "!");
+ PS.debug("&c[ERROR] " + "Failed to save " + obj + "!");
}
}
- PS.log("&aBatch 3");
+ PS.debug("&aBatch 3");
preparedStmt.executeBatch();
preparedStmt.close();
} catch (Exception e3) {
e3.printStackTrace();
- PS.log("&c[ERROR] " + "Failed to save all!");
+ PS.debug("&c[ERROR] " + "Failed to save all!");
}
}
if (whenDone != null) whenDone.run();
@@ -627,7 +646,7 @@ public class SQLManager implements AbstractDB {
stmt.close();
} catch (final Exception e) {
e.printStackTrace();
- PS.log("&c[ERROR] " + "Failed to save plot " + plot.id);
+ PS.debug("&c[ERROR] " + "Failed to save plot " + plot.id);
}
}
});
@@ -654,7 +673,7 @@ public class SQLManager implements AbstractDB {
stmt.close();
} catch (final Exception e) {
e.printStackTrace();
- PS.log("&c[ERROR] " + "Failed to save plot " + plot.id);
+ PS.debug("&c[ERROR] " + "Failed to save plot " + plot.id);
}
}
});
@@ -688,7 +707,7 @@ public class SQLManager implements AbstractDB {
}
boolean add_constraint;
add_constraint = create == tables.length;
- PS.log("Creating tables");
+ PS.debug("Creating tables");
final Statement stmt = this.connection.createStatement();
if (mysql) {
stmt.addBatch("CREATE TABLE IF NOT EXISTS `" + this.prefix + "plot` (" + "`id` INT(11) NOT NULL AUTO_INCREMENT," + "`plot_id_x` INT(11) NOT NULL," + "`plot_id_z` INT(11) NOT NULL," + "`owner` VARCHAR(40) NOT NULL," + "`world` VARCHAR(45) NOT NULL," + "`timestamp` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP," + "PRIMARY KEY (`id`)" + ") ENGINE=InnoDB DEFAULT CHARSET=utf8 AUTO_INCREMENT=0");
@@ -763,7 +782,7 @@ public class SQLManager implements AbstractDB {
stmt.close();
} catch (final SQLException e) {
e.printStackTrace();
- PS.log("&c[ERROR] " + "Failed to delete plot " + plot.id);
+ PS.debug("&c[ERROR] " + "Failed to delete plot " + plot.id);
}
}
});
@@ -860,13 +879,13 @@ public class SQLManager implements AbstractDB {
for (String table : new String[]{"plot_denied", "plot_helpers", "plot_trusted"} ) {
ResultSet result = statement.executeQuery("SELECT plot_plot_id, user_uuid, COUNT(*) FROM " + this.prefix + table + " GROUP BY plot_plot_id, user_uuid HAVING COUNT(*) > 1");
if (result.next()) {
- PS.log("BACKING UP: " + table);
+ PS.debug("BACKING UP: " + table);
result.close();
statement.executeUpdate("CREATE TABLE " + table + "_tmp AS SELECT * FROM " + this.prefix + table + " GROUP BY plot_plot_id, user_uuid");
statement.executeUpdate("DROP TABLE " + this.prefix + table);
statement.executeUpdate("CREATE TABLE " + this.prefix + table + " AS SELECT * FROM " + table + "_tmp");
statement.executeUpdate("DROP TABLE " + this.prefix + table + "_tmp");
- PS.log("RESTORING: " + table);
+ PS.debug("RESTORING: " + table);
}
}
statement.close();
@@ -943,7 +962,7 @@ public class SQLManager implements AbstractDB {
}
plot.getSettings().ratings.put(user, r.getInt("rating"));
} else {
- PS.log("&cPLOT " + id + " in plot_helpers does not exist. Please create the plot or remove this entry.");
+ PS.debug("&cPLOT " + id + " in plot_helpers does not exist. Please create the plot or remove this entry.");
}
}
}
@@ -964,7 +983,7 @@ public class SQLManager implements AbstractDB {
if (plot != null) {
plot.getTrusted().add(user);
} else {
- PS.log("&cPLOT " + id + " in plot_helpers does not exist. Please create the plot or remove this entry.");
+ PS.debug("&cPLOT " + id + " in plot_helpers does not exist. Please create the plot or remove this entry.");
}
}
@@ -984,7 +1003,7 @@ public class SQLManager implements AbstractDB {
if (plot != null) {
plot.getMembers().add(user);
} else {
- PS.log("&cPLOT " + id + " in plot_trusted does not exist. Please create the plot or remove this entry.");
+ PS.debug("&cPLOT " + id + " in plot_trusted does not exist. Please create the plot or remove this entry.");
}
}
@@ -1004,7 +1023,7 @@ public class SQLManager implements AbstractDB {
if (plot != null) {
plot.getDenied().add(user);
} else {
- PS.log("&cPLOT " + id + " in plot_denied does not exist. Please create the plot or remove this entry.");
+ PS.debug("&cPLOT " + id + " in plot_denied does not exist. Please create the plot or remove this entry.");
}
}
@@ -1018,14 +1037,6 @@ public class SQLManager implements AbstractDB {
newplots.put(plot.world, new HashMap());
}
newplots.get(plot.world).put(plot.id, plot);
- final String b = r.getString("biome");
- if (b != null) {
- for (final Biome mybiome : Biome.values()) {
- if (mybiome.toString().equalsIgnoreCase(b)) {
- break;
- }
- }
- }
final String alias = r.getString("alias");
if (alias != null) {
plot.getSettings().setAlias(alias);
@@ -1083,18 +1094,18 @@ public class SQLManager implements AbstractDB {
Flag flag = new Flag(FlagManager.getFlag(element, true), "");
flags.put(flag.getKey(), flag);
} else {
- PS.log("INVALID FLAG: " + element);
+ PS.debug("INVALID FLAG: " + element);
}
}
}
if (exception) {
- PS.log("&cPlot " + id + " had an invalid flag. A fix has been attempted.");
- PS.log("&c" + myflags);
+ PS.debug("&cPlot " + id + " had an invalid flag. A fix has been attempted.");
+ PS.debug("&c" + myflags);
setFlags(id, flags.values());
}
plot.getSettings().flags = flags;
} else {
- PS.log("&cPLOT " + id + " in plot_settings does not exist. Please create the plot or remove this entry.");
+ PS.debug("&cPLOT " + id + " in plot_settings does not exist. Please create the plot or remove this entry.");
}
}
@@ -1106,13 +1117,13 @@ public class SQLManager implements AbstractDB {
boolean invalidPlot = false;
for (final String worldname : noExist.keySet()) {
invalidPlot = true;
- PS.log("&c[WARNING] Found " + noExist.get(worldname) + " plots in DB for non existant world; '" + worldname + "'.");
+ PS.debug("&c[WARNING] Found " + noExist.get(worldname) + " plots in DB for non existant world; '" + worldname + "'.");
}
if (invalidPlot) {
- PS.log("&c[WARNING] - Please create the world/s or remove the plots using the purge command");
+ PS.debug("&c[WARNING] - Please create the world/s or remove the plots using the purge command");
}
} catch (final SQLException e) {
- PS.log("&7[WARN] " + "Failed to load plots.");
+ PS.debug("&7[WARN] " + "Failed to load plots.");
e.printStackTrace();
}
return newplots;
@@ -1136,7 +1147,7 @@ public class SQLManager implements AbstractDB {
stmt.close();
} catch (final SQLException e) {
e.printStackTrace();
- PS.log("&7[WARN] " + "Could not set merged for plot " + plot.id);
+ PS.debug("&7[WARN] " + "Could not set merged for plot " + plot.id);
}
}
});
@@ -1219,7 +1230,7 @@ public class SQLManager implements AbstractDB {
stmt.close();
} catch (final SQLException e) {
e.printStackTrace();
- PS.log("&7[WARN] " + "Could not set flag for plot " + plot.id);
+ PS.debug("&7[WARN] " + "Could not set flag for plot " + plot.id);
}
}
});
@@ -1238,7 +1249,7 @@ public class SQLManager implements AbstractDB {
stmt.close();
} catch (final SQLException e) {
e.printStackTrace();
- PS.log("&7[WARN] " + "Could not set flag for plot " + id);
+ PS.debug("&7[WARN] " + "Could not set flag for plot " + id);
}
}
});
@@ -1257,7 +1268,7 @@ public class SQLManager implements AbstractDB {
stmt.executeUpdate();
stmt.close();
} catch (final SQLException e) {
- PS.log("&7[WARN] " + "Failed to set alias for plot " + plot.id);
+ PS.debug("&7[WARN] " + "Failed to set alias for plot " + plot.id);
e.printStackTrace();
}
}
@@ -1300,11 +1311,11 @@ public class SQLManager implements AbstractDB {
stmt.close();
} catch (final SQLException e) {
e.printStackTrace();
- PS.log("&c[ERROR] " + "FAILED TO PURGE WORLD '" + world + "'!");
+ PS.debug("&c[ERROR] " + "FAILED TO PURGE WORLD '" + world + "'!");
return;
}
}
- PS.log("&6[INFO] " + "SUCCESSFULLY PURGED WORLD '" + world + "'!");
+ PS.debug("&6[INFO] " + "SUCCESSFULLY PURGED WORLD '" + world + "'!");
}
@Override
@@ -1333,7 +1344,7 @@ public class SQLManager implements AbstractDB {
}
} catch (final SQLException e) {
e.printStackTrace();
- PS.log("&c[ERROR] " + "FAILED TO PURGE WORLD '" + world + "'!");
+ PS.debug("&c[ERROR] " + "FAILED TO PURGE WORLD '" + world + "'!");
}
}
@@ -1350,7 +1361,7 @@ public class SQLManager implements AbstractDB {
stmt.executeUpdate();
stmt.close();
} catch (final SQLException e) {
- PS.log("&7[WARN] " + "Failed to set position for plot " + plot.id);
+ PS.debug("&7[WARN] " + "Failed to set position for plot " + plot.id);
e.printStackTrace();
}
}
@@ -1399,7 +1410,7 @@ public class SQLManager implements AbstractDB {
stmt.close();
r.close();
} catch (final SQLException e) {
- PS.log("&7[WARN] " + "Failed to load settings for plot: " + id);
+ PS.debug("&7[WARN] " + "Failed to load settings for plot: " + id);
e.printStackTrace();
}
return h;
@@ -1429,7 +1440,7 @@ public class SQLManager implements AbstractDB {
statement.close();
} catch (final SQLException e) {
e.printStackTrace();
- PS.log("&7[WARN] " + "Failed to remove comment for plot " + plot.id);
+ PS.debug("&7[WARN] " + "Failed to remove comment for plot " + plot.id);
}
}
});
@@ -1455,7 +1466,7 @@ public class SQLManager implements AbstractDB {
statement.close();
} catch (final SQLException e) {
e.printStackTrace();
- PS.log("&7[WARN] " + "Failed to remove comment for plot " + plot.id);
+ PS.debug("&7[WARN] " + "Failed to remove comment for plot " + plot.id);
}
}
});
@@ -1500,7 +1511,7 @@ public class SQLManager implements AbstractDB {
statement.close();
set.close();
} catch (final SQLException e) {
- PS.log("&7[WARN] " + "Failed to fetch comment");
+ PS.debug("&7[WARN] " + "Failed to fetch comment");
e.printStackTrace();
}
}
@@ -1524,7 +1535,7 @@ public class SQLManager implements AbstractDB {
statement.close();
} catch (final SQLException e) {
e.printStackTrace();
- PS.log("&7[WARN] " + "Failed to set comment for plot " + plot.id);
+ PS.debug("&7[WARN] " + "Failed to set comment for plot " + plot.id);
}
}
});
@@ -1543,7 +1554,7 @@ public class SQLManager implements AbstractDB {
statement.close();
} catch (final SQLException e) {
e.printStackTrace();
- PS.log("&7[WARN] " + "Failed to remove helper for plot " + plot.id);
+ PS.debug("&7[WARN] " + "Failed to remove helper for plot " + plot.id);
}
}
});
@@ -1562,7 +1573,7 @@ public class SQLManager implements AbstractDB {
statement.close();
} catch (final SQLException e) {
e.printStackTrace();
- PS.log("&7[WARN] " + "Failed to remove trusted user for plot " + plot.id);
+ PS.debug("&7[WARN] " + "Failed to remove trusted user for plot " + plot.id);
}
}
});
@@ -1580,7 +1591,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate();
statement.close();
} catch (final SQLException e) {
- PS.log("&7[WARN] " + "Failed to set helper for plot " + plot.id);
+ PS.debug("&7[WARN] " + "Failed to set helper for plot " + plot.id);
e.printStackTrace();
}
}
@@ -1598,7 +1609,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate();
statement.close();
} catch (final SQLException e) {
- PS.log("&7[WARN] " + "Failed to set helper for id " + id);
+ PS.debug("&7[WARN] " + "Failed to set helper for id " + id);
e.printStackTrace();
}
}
@@ -1617,7 +1628,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate();
statement.close();
} catch (final SQLException e) {
- PS.log("&7[WARN] " + "Failed to set plot trusted for plot " + plot.id);
+ PS.debug("&7[WARN] " + "Failed to set plot trusted for plot " + plot.id);
e.printStackTrace();
}
}
@@ -1637,7 +1648,7 @@ public class SQLManager implements AbstractDB {
statement.close();
} catch (final SQLException e) {
e.printStackTrace();
- PS.log("&7[WARN] " + "Failed to remove denied for plot " + plot.id);
+ PS.debug("&7[WARN] " + "Failed to remove denied for plot " + plot.id);
}
}
});
@@ -1655,7 +1666,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate();
statement.close();
} catch (final SQLException e) {
- PS.log("&7[WARN] " + "Failed to set denied for plot " + plot.id);
+ PS.debug("&7[WARN] " + "Failed to set denied for plot " + plot.id);
e.printStackTrace();
}
}
@@ -1677,7 +1688,7 @@ public class SQLManager implements AbstractDB {
statement.close();
set.close();
} catch (final SQLException e) {
- PS.log("&7[WARN] " + "Failed to fetch rating for plot " + plot.getId().toString());
+ PS.debug("&7[WARN] " + "Failed to fetch rating for plot " + plot.getId().toString());
e.printStackTrace();
}
return map;
@@ -1696,7 +1707,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate();
statement.close();
} catch (final SQLException e) {
- PS.log("&7[WARN] " + "Failed to set denied for plot " + plot.id);
+ PS.debug("&7[WARN] " + "Failed to set denied for plot " + plot.id);
e.printStackTrace();
}
}
@@ -1728,7 +1739,7 @@ public class SQLManager implements AbstractDB {
stmt.close();
} catch (final SQLException e) {
e.printStackTrace();
- PS.log("&c[ERROR] " + "Failed to delete plot cluster: " + cluster.getP1() + ":" + cluster.getP2());
+ PS.debug("&c[ERROR] " + "Failed to delete plot cluster: " + cluster.getP1() + ":" + cluster.getP2());
}
}
});
@@ -1819,7 +1830,7 @@ public class SQLManager implements AbstractDB {
if (cluster != null) {
cluster.helpers.add(user);
} else {
- PS.log("&cCluster " + id + " in cluster_helpers does not exist. Please create the cluster or remove this entry.");
+ PS.debug("&cCluster " + id + " in cluster_helpers does not exist. Please create the cluster or remove this entry.");
}
}
/*
@@ -1838,7 +1849,7 @@ public class SQLManager implements AbstractDB {
if (cluster != null) {
cluster.invited.add(user);
} else {
- PS.log("&cCluster " + id + " in cluster_invited does not exist. Please create the cluster or remove this entry.");
+ PS.debug("&cCluster " + id + " in cluster_invited does not exist. Please create the cluster or remove this entry.");
}
}
r = stmt.executeQuery("SELECT * FROM `" + this.prefix + "cluster_settings`");
@@ -1846,14 +1857,6 @@ public class SQLManager implements AbstractDB {
id = r.getInt("cluster_id");
cluster = clusters.get(id);
if (cluster != null) {
- final String b = r.getString("biome");
- if (b != null) {
- for (final Biome mybiome : Biome.values()) {
- if (mybiome.toString().equalsIgnoreCase(b)) {
- break;
- }
- }
- }
final String alias = r.getString("alias");
if (alias != null) {
cluster.settings.setAlias(alias);
@@ -1913,12 +1916,12 @@ public class SQLManager implements AbstractDB {
}
}
if (exception) {
- PS.log("&cCluster " + id + " had an invalid flag. A fix has been attempted.");
- PS.log("&c" + myflags);
+ PS.debug("&cCluster " + id + " had an invalid flag. A fix has been attempted.");
+ PS.debug("&c" + myflags);
}
cluster.settings.flags = flags;
} else {
- PS.log("&cCluster " + id + " in cluster_settings does not exist. Please create the cluster or remove this entry.");
+ PS.debug("&cCluster " + id + " in cluster_settings does not exist. Please create the cluster or remove this entry.");
}
}
stmt.close();
@@ -1933,13 +1936,13 @@ public class SQLManager implements AbstractDB {
boolean invalidPlot = false;
for (final String w : noExist.keySet()) {
invalidPlot = true;
- PS.log("&c[WARNING] Found " + noExist.get(w) + " clusters in DB for non existant world; '" + w + "'.");
+ PS.debug("&c[WARNING] Found " + noExist.get(w) + " clusters in DB for non existant world; '" + w + "'.");
}
if (invalidPlot) {
- PS.log("&c[WARNING] - Please create the world/s or remove the clusters using the purge command");
+ PS.debug("&c[WARNING] - Please create the world/s or remove the clusters using the purge command");
}
} catch (final SQLException e) {
- PS.log("&7[WARN] " + "Failed to load clusters.");
+ PS.debug("&7[WARN] " + "Failed to load clusters.");
e.printStackTrace();
}
return newClusters;
@@ -1967,7 +1970,7 @@ public class SQLManager implements AbstractDB {
stmt.close();
} catch (final SQLException e) {
e.printStackTrace();
- PS.log("&7[WARN] " + "Could not set flag for plot " + cluster);
+ PS.debug("&7[WARN] " + "Could not set flag for plot " + cluster);
}
}
});
@@ -1987,7 +1990,7 @@ public class SQLManager implements AbstractDB {
stmt.executeUpdate();
stmt.close();
} catch (final SQLException e) {
- PS.log("&7[WARN] " + "Failed to set alias for cluster " + cluster);
+ PS.debug("&7[WARN] " + "Failed to set alias for cluster " + cluster);
e.printStackTrace();
}
}
@@ -2007,7 +2010,7 @@ public class SQLManager implements AbstractDB {
statement.close();
} catch (final SQLException e) {
e.printStackTrace();
- PS.log("&7[WARN] " + "Failed to remove helper for cluster " + cluster);
+ PS.debug("&7[WARN] " + "Failed to remove helper for cluster " + cluster);
}
}
});
@@ -2025,7 +2028,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate();
statement.close();
} catch (final SQLException e) {
- PS.log("&7[WARN] " + "Failed to set helper for cluster " + cluster);
+ PS.debug("&7[WARN] " + "Failed to set helper for cluster " + cluster);
e.printStackTrace();
}
}
@@ -2056,7 +2059,7 @@ public class SQLManager implements AbstractDB {
stmt.close();
} catch (final Exception e) {
e.printStackTrace();
- PS.log("&c[ERROR] " + "Failed to save cluster " + cluster);
+ PS.debug("&c[ERROR] " + "Failed to save cluster " + cluster);
}
}
});
@@ -2082,7 +2085,7 @@ public class SQLManager implements AbstractDB {
stmt.executeUpdate();
stmt.close();
} catch (final SQLException e) {
- PS.log("&7[WARN] " + "Failed to rezize cluster " + current);
+ PS.debug("&7[WARN] " + "Failed to rezize cluster " + current);
e.printStackTrace();
}
}
@@ -2102,7 +2105,7 @@ public class SQLManager implements AbstractDB {
stmt.executeUpdate();
stmt.close();
} catch (final SQLException e) {
- PS.log("&7[WARN] " + "Failed to set position for cluster " + cluster);
+ PS.debug("&7[WARN] " + "Failed to set position for cluster " + cluster);
e.printStackTrace();
}
}
@@ -2151,7 +2154,7 @@ public class SQLManager implements AbstractDB {
stmt.close();
r.close();
} catch (final SQLException e) {
- PS.log("&7[WARN] " + "Failed to load settings for cluster: " + id);
+ PS.debug("&7[WARN] " + "Failed to load settings for cluster: " + id);
e.printStackTrace();
}
return h;
@@ -2170,7 +2173,7 @@ public class SQLManager implements AbstractDB {
statement.close();
} catch (final SQLException e) {
e.printStackTrace();
- PS.log("&7[WARN] " + "Failed to remove invited for cluster " + cluster);
+ PS.debug("&7[WARN] " + "Failed to remove invited for cluster " + cluster);
}
}
});
@@ -2188,7 +2191,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate();
statement.close();
} catch (final SQLException e) {
- PS.log("&7[WARN] " + "Failed to set helper for cluster " + cluster);
+ PS.debug("&7[WARN] " + "Failed to set helper for cluster " + cluster);
e.printStackTrace();
}
}
diff --git a/src/main/java/com/intellectualcrafters/plot/database/SQLite.java b/src/main/java/com/intellectualcrafters/plot/database/SQLite.java
index 00fca9c9c..22188fae2 100644
--- a/src/main/java/com/intellectualcrafters/plot/database/SQLite.java
+++ b/src/main/java/com/intellectualcrafters/plot/database/SQLite.java
@@ -20,11 +20,15 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.database;
-import com.intellectualcrafters.plot.PS;
-
import java.io.File;
import java.io.IOException;
-import java.sql.*;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+
+import com.intellectualcrafters.plot.PS;
/**
* Connects to and uses a SQLite database
@@ -58,7 +62,7 @@ public class SQLite extends Database {
try {
file.createNewFile();
} catch (final IOException e) {
- PS.log("&cUnable to create database!");
+ PS.debug("&cUnable to create database!");
}
}
Class.forName("org.sqlite.JDBC");
diff --git a/src/main/java/com/intellectualcrafters/plot/database/StmtMod.java b/src/main/java/com/intellectualcrafters/plot/database/StmtMod.java
index 4f6363039..2aaa21c6c 100644
--- a/src/main/java/com/intellectualcrafters/plot/database/StmtMod.java
+++ b/src/main/java/com/intellectualcrafters/plot/database/StmtMod.java
@@ -1,10 +1,10 @@
package com.intellectualcrafters.plot.database;
-import com.intellectualcrafters.plot.util.StringMan;
-
import java.sql.PreparedStatement;
import java.sql.SQLException;
+import com.intellectualcrafters.plot.util.StringMan;
+
public abstract class StmtMod {
public abstract String getCreateMySQL(int size);
diff --git a/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java b/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java
index b65a041bc..457df3b78 100644
--- a/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java
+++ b/src/main/java/com/intellectualcrafters/plot/flag/FlagManager.java
@@ -20,15 +20,24 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.flag;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
-import com.intellectualcrafters.plot.object.*;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotCluster;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.PlotSettings;
+import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.util.EventUtil;
import com.intellectualcrafters.plot.util.MainUtil;
-import java.util.*;
-
/**
* Flag Manager Utility
*
@@ -91,7 +100,7 @@ public class FlagManager {
}
public static boolean addFlag(AbstractFlag af, boolean reserved) {
- PS.log(C.PREFIX.s() + "&8 - Adding flag: &7" + af);
+ PS.debug(C.PREFIX.s() + "&8 - Adding flag: &7" + af);
for (PlotWorld plotworld : PS.get().getPlotWorldObjects()) {
Flag flag = ((HashMap) plotworld.DEFAULT_FLAGS.clone()).get(af.getKey());
if (flag != null) {
diff --git a/src/main/java/com/intellectualcrafters/plot/flag/FlagValue.java b/src/main/java/com/intellectualcrafters/plot/flag/FlagValue.java
index d89ea52f1..7e93e7069 100644
--- a/src/main/java/com/intellectualcrafters/plot/flag/FlagValue.java
+++ b/src/main/java/com/intellectualcrafters/plot/flag/FlagValue.java
@@ -1,13 +1,13 @@
package com.intellectualcrafters.plot.flag;
-import com.intellectualcrafters.plot.object.PlotBlock;
-import com.intellectualcrafters.plot.util.StringMan;
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.util.StringMan;
+
/**
* Created 2014-11-17 for PlotSquared
*
diff --git a/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotManager.java b/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotManager.java
index 04002d3e4..6cd51ce4a 100644
--- a/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotManager.java
+++ b/src/main/java/com/intellectualcrafters/plot/generator/ClassicPlotManager.java
@@ -1,11 +1,16 @@
package com.intellectualcrafters.plot.generator;
-import com.intellectualcrafters.plot.object.*;
+import java.util.ArrayList;
+
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.object.PseudoRandom;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.SetBlockQueue;
-import java.util.ArrayList;
-
/**
* A plot manager with square plots which tesselate on a square grid with the following sections: ROAD, WALL, BORDER (wall), PLOT, FLOOR (plot)
*/
diff --git a/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java b/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java
index 7b0703625..5245a8c62 100644
--- a/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java
+++ b/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotManager.java
@@ -20,14 +20,6 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.generator;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.commands.Template;
-import com.intellectualcrafters.plot.object.*;
-import com.intellectualcrafters.plot.util.BlockManager;
-import com.intellectualcrafters.plot.util.ChunkManager;
-import com.intellectualcrafters.plot.util.MainUtil;
-import com.intellectualcrafters.plot.util.SetBlockQueue;
-
import java.io.File;
import java.io.IOException;
import java.nio.file.Files;
@@ -35,6 +27,21 @@ import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.commands.Template;
+import com.intellectualcrafters.plot.object.ChunkLoc;
+import com.intellectualcrafters.plot.object.FileBytes;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotLoc;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.object.RunnableVal;
+import com.intellectualcrafters.plot.util.ChunkManager;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.SetBlockQueue;
+
public class HybridPlotManager extends ClassicPlotManager {
@Override
diff --git a/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotWorld.java b/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotWorld.java
index 204944545..0beb6053d 100644
--- a/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotWorld.java
+++ b/src/main/java/com/intellectualcrafters/plot/generator/HybridPlotWorld.java
@@ -20,6 +20,9 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.generator;
+import java.util.HashMap;
+import java.util.HashSet;
+
import com.intellectualcrafters.configuration.ConfigurationSection;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
@@ -30,9 +33,6 @@ import com.intellectualcrafters.plot.util.SchematicHandler;
import com.intellectualcrafters.plot.util.SchematicHandler.Dimension;
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
-import java.util.HashMap;
-import java.util.HashSet;
-
public class HybridPlotWorld extends ClassicPlotWorld {
public boolean ROAD_SCHEMATIC_ENABLED;
public short SCHEMATIC_HEIGHT;
@@ -68,7 +68,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
try {
setupSchematics();
} catch (final Exception e) {
- PS.log("&c - road schematics are disabled for this world.");
+ PS.debug("&c - road schematics are disabled for this world.");
}
}
@@ -133,7 +133,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
}
}
if ((schem1 == null) || (schem2 == null) || (this.ROAD_WIDTH == 0)) {
- PS.log(C.PREFIX.s() + "&3 - schematic: &7false");
+ PS.debug(C.PREFIX.s() + "&3 - schematic: &7false");
return;
}
this.ROAD_SCHEMATIC_ENABLED = true;
@@ -196,6 +196,8 @@ public class HybridPlotWorld extends ClassicPlotWorld {
return data;
}
+ // FIXME depends on block ids
+ // Possibly make abstract?
public static byte rotate(final short id, byte data) {
switch (id) {
case 162:
diff --git a/src/main/java/com/intellectualcrafters/plot/generator/HybridUtils.java b/src/main/java/com/intellectualcrafters/plot/generator/HybridUtils.java
index a6e31bd72..d56f502cf 100644
--- a/src/main/java/com/intellectualcrafters/plot/generator/HybridUtils.java
+++ b/src/main/java/com/intellectualcrafters/plot/generator/HybridUtils.java
@@ -1,16 +1,24 @@
package com.intellectualcrafters.plot.generator;
+import java.io.File;
+import java.util.HashMap;
+
import com.intellectualcrafters.jnbt.CompoundTag;
import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.object.*;
+import com.intellectualcrafters.plot.object.ChunkLoc;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotAnalysis;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotLoc;
+import com.intellectualcrafters.plot.object.PlotManager;
+import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.ChunkManager;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.SchematicHandler;
-import java.io.File;
-import java.util.HashMap;
-
public abstract class HybridUtils {
public static HybridUtils manager;
diff --git a/src/main/java/com/intellectualcrafters/plot/generator/SquarePlotManager.java b/src/main/java/com/intellectualcrafters/plot/generator/SquarePlotManager.java
index 6601f9fc1..133da5389 100644
--- a/src/main/java/com/intellectualcrafters/plot/generator/SquarePlotManager.java
+++ b/src/main/java/com/intellectualcrafters/plot/generator/SquarePlotManager.java
@@ -5,7 +5,6 @@ import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotWorld;
-import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.ChunkManager;
import com.intellectualcrafters.plot.util.MainUtil;
diff --git a/src/main/java/com/intellectualcrafters/plot/generator/SquarePlotWorld.java b/src/main/java/com/intellectualcrafters/plot/generator/SquarePlotWorld.java
index 5973e1609..74eac2923 100644
--- a/src/main/java/com/intellectualcrafters/plot/generator/SquarePlotWorld.java
+++ b/src/main/java/com/intellectualcrafters/plot/generator/SquarePlotWorld.java
@@ -16,7 +16,7 @@ public abstract class SquarePlotWorld extends GridPlotWorld {
@Override
public void loadConfiguration(final ConfigurationSection config) {
if (!config.contains("plot.height")) {
- PS.log(" - &cConfiguration is null? (" + config.getCurrentPath() + ")");
+ PS.debug(" - &cConfiguration is null? (" + config.getCurrentPath() + ")");
}
this.PLOT_WIDTH = config.getInt("plot.size");
this.ROAD_WIDTH = config.getInt("road.width");
diff --git a/src/main/java/com/intellectualcrafters/plot/object/BlockWrapper.java b/src/main/java/com/intellectualcrafters/plot/object/BlockWrapper.java
index 518c562fa..d83e5c3c2 100644
--- a/src/main/java/com/intellectualcrafters/plot/object/BlockWrapper.java
+++ b/src/main/java/com/intellectualcrafters/plot/object/BlockWrapper.java
@@ -20,8 +20,6 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.object;
-import org.bukkit.World;
-import org.bukkit.block.Block;
/**
* Wrapper class for blocks, using pure data rather than the object.
diff --git a/src/main/java/com/intellectualcrafters/plot/object/ConsolePlayer.java b/src/main/java/com/intellectualcrafters/plot/object/ConsolePlayer.java
index 790caf7a1..fc7b27267 100644
--- a/src/main/java/com/intellectualcrafters/plot/object/ConsolePlayer.java
+++ b/src/main/java/com/intellectualcrafters/plot/object/ConsolePlayer.java
@@ -1,14 +1,16 @@
package com.intellectualcrafters.plot.object;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.UUID;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.commands.RequiredType;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.util.MainUtil;
-
-import java.util.HashMap;
-import java.util.Set;
-import java.util.UUID;
+import com.intellectualcrafters.plot.util.PlotGamemode;
+import com.intellectualcrafters.plot.util.PlotWeather;
public class ConsolePlayer implements PlotPlayer {
@@ -134,5 +136,28 @@ public class ConsolePlayer implements PlotPlayer {
public RequiredType getSuperCaller() {
return RequiredType.CONSOLE;
}
+
+ @Override
+ public void setWeather(PlotWeather weather) {}
+
+ @Override
+ public PlotGamemode getGamemode() {
+ return PlotGamemode.CREATIVE;
+ }
+
+ @Override
+ public void setGamemode(PlotGamemode gamemode) {}
+
+ @Override
+ public void setTime(long time) {}
+
+ @Override
+ public void setFlight(boolean fly) {}
+
+ @Override
+ public void playMusic(Location loc, int id) {}
+
+ @Override
+ public void kick(String message) {}
}
diff --git a/src/main/java/com/intellectualcrafters/plot/object/Plot.java b/src/main/java/com/intellectualcrafters/plot/object/Plot.java
index a43dabb61..1512e020b 100644
--- a/src/main/java/com/intellectualcrafters/plot/object/Plot.java
+++ b/src/main/java/com/intellectualcrafters/plot/object/Plot.java
@@ -20,18 +20,18 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.object;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.database.DBFunc;
-import com.intellectualcrafters.plot.flag.Flag;
-import com.intellectualcrafters.plot.util.ChunkManager;
-import com.intellectualcrafters.plot.util.MainUtil;
-
import java.util.Collection;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map.Entry;
import java.util.UUID;
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.util.ChunkManager;
+import com.intellectualcrafters.plot.util.MainUtil;
+
/**
* The plot class
*
diff --git a/src/main/java/com/intellectualcrafters/plot/object/PlotAnalysis.java b/src/main/java/com/intellectualcrafters/plot/object/PlotAnalysis.java
index 67c16a63a..9b8067b81 100644
--- a/src/main/java/com/intellectualcrafters/plot/object/PlotAnalysis.java
+++ b/src/main/java/com/intellectualcrafters/plot/object/PlotAnalysis.java
@@ -1,5 +1,13 @@
package com.intellectualcrafters.plot.object;
+import java.io.IOException;
+import java.lang.reflect.Array;
+import java.util.ArrayDeque;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
import com.intellectualcrafters.configuration.file.YamlConfiguration;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.flag.Flag;
@@ -9,14 +17,6 @@ import com.intellectualcrafters.plot.util.MathMan;
import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.bukkit.util.BukkitHybridUtils;
-import java.io.IOException;
-import java.lang.reflect.Array;
-import java.util.ArrayDeque;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicInteger;
-
public class PlotAnalysis {
public int changes;
public int faces;
@@ -87,21 +87,21 @@ public class PlotAnalysis {
*/
public static void calcOptimalModifiers(final Runnable whenDone, final double threshold) {
if (running) {
- PS.log("Calibration task already in progress!");
+ PS.debug("Calibration task already in progress!");
return;
}
if (threshold <= 0 || threshold >= 1) {
- PS.log("Invalid threshold provided! (Cannot be 0 or 100 as then there's no point calibrating)");
+ PS.debug("Invalid threshold provided! (Cannot be 0 or 100 as then there's no point calibrating)");
return;
}
running = true;
- PS.log(" - Fetching all plots");
+ PS.debug(" - Fetching all plots");
final ArrayList plots = new ArrayList<>(PS.get().getPlots());
TaskManager.runTaskAsync(new Runnable() {
@Override
public void run() {
Iterator iter = plots.iterator();
- PS.log(" - $1Reducing " + plots.size() + " plots to those with sufficient data");
+ PS.debug(" - $1Reducing " + plots.size() + " plots to those with sufficient data");
while (iter.hasNext()) {
Plot plot = iter.next();
if (plot.getSettings().ratings == null || plot.getSettings().ratings.size() == 0) {
@@ -111,10 +111,10 @@ public class PlotAnalysis {
MainUtil.runners.put(plot, 1);
}
}
- PS.log(" - | Reduced to " + plots.size() + " plots");
+ PS.debug(" - | Reduced to " + plots.size() + " plots");
if (plots.size() < 3) {
- PS.log("Calibration cancelled due to insufficient comparison data, please try again later");
+ PS.debug("Calibration cancelled due to insufficient comparison data, please try again later");
running = false;
for (Plot plot : plots) {
MainUtil.runners.remove(plot);
@@ -122,7 +122,7 @@ public class PlotAnalysis {
return;
}
- PS.log(" - $1Analyzing plot contents (this may take a while)");
+ PS.debug(" - $1Analyzing plot contents (this may take a while)");
final int[] changes = new int[plots.size()];
final int[] faces = new int[plots.size()];
@@ -147,7 +147,7 @@ public class PlotAnalysis {
int i = mi.intValue();
Plot plot = plots.get(i);
ratings[i] = (int) ((plot.getAverageRating() + plot.getSettings().ratings.size()) * 100);
- PS.log(" | " + plot + " (rating) " + (ratings[i]));
+ PS.debug(" | " + plot + " (rating) " + (ratings[i]));
}
}
});
@@ -159,7 +159,7 @@ public class PlotAnalysis {
if (queuePlot == null) {
break;
}
- PS.log(" | " + queuePlot);
+ PS.debug(" | " + queuePlot);
final Object lock = new Object();
TaskManager.runTask(new Runnable() {
@Override
@@ -188,17 +188,17 @@ public class PlotAnalysis {
}
}
- PS.log(" - $1Waiting on plot rating thread: " + ((mi.intValue() * 100) / plots.size()) + "%");
+ PS.debug(" - $1Waiting on plot rating thread: " + ((mi.intValue() * 100) / plots.size()) + "%");
try {
ratingAnalysis.join();
} catch (InterruptedException e) {
e.printStackTrace();
}
- PS.log(" - $1Processing and grouping single plot analysis for bulk processing");
+ PS.debug(" - $1Processing and grouping single plot analysis for bulk processing");
for (int i = 0; i < plots.size(); i++) {
Plot plot = plots.get(i);
- PS.log(" | " + plot);
+ PS.debug(" | " + plot);
PlotAnalysis analysis = plot.getComplexity();
changes[i] = analysis.changes;
@@ -214,16 +214,16 @@ public class PlotAnalysis {
variety_sd[i] = analysis.variety_sd;
}
- PS.log(" - $1Calculating rankings");
+ PS.debug(" - $1Calculating rankings");
int[] rank_ratings = rank(ratings);
int n = rank_ratings.length;
int optimal_index = (int) Math.round((1 - threshold) * (n - 1));
- PS.log(" - $1Calculating rank correlation: ");
- PS.log(" - The analyzed plots which were processed and put into bulk data will be compared and correlated to the plot ranking");
- PS.log(" - The calculated correlation constant will then be used to calibrate the threshold for auto plot clearing");
+ PS.debug(" - $1Calculating rank correlation: ");
+ PS.debug(" - The analyzed plots which were processed and put into bulk data will be compared and correlated to the plot ranking");
+ PS.debug(" - The calculated correlation constant will then be used to calibrate the threshold for auto plot clearing");
int[] rank_changes = rank(changes);
int[] sd_changes = getSD(rank_changes, rank_ratings);
@@ -231,7 +231,7 @@ public class PlotAnalysis {
int sum_changes = sum(variance_changes);
double factor_changes = getCC(n, sum_changes);
PlotAnalysis.MODIFIERS.changes = factor_changes == 1 ? 0 : (int) (factor_changes * 1000 / MathMan.getMean(changes));
- PS.log(" - | changes " + factor_changes);
+ PS.debug(" - | changes " + factor_changes);
int[] rank_faces = rank(faces);
int[] sd_faces = getSD(rank_faces, rank_ratings);
@@ -239,7 +239,7 @@ public class PlotAnalysis {
int sum_faces = sum(variance_faces);
double factor_faces = getCC(n, sum_faces);
PlotAnalysis.MODIFIERS.faces = factor_faces == 1 ? 0 : (int) (factor_faces * 1000 / MathMan.getMean(faces));
- PS.log(" - | faces " + factor_faces);
+ PS.debug(" - | faces " + factor_faces);
int[] rank_data = rank(data);
int[] sd_data = getSD(rank_data, rank_ratings);
@@ -247,7 +247,7 @@ public class PlotAnalysis {
int sum_data = sum(variance_data);
double factor_data = getCC(n, sum_data);
PlotAnalysis.MODIFIERS.data = factor_data == 1 ? 0 : (int) (factor_data * 1000 / MathMan.getMean(data));
- PS.log(" - | data " + factor_data);
+ PS.debug(" - | data " + factor_data);
int[] rank_air = rank(air);
int[] sd_air = getSD(rank_air, rank_ratings);
@@ -255,7 +255,7 @@ public class PlotAnalysis {
int sum_air = sum(variance_air);
double factor_air = getCC(n, sum_air);
PlotAnalysis.MODIFIERS.air = factor_air == 1 ? 0 : (int) (factor_air * 1000 / MathMan.getMean(air));
- PS.log(" - | air " + factor_air);
+ PS.debug(" - | air " + factor_air);
int[] rank_variety = rank(variety);
int[] sd_variety = getSD(rank_variety, rank_ratings);
@@ -263,7 +263,7 @@ public class PlotAnalysis {
int sum_variety = sum(variance_variety);
double factor_variety = getCC(n, sum_variety);
PlotAnalysis.MODIFIERS.variety = factor_variety == 1 ? 0 : (int) (factor_variety * 1000 / MathMan.getMean(variety));
- PS.log(" - | variety " + factor_variety);
+ PS.debug(" - | variety " + factor_variety);
int[] rank_changes_sd = rank(changes_sd);
int[] sd_changes_sd = getSD(rank_changes_sd, rank_ratings);
@@ -271,7 +271,7 @@ public class PlotAnalysis {
int sum_changes_sd = sum(variance_changes_sd);
double factor_changes_sd = getCC(n, sum_changes_sd);
PlotAnalysis.MODIFIERS.changes_sd = factor_changes_sd == 1 ? 0 : (int) (factor_changes_sd * 1000 / MathMan.getMean(changes_sd));
- PS.log(" - | changes_sd " + factor_changes_sd);
+ PS.debug(" - | changes_sd " + factor_changes_sd);
int[] rank_faces_sd = rank(faces_sd);
int[] sd_faces_sd = getSD(rank_faces_sd, rank_ratings);
@@ -279,7 +279,7 @@ public class PlotAnalysis {
int sum_faces_sd = sum(variance_faces_sd);
double factor_faces_sd = getCC(n, sum_faces_sd);
PlotAnalysis.MODIFIERS.faces_sd = factor_faces_sd == 1 ? 0 : (int) (factor_faces_sd * 1000 / MathMan.getMean(faces_sd));
- PS.log(" - | faces_sd " + factor_faces_sd);
+ PS.debug(" - | faces_sd " + factor_faces_sd);
int[] rank_data_sd = rank(data_sd);
int[] sd_data_sd = getSD(rank_data_sd, rank_ratings);
@@ -287,7 +287,7 @@ public class PlotAnalysis {
int sum_data_sd = sum(variance_data_sd);
double factor_data_sd = getCC(n, sum_data_sd);
PlotAnalysis.MODIFIERS.data_sd = factor_data_sd == 1 ? 0 : (int) (factor_data_sd * 1000 / MathMan.getMean(data_sd));
- PS.log(" - | data_sd " + factor_data_sd);
+ PS.debug(" - | data_sd " + factor_data_sd);
int[] rank_air_sd = rank(air_sd);
int[] sd_air_sd = getSD(rank_air_sd, rank_ratings);
@@ -295,7 +295,7 @@ public class PlotAnalysis {
int sum_air_sd = sum(variance_air_sd);
double factor_air_sd = getCC(n, sum_air_sd);
PlotAnalysis.MODIFIERS.air_sd = factor_air_sd == 1 ? 0 : (int) (factor_air_sd * 1000 / MathMan.getMean(air_sd));
- PS.log(" - | air_sd " + factor_air_sd);
+ PS.debug(" - | air_sd " + factor_air_sd);
int[] rank_variety_sd = rank(variety_sd);
int[] sd_variety_sd = getSD(rank_variety_sd, rank_ratings);
@@ -303,11 +303,11 @@ public class PlotAnalysis {
int sum_variety_sd = sum(variance_variety_sd);
double factor_variety_sd = getCC(n, sum_variety_sd);
PlotAnalysis.MODIFIERS.variety_sd = factor_variety_sd == 1 ? 0 : (int) (factor_variety_sd * 1000 / MathMan.getMean(variety_sd));
- PS.log(" - | variety_sd " + factor_variety_sd);
+ PS.debug(" - | variety_sd " + factor_variety_sd);
int[] complexity = new int[n];
- PS.log(" $1Calculating threshold");
+ PS.debug(" $1Calculating threshold");
int max = 0;
int min = 0;
for (int i = 0; i < n; i++) {
@@ -337,7 +337,7 @@ public class PlotAnalysis {
logln("Correlation: ");
logln(getCC(n, sum(square(getSD(rank_complexity, rank_ratings)))));
if (optimal_complexity == Integer.MAX_VALUE) {
- PS.log("Insufficient data to determine correlation! " + optimal_index + " | " + n);
+ PS.debug("Insufficient data to determine correlation! " + optimal_index + " | " + n);
running = false;
for (Plot plot : plots) {
MainUtil.runners.remove(plot);
@@ -356,7 +356,7 @@ public class PlotAnalysis {
}
// Save calibration
- PS.log(" $1Saving calibration");
+ PS.debug(" $1Saving calibration");
YamlConfiguration config = PS.get().config;
config.set("clear.auto.threshold", optimal_complexity);
config.set("clear.auto.calibration.changes", PlotAnalysis.MODIFIERS.changes);
@@ -375,7 +375,7 @@ public class PlotAnalysis {
e.printStackTrace();
}
- PS.log("$1Done!");
+ PS.debug("$1Done!");
running = false;
for (Plot plot : plots) {
MainUtil.runners.remove(plot);
diff --git a/src/main/java/com/intellectualcrafters/plot/object/PlotCluster.java b/src/main/java/com/intellectualcrafters/plot/object/PlotCluster.java
index bd2c29b9c..81a1a7539 100644
--- a/src/main/java/com/intellectualcrafters/plot/object/PlotCluster.java
+++ b/src/main/java/com/intellectualcrafters/plot/object/PlotCluster.java
@@ -1,10 +1,10 @@
package com.intellectualcrafters.plot.object;
-import com.intellectualcrafters.plot.database.DBFunc;
-
import java.util.HashSet;
import java.util.UUID;
+import com.intellectualcrafters.plot.database.DBFunc;
+
public class PlotCluster {
public final String world;
public PlotSettings settings;
diff --git a/src/main/java/com/intellectualcrafters/plot/object/PlotHandler.java b/src/main/java/com/intellectualcrafters/plot/object/PlotHandler.java
index 585952bf4..46f7021da 100644
--- a/src/main/java/com/intellectualcrafters/plot/object/PlotHandler.java
+++ b/src/main/java/com/intellectualcrafters/plot/object/PlotHandler.java
@@ -1,14 +1,14 @@
package com.intellectualcrafters.plot.object;
-import com.intellectualcrafters.plot.database.DBFunc;
-import com.intellectualcrafters.plot.util.MainUtil;
-import com.intellectualcrafters.plot.util.UUIDHandler;
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.UUID;
+import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.UUIDHandler;
+
public class PlotHandler {
public static HashSet getOwners(Plot plot) {
if (plot.owner == null) {
diff --git a/src/main/java/com/intellectualcrafters/plot/object/PlotItemStack.java b/src/main/java/com/intellectualcrafters/plot/object/PlotItemStack.java
index ea499ae7c..597cbb0e2 100644
--- a/src/main/java/com/intellectualcrafters/plot/object/PlotItemStack.java
+++ b/src/main/java/com/intellectualcrafters/plot/object/PlotItemStack.java
@@ -1,5 +1,7 @@
package com.intellectualcrafters.plot.object;
+import com.intellectualcrafters.plot.util.BlockManager;
+
public class PlotItemStack {
public final int id;
public final short data;
@@ -7,6 +9,7 @@ public class PlotItemStack {
public final String name;
public final String[] lore;
+ @Deprecated
public PlotItemStack(int id, short data, int amount, String name, String... lore) {
this.id = id;
this.data = data;
@@ -14,4 +17,13 @@ public class PlotItemStack {
this.name = name;
this.lore = lore;
}
+
+ public PlotItemStack(String id, int amount, String name, String... lore) {
+ PlotBlock block = BlockManager.manager.getPlotBlockFromString(id);
+ this.id = block.id;
+ this.data = block.data;
+ this.amount = amount;
+ this.name = name;
+ this.lore = lore;
+ }
}
diff --git a/src/main/java/com/intellectualcrafters/plot/object/PlotManager.java b/src/main/java/com/intellectualcrafters/plot/object/PlotManager.java
index 9f868ca0a..6d8029260 100644
--- a/src/main/java/com/intellectualcrafters/plot/object/PlotManager.java
+++ b/src/main/java/com/intellectualcrafters/plot/object/PlotManager.java
@@ -20,13 +20,13 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.object;
-import com.intellectualcrafters.plot.commands.Template;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
+import com.intellectualcrafters.plot.commands.Template;
+
public abstract class PlotManager {
/*
* Plot locations (methods with Abs in them will not need to consider mega
diff --git a/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java b/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java
index 257559951..673200167 100644
--- a/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java
+++ b/src/main/java/com/intellectualcrafters/plot/object/PlotPlayer.java
@@ -1,9 +1,11 @@
package com.intellectualcrafters.plot.object;
-import com.plotsquared.general.commands.CommandCaller;
-
import java.util.UUID;
+import com.intellectualcrafters.plot.util.PlotGamemode;
+import com.intellectualcrafters.plot.util.PlotWeather;
+import com.plotsquared.general.commands.CommandCaller;
+
/**
* Created 2015-02-20 for PlotSquared
*
@@ -60,4 +62,18 @@ public interface PlotPlayer extends CommandCaller {
void setMeta(String key, Object value);
Object getMeta(String key);
void deleteMeta(String key);
+
+ void setWeather(PlotWeather weather);
+
+ PlotGamemode getGamemode();
+
+ void setGamemode(PlotGamemode gamemode);
+
+ void setTime(long time);
+
+ void setFlight(boolean fly);
+
+ void playMusic(Location loc, int id);
+
+ void kick(String message);
}
diff --git a/src/main/java/com/intellectualcrafters/plot/object/PlotSettings.java b/src/main/java/com/intellectualcrafters/plot/object/PlotSettings.java
index 10c09b39e..7534e3e86 100644
--- a/src/main/java/com/intellectualcrafters/plot/object/PlotSettings.java
+++ b/src/main/java/com/intellectualcrafters/plot/object/PlotSettings.java
@@ -20,17 +20,17 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.object;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.UUID;
+
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.object.comment.PlotComment;
import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.MainUtil;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.UUID;
-
/**
* plot settings
*
diff --git a/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java b/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java
index 907d2f312..4201c021f 100644
--- a/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java
+++ b/src/main/java/com/intellectualcrafters/plot/object/PlotWorld.java
@@ -20,6 +20,11 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.object;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Set;
+
import com.intellectualcrafters.configuration.ConfigurationSection;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Configuration;
@@ -28,13 +33,9 @@ import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.util.EconHandler;
+import com.intellectualcrafters.plot.util.PlotGamemode;
import com.intellectualcrafters.plot.util.StringMan;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Set;
-
/**
* @author Jesse Boyd
*/
@@ -60,6 +61,7 @@ public abstract class PlotWorld {
public final static boolean WORLD_BORDER_DEFAULT = false;
public final static int MAX_PLOT_MEMBERS_DEFAULT = 128;
public final static int MAX_BUILD_HEIGHT_DEFAULT = 256;
+ public final static PlotGamemode GAMEMODE_DEFAULT = PlotGamemode.CREATIVE;
// are plot clusters enabled
// require claim in cluster
// TODO make this configurable
@@ -95,6 +97,7 @@ public abstract class PlotWorld {
public boolean HOME_ALLOW_NONMEMBER;
public PlotLoc DEFAULT_HOME;
public int MAX_BUILD_HEIGHT;
+ public PlotGamemode GAMEMODE = PlotGamemode.CREATIVE;
public PlotWorld(final String worldname) {
this.worldname = worldname;
@@ -152,6 +155,26 @@ public abstract class PlotWorld {
this.WORLD_BORDER = config.getBoolean("world.border");
this.MAX_BUILD_HEIGHT = config.getInt("world.max_height");
+ switch (config.getString("world.gamemode").toLowerCase()) {
+ case "survival":
+ case "s":
+ case "0":
+ this.GAMEMODE = PlotGamemode.SURVIVAL;
+ case "creative":
+ case "c":
+ case "1":
+ this.GAMEMODE = PlotGamemode.CREATIVE;
+ case "adventure":
+ case "a":
+ case "2":
+ this.GAMEMODE = PlotGamemode.ADVENTURE;
+ case "spectator":
+ case "3":
+ this.GAMEMODE = PlotGamemode.SPECTATOR;
+ default:
+ PS.debug("&cInvalid gamemode set for: " + worldname);
+ }
+
this.HOME_ALLOW_NONMEMBER = config.getBoolean("home.allow-nonmembers");
String homeDefault = config.getString("home.default");
if (homeDefault.equalsIgnoreCase("side")) {
@@ -188,7 +211,7 @@ public abstract class PlotWorld {
this.DEFAULT_FLAGS = FlagManager.parseFlags(flags);
} catch (final Exception e) {
e.printStackTrace();
- PS.log("&cInvalid default flags for " + this.worldname + ": " + StringMan.join(flags, ","));
+ PS.debug("&cInvalid default flags for " + this.worldname + ": " + StringMan.join(flags, ","));
this.DEFAULT_FLAGS = new HashMap<>();
}
this.PVP = config.getBoolean("event.pvp");
@@ -232,6 +255,7 @@ public abstract class PlotWorld {
options.put("home.default", "side");
options.put("home.allow-nonmembers", false);
options.put("world.max_height", PlotWorld.MAX_BUILD_HEIGHT_DEFAULT);
+ options.put("world.gamemode", PlotWorld.GAMEMODE_DEFAULT.name().toLowerCase());
if (Settings.ENABLE_CLUSTERS && (this.TYPE != 0)) {
options.put("generator.terrain", this.TERRAIN);
diff --git a/src/main/java/com/intellectualcrafters/plot/object/Rating.java b/src/main/java/com/intellectualcrafters/plot/object/Rating.java
index db028ec57..b701baa1a 100644
--- a/src/main/java/com/intellectualcrafters/plot/object/Rating.java
+++ b/src/main/java/com/intellectualcrafters/plot/object/Rating.java
@@ -1,12 +1,12 @@
package com.intellectualcrafters.plot.object;
-import com.intellectualcrafters.plot.config.Settings;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
+import com.intellectualcrafters.plot.config.Settings;
+
public class Rating {
/**
@@ -14,6 +14,9 @@ public class Rating {
*/
private HashMap ratingMap;
+ private boolean changed;
+ private int initial;
+
public Rating(int value) {
ratingMap = new HashMap<>();
if (Settings.RATING_CATEGORIES != null && Settings.RATING_CATEGORIES.size() > 1) {
@@ -25,6 +28,7 @@ public class Rating {
else {
ratingMap.put(null, value);
}
+ this.initial = value;
}
public List getCategories() {
@@ -46,5 +50,30 @@ public class Rating {
return ratingMap.get(category);
}
+ public boolean setRating(String category, int value) {
+ changed = true;
+ if (!this.ratingMap.containsKey(category)) {
+ return false;
+ }
+ return this.ratingMap.put(category, value) != null;
+ }
+
+ public int getAggregate() {
+ if (!changed) {
+ return initial;
+ }
+ if (Settings.RATING_CATEGORIES != null && Settings.RATING_CATEGORIES.size() > 1) {
+ int val = 0;
+ for (int i = 0; i < Settings.RATING_CATEGORIES.size(); i++) {
+ val += (i + 1) * Math.pow(10, ratingMap.get(Settings.RATING_CATEGORIES.get(i)));
+ }
+ return val;
+ }
+ else {
+ return ratingMap.get(null);
+ }
+
+ }
+
}
diff --git a/src/main/java/com/intellectualcrafters/plot/object/comment/InboxOwner.java b/src/main/java/com/intellectualcrafters/plot/object/comment/InboxOwner.java
index 4e89b9cd3..2a622d5fe 100644
--- a/src/main/java/com/intellectualcrafters/plot/object/comment/InboxOwner.java
+++ b/src/main/java/com/intellectualcrafters/plot/object/comment/InboxOwner.java
@@ -1,5 +1,7 @@
package com.intellectualcrafters.plot.object.comment;
+import java.util.ArrayList;
+
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotHandler;
@@ -8,8 +10,6 @@ import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.TaskManager;
-import java.util.ArrayList;
-
public class InboxOwner extends CommentInbox {
@Override
diff --git a/src/main/java/com/intellectualcrafters/plot/object/comment/InboxPublic.java b/src/main/java/com/intellectualcrafters/plot/object/comment/InboxPublic.java
index 4fa6efe9a..62890fb89 100644
--- a/src/main/java/com/intellectualcrafters/plot/object/comment/InboxPublic.java
+++ b/src/main/java/com/intellectualcrafters/plot/object/comment/InboxPublic.java
@@ -1,5 +1,7 @@
package com.intellectualcrafters.plot.object.comment;
+import java.util.ArrayList;
+
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotHandler;
@@ -8,8 +10,6 @@ import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.TaskManager;
-import java.util.ArrayList;
-
public class InboxPublic extends CommentInbox {
@Override
diff --git a/src/main/java/com/plotsquared/bukkit/titles/AbstractTitle.java b/src/main/java/com/intellectualcrafters/plot/util/AbstractTitle.java
similarity index 73%
rename from src/main/java/com/plotsquared/bukkit/titles/AbstractTitle.java
rename to src/main/java/com/intellectualcrafters/plot/util/AbstractTitle.java
index b8d19de76..f13731b6f 100644
--- a/src/main/java/com/plotsquared/bukkit/titles/AbstractTitle.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/AbstractTitle.java
@@ -1,12 +1,15 @@
-package com.plotsquared.bukkit.titles;
+package com.intellectualcrafters.plot.util;
+import com.intellectualcrafters.plot.object.ConsolePlayer;
import com.intellectualcrafters.plot.object.PlotPlayer;
-import org.bukkit.ChatColor;
public abstract class AbstractTitle {
public static AbstractTitle TITLE_CLASS;
public static void sendTitle(PlotPlayer player, String head, String sub) {
+ if (ConsolePlayer.isConsole(player)) {
+ return;
+ }
if (TITLE_CLASS != null && !player.getAttribute("disabletitles")) {
TITLE_CLASS.sendTitle(player, head, sub, 1, 2, 1);
}
diff --git a/src/main/java/com/intellectualcrafters/plot/util/BlockManager.java b/src/main/java/com/intellectualcrafters/plot/util/BlockManager.java
index db437a761..ff214913e 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/BlockManager.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/BlockManager.java
@@ -19,7 +19,7 @@ public abstract class BlockManager {
public abstract int getBiomeFromString(String biome);
- public abstract int getBlockIdFromString(String block);
+ public abstract PlotBlock getPlotBlockFromString(String block);
public abstract int getHeighestBlock(String world, int x, int z);
diff --git a/src/main/java/com/intellectualcrafters/plot/util/BlockUpdateUtil.java b/src/main/java/com/intellectualcrafters/plot/util/BlockUpdateUtil.java
index b11d43a15..09b982afb 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/BlockUpdateUtil.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/BlockUpdateUtil.java
@@ -1,9 +1,9 @@
package com.intellectualcrafters.plot.util;
-import com.intellectualcrafters.plot.object.ChunkLoc;
-
import java.util.Collection;
+import com.intellectualcrafters.plot.object.ChunkLoc;
+
public abstract class BlockUpdateUtil {
public static BlockUpdateUtil setBlockManager = null;
diff --git a/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java b/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java
index c5a55b576..4416c425d 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/ChunkManager.java
@@ -1,12 +1,19 @@
package com.intellectualcrafters.plot.util;
-import com.intellectualcrafters.plot.object.*;
-import com.intellectualcrafters.plot.util.SetBlockQueue.ChunkWrapper;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
+import com.intellectualcrafters.plot.object.ChunkLoc;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotLoc;
+import com.intellectualcrafters.plot.object.RegionWrapper;
+import com.intellectualcrafters.plot.object.RunnableVal;
+import com.intellectualcrafters.plot.util.SetBlockQueue.ChunkWrapper;
+
public abstract class ChunkManager {
public static ChunkManager manager = null;
diff --git a/src/main/java/com/intellectualcrafters/plot/util/ClusterManager.java b/src/main/java/com/intellectualcrafters/plot/util/ClusterManager.java
index c7a1570c8..23ca04120 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/ClusterManager.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/ClusterManager.java
@@ -1,20 +1,29 @@
package com.intellectualcrafters.plot.util;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.config.C;
-import com.intellectualcrafters.plot.object.*;
-import com.plotsquared.bukkit.generator.AugmentedPopulator;
-import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
-import org.bukkit.Bukkit;
-import org.bukkit.Chunk;
-import org.bukkit.World;
-import org.bukkit.generator.BlockPopulator;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Random;
+import org.bukkit.Bukkit;
+import org.bukkit.Chunk;
+import org.bukkit.World;
+import org.bukkit.generator.BlockPopulator;
+
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.object.BlockLoc;
+import com.intellectualcrafters.plot.object.ChunkLoc;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotCluster;
+import com.intellectualcrafters.plot.object.PlotClusterId;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotManager;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.plotsquared.bukkit.generator.AugmentedPopulator;
+
public class ClusterManager {
public static HashMap> clusters;
public static PlotCluster last;
diff --git a/src/main/java/com/intellectualcrafters/plot/util/CmdConfirm.java b/src/main/java/com/intellectualcrafters/plot/util/CmdConfirm.java
index 28071ee95..b238e91b0 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/CmdConfirm.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/CmdConfirm.java
@@ -1,11 +1,11 @@
package com.intellectualcrafters.plot.util;
+import java.util.HashMap;
+
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.CmdInstance;
import com.intellectualcrafters.plot.object.PlotPlayer;
-import java.util.HashMap;
-
public class CmdConfirm {
private static HashMap pending = new HashMap<>();
diff --git a/src/main/java/com/intellectualcrafters/plot/util/CommentManager.java b/src/main/java/com/intellectualcrafters/plot/util/CommentManager.java
index e35bd99f5..4803b4e23 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/CommentManager.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/CommentManager.java
@@ -1,17 +1,20 @@
package com.intellectualcrafters.plot.util;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.concurrent.atomic.AtomicInteger;
+
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RunnableVal;
-import com.intellectualcrafters.plot.object.comment.*;
-import com.plotsquared.bukkit.titles.AbstractTitle;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.concurrent.atomic.AtomicInteger;
+import com.intellectualcrafters.plot.object.comment.CommentInbox;
+import com.intellectualcrafters.plot.object.comment.InboxOwner;
+import com.intellectualcrafters.plot.object.comment.InboxPublic;
+import com.intellectualcrafters.plot.object.comment.InboxReport;
+import com.intellectualcrafters.plot.object.comment.PlotComment;
public class CommentManager {
diff --git a/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java b/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java
index 635ecb6ca..7b537ad4a 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/EventUtil.java
@@ -7,7 +7,6 @@ import java.util.UUID;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager;
-import com.plotsquared.bukkit.listeners.PlayerBlockEventType;
import com.intellectualcrafters.plot.object.LazyBlock;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
@@ -15,6 +14,7 @@ import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.object.PlotCluster;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.plotsquared.bukkit.listeners.PlayerBlockEventType;
public abstract class EventUtil {
diff --git a/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java b/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java
index 13e2caff4..53f2d1220 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/ExpireManager.java
@@ -1,20 +1,27 @@
package com.intellectualcrafters.plot.util;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.ConcurrentHashMap;
+
+import org.bukkit.Bukkit;
+import org.bukkit.OfflinePlayer;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.generator.HybridUtils;
-import com.intellectualcrafters.plot.object.*;
-import org.bukkit.Bukkit;
-import org.bukkit.OfflinePlayer;
-
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.UUID;
-import java.util.concurrent.ConcurrentHashMap;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotAnalysis;
+import com.intellectualcrafters.plot.object.PlotHandler;
+import com.intellectualcrafters.plot.object.PlotManager;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.object.RunnableVal;
public class ExpireManager {
public static ConcurrentHashMap> expiredPlots = new ConcurrentHashMap<>();
@@ -42,7 +49,7 @@ public class ExpireManager {
public void run() {
try {
final List plots = getOldPlots(world);
- PS.log("$2[&5Expire&dManager$2] $4Found " + plots.size() + " expired plots for " + world + "!");
+ PS.debug("$2[&5Expire&dManager$2] $4Found " + plots.size() + " expired plots for " + world + "!");
expiredPlots.put(world, plots);
updatingPlots.put(world, false);
}
@@ -69,18 +76,18 @@ public class ExpireManager {
}
final Boolean updating = ExpireManager.updatingPlots.get(world);
if (updating) {
- PS.log("$2[&5Expire&dManager$2] $4Waiting on fetch...");
+ PS.debug("$2[&5Expire&dManager$2] $4Waiting on fetch...");
return;
}
if (!expiredPlots.containsKey(world)) {
- PS.log("$2[&5Expire&dManager$2] $4Updating expired plots for: " + world);
+ PS.debug("$2[&5Expire&dManager$2] $4Updating expired plots for: " + world);
updateExpired(world);
return;
}
final List plots = expiredPlots.get(world);
if ((plots == null) || (plots.size() == 0)) {
if (updateExpired(world)) {
- PS.log("$2[&5Expire&dManager$2] $4Re-evaluating expired plots for: " + world);
+ PS.debug("$2[&5Expire&dManager$2] $4Re-evaluating expired plots for: " + world);
return;
}
continue;
@@ -88,7 +95,7 @@ public class ExpireManager {
final Plot plot = plots.iterator().next();
if (!isExpired(plot)) {
expiredPlots.get(world).remove(plot);
- PS.log("$2[&5Expire&dManager$2] &bSkipping no longer expired: " + plot);
+ PS.debug("$2[&5Expire&dManager$2] &bSkipping no longer expired: " + plot);
return;
}
for (final UUID helper : plot.getTrusted()) {
@@ -105,7 +112,7 @@ public class ExpireManager {
}
final PlotManager manager = PS.get().getPlotManager(world);
if (manager == null) {
- PS.log("$2[&5Expire&dManager$2] &cThis is a friendly reminder to create or delete " + world +" as it is currently setup incorrectly");
+ PS.debug("$2[&5Expire&dManager$2] &cThis is a friendly reminder to create or delete " + world +" as it is currently setup incorrectly");
expiredPlots.get(world).remove(plot);
return;
}
@@ -116,7 +123,7 @@ public class ExpireManager {
PlotAnalysis changed = this.value;
if (Settings.CLEAR_THRESHOLD != -1 && plotworld.TYPE == 0 && changed != null) {
if (changed.getComplexity() > Settings.CLEAR_THRESHOLD) {
- PS.log("$2[&5Expire&dManager$2] &bIgnoring modified plot: " + plot + " : " + changed.getComplexity() + " - " + changed.changes);
+ PS.debug("$2[&5Expire&dManager$2] &bIgnoring modified plot: " + plot + " : " + changed.getComplexity() + " - " + changed.changes);
expiredPlots.get(world).remove(plot);
FlagManager.addPlotFlag(plot, new Flag(FlagManager.getFlag("analysis"), value));
return;
@@ -129,17 +136,17 @@ public class ExpireManager {
expiredPlots.get(world).remove(plot);
int complexity = changed == null ? 0 : changed.getComplexity();
int modified = changed == null ? 0 : changed.changes;
- PS.log("$2[&5Expire&dManager$2] &cDeleted expired plot: " + plot + " : " + complexity + " - " + modified);
- PS.log("$4 - World: " + plot.world);
+ PS.debug("$2[&5Expire&dManager$2] &cDeleted expired plot: " + plot + " : " + complexity + " - " + modified);
+ PS.debug("$4 - World: " + plot.world);
if (plot.hasOwner()) {
- PS.log("$4 - Owner: " + UUIDHandler.getName(plot.owner));
+ PS.debug("$4 - Owner: " + UUIDHandler.getName(plot.owner));
} else {
- PS.log("$4 - Owner: Unowned");
+ PS.debug("$4 - Owner: Unowned");
}
}
};
if (MainUtil.runners.containsKey(plot)) {
- PS.log("$2[&5Expire&dManager$2] &bSkipping plot in use: " + plot);
+ PS.debug("$2[&5Expire&dManager$2] &bSkipping plot in use: " + plot);
expiredPlots.get(world).remove(plot);
this.run();
return;
@@ -148,7 +155,7 @@ public class ExpireManager {
PlotAnalysis analysis = plot.getComplexity();
if (analysis != null) {
if (analysis.getComplexity() > Settings.CLEAR_THRESHOLD) {
- PS.log("$2[&5Expire&dManager$2] &bSkipping modified: " + plot);
+ PS.debug("$2[&5Expire&dManager$2] &bSkipping modified: " + plot);
expiredPlots.get(world).remove(plot);
this.run();
return;
diff --git a/src/main/java/com/intellectualcrafters/plot/util/HastebinUtility.java b/src/main/java/com/intellectualcrafters/plot/util/HastebinUtility.java
index b90de3085..a525bc1f9 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/HastebinUtility.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/HastebinUtility.java
@@ -1,6 +1,11 @@
package com.intellectualcrafters.plot.util;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.DataOutputStream;
+import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.regex.Matcher;
diff --git a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java
index fb624e5f7..7d03e36c0 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java
@@ -20,16 +20,30 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.util;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.UUID;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
-import com.intellectualcrafters.plot.object.*;
-import com.plotsquared.bukkit.listeners.PlotListener;
-import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
-
-import java.util.*;
-import java.util.Map.Entry;
+import com.intellectualcrafters.plot.object.BlockLoc;
+import com.intellectualcrafters.plot.object.ChunkLoc;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.object.PlotCluster;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotManager;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.object.PseudoRandom;
+import com.intellectualcrafters.plot.object.RunnableVal;
+import com.plotsquared.listener.PlotListener;
/**
* plot functions
@@ -46,6 +60,30 @@ public class MainUtil {
static long state = 1;
static PseudoRandom random = new PseudoRandom();
+ public static short[][] x_loc;
+ public static short[][] y_loc;
+ public static short[][] z_loc;
+
+ public static void initCache() {
+ if (x_loc == null) {
+ x_loc = new short[16][4096];
+ y_loc = new short[16][4096];
+ z_loc = new short[16][4096];
+ for (int i = 0; i < 16; i++) {
+ int i4 = i << 4;
+ for (int j = 0; j < 4096; j++) {
+ final int y = (i4) + (j >> 8);
+ final int a = (j - ((y & 0xF) << 8));
+ final int z1 = (a >> 4);
+ final int x1 = a - (z1 << 4);
+ x_loc[i][j] = (short) x1;
+ y_loc[i][j] = (short) y;
+ z_loc[i][j] = (short) z1;
+ }
+ }
+ }
+ }
+
public static boolean isPlotArea(final Location location) {
final PlotWorld plotworld = PS.get().getPlotWorld(location.getWorld());
if (plotworld.TYPE == 2) {
@@ -56,11 +94,11 @@ public class MainUtil {
public static String getName(UUID owner) {
if (owner == null) {
- return "unowned";
+ return C.NONE.s();
}
String name = UUIDHandler.getName(owner);
if (name == null) {
- return "unknown";
+ return C.UNKNOWN.s();
}
return name;
}
@@ -80,8 +118,8 @@ public class MainUtil {
@Override
public void run() {
for (PlotPlayer pp : getPlayersInPlot(plot)) {
- PlotListener.manager.plotExit(pp, plot);
- PlotListener.manager.plotEntry(pp, plot);
+ PlotListener.plotExit(pp, plot);
+ PlotListener.plotEntry(pp, plot);
}
}
}, 1);
@@ -751,7 +789,7 @@ public class MainUtil {
if (plotworld.ALLOW_SIGNS) {
final Location loc = manager.getSignLoc(plotworld, p);
final String id = p.id.x + ";" + p.id.y;
- final String[] lines = new String[] { C.OWNER_SIGN_LINE_1.translated().replaceAll("%id%", id), C.OWNER_SIGN_LINE_2.translated().replaceAll("%id%", id).replaceAll("%plr%", name), C.OWNER_SIGN_LINE_3.translated().replaceAll("%id%", id).replaceAll("%plr%", name), C.OWNER_SIGN_LINE_4.translated().replaceAll("%id%", id).replaceAll("%plr%", name) };
+ final String[] lines = new String[] { C.OWNER_SIGN_LINE_1.formatted().replaceAll("%id%", id), C.OWNER_SIGN_LINE_2.formatted().replaceAll("%id%", id).replaceAll("%plr%", name), C.OWNER_SIGN_LINE_3.formatted().replaceAll("%id%", id).replaceAll("%plr%", name), C.OWNER_SIGN_LINE_4.formatted().replaceAll("%id%", id).replaceAll("%plr%", name) };
BlockManager.setSign(p.world, loc.getX(), loc.getY(), loc.getZ(), lines);
}
}
diff --git a/src/main/java/com/intellectualcrafters/plot/util/NbtFactory.java b/src/main/java/com/intellectualcrafters/plot/util/NbtFactory.java
index c351c839a..0f0bb0a00 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/NbtFactory.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/NbtFactory.java
@@ -1,5 +1,34 @@
package com.intellectualcrafters.plot.util;
+import java.io.BufferedInputStream;
+import java.io.DataInput;
+import java.io.DataInputStream;
+import java.io.DataOutput;
+import java.io.DataOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.AbstractList;
+import java.util.AbstractMap;
+import java.util.AbstractSet;
+import java.util.Arrays;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.ConcurrentMap;
+import java.util.zip.GZIPInputStream;
+import java.util.zip.GZIPOutputStream;
+
+import org.bukkit.Bukkit;
+import org.bukkit.Material;
+import org.bukkit.Server;
+import org.bukkit.inventory.ItemStack;
+
import com.google.common.base.Splitter;
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
@@ -10,20 +39,6 @@ import com.google.common.io.Files;
import com.google.common.io.InputSupplier;
import com.google.common.io.OutputSupplier;
import com.google.common.primitives.Primitives;
-import org.bukkit.Bukkit;
-import org.bukkit.Material;
-import org.bukkit.Server;
-import org.bukkit.inventory.ItemStack;
-
-import java.io.*;
-import java.lang.reflect.Constructor;
-import java.lang.reflect.Field;
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.*;
-import java.util.concurrent.ConcurrentMap;
-import java.util.zip.GZIPInputStream;
-import java.util.zip.GZIPOutputStream;
public class NbtFactory {
// Convert between NBT id and the equivalent class in java
diff --git a/src/main/java/com/intellectualcrafters/plot/util/PlayerManager.java b/src/main/java/com/intellectualcrafters/plot/util/PlayerManager.java
deleted file mode 100644
index cfcdcb137..000000000
--- a/src/main/java/com/intellectualcrafters/plot/util/PlayerManager.java
+++ /dev/null
@@ -1,9 +0,0 @@
-package com.intellectualcrafters.plot.util;
-
-import com.intellectualcrafters.plot.object.PlotPlayer;
-
-public abstract class PlayerManager {
- public static PlayerManager manager;
-
- public abstract void kickPlayer(PlotPlayer player, String reason);
-}
diff --git a/src/main/java/com/intellectualcrafters/plot/util/PlotGamemode.java b/src/main/java/com/intellectualcrafters/plot/util/PlotGamemode.java
new file mode 100644
index 000000000..a3f30ff21
--- /dev/null
+++ b/src/main/java/com/intellectualcrafters/plot/util/PlotGamemode.java
@@ -0,0 +1,8 @@
+package com.intellectualcrafters.plot.util;
+
+public enum PlotGamemode {
+ ADVENTURE,
+ SURVIVAL,
+ CREATIVE,
+ SPECTATOR;
+}
diff --git a/src/main/java/com/intellectualcrafters/plot/util/PlotSquaredException.java b/src/main/java/com/intellectualcrafters/plot/util/PlotSquaredException.java
deleted file mode 100644
index 1ad987181..000000000
--- a/src/main/java/com/intellectualcrafters/plot/util/PlotSquaredException.java
+++ /dev/null
@@ -1,54 +0,0 @@
-////////////////////////////////////////////////////////////////////////////////////////////////////
-// PlotSquared - A plot manager and world generator for the Bukkit API /
-// Copyright (c) 2014 IntellectualSites/IntellectualCrafters /
-// /
-// This program is free software; you can redistribute it and/or modify /
-// it under the terms of the GNU General Public License as published by /
-// the Free Software Foundation; either version 3 of the License, or /
-// (at your option) any later version. /
-// /
-// This program is distributed in the hope that it will be useful, /
-// but WITHOUT ANY WARRANTY; without even the implied warranty of /
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /
-// GNU General Public License for more details. /
-// /
-// You should have received a copy of the GNU General Public License /
-// along with this program; if not, write to the Free Software Foundation, /
-// Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA /
-// /
-// You can contact us via: support@intellectualsites.com /
-////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.intellectualcrafters.plot.util;
-
-import com.intellectualcrafters.plot.PS;
-
-/**
- * Created 2014-09-29 for PlotSquared
- *
- * @author Citymonstret
- */
-public class PlotSquaredException extends RuntimeException {
- public PlotSquaredException(final PlotError error, final String details) {
- super("PlotError >> " + error.getHeader() + ": " + details);
- PS.log("&cPlotError &6>> &c" + error.getHeader() + ": &6" + details);
- }
-
- public static enum PlotError {
- PLOTMAIN_NULL("The PlotSquared instance was null"),
- MISSING_DEPENDENCY("Missing Dependency");
- private final String errorHeader;
-
- PlotError(final String errorHeader) {
- this.errorHeader = errorHeader;
- }
-
- public String getHeader() {
- return this.errorHeader;
- }
-
- @Override
- public String toString() {
- return this.getHeader();
- }
- }
-}
diff --git a/src/main/java/com/intellectualcrafters/plot/util/PlotWeather.java b/src/main/java/com/intellectualcrafters/plot/util/PlotWeather.java
new file mode 100644
index 000000000..9b008072c
--- /dev/null
+++ b/src/main/java/com/intellectualcrafters/plot/util/PlotWeather.java
@@ -0,0 +1,7 @@
+package com.intellectualcrafters.plot.util;
+
+public enum PlotWeather {
+ RAIN,
+ CLEAR,
+ RESET;
+}
diff --git a/src/main/java/com/intellectualcrafters/plot/util/ReflectionUtils.java b/src/main/java/com/intellectualcrafters/plot/util/ReflectionUtils.java
index c8e4265b2..83cebe89a 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/ReflectionUtils.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/ReflectionUtils.java
@@ -20,9 +20,6 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.util;
-import org.bukkit.Bukkit;
-import org.bukkit.Server;
-
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
@@ -32,6 +29,9 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
+import org.bukkit.Bukkit;
+import org.bukkit.Server;
+
/**
* @author DPOH-VAR
* @version 1.0
diff --git a/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java b/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java
index 80093a954..0da7b398a 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/SchematicHandler.java
@@ -1,29 +1,56 @@
package com.intellectualcrafters.plot.util;
-import com.google.common.collect.Lists;
-import com.intellectualcrafters.jnbt.*;
-import com.intellectualcrafters.json.JSONArray;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.config.Settings;
-import com.intellectualcrafters.plot.object.*;
-import com.intellectualcrafters.plot.object.schematic.PlotItem;
-import com.plotsquared.bukkit.object.schematic.StateWrapper;
-import com.plotsquared.bukkit.util.WorldEditSchematic;
-import com.plotsquared.bukkit.util.bukkit.BukkitSchematicHandler;
-import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
-
-import java.io.*;
+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.io.OutputStream;
+import java.io.OutputStreamWriter;
+import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
import java.nio.channels.Channels;
import java.nio.channels.ReadableByteChannel;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
import java.util.zip.GZIPInputStream;
import java.util.zip.GZIPOutputStream;
+import com.google.common.collect.Lists;
+import com.intellectualcrafters.jnbt.ByteArrayTag;
+import com.intellectualcrafters.jnbt.CompoundTag;
+import com.intellectualcrafters.jnbt.IntTag;
+import com.intellectualcrafters.jnbt.ListTag;
+import com.intellectualcrafters.jnbt.NBTInputStream;
+import com.intellectualcrafters.jnbt.NBTOutputStream;
+import com.intellectualcrafters.jnbt.ShortTag;
+import com.intellectualcrafters.jnbt.StringTag;
+import com.intellectualcrafters.jnbt.Tag;
+import com.intellectualcrafters.json.JSONArray;
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.config.Settings;
+import com.intellectualcrafters.plot.object.ChunkLoc;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.RunnableVal;
+import com.intellectualcrafters.plot.object.schematic.PlotItem;
+import com.plotsquared.bukkit.object.schematic.StateWrapper;
+import com.plotsquared.bukkit.util.WorldEditSchematic;
+
public abstract class SchematicHandler {
- public static SchematicHandler manager = new BukkitSchematicHandler();
+ public static SchematicHandler manager;
private boolean exportAll = false;
@@ -69,7 +96,7 @@ public abstract class SchematicHandler {
Location bot = plot.getBottom();
int area = (1 + top.getX() - bot.getX()) * (1 + top.getZ() - bot.getZ());
if (area > 4096) {
- PS.log("The plot is > 64 x 64 - Fast lossy schematic saving will be used");
+ PS.debug("The plot is > 64 x 64 - Fast lossy schematic saving will be used");
}
if (area <= 4096 && PS.get().worldEdit != null) {
new WorldEditSchematic().saveSchematic(directory + File.separator + name + ".schematic", plot.world, plot.id);
@@ -126,7 +153,7 @@ public abstract class SchematicHandler {
public void run() {
if (whenDone != null) whenDone.value = false;
if (schematic == null) {
- PS.log("Schematic == null :|");
+ PS.debug("Schematic == null :|");
TaskManager.runTask(whenDone);
return;
}
@@ -139,7 +166,7 @@ public abstract class SchematicHandler {
Location bottom = plot.getBottom();
Location top = plot.getTop();
if (top.getX() - bottom.getX() < WIDTH || top.getZ() - bottom.getZ() < LENGTH || HEIGHT > 256) {
- PS.log("Schematic is too large");
+ PS.debug("Schematic is too large");
TaskManager.runTask(whenDone);
return;
}
@@ -338,7 +365,7 @@ public abstract class SchematicHandler {
public boolean pasteStates(final Schematic schematic, final Plot plot, final int x_offset, final int z_offset) {
if (schematic == null) {
- PS.log("Schematic == null :|");
+ PS.debug("Schematic == null :|");
return false;
}
HashSet items = schematic.getItems();
@@ -461,7 +488,7 @@ public abstract class SchematicHandler {
*/
public Schematic getSchematic(File file) {
if (!file.exists()) {
- PS.log(file.toString() + " doesn't exist");
+ PS.debug(file.toString() + " doesn't exist");
return null;
}
try {
@@ -496,7 +523,7 @@ public abstract class SchematicHandler {
}
catch (Exception e) {
e.printStackTrace();
- PS.log(is.toString() + " | " + is.getClass().getCanonicalName() + " is not in GZIP format : " + e.getMessage());
+ PS.debug(is.toString() + " | " + is.getClass().getCanonicalName() + " is not in GZIP format : " + e.getMessage());
}
return null;
}
@@ -530,7 +557,7 @@ public abstract class SchematicHandler {
public URL upload(final CompoundTag tag, UUID uuid, String file) {
if (tag == null) {
- PS.log("&cCannot save empty tag");
+ PS.debug("&cCannot save empty tag");
return null;
}
try {
@@ -610,7 +637,7 @@ public abstract class SchematicHandler {
*/
public boolean save(final CompoundTag tag, final String path) {
if (tag == null) {
- PS.log("&cCannot save empty tag");
+ PS.debug("&cCannot save empty tag");
return false;
}
try {
diff --git a/src/main/java/com/intellectualcrafters/plot/util/SetBlockQueue.java b/src/main/java/com/intellectualcrafters/plot/util/SetBlockQueue.java
index 876ab91d7..2dd05208f 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/SetBlockQueue.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/SetBlockQueue.java
@@ -1,14 +1,13 @@
package com.intellectualcrafters.plot.util;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.object.ChunkLoc;
-import com.intellectualcrafters.plot.object.PlotBlock;
-import com.plotsquared.bukkit.generator.AugmentedPopulator;
-
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map.Entry;
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.object.ChunkLoc;
+import com.intellectualcrafters.plot.object.PlotBlock;
+
public class SetBlockQueue {
private volatile static HashMap blocks;
@@ -46,8 +45,8 @@ public class SetBlockQueue {
public synchronized static void init() {
if (blocks == null) {
- if (AugmentedPopulator.x_loc == null) {
- AugmentedPopulator.initCache();
+ if (MainUtil.x_loc == null) {
+ MainUtil.initCache();
}
blocks = new HashMap<>();
runnables = new HashSet<>();
@@ -100,9 +99,9 @@ public class SetBlockQueue {
}
PlotBlock block = blocksj[k];
if (block != null) {
- int x = AugmentedPopulator.x_loc[j][k];
- int y = AugmentedPopulator.y_loc[j][k];
- int z = AugmentedPopulator.z_loc[j][k];
+ int x = MainUtil.x_loc[j][k];
+ int y = MainUtil.y_loc[j][k];
+ int z = MainUtil.z_loc[j][k];
BlockManager.manager.functionSetBlock(world, X + x, y, Z + z, block.id, block.data);
blocks[j][k] = null;
once = true;
@@ -120,9 +119,9 @@ public class SetBlockQueue {
for (int k = 0; k < blocksj.length; k++) {
PlotBlock block = blocksj[k];
if (block != null) {
- int x = AugmentedPopulator.x_loc[j][k];
- int y = AugmentedPopulator.y_loc[j][k];
- int z = AugmentedPopulator.z_loc[j][k];
+ int x = MainUtil.x_loc[j][k];
+ int y = MainUtil.y_loc[j][k];
+ int z = MainUtil.z_loc[j][k];
BlockManager.manager.functionSetBlock(world, X + x, y, Z + z, block.id, block.data);
}
}
diff --git a/src/main/java/com/intellectualcrafters/plot/util/SetupUtils.java b/src/main/java/com/intellectualcrafters/plot/util/SetupUtils.java
index e64b213d7..5d61cfd66 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/SetupUtils.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/SetupUtils.java
@@ -1,14 +1,12 @@
package com.intellectualcrafters.plot.util;
+import java.util.HashMap;
+import java.util.Map;
+
import com.intellectualcrafters.plot.generator.PlotGenerator;
import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.object.SetupObject;
-import org.bukkit.generator.ChunkGenerator;
-
-import java.util.HashMap;
-import java.util.Map;
-
public abstract class SetupUtils {
public static SetupUtils manager;
diff --git a/src/main/java/com/intellectualcrafters/plot/util/StringComparison.java b/src/main/java/com/intellectualcrafters/plot/util/StringComparison.java
index 3b5fadea9..9bf3ab67f 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/StringComparison.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/StringComparison.java
@@ -62,13 +62,17 @@ public class StringComparison {
this.bestMatchObject = objects[0];
input = input.toLowerCase();
for (final T o : objects) {
- if ((c = compare(input, o.toString().toLowerCase())) < this.match) {
+ if ((c = compare(input, getString(o).toLowerCase())) < this.match) {
this.match = c;
this.bestMatch = o;
this.bestMatchObject = o;
}
}
}
+
+ public String getString(T o) {
+ return o.toString();
+ }
/**
* Compare two strings
@@ -137,7 +141,7 @@ public class StringComparison {
* @return match value
*/
public String getBestMatch() {
- return this.bestMatch.toString();
+ return getString(this.bestMatch);
}
/**
diff --git a/src/main/java/com/intellectualcrafters/plot/util/TaskManager.java b/src/main/java/com/intellectualcrafters/plot/util/TaskManager.java
index 51e5dbb6e..ec83706bd 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/TaskManager.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/TaskManager.java
@@ -1,11 +1,11 @@
package com.intellectualcrafters.plot.util;
-import com.intellectualcrafters.plot.PS;
-
import java.util.HashMap;
import java.util.HashSet;
import java.util.concurrent.atomic.AtomicInteger;
+import com.intellectualcrafters.plot.PS;
+
public abstract class TaskManager {
public static HashSet TELEPORT_QUEUE = new HashSet<>();
diff --git a/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java b/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java
index 8880924f7..12fa118d7 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/UUIDHandler.java
@@ -1,14 +1,18 @@
package com.intellectualcrafters.plot.util;
-import com.google.common.collect.BiMap;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.object.*;
-import com.intellectualcrafters.plot.uuid.UUIDWrapper;
-
import java.util.HashSet;
import java.util.Map;
import java.util.UUID;
+import com.google.common.collect.BiMap;
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.RunnableVal;
+import com.intellectualcrafters.plot.object.StringWrapper;
+import com.intellectualcrafters.plot.uuid.UUIDWrapper;
+
public class UUIDHandler {
public static UUIDHandlerImplementation implementation;
diff --git a/src/main/java/com/intellectualcrafters/plot/util/UUIDHandlerImplementation.java b/src/main/java/com/intellectualcrafters/plot/util/UUIDHandlerImplementation.java
index c430ada4c..56a1cdeeb 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/UUIDHandlerImplementation.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/UUIDHandlerImplementation.java
@@ -1,5 +1,9 @@
package com.intellectualcrafters.plot.util;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+
import com.google.common.collect.BiMap;
import com.google.common.collect.HashBiMap;
import com.intellectualcrafters.plot.PS;
@@ -9,14 +13,8 @@ import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.object.StringWrapper;
-import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper;
-import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-
public abstract class UUIDHandlerImplementation {
private BiMap uuidMap = HashBiMap.create(new HashMap());
@@ -83,7 +81,7 @@ public abstract class UUIDHandlerImplementation {
}
uuidMap.put(name, uuid);
}
- PS.log(C.PREFIX.s() + "&6Cached a total of: " + uuidMap.size() + " UUIDs");
+ PS.debug(C.PREFIX.s() + "&6Cached a total of: " + uuidMap.size() + " UUIDs");
}
});
}
@@ -155,7 +153,7 @@ public abstract class UUIDHandlerImplementation {
return uuid;
}
// Read from disk OR convert directly to offline UUID
- if (uuidWrapper instanceof OfflineUUIDWrapper || uuidWrapper instanceof LowerOfflineUUIDWrapper) {
+ if (Settings.OFFLINE_MODE) {
uuid = uuidWrapper.getUUID(name);
add(new StringWrapper(name), uuid);
return uuid;
diff --git a/src/main/java/com/intellectualcrafters/plot/util/helpmenu/HelpMenu.java b/src/main/java/com/intellectualcrafters/plot/util/helpmenu/HelpMenu.java
index b07a04fba..f46467d1a 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/helpmenu/HelpMenu.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/helpmenu/HelpMenu.java
@@ -1,12 +1,12 @@
package com.intellectualcrafters.plot.util.helpmenu;
+import java.util.List;
+
import com.intellectualcrafters.plot.commands.CommandCategory;
import com.intellectualcrafters.plot.commands.MainCommand;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.plotsquared.general.commands.Command;
-import java.util.List;
-
public class HelpMenu {
public static final int PER_PAGE = 5;
diff --git a/src/main/java/com/intellectualcrafters/plot/util/helpmenu/HelpPage.java b/src/main/java/com/intellectualcrafters/plot/util/helpmenu/HelpPage.java
index ac2c21578..c539faf1d 100644
--- a/src/main/java/com/intellectualcrafters/plot/util/helpmenu/HelpPage.java
+++ b/src/main/java/com/intellectualcrafters/plot/util/helpmenu/HelpPage.java
@@ -1,13 +1,13 @@
package com.intellectualcrafters.plot.util.helpmenu;
+import java.util.ArrayList;
+import java.util.List;
+
import com.intellectualcrafters.plot.commands.CommandCategory;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil;
-import java.util.ArrayList;
-import java.util.List;
-
public class HelpPage {
private final List _helpObjecs;
diff --git a/src/main/java/com/intellectualcrafters/plot/uuid/UUIDWrapper.java b/src/main/java/com/intellectualcrafters/plot/uuid/UUIDWrapper.java
index a5a30d7e0..1c6381c1c 100644
--- a/src/main/java/com/intellectualcrafters/plot/uuid/UUIDWrapper.java
+++ b/src/main/java/com/intellectualcrafters/plot/uuid/UUIDWrapper.java
@@ -1,10 +1,10 @@
package com.intellectualcrafters.plot.uuid;
+import java.util.UUID;
+
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
import com.intellectualcrafters.plot.object.PlotPlayer;
-import java.util.UUID;
-
public abstract class UUIDWrapper {
public abstract UUID getUUID(PlotPlayer player);
diff --git a/src/main/java/com/plotsquared/bukkit/BukkitMain.java b/src/main/java/com/plotsquared/bukkit/BukkitMain.java
index 59a9e8848..68236a262 100644
--- a/src/main/java/com/plotsquared/bukkit/BukkitMain.java
+++ b/src/main/java/com/plotsquared/bukkit/BukkitMain.java
@@ -24,6 +24,7 @@ import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.generator.HybridUtils;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.util.AbstractTitle;
import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.BlockUpdateUtil;
import com.intellectualcrafters.plot.util.ChunkManager;
@@ -32,7 +33,7 @@ import com.intellectualcrafters.plot.util.EconHandler;
import com.intellectualcrafters.plot.util.EventUtil;
import com.intellectualcrafters.plot.util.InventoryUtil;
import com.intellectualcrafters.plot.util.MainUtil;
-import com.intellectualcrafters.plot.util.PlayerManager;
+import com.intellectualcrafters.plot.util.SchematicHandler;
import com.intellectualcrafters.plot.util.SetupUtils;
import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandlerImplementation;
@@ -48,20 +49,18 @@ import com.plotsquared.bukkit.listeners.ForceFieldListener;
import com.plotsquared.bukkit.listeners.PlayerEvents;
import com.plotsquared.bukkit.listeners.PlayerEvents_1_8;
import com.plotsquared.bukkit.listeners.PlayerEvents_1_8_3;
-import com.plotsquared.bukkit.listeners.PlotListener;
import com.plotsquared.bukkit.listeners.PlotPlusListener;
import com.plotsquared.bukkit.listeners.TNTListener;
import com.plotsquared.bukkit.listeners.WorldEvents;
import com.plotsquared.bukkit.listeners.worldedit.WEListener;
import com.plotsquared.bukkit.listeners.worldedit.WESubscriber;
-import com.plotsquared.bukkit.titles.AbstractTitle;
import com.plotsquared.bukkit.titles.DefaultTitle;
import com.plotsquared.bukkit.util.BukkitHybridUtils;
import com.plotsquared.bukkit.util.bukkit.BukkitChunkManager;
import com.plotsquared.bukkit.util.bukkit.BukkitEconHandler;
import com.plotsquared.bukkit.util.bukkit.BukkitEventUtil;
import com.plotsquared.bukkit.util.bukkit.BukkitInventoryUtil;
-import com.plotsquared.bukkit.util.bukkit.BukkitPlayerManager;
+import com.plotsquared.bukkit.util.bukkit.BukkitSchematicHandler;
import com.plotsquared.bukkit.util.bukkit.BukkitSetBlockManager;
import com.plotsquared.bukkit.util.bukkit.BukkitSetupUtils;
import com.plotsquared.bukkit.util.bukkit.BukkitTaskManager;
@@ -77,7 +76,6 @@ import com.plotsquared.bukkit.util.bukkit.uuid.SQLUUIDHandler;
import com.plotsquared.bukkit.uuid.DefaultUUIDWrapper;
import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper;
import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
-import com.plotsquared.listener.APlotListener;
import com.sk89q.worldedit.WorldEdit;
import com.sk89q.worldedit.bukkit.WorldEditPlugin;
@@ -494,11 +492,6 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
BukkitUtil.removePlayer(player.getName());
}
- @Override
- public APlotListener initPlotListener() {
- return new PlotListener();
- }
-
@Override
public void registerChunkProcessor() {
getServer().getPluginManager().registerEvents(new ChunkListener(), this);
@@ -509,11 +502,6 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
getServer().getPluginManager().registerEvents(new WorldEvents(), this);
}
- @Override
- public PlayerManager initPlayerManager() {
- return new BukkitPlayerManager();
- }
-
@Override
public InventoryUtil initInventoryUtil() {
return new BukkitInventoryUtil();
@@ -544,4 +532,15 @@ public class BukkitMain extends JavaPlugin implements Listener, IPlotMain {
Bukkit.getServer().unloadWorld(world, false);
}
}
+
+ @Override
+ public SchematicHandler initSchematicHandler() {
+ return new BukkitSchematicHandler();
+ }
+
+ @Override
+ public AbstractTitle initTitleManager() {
+ // Already initialized in UUID handler
+ return AbstractTitle.TITLE_CLASS;
+ }
}
diff --git a/src/main/java/com/plotsquared/bukkit/commands/BukkitCommand.java b/src/main/java/com/plotsquared/bukkit/commands/BukkitCommand.java
index 50261dd42..96db9e5bc 100644
--- a/src/main/java/com/plotsquared/bukkit/commands/BukkitCommand.java
+++ b/src/main/java/com/plotsquared/bukkit/commands/BukkitCommand.java
@@ -1,17 +1,23 @@
package com.plotsquared.bukkit.commands;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.bukkit.command.CommandExecutor;
+import org.bukkit.command.CommandSender;
+import org.bukkit.command.TabCompleter;
+import org.bukkit.entity.Player;
+
+import com.intellectualcrafters.plot.commands.DebugUUID;
import com.intellectualcrafters.plot.commands.MainCommand;
import com.intellectualcrafters.plot.object.ConsolePlayer;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.StringComparison;
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
import com.plotsquared.general.commands.Command;
-import org.bukkit.command.CommandExecutor;
-import org.bukkit.command.CommandSender;
-import org.bukkit.command.TabCompleter;
-import org.bukkit.entity.Player;
-
-import java.util.*;
/**
* Created 2015-02-20 for PlotSquared
@@ -20,6 +26,10 @@ import java.util.*;
*/
public class BukkitCommand implements CommandExecutor, TabCompleter {
+ public BukkitCommand() {
+ MainCommand.getInstance().addCommand(new DebugUUID());
+ }
+
@Override
public boolean onCommand(final CommandSender commandSender, final org.bukkit.command.Command command, final String commandLabel, final String[] args) {
if (commandSender instanceof Player) {
diff --git a/src/main/java/com/plotsquared/bukkit/database/plotme/APlotMeConnector.java b/src/main/java/com/plotsquared/bukkit/database/plotme/APlotMeConnector.java
index 409d2071d..dce18505e 100644
--- a/src/main/java/com/plotsquared/bukkit/database/plotme/APlotMeConnector.java
+++ b/src/main/java/com/plotsquared/bukkit/database/plotme/APlotMeConnector.java
@@ -1,17 +1,18 @@
package com.plotsquared.bukkit.database.plotme;
+import java.sql.Connection;
+import java.sql.SQLException;
+import java.util.Arrays;
+import java.util.HashMap;
+
+import org.bukkit.Bukkit;
+import org.bukkit.World;
+
import com.intellectualcrafters.configuration.file.FileConfiguration;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId;
-import org.bukkit.Bukkit;
-import org.bukkit.World;
-
-import java.sql.Connection;
-import java.sql.SQLException;
-import java.util.Arrays;
-import java.util.HashMap;
public abstract class APlotMeConnector {
public abstract Connection getPlotMeConnection(String plugin, FileConfiguration plotConfig, String dataFolder);
diff --git a/src/main/java/com/plotsquared/bukkit/database/plotme/ClassicPlotMeConnector.java b/src/main/java/com/plotsquared/bukkit/database/plotme/ClassicPlotMeConnector.java
index c1a64e5a5..333fbbc89 100644
--- a/src/main/java/com/plotsquared/bukkit/database/plotme/ClassicPlotMeConnector.java
+++ b/src/main/java/com/plotsquared/bukkit/database/plotme/ClassicPlotMeConnector.java
@@ -1,5 +1,15 @@
package com.plotsquared.bukkit.database.plotme;
+import java.io.File;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map.Entry;
+import java.util.UUID;
+
import com.intellectualcrafters.configuration.file.FileConfiguration;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Settings;
@@ -12,12 +22,6 @@ import com.intellectualcrafters.plot.object.StringWrapper;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.UUIDHandler;
-import java.io.File;
-import java.sql.*;
-import java.util.HashMap;
-import java.util.Map.Entry;
-import java.util.UUID;
-
public class ClassicPlotMeConnector extends APlotMeConnector {
private String plugin;
diff --git a/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java b/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java
index 25544571a..46b6a6811 100644
--- a/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java
+++ b/src/main/java/com/plotsquared/bukkit/database/plotme/LikePlotMeConverter.java
@@ -20,19 +20,6 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.database.plotme;
-import com.intellectualcrafters.configuration.file.FileConfiguration;
-import com.intellectualcrafters.configuration.file.YamlConfiguration;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.config.Settings;
-import com.intellectualcrafters.plot.database.DBFunc;
-import com.intellectualcrafters.plot.object.Plot;
-import com.intellectualcrafters.plot.object.PlotId;
-import com.intellectualcrafters.plot.util.TaskManager;
-import com.plotsquared.bukkit.generator.HybridGen;
-import org.bukkit.Bukkit;
-import org.bukkit.World;
-import org.bukkit.WorldCreator;
-
import java.io.File;
import java.io.IOException;
import java.nio.charset.Charset;
@@ -47,6 +34,20 @@ import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Set;
+import org.bukkit.Bukkit;
+import org.bukkit.World;
+import org.bukkit.WorldCreator;
+
+import com.intellectualcrafters.configuration.file.FileConfiguration;
+import com.intellectualcrafters.configuration.file.YamlConfiguration;
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.config.Settings;
+import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.util.TaskManager;
+import com.plotsquared.bukkit.generator.HybridGen;
+
/**
* Created 2014-08-17 for PlotSquared
*
@@ -75,7 +76,7 @@ public class LikePlotMeConverter {
}
private void sendMessage(final String message) {
- PS.log("&3PlotMe&8->&3PlotSquared&8: &7" + message);
+ PS.debug("&3PlotMe&8->&3PlotSquared&8: &7" + message);
}
public String getPlotMePath() {
@@ -128,7 +129,7 @@ public class LikePlotMeConverter {
return false;
}
- PS.log("&3Using connector: " + connector.getClass().getCanonicalName());
+ PS.debug("&3Using connector: " + connector.getClass().getCanonicalName());
Connection connection = connector.getPlotMeConnection(plugin, plotConfig, dataFolder);
@@ -238,7 +239,7 @@ public class LikePlotMeConverter {
}
}
if (duplicate > 0) {
- PS.log("&c[WARNING] Found " + duplicate + " duplicate plots already in DB for world: '" + world + "'. Have you run the converter already?");
+ PS.debug("&c[WARNING] Found " + duplicate + " duplicate plots already in DB for world: '" + world + "'. Have you run the converter already?");
}
}
sendMessage("Creating plot DB");
@@ -247,10 +248,10 @@ public class LikePlotMeConverter {
@Override
public void run() {
sendMessage("&aDatabase conversion is now complete!");
- PS.log("&c - Stop the server");
- PS.log("&c - Disable 'plotme-convert.enabled' and 'plotme-convert.cache-uuids' in the settings.yml");
- PS.log("&c - Correct any generator settings that haven't copied to 'settings.yml' properly");
- PS.log("&c - Start the server");
+ PS.debug("&c - Stop the server");
+ PS.debug("&c - Disable 'plotme-convert.enabled' and 'plotme-convert.cache-uuids' in the settings.yml");
+ PS.debug("&c - Correct any generator settings that haven't copied to 'settings.yml' properly");
+ PS.debug("&c - Start the server");
PS.get().setAllPlotsRaw(DBFunc.getPlots());
}
});
@@ -315,7 +316,7 @@ public class LikePlotMeConverter {
});
} catch (final Exception e) {
e.printStackTrace();
- PS.log("&/end/");
+ PS.debug("&/end/");
}
return true;
}
diff --git a/src/main/java/com/plotsquared/bukkit/database/plotme/PlotMeConnector_017.java b/src/main/java/com/plotsquared/bukkit/database/plotme/PlotMeConnector_017.java
index 8352113ae..3d0978664 100644
--- a/src/main/java/com/plotsquared/bukkit/database/plotme/PlotMeConnector_017.java
+++ b/src/main/java/com/plotsquared/bukkit/database/plotme/PlotMeConnector_017.java
@@ -1,5 +1,15 @@
package com.plotsquared.bukkit.database.plotme;
+import java.io.File;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.HashMap;
+import java.util.Map.Entry;
+import java.util.UUID;
+
import com.intellectualcrafters.configuration.file.FileConfiguration;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Settings;
@@ -12,12 +22,6 @@ import com.intellectualcrafters.plot.object.StringWrapper;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.UUIDHandler;
-import java.io.File;
-import java.sql.*;
-import java.util.HashMap;
-import java.util.Map.Entry;
-import java.util.UUID;
-
public class PlotMeConnector_017 extends APlotMeConnector {
private String plugin;
diff --git a/src/main/java/com/plotsquared/bukkit/events/ClusterFlagRemoveEvent.java b/src/main/java/com/plotsquared/bukkit/events/ClusterFlagRemoveEvent.java
index 4cd04a8b7..ee71aaf0b 100644
--- a/src/main/java/com/plotsquared/bukkit/events/ClusterFlagRemoveEvent.java
+++ b/src/main/java/com/plotsquared/bukkit/events/ClusterFlagRemoveEvent.java
@@ -20,12 +20,13 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.events;
-import com.intellectualcrafters.plot.flag.Flag;
-import com.intellectualcrafters.plot.object.PlotCluster;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.object.PlotCluster;
+
/**
* Called when a flag is removed from a plot
*
diff --git a/src/main/java/com/plotsquared/bukkit/events/PlayerClaimPlotEvent.java b/src/main/java/com/plotsquared/bukkit/events/PlayerClaimPlotEvent.java
index bb6d491ab..b9616c300 100644
--- a/src/main/java/com/plotsquared/bukkit/events/PlayerClaimPlotEvent.java
+++ b/src/main/java/com/plotsquared/bukkit/events/PlayerClaimPlotEvent.java
@@ -20,12 +20,13 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.events;
-import com.intellectualcrafters.plot.object.Plot;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
+import com.intellectualcrafters.plot.object.Plot;
+
/**
* @author Citymonstret
* @author Empire92
diff --git a/src/main/java/com/plotsquared/bukkit/events/PlayerEnterPlotEvent.java b/src/main/java/com/plotsquared/bukkit/events/PlayerEnterPlotEvent.java
index 2331e5953..ba203cebe 100644
--- a/src/main/java/com/plotsquared/bukkit/events/PlayerEnterPlotEvent.java
+++ b/src/main/java/com/plotsquared/bukkit/events/PlayerEnterPlotEvent.java
@@ -20,11 +20,12 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.events;
-import com.intellectualcrafters.plot.object.Plot;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
+import com.intellectualcrafters.plot.object.Plot;
+
/**
* @author Citymonstret
* @author Empire92
diff --git a/src/main/java/com/plotsquared/bukkit/events/PlayerLeavePlotEvent.java b/src/main/java/com/plotsquared/bukkit/events/PlayerLeavePlotEvent.java
index ab26b59a3..c493388ea 100644
--- a/src/main/java/com/plotsquared/bukkit/events/PlayerLeavePlotEvent.java
+++ b/src/main/java/com/plotsquared/bukkit/events/PlayerLeavePlotEvent.java
@@ -20,11 +20,12 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.events;
-import com.intellectualcrafters.plot.object.Plot;
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
+import com.intellectualcrafters.plot.object.Plot;
+
/**
* @author Citymonstret
* @author Empire92
diff --git a/src/main/java/com/plotsquared/bukkit/events/PlayerPlotDeniedEvent.java b/src/main/java/com/plotsquared/bukkit/events/PlayerPlotDeniedEvent.java
index e0c298a9f..2fd73d28d 100644
--- a/src/main/java/com/plotsquared/bukkit/events/PlayerPlotDeniedEvent.java
+++ b/src/main/java/com/plotsquared/bukkit/events/PlayerPlotDeniedEvent.java
@@ -20,11 +20,12 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.events;
-import com.intellectualcrafters.plot.object.Plot;
+import java.util.UUID;
+
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
-import java.util.UUID;
+import com.intellectualcrafters.plot.object.Plot;
/**
* @author Citymonstret
diff --git a/src/main/java/com/plotsquared/bukkit/events/PlayerPlotHelperEvent.java b/src/main/java/com/plotsquared/bukkit/events/PlayerPlotHelperEvent.java
index 9df0f2e4b..c44156f51 100644
--- a/src/main/java/com/plotsquared/bukkit/events/PlayerPlotHelperEvent.java
+++ b/src/main/java/com/plotsquared/bukkit/events/PlayerPlotHelperEvent.java
@@ -20,11 +20,12 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.events;
-import com.intellectualcrafters.plot.object.Plot;
+import java.util.UUID;
+
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
-import java.util.UUID;
+import com.intellectualcrafters.plot.object.Plot;
/**
* @author Empire92
diff --git a/src/main/java/com/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java b/src/main/java/com/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java
index c646d5811..189cd575c 100644
--- a/src/main/java/com/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java
+++ b/src/main/java/com/plotsquared/bukkit/events/PlayerPlotTrustedEvent.java
@@ -20,11 +20,12 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.events;
-import com.intellectualcrafters.plot.object.Plot;
+import java.util.UUID;
+
import org.bukkit.entity.Player;
import org.bukkit.event.HandlerList;
-import java.util.UUID;
+import com.intellectualcrafters.plot.object.Plot;
/**
* @author Citymonstret
diff --git a/src/main/java/com/plotsquared/bukkit/events/PlayerTeleportToPlotEvent.java b/src/main/java/com/plotsquared/bukkit/events/PlayerTeleportToPlotEvent.java
index 7676f482b..d8af3de51 100644
--- a/src/main/java/com/plotsquared/bukkit/events/PlayerTeleportToPlotEvent.java
+++ b/src/main/java/com/plotsquared/bukkit/events/PlayerTeleportToPlotEvent.java
@@ -20,13 +20,14 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.events;
-import com.intellectualcrafters.plot.object.Location;
-import com.intellectualcrafters.plot.object.Plot;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
import org.bukkit.event.player.PlayerEvent;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+
/**
* Called when a player teleports to a plot
*
diff --git a/src/main/java/com/plotsquared/bukkit/events/PlotClearEvent.java b/src/main/java/com/plotsquared/bukkit/events/PlotClearEvent.java
index d5be3eb22..036c1c634 100644
--- a/src/main/java/com/plotsquared/bukkit/events/PlotClearEvent.java
+++ b/src/main/java/com/plotsquared/bukkit/events/PlotClearEvent.java
@@ -20,11 +20,12 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.events;
-import com.intellectualcrafters.plot.object.PlotId;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
+import com.intellectualcrafters.plot.object.PlotId;
+
/**
* Called when a plot is cleared
*
@@ -38,7 +39,7 @@ public class PlotClearEvent extends Event implements Cancellable {
private boolean cancelled;
/**
- * PlotDeleteEvent: Called when a plot is cleared
+ * PlotClearEvent: Called when a plot is cleared
*
* @param world The world in which the plot was cleared
* @param id The plot that was cleared
diff --git a/src/main/java/com/plotsquared/bukkit/events/PlotDeleteEvent.java b/src/main/java/com/plotsquared/bukkit/events/PlotDeleteEvent.java
index 71d9bd330..5f5b0aa38 100644
--- a/src/main/java/com/plotsquared/bukkit/events/PlotDeleteEvent.java
+++ b/src/main/java/com/plotsquared/bukkit/events/PlotDeleteEvent.java
@@ -20,10 +20,11 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.events;
-import com.intellectualcrafters.plot.object.PlotId;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
+import com.intellectualcrafters.plot.object.PlotId;
+
/**
* Called when a plot is deleted
*
diff --git a/src/main/java/com/plotsquared/bukkit/events/PlotEvent.java b/src/main/java/com/plotsquared/bukkit/events/PlotEvent.java
index 5fae6f1a6..1e45b9fbf 100644
--- a/src/main/java/com/plotsquared/bukkit/events/PlotEvent.java
+++ b/src/main/java/com/plotsquared/bukkit/events/PlotEvent.java
@@ -1,8 +1,9 @@
package com.plotsquared.bukkit.events;
-import com.intellectualcrafters.plot.object.Plot;
import org.bukkit.event.Event;
+import com.intellectualcrafters.plot.object.Plot;
+
public abstract class PlotEvent extends Event {
private final Plot plot;
diff --git a/src/main/java/com/plotsquared/bukkit/events/PlotFlagAddEvent.java b/src/main/java/com/plotsquared/bukkit/events/PlotFlagAddEvent.java
index 6ecb97052..eefd61555 100644
--- a/src/main/java/com/plotsquared/bukkit/events/PlotFlagAddEvent.java
+++ b/src/main/java/com/plotsquared/bukkit/events/PlotFlagAddEvent.java
@@ -20,11 +20,12 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.events;
-import com.intellectualcrafters.plot.flag.Flag;
-import com.intellectualcrafters.plot.object.Plot;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.object.Plot;
+
/**
* Called when a Flag is added to a plot
*
diff --git a/src/main/java/com/plotsquared/bukkit/events/PlotFlagRemoveEvent.java b/src/main/java/com/plotsquared/bukkit/events/PlotFlagRemoveEvent.java
index 5ca46babb..cce59834f 100644
--- a/src/main/java/com/plotsquared/bukkit/events/PlotFlagRemoveEvent.java
+++ b/src/main/java/com/plotsquared/bukkit/events/PlotFlagRemoveEvent.java
@@ -20,11 +20,12 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.events;
-import com.intellectualcrafters.plot.flag.Flag;
-import com.intellectualcrafters.plot.object.Plot;
import org.bukkit.event.Cancellable;
import org.bukkit.event.HandlerList;
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.object.Plot;
+
/**
* Called when a flag is removed from a plot
*
diff --git a/src/main/java/com/plotsquared/bukkit/events/PlotMergeEvent.java b/src/main/java/com/plotsquared/bukkit/events/PlotMergeEvent.java
index 4e14a1a68..99ca03ddb 100644
--- a/src/main/java/com/plotsquared/bukkit/events/PlotMergeEvent.java
+++ b/src/main/java/com/plotsquared/bukkit/events/PlotMergeEvent.java
@@ -20,14 +20,15 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.events;
-import com.intellectualcrafters.plot.object.Plot;
-import com.intellectualcrafters.plot.object.PlotId;
+import java.util.ArrayList;
+
import org.bukkit.World;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
-import java.util.ArrayList;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
/**
* @author Empire92
diff --git a/src/main/java/com/plotsquared/bukkit/events/PlotRateEvent.java b/src/main/java/com/plotsquared/bukkit/events/PlotRateEvent.java
index 65c20e15a..b888ffd06 100644
--- a/src/main/java/com/plotsquared/bukkit/events/PlotRateEvent.java
+++ b/src/main/java/com/plotsquared/bukkit/events/PlotRateEvent.java
@@ -1,8 +1,10 @@
package com.plotsquared.bukkit.events;
+import org.bukkit.event.HandlerList;
+
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
-import org.bukkit.event.HandlerList;
+import com.intellectualcrafters.plot.object.Rating;
/**
* Created 2015-07-13 for PlotSquaredGit
@@ -13,9 +15,9 @@ public class PlotRateEvent extends PlotEvent {
private static HandlerList handlers = new HandlerList();
private final PlotPlayer rater;
- private int rating;
+ private Rating rating;
- public PlotRateEvent(final PlotPlayer rater, final int rating, final Plot plot) {
+ public PlotRateEvent(final PlotPlayer rater, final Rating rating, final Plot plot) {
super(plot);
this.rater = rater;
this.rating = rating;
@@ -29,11 +31,11 @@ public class PlotRateEvent extends PlotEvent {
return this.rater;
}
- public void setRating(int rating) {
+ public void setRating(Rating rating) {
this.rating = rating;
}
- public int getRating() {
+ public Rating getRating() {
return this.rating;
}
diff --git a/src/main/java/com/plotsquared/bukkit/events/PlotUnlinkEvent.java b/src/main/java/com/plotsquared/bukkit/events/PlotUnlinkEvent.java
index b6c7166a0..a8d4e8854 100644
--- a/src/main/java/com/plotsquared/bukkit/events/PlotUnlinkEvent.java
+++ b/src/main/java/com/plotsquared/bukkit/events/PlotUnlinkEvent.java
@@ -20,13 +20,14 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.events;
-import com.intellectualcrafters.plot.object.PlotId;
+import java.util.ArrayList;
+
import org.bukkit.World;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
import org.bukkit.event.HandlerList;
-import java.util.ArrayList;
+import com.intellectualcrafters.plot.object.PlotId;
/**
* @author Empire92
diff --git a/src/main/java/com/plotsquared/bukkit/generator/AugmentedPopulator.java b/src/main/java/com/plotsquared/bukkit/generator/AugmentedPopulator.java
index 11d678848..3782d0e9b 100644
--- a/src/main/java/com/plotsquared/bukkit/generator/AugmentedPopulator.java
+++ b/src/main/java/com/plotsquared/bukkit/generator/AugmentedPopulator.java
@@ -1,11 +1,9 @@
package com.plotsquared.bukkit.generator;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.object.*;
-import com.intellectualcrafters.plot.util.ChunkManager;
-import com.intellectualcrafters.plot.util.TaskManager;
-import com.plotsquared.bukkit.util.bukkit.BukkitChunkManager;
-import com.plotsquared.bukkit.util.bukkit.BukkitSetBlockManager;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map.Entry;
+import java.util.Random;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
@@ -13,15 +11,22 @@ import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.generator.BlockPopulator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map.Entry;
-import java.util.Random;
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.object.BlockWrapper;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.PlotCluster;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotLoc;
+import com.intellectualcrafters.plot.object.PlotManager;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.object.RegionWrapper;
+import com.intellectualcrafters.plot.util.ChunkManager;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.TaskManager;
+import com.plotsquared.bukkit.util.bukkit.BukkitChunkManager;
+import com.plotsquared.bukkit.util.bukkit.BukkitSetBlockManager;
public class AugmentedPopulator extends BlockPopulator {
- public static short[][] x_loc;
- public static short[][] y_loc;
- public static short[][] z_loc;
public final PlotWorld plotworld;
public final PlotManager manager;
public final BukkitPlotGenerator generator;
@@ -36,7 +41,7 @@ public class AugmentedPopulator extends BlockPopulator {
private final int tz;
public AugmentedPopulator(final String world, final BukkitPlotGenerator generator, final PlotCluster cluster, final boolean p, final boolean b) {
- initCache();
+ MainUtil.initCache();
this.cluster = cluster;
this.generator = generator;
this.plotworld = PS.get().getPlotWorld(world);
@@ -77,27 +82,7 @@ public class AugmentedPopulator extends BlockPopulator {
}
}
}
-
- public static void initCache() {
- if (x_loc == null) {
- x_loc = new short[16][4096];
- y_loc = new short[16][4096];
- z_loc = new short[16][4096];
- for (int i = 0; i < 16; i++) {
- int i4 = i << 4;
- for (int j = 0; j < 4096; j++) {
- final int y = (i4) + (j >> 8);
- final int a = (j - ((y & 0xF) << 8));
- final int z1 = (a >> 4);
- final int x1 = a - (z1 << 4);
- x_loc[i][j] = (short) x1;
- y_loc[i][j] = (short) y;
- z_loc[i][j] = (short) z1;
- }
- }
- }
- }
-
+
public BlockWrapper get(final int x, final int z, final int i, final int j, final short[][] r, final boolean c) {
final int y = (i << 4) + (j >> 8);
final int a = (j - ((y & 0xF) << 8));
@@ -221,9 +206,9 @@ public class AugmentedPopulator extends BlockPopulator {
for (int i = 0; i < result.length; i++) {
if (result[i] != null) {
for (int j = 0; j < 4096; j++) {
- int x1 = x_loc[i][j];
- int y = y_loc[i][j];
- int z1 = z_loc[i][j];
+ int x1 = MainUtil.x_loc[i][j];
+ int y = MainUtil.y_loc[i][j];
+ int z1 = MainUtil.z_loc[i][j];
short id = result[i][j];
final int xx = x + x1;
final int zz = z + z1;
@@ -243,7 +228,7 @@ public class AugmentedPopulator extends BlockPopulator {
}
}
else {
- short y_min = y_loc[i][0];
+ short y_min = MainUtil.y_loc[i][0];
if (y_min < 128) {
for (int x1 = x; x1 < x + 16; x1++) {
for (int z1 = z; z1 < z + 16; z1++) {
diff --git a/src/main/java/com/plotsquared/bukkit/generator/BukkitGeneratorWrapper.java b/src/main/java/com/plotsquared/bukkit/generator/BukkitGeneratorWrapper.java
index 611d87e00..795624b92 100644
--- a/src/main/java/com/plotsquared/bukkit/generator/BukkitGeneratorWrapper.java
+++ b/src/main/java/com/plotsquared/bukkit/generator/BukkitGeneratorWrapper.java
@@ -1,5 +1,7 @@
package com.plotsquared.bukkit.generator;
+import org.bukkit.generator.ChunkGenerator;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.generator.PlotGenerator;
import com.intellectualcrafters.plot.object.PlotCluster;
@@ -7,8 +9,6 @@ import com.intellectualcrafters.plot.object.PlotManager;
import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.object.SetupObject;
-import org.bukkit.generator.ChunkGenerator;
-
public class BukkitGeneratorWrapper extends PlotGenerator {
public final boolean full;
diff --git a/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java b/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java
index 0f346c90a..c232d998d 100644
--- a/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java
+++ b/src/main/java/com/plotsquared/bukkit/generator/BukkitPlotGenerator.java
@@ -20,22 +20,28 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.generator;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.object.*;
-import com.intellectualcrafters.plot.util.ChunkManager;
-import com.plotsquared.bukkit.listeners.WorldEvents;
-import com.plotsquared.bukkit.object.BukkitPlotPopulator;
-import org.bukkit.World;
-import org.bukkit.block.Biome;
-import org.bukkit.generator.BlockPopulator;
-import org.bukkit.generator.ChunkGenerator;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.Random;
+import org.bukkit.World;
+import org.bukkit.block.Biome;
+import org.bukkit.generator.BlockPopulator;
+import org.bukkit.generator.ChunkGenerator;
+
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.object.PlotLoc;
+import com.intellectualcrafters.plot.object.PlotManager;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.object.PseudoRandom;
+import com.intellectualcrafters.plot.object.RegionWrapper;
+import com.intellectualcrafters.plot.object.SetupObject;
+import com.intellectualcrafters.plot.util.ChunkManager;
+import com.plotsquared.bukkit.listeners.WorldEvents;
+import com.plotsquared.bukkit.object.BukkitPlotPopulator;
+
public abstract class BukkitPlotGenerator extends ChunkGenerator {
public static short[][][] CACHE_I = null;
diff --git a/src/main/java/com/plotsquared/bukkit/generator/HybridGen.java b/src/main/java/com/plotsquared/bukkit/generator/HybridGen.java
index 4e85160b4..463d8b9f2 100644
--- a/src/main/java/com/plotsquared/bukkit/generator/HybridGen.java
+++ b/src/main/java/com/plotsquared/bukkit/generator/HybridGen.java
@@ -20,20 +20,24 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.generator;
-import com.intellectualcrafters.plot.generator.HybridPlotManager;
-import com.intellectualcrafters.plot.generator.HybridPlotWorld;
-import com.intellectualcrafters.plot.generator.HybridPop;
-import com.intellectualcrafters.plot.object.*;
-import com.plotsquared.bukkit.object.BukkitPlotPopulator;
-import org.bukkit.Bukkit;
-import org.bukkit.World;
-import org.bukkit.block.Biome;
-
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
+import org.bukkit.Bukkit;
+import org.bukkit.World;
+import org.bukkit.block.Biome;
+
+import com.intellectualcrafters.plot.generator.HybridPlotManager;
+import com.intellectualcrafters.plot.generator.HybridPlotWorld;
+import com.intellectualcrafters.plot.object.PlotLoc;
+import com.intellectualcrafters.plot.object.PlotManager;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.object.PseudoRandom;
+import com.intellectualcrafters.plot.object.RegionWrapper;
+import com.plotsquared.bukkit.object.BukkitPlotPopulator;
+
/**
* The default generator is very messy, as we have decided to try externalize all calculations from within the loop. -
* You will see a lot of slower implementations have a single for loop. - This is perfectly fine to do, it will just
diff --git a/src/main/java/com/intellectualcrafters/plot/generator/HybridPop.java b/src/main/java/com/plotsquared/bukkit/generator/HybridPop.java
similarity index 98%
rename from src/main/java/com/intellectualcrafters/plot/generator/HybridPop.java
rename to src/main/java/com/plotsquared/bukkit/generator/HybridPop.java
index 035a79dd1..9b9ad0857 100644
--- a/src/main/java/com/intellectualcrafters/plot/generator/HybridPop.java
+++ b/src/main/java/com/plotsquared/bukkit/generator/HybridPop.java
@@ -1,6 +1,13 @@
-package com.intellectualcrafters.plot.generator;
+package com.plotsquared.bukkit.generator;
+
+import java.util.HashMap;
+import java.util.HashSet;
+
+import org.bukkit.World;
+import org.bukkit.block.Biome;
import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.generator.HybridPlotWorld;
import com.intellectualcrafters.plot.object.PlotLoc;
import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.object.PseudoRandom;
@@ -8,11 +15,6 @@ import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.object.schematic.PlotItem;
import com.intellectualcrafters.plot.util.BlockManager;
import com.plotsquared.bukkit.object.BukkitPlotPopulator;
-import org.bukkit.World;
-import org.bukkit.block.Biome;
-
-import java.util.HashMap;
-import java.util.HashSet;
/**
* @author Citymonstret
diff --git a/src/main/java/com/plotsquared/bukkit/listeners/ChatListener.java b/src/main/java/com/plotsquared/bukkit/listeners/ChatListener.java
index b1b51eb79..e6b8dcaba 100644
--- a/src/main/java/com/plotsquared/bukkit/listeners/ChatListener.java
+++ b/src/main/java/com/plotsquared/bukkit/listeners/ChatListener.java
@@ -1,10 +1,7 @@
package com.plotsquared.bukkit.listeners;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.config.C;
-import com.intellectualcrafters.plot.object.*;
-import com.intellectualcrafters.plot.util.MainUtil;
-import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
+import java.util.Set;
+
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.entity.Player;
@@ -13,7 +10,15 @@ import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.player.AsyncPlayerChatEvent;
-import java.util.Set;
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
/**
* Created 2015-07-13 for PlotSquaredGit
diff --git a/src/main/java/com/plotsquared/bukkit/listeners/ChunkListener.java b/src/main/java/com/plotsquared/bukkit/listeners/ChunkListener.java
index 2601205e1..2f8c2b860 100644
--- a/src/main/java/com/plotsquared/bukkit/listeners/ChunkListener.java
+++ b/src/main/java/com/plotsquared/bukkit/listeners/ChunkListener.java
@@ -1,8 +1,5 @@
package com.plotsquared.bukkit.listeners;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.config.Settings;
-import com.intellectualcrafters.plot.util.TaskManager;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.Material;
@@ -20,6 +17,10 @@ import org.bukkit.event.entity.ItemSpawnEvent;
import org.bukkit.event.world.ChunkLoadEvent;
import org.bukkit.event.world.ChunkUnloadEvent;
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.config.Settings;
+import com.intellectualcrafters.plot.util.TaskManager;
+
public class ChunkListener implements Listener {
private Chunk lastChunk = null;
@@ -100,7 +101,7 @@ public class ChunkListener implements Listener {
if (!chunk.isLoaded()) {
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
TaskManager.tasks.remove(currentIndex);
- PS.log("[PlotSquared] &aSuccessfully processed and unloaded chunk!");
+ PS.debug("[PlotSquared] &aSuccessfully processed and unloaded chunk!");
chunk.unload(true, true);
return;
}
@@ -108,7 +109,7 @@ public class ChunkListener implements Listener {
if (tiles.length == 0) {
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
TaskManager.tasks.remove(currentIndex);
- PS.log("[PlotSquared] &aSuccessfully processed and unloaded chunk!");
+ PS.debug("[PlotSquared] &aSuccessfully processed and unloaded chunk!");
chunk.unload(true, true);
return;
}
@@ -118,7 +119,7 @@ public class ChunkListener implements Listener {
if (i >= tiles.length) {
Bukkit.getScheduler().cancelTask(TaskManager.tasks.get(currentIndex));
TaskManager.tasks.remove(currentIndex);
- PS.log("[PlotSquared] &aSuccessfully processed and unloaded chunk!");
+ PS.debug("[PlotSquared] &aSuccessfully processed and unloaded chunk!");
chunk.unload(true, true);
return;
}
@@ -142,11 +143,11 @@ public class ChunkListener implements Listener {
ent.remove();
}
}
- PS.log("[PlotSquared] &a detected unsafe chunk and processed: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4));
+ PS.debug("[PlotSquared] &a detected unsafe chunk and processed: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4));
}
if (tiles.length > Settings.CHUNK_PROCESSOR_MAX_BLOCKSTATES) {
if (unload) {
- PS.log("[PlotSquared] &c detected unsafe chunk: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4));
+ PS.debug("[PlotSquared] &c detected unsafe chunk: " + (chunk.getX() << 4) + "," + (chunk.getX() << 4));
cleanChunk(chunk);
return true;
}
diff --git a/src/main/java/com/plotsquared/bukkit/listeners/ForceFieldListener.java b/src/main/java/com/plotsquared/bukkit/listeners/ForceFieldListener.java
index 82a22de06..07a3eadfd 100644
--- a/src/main/java/com/plotsquared/bukkit/listeners/ForceFieldListener.java
+++ b/src/main/java/com/plotsquared/bukkit/listeners/ForceFieldListener.java
@@ -20,6 +20,16 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.listeners;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.UUID;
+
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.Listener;
+import org.bukkit.util.Vector;
+
import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
@@ -28,15 +38,6 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.bukkit.events.PlayerEnterPlotEvent;
import com.plotsquared.bukkit.util.bukkit.BukkitPlayerFunctions;
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Player;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.Listener;
-import org.bukkit.util.Vector;
-
-import java.util.HashSet;
-import java.util.Set;
-import java.util.UUID;
/**
* @author Citymonstret
diff --git a/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java b/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java
index 5209ad78a..843ab85d6 100644
--- a/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java
+++ b/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java
@@ -1,36 +1,110 @@
package com.plotsquared.bukkit.listeners;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.config.C;
-import com.intellectualcrafters.plot.config.Settings;
-import com.intellectualcrafters.plot.database.DBFunc;
-import com.intellectualcrafters.plot.flag.Flag;
-import com.intellectualcrafters.plot.flag.FlagManager;
-import com.intellectualcrafters.plot.object.Location;
-import com.intellectualcrafters.plot.object.*;
-import com.intellectualcrafters.plot.util.*;
-import com.plotsquared.bukkit.listeners.worldedit.WEManager;
-import com.plotsquared.bukkit.object.BukkitLazyBlock;
-import com.plotsquared.bukkit.object.BukkitPlayer;
-import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
-import org.bukkit.*;
+import static com.intellectualcrafters.plot.object.StaticStrings.FLAG_ANIMAL_INTERACT;
+import static com.intellectualcrafters.plot.object.StaticStrings.FLAG_DISABLE_PHYSICS;
+import static com.intellectualcrafters.plot.object.StaticStrings.FLAG_HANGING_BREAK;
+import static com.intellectualcrafters.plot.object.StaticStrings.FLAG_HANGING_PLACE;
+import static com.intellectualcrafters.plot.object.StaticStrings.FLAG_HOSTILE_INTERACT;
+import static com.intellectualcrafters.plot.object.StaticStrings.FLAG_PLACE;
+import static com.intellectualcrafters.plot.object.StaticStrings.FLAG_PVP;
+import static com.intellectualcrafters.plot.object.StaticStrings.FLAG_TAMED_INTERACT;
+import static com.intellectualcrafters.plot.object.StaticStrings.FLAG_USE;
+import static com.intellectualcrafters.plot.object.StaticStrings.FLAG_VEHICLE_USE;
+import static com.intellectualcrafters.plot.object.StaticStrings.META_INVENTORY;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_ADMIN_BUILD_HEIGHTLIMIT;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_ADMIN_BUILD_OTHER;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_ADMIN_BUILD_ROAD;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_ADMIN_BUILD_UNOWNED;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_ADMIN_DESTROY_OTHER;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_ADMIN_DESTROY_ROAD;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_ADMIN_DESTROY_UNOWNED;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_ADMIN_ENTRY_DENIED;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_ADMIN_EXIT_DENIED;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_ADMIN_INTERACT_BLOCKED_CMDS;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_ADMIN_INTERACT_OTHER;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_ADMIN_INTERACT_ROAD;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_ADMIN_INTERACT_UNOWNED;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_COMMANDS_CHAT;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_PROJECTILE_OTHER;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_PROJECTILE_UNOWNED;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_WORLDEDIT_BYPASS;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+import java.util.UUID;
+import java.util.regex.Pattern;
+
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.Chunk;
+import org.bukkit.Material;
+import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockFace;
import org.bukkit.block.BlockState;
import org.bukkit.command.PluginCommand;
-import org.bukkit.entity.*;
+import org.bukkit.entity.Animals;
+import org.bukkit.entity.ArmorStand;
+import org.bukkit.entity.Arrow;
+import org.bukkit.entity.Creature;
+import org.bukkit.entity.EnderDragon;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.FallingBlock;
+import org.bukkit.entity.Hanging;
+import org.bukkit.entity.HumanEntity;
+import org.bukkit.entity.Monster;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.Projectile;
+import org.bukkit.entity.Tameable;
+import org.bukkit.entity.Vehicle;
import org.bukkit.entity.minecart.RideableMinecart;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
-import org.bukkit.event.block.*;
-import org.bukkit.event.entity.*;
+import org.bukkit.event.block.Action;
+import org.bukkit.event.block.BlockBreakEvent;
+import org.bukkit.event.block.BlockDamageEvent;
+import org.bukkit.event.block.BlockFadeEvent;
+import org.bukkit.event.block.BlockFormEvent;
+import org.bukkit.event.block.BlockFromToEvent;
+import org.bukkit.event.block.BlockGrowEvent;
+import org.bukkit.event.block.BlockIgniteEvent;
+import org.bukkit.event.block.BlockPhysicsEvent;
+import org.bukkit.event.block.BlockPistonExtendEvent;
+import org.bukkit.event.block.BlockPistonRetractEvent;
+import org.bukkit.event.block.BlockPlaceEvent;
+import org.bukkit.event.block.BlockRedstoneEvent;
+import org.bukkit.event.block.BlockSpreadEvent;
+import org.bukkit.event.block.EntityBlockFormEvent;
+import org.bukkit.event.entity.CreatureSpawnEvent;
+import org.bukkit.event.entity.EntityChangeBlockEvent;
+import org.bukkit.event.entity.EntityDamageByEntityEvent;
+import org.bukkit.event.entity.EntityExplodeEvent;
+import org.bukkit.event.entity.ProjectileHitEvent;
import org.bukkit.event.hanging.HangingBreakByEntityEvent;
import org.bukkit.event.hanging.HangingPlaceEvent;
import org.bukkit.event.inventory.InventoryClickEvent;
import org.bukkit.event.inventory.InventoryCloseEvent;
-import org.bukkit.event.player.*;
+import org.bukkit.event.player.AsyncPlayerChatEvent;
+import org.bukkit.event.player.PlayerBucketEmptyEvent;
+import org.bukkit.event.player.PlayerBucketFillEvent;
+import org.bukkit.event.player.PlayerChangedWorldEvent;
+import org.bukkit.event.player.PlayerCommandPreprocessEvent;
+import org.bukkit.event.player.PlayerEggThrowEvent;
+import org.bukkit.event.player.PlayerInteractEntityEvent;
+import org.bukkit.event.player.PlayerInteractEvent;
+import org.bukkit.event.player.PlayerJoinEvent;
+import org.bukkit.event.player.PlayerLoginEvent;
import org.bukkit.event.player.PlayerLoginEvent.Result;
+import org.bukkit.event.player.PlayerMoveEvent;
+import org.bukkit.event.player.PlayerQuitEvent;
+import org.bukkit.event.player.PlayerTeleportEvent;
import org.bukkit.event.vehicle.VehicleCreateEvent;
import org.bukkit.event.vehicle.VehicleDestroyEvent;
import org.bukkit.event.world.ChunkLoadEvent;
@@ -41,10 +115,35 @@ import org.bukkit.projectiles.BlockProjectileSource;
import org.bukkit.projectiles.ProjectileSource;
import org.bukkit.util.Vector;
-import java.util.*;
-import java.util.regex.Pattern;
-
-import static com.intellectualcrafters.plot.object.StaticStrings.*;
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.config.Settings;
+import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.flag.FlagManager;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.object.PlotHandler;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotInventory;
+import com.intellectualcrafters.plot.object.PlotManager;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.object.StringWrapper;
+import com.intellectualcrafters.plot.util.ChunkManager;
+import com.intellectualcrafters.plot.util.EventUtil;
+import com.intellectualcrafters.plot.util.ExpireManager;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.Permissions;
+import com.intellectualcrafters.plot.util.RegExUtil;
+import com.intellectualcrafters.plot.util.StringMan;
+import com.intellectualcrafters.plot.util.TaskManager;
+import com.intellectualcrafters.plot.util.UUIDHandler;
+import com.plotsquared.bukkit.listeners.worldedit.WEManager;
+import com.plotsquared.bukkit.object.BukkitLazyBlock;
+import com.plotsquared.bukkit.object.BukkitPlayer;
+import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
/**
* Player Events involving plots
@@ -53,7 +152,7 @@ import static com.intellectualcrafters.plot.object.StaticStrings.*;
* @author Empire92
*/
@SuppressWarnings({"unused","deprecation","unchecked"})
-public class PlayerEvents extends com.plotsquared.bukkit.listeners.PlotListener implements Listener {
+public class PlayerEvents extends com.plotsquared.listener.PlotListener implements Listener {
private boolean pistonBlocks = true;
@@ -1492,7 +1591,7 @@ public class PlayerEvents extends com.plotsquared.bukkit.listeners.PlotListener
final Collection plots = PS.get().getPlots(pp.getName()).values();
for (final Plot plot : plots) {
plot.delete();
- PS.log(String.format("&cPlot &6%s &cwas deleted + cleared due to &6%s&c getting banned", plot.getId(), event.getPlayer().getName()));
+ PS.debug(String.format("&cPlot &6%s &cwas deleted + cleared due to &6%s&c getting banned", plot.getId(), event.getPlayer().getName()));
}
}
BukkitUtil.removePlayer(pp.getName());
diff --git a/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents_1_8.java b/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents_1_8.java
index 03e5b002a..046f131d6 100644
--- a/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents_1_8.java
+++ b/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents_1_8.java
@@ -1,13 +1,9 @@
package com.plotsquared.bukkit.listeners;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.config.C;
-import com.intellectualcrafters.plot.object.Location;
-import com.intellectualcrafters.plot.object.Plot;
-import com.intellectualcrafters.plot.object.PlotPlayer;
-import com.intellectualcrafters.plot.util.MainUtil;
-import com.intellectualcrafters.plot.util.Permissions;
-import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
+import java.util.HashSet;
+import java.util.List;
+import java.util.UUID;
+
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
import org.bukkit.entity.ArmorStand;
@@ -24,9 +20,15 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.inventory.meta.ItemMeta;
-import java.util.HashSet;
-import java.util.List;
-import java.util.UUID;
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.Permissions;
+import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
+import com.plotsquared.listener.PlotListener;
public class PlayerEvents_1_8 extends PlotListener implements Listener {
diff --git a/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents_1_8_3.java b/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents_1_8_3.java
index 9e77afaee..486f54af1 100644
--- a/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents_1_8_3.java
+++ b/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents_1_8_3.java
@@ -1,18 +1,19 @@
package com.plotsquared.bukkit.listeners;
+import java.util.Iterator;
+
+import org.bukkit.block.Block;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.block.BlockExplodeEvent;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.util.MainUtil;
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
-import org.bukkit.block.Block;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.Listener;
-import org.bukkit.event.block.BlockExplodeEvent;
-
-import java.util.Iterator;
public class PlayerEvents_1_8_3 implements Listener {
@EventHandler(priority = EventPriority.HIGHEST, ignoreCancelled = true)
diff --git a/src/main/java/com/plotsquared/bukkit/listeners/PlotPlusListener.java b/src/main/java/com/plotsquared/bukkit/listeners/PlotPlusListener.java
index 73c35c8c6..82a8ce7e4 100644
--- a/src/main/java/com/plotsquared/bukkit/listeners/PlotPlusListener.java
+++ b/src/main/java/com/plotsquared/bukkit/listeners/PlotPlusListener.java
@@ -20,18 +20,13 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.listeners;
-import com.intellectualcrafters.plot.config.C;
-import com.intellectualcrafters.plot.flag.Flag;
-import com.intellectualcrafters.plot.flag.FlagManager;
-import com.intellectualcrafters.plot.object.Plot;
-import com.intellectualcrafters.plot.object.PlotHandler;
-import com.intellectualcrafters.plot.object.PlotPlayer;
-import com.intellectualcrafters.plot.util.MainUtil;
-import com.intellectualcrafters.plot.util.Permissions;
-import com.intellectualcrafters.plot.util.UUIDHandler;
-import com.plotsquared.bukkit.events.PlayerEnterPlotEvent;
-import com.plotsquared.bukkit.events.PlayerLeavePlotEvent;
-import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map.Entry;
+import java.util.UUID;
+
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.GameMode;
@@ -48,8 +43,19 @@ import org.bukkit.event.player.PlayerPickupItemEvent;
import org.bukkit.event.player.PlayerQuitEvent;
import org.bukkit.plugin.java.JavaPlugin;
-import java.util.*;
-import java.util.Map.Entry;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.flag.FlagManager;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotHandler;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.Permissions;
+import com.intellectualcrafters.plot.util.UUIDHandler;
+import com.plotsquared.bukkit.events.PlayerEnterPlotEvent;
+import com.plotsquared.bukkit.events.PlayerLeavePlotEvent;
+import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
+import com.plotsquared.listener.PlotListener;
/**
* Created 2014-10-30 for PlotSquared
diff --git a/src/main/java/com/plotsquared/bukkit/listeners/TNTListener.java b/src/main/java/com/plotsquared/bukkit/listeners/TNTListener.java
index b179625ef..53894c631 100644
--- a/src/main/java/com/plotsquared/bukkit/listeners/TNTListener.java
+++ b/src/main/java/com/plotsquared/bukkit/listeners/TNTListener.java
@@ -1,11 +1,7 @@
package com.plotsquared.bukkit.listeners;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.flag.FlagManager;
-import com.intellectualcrafters.plot.object.Location;
-import com.intellectualcrafters.plot.object.Plot;
-import com.intellectualcrafters.plot.util.MainUtil;
-import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
+import java.util.List;
+
import org.bukkit.World;
import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType;
@@ -16,7 +12,12 @@ import org.bukkit.event.entity.EntityExplodeEvent;
import org.bukkit.event.entity.ExplosionPrimeEvent;
import org.bukkit.util.Vector;
-import java.util.List;
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.flag.FlagManager;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
public class TNTListener implements Listener {
private double lastRadius;
diff --git a/src/main/java/com/plotsquared/bukkit/listeners/WorldEvents.java b/src/main/java/com/plotsquared/bukkit/listeners/WorldEvents.java
index d3217f96e..9b2f99a0d 100644
--- a/src/main/java/com/plotsquared/bukkit/listeners/WorldEvents.java
+++ b/src/main/java/com/plotsquared/bukkit/listeners/WorldEvents.java
@@ -1,17 +1,16 @@
package com.plotsquared.bukkit.listeners;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.util.UUIDHandler;
-import com.plotsquared.bukkit.generator.BukkitGeneratorWrapper;
-import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
import org.bukkit.World;
import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener;
import org.bukkit.event.world.WorldInitEvent;
-import org.bukkit.event.world.WorldLoadEvent;
import org.bukkit.generator.ChunkGenerator;
+import com.intellectualcrafters.plot.PS;
+import com.plotsquared.bukkit.generator.BukkitGeneratorWrapper;
+import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
+
public class WorldEvents implements Listener {
public static String lastWorld = null;
diff --git a/src/main/java/com/plotsquared/bukkit/listeners/worldedit/NullExtent.java b/src/main/java/com/plotsquared/bukkit/listeners/worldedit/NullExtent.java
index 8cfa88546..2d196ac1d 100644
--- a/src/main/java/com/plotsquared/bukkit/listeners/worldedit/NullExtent.java
+++ b/src/main/java/com/plotsquared/bukkit/listeners/worldedit/NullExtent.java
@@ -1,5 +1,8 @@
package com.plotsquared.bukkit.listeners.worldedit;
+import java.util.ArrayList;
+import java.util.List;
+
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.Vector2D;
import com.sk89q.worldedit.WorldEditException;
@@ -12,9 +15,6 @@ import com.sk89q.worldedit.regions.Region;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.biome.BaseBiome;
-import java.util.ArrayList;
-import java.util.List;
-
public class NullExtent implements Extent {
@Override
diff --git a/src/main/java/com/plotsquared/bukkit/listeners/worldedit/ProcessedWEExtent.java b/src/main/java/com/plotsquared/bukkit/listeners/worldedit/ProcessedWEExtent.java
index 05a93cbe0..72079c56f 100644
--- a/src/main/java/com/plotsquared/bukkit/listeners/worldedit/ProcessedWEExtent.java
+++ b/src/main/java/com/plotsquared/bukkit/listeners/worldedit/ProcessedWEExtent.java
@@ -1,5 +1,7 @@
package com.plotsquared.bukkit.listeners.worldedit;
+import java.util.HashSet;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.RegionWrapper;
@@ -14,8 +16,6 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.biome.BaseBiome;
-import java.util.HashSet;
-
public class ProcessedWEExtent extends AbstractDelegateExtent {
private final HashSet mask;
int BScount = 0;
@@ -72,7 +72,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
BScount++;
if (BScount > Settings.CHUNK_PROCESSOR_MAX_BLOCKSTATES) {
BSblocked = true;
- PS.log("&cPlotSquared detected unsafe WorldEdit: " + (location.getBlockX()) + "," + (location.getBlockZ()));
+ PS.debug("&cPlotSquared detected unsafe WorldEdit: " + (location.getBlockX()) + "," + (location.getBlockZ()));
}
}
}
@@ -90,7 +90,7 @@ public class ProcessedWEExtent extends AbstractDelegateExtent {
Ecount++;
if (Ecount > Settings.CHUNK_PROCESSOR_MAX_ENTITIES) {
Eblocked = true;
- PS.log("&cPlotSquared detected unsafe WorldEdit: " + (location.getBlockX()) + "," + (location.getBlockZ()));
+ PS.debug("&cPlotSquared detected unsafe WorldEdit: " + (location.getBlockX()) + "," + (location.getBlockZ()));
}
if (WEManager.maskContains(mask, location.getBlockX(), location.getBlockZ())) {
return super.createEntity(location, entity);
diff --git a/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WEExtent.java b/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WEExtent.java
index 3451a9aa8..4656409fe 100644
--- a/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WEExtent.java
+++ b/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WEExtent.java
@@ -1,5 +1,7 @@
package com.plotsquared.bukkit.listeners.worldedit;
+import java.util.HashSet;
+
import com.intellectualcrafters.plot.object.RegionWrapper;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.Vector2D;
@@ -12,8 +14,6 @@ import com.sk89q.worldedit.extent.Extent;
import com.sk89q.worldedit.util.Location;
import com.sk89q.worldedit.world.biome.BaseBiome;
-import java.util.HashSet;
-
public class WEExtent extends AbstractDelegateExtent {
private final HashSet mask;
diff --git a/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WEListener.java b/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WEListener.java
index 9ac4927cd..273b323c6 100644
--- a/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WEListener.java
+++ b/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WEListener.java
@@ -1,5 +1,16 @@
package com.plotsquared.bukkit.listeners.worldedit;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+
+import org.bukkit.entity.Player;
+import org.bukkit.event.Cancellable;
+import org.bukkit.event.EventHandler;
+import org.bukkit.event.EventPriority;
+import org.bukkit.event.Listener;
+import org.bukkit.event.player.PlayerCommandPreprocessEvent;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
@@ -11,16 +22,6 @@ import com.intellectualcrafters.plot.util.Permissions;
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
import com.sk89q.worldedit.BlockVector;
import com.sk89q.worldedit.bukkit.selections.Selection;
-import org.bukkit.entity.Player;
-import org.bukkit.event.Cancellable;
-import org.bukkit.event.EventHandler;
-import org.bukkit.event.EventPriority;
-import org.bukkit.event.Listener;
-import org.bukkit.event.player.PlayerCommandPreprocessEvent;
-
-import java.util.Arrays;
-import java.util.HashSet;
-import java.util.List;
public class WEListener implements Listener {
diff --git a/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WEManager.java b/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WEManager.java
index 1a0711e1d..80129c803 100644
--- a/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WEManager.java
+++ b/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WEManager.java
@@ -1,5 +1,8 @@
package com.plotsquared.bukkit.listeners.worldedit;
+import java.util.HashSet;
+import java.util.UUID;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.Location;
@@ -8,9 +11,6 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.util.MainUtil;
-import java.util.HashSet;
-import java.util.UUID;
-
public class WEManager {
public static HashSet bypass = new HashSet<>();
diff --git a/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WESubscriber.java b/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WESubscriber.java
index 6b2bee0bc..62d5ee86a 100644
--- a/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WESubscriber.java
+++ b/src/main/java/com/plotsquared/bukkit/listeners/worldedit/WESubscriber.java
@@ -1,5 +1,7 @@
package com.plotsquared.bukkit.listeners.worldedit;
+import java.util.HashSet;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
@@ -13,8 +15,6 @@ import com.sk89q.worldedit.extension.platform.Actor;
import com.sk89q.worldedit.util.eventbus.EventHandler.Priority;
import com.sk89q.worldedit.util.eventbus.Subscribe;
-import java.util.HashSet;
-
public class WESubscriber {
@Subscribe(priority=Priority.VERY_EARLY)
public void onEditSession(EditSessionEvent event) {
diff --git a/src/main/java/com/plotsquared/bukkit/object/BukkitLazyBlock.java b/src/main/java/com/plotsquared/bukkit/object/BukkitLazyBlock.java
index df92a5b9a..35023f03c 100644
--- a/src/main/java/com/plotsquared/bukkit/object/BukkitLazyBlock.java
+++ b/src/main/java/com/plotsquared/bukkit/object/BukkitLazyBlock.java
@@ -1,8 +1,9 @@
package com.plotsquared.bukkit.object;
+import org.bukkit.block.Block;
+
import com.intellectualcrafters.plot.object.LazyBlock;
import com.intellectualcrafters.plot.object.PlotBlock;
-import org.bukkit.block.Block;
public class BukkitLazyBlock extends LazyBlock {
diff --git a/src/main/java/com/plotsquared/bukkit/object/BukkitOfflinePlayer.java b/src/main/java/com/plotsquared/bukkit/object/BukkitOfflinePlayer.java
index 5b511cfc3..c935aec8d 100644
--- a/src/main/java/com/plotsquared/bukkit/object/BukkitOfflinePlayer.java
+++ b/src/main/java/com/plotsquared/bukkit/object/BukkitOfflinePlayer.java
@@ -1,9 +1,10 @@
package com.plotsquared.bukkit.object;
-import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
+import java.util.UUID;
+
import org.bukkit.OfflinePlayer;
-import java.util.UUID;
+import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
public class BukkitOfflinePlayer implements OfflinePlotPlayer {
diff --git a/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java b/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java
index c3ff8248f..ba0eb3d1a 100644
--- a/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java
+++ b/src/main/java/com/plotsquared/bukkit/object/BukkitPlayer.java
@@ -1,5 +1,18 @@
package com.plotsquared.bukkit.object;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.UUID;
+
+import org.bukkit.Bukkit;
+import org.bukkit.Effect;
+import org.bukkit.GameMode;
+import org.bukkit.Material;
+import org.bukkit.WeatherType;
+import org.bukkit.entity.Player;
+import org.bukkit.permissions.Permission;
+import org.bukkit.permissions.PermissionDefault;
+
import com.intellectualcrafters.plot.commands.RequiredType;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
@@ -7,16 +20,10 @@ import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.EconHandler;
import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.PlotGamemode;
+import com.intellectualcrafters.plot.util.PlotWeather;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
-import org.bukkit.Bukkit;
-import org.bukkit.entity.Player;
-import org.bukkit.permissions.Permission;
-import org.bukkit.permissions.PermissionDefault;
-
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.UUID;
public class BukkitPlayer implements PlotPlayer {
@@ -199,4 +206,69 @@ public class BukkitPlayer implements PlotPlayer {
public RequiredType getSuperCaller() {
return RequiredType.PLAYER;
}
+
+ @Override
+ public void setWeather(PlotWeather weather) {
+ switch (weather) {
+ case CLEAR:
+ player.setPlayerWeather(WeatherType.CLEAR);
+ return;
+ case RAIN: {
+ player.setPlayerWeather(WeatherType.DOWNFALL);
+ return;
+ }
+ case RESET:
+ player.resetPlayerWeather();
+ return;
+ }
+ }
+
+ @Override
+ public PlotGamemode getGamemode() {
+ switch (player.getGameMode()) {
+ case ADVENTURE:
+ return PlotGamemode.ADVENTURE;
+ case CREATIVE:
+ return PlotGamemode.CREATIVE;
+ case SPECTATOR:
+ return PlotGamemode.SPECTATOR;
+ case SURVIVAL:
+ return PlotGamemode.SURVIVAL;
+ }
+ return null;
+ }
+
+ @Override
+ public void setGamemode(PlotGamemode gamemode) {
+ switch (gamemode) {
+ case ADVENTURE:
+ player.setGameMode(GameMode.ADVENTURE);
+ case CREATIVE:
+ player.setGameMode(GameMode.CREATIVE);
+ case SPECTATOR:
+ player.setGameMode(GameMode.SPECTATOR);
+ case SURVIVAL:
+ player.setGameMode(GameMode.SURVIVAL);
+ }
+ }
+
+ @Override
+ public void setTime(long time) {
+ player.setPlayerTime(time, false);
+ }
+
+ @Override
+ public void setFlight(boolean fly) {
+ player.setAllowFlight(fly);
+ }
+
+ @Override
+ public void playMusic(Location loc, int id) {
+ player.playEffect(BukkitUtil.getLocation(loc), Effect.RECORD_PLAY, Material.getMaterial(id));
+ }
+
+ @Override
+ public void kick(String message) {
+ player.kickPlayer(message);
+ }
}
diff --git a/src/main/java/com/plotsquared/bukkit/object/BukkitPlotPopulator.java b/src/main/java/com/plotsquared/bukkit/object/BukkitPlotPopulator.java
index fabf5afec..5b8e735b3 100644
--- a/src/main/java/com/plotsquared/bukkit/object/BukkitPlotPopulator.java
+++ b/src/main/java/com/plotsquared/bukkit/object/BukkitPlotPopulator.java
@@ -1,23 +1,19 @@
package com.plotsquared.bukkit.object;
-import com.intellectualcrafters.plot.object.PlotBlock;
-import com.intellectualcrafters.plot.object.PlotLoc;
-import com.intellectualcrafters.plot.object.PseudoRandom;
-import com.intellectualcrafters.plot.object.RegionWrapper;
-import com.intellectualcrafters.plot.util.BlockManager;
-import com.intellectualcrafters.plot.util.ChunkManager;
-import com.intellectualcrafters.plot.util.MainUtil;
-import com.intellectualcrafters.plot.util.SetBlockQueue;
-import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
-import com.plotsquared.bukkit.util.bukkit.SetBlockFast;
+import java.util.HashMap;
+import java.util.Map.Entry;
+import java.util.Random;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.generator.BlockPopulator;
-import java.util.HashMap;
-import java.util.Map.Entry;
-import java.util.Random;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.object.PlotLoc;
+import com.intellectualcrafters.plot.object.PseudoRandom;
+import com.intellectualcrafters.plot.object.RegionWrapper;
+import com.intellectualcrafters.plot.util.ChunkManager;
+import com.intellectualcrafters.plot.util.SetBlockQueue;
public abstract class BukkitPlotPopulator extends BlockPopulator {
diff --git a/src/main/java/com/plotsquared/bukkit/object/entity/EntityWrapper.java b/src/main/java/com/plotsquared/bukkit/object/entity/EntityWrapper.java
index 5fff010d6..c153b49a8 100644
--- a/src/main/java/com/plotsquared/bukkit/object/entity/EntityWrapper.java
+++ b/src/main/java/com/plotsquared/bukkit/object/entity/EntityWrapper.java
@@ -1,23 +1,41 @@
package com.plotsquared.bukkit.object.entity;
+import org.bukkit.Art;
+import org.bukkit.DyeColor;
+import org.bukkit.Location;
+import org.bukkit.Rotation;
+import org.bukkit.World;
+import org.bukkit.block.BlockFace;
+import org.bukkit.entity.Ageable;
+import org.bukkit.entity.ArmorStand;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Guardian;
+import org.bukkit.entity.Horse;
+import org.bukkit.entity.Horse.Color;
+import org.bukkit.entity.Horse.Style;
+import org.bukkit.entity.Horse.Variant;
+import org.bukkit.entity.Item;
+import org.bukkit.entity.ItemFrame;
+import org.bukkit.entity.LivingEntity;
+import org.bukkit.entity.Painting;
+import org.bukkit.entity.Rabbit;
+import org.bukkit.entity.Rabbit.Type;
+import org.bukkit.entity.Sheep;
+import org.bukkit.entity.Skeleton;
+import org.bukkit.entity.Skeleton.SkeletonType;
+import org.bukkit.entity.Tameable;
+import org.bukkit.inventory.EntityEquipment;
+import org.bukkit.inventory.InventoryHolder;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.util.EulerAngle;
+import org.bukkit.util.Vector;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.entity.AgeableStats;
import com.intellectualcrafters.plot.object.entity.ArmorStandStats;
import com.intellectualcrafters.plot.object.entity.EntityBaseStats;
import com.intellectualcrafters.plot.object.entity.HorseStats;
-import org.bukkit.*;
-import org.bukkit.block.BlockFace;
-import org.bukkit.entity.*;
-import org.bukkit.entity.Horse.Color;
-import org.bukkit.entity.Horse.Style;
-import org.bukkit.entity.Horse.Variant;
-import org.bukkit.entity.Rabbit.Type;
-import org.bukkit.entity.Skeleton.SkeletonType;
-import org.bukkit.inventory.EntityEquipment;
-import org.bukkit.inventory.InventoryHolder;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.util.EulerAngle;
-import org.bukkit.util.Vector;
public class EntityWrapper {
public short id;
@@ -198,7 +216,7 @@ public class EntityWrapper {
return;
}
default: {
- PS.log("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
+ PS.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
return;
}
// MISC //
@@ -455,7 +473,7 @@ public class EntityWrapper {
return entity;
}
default: {
- PS.log("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
+ PS.debug("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
return entity;
}
// MISC //
diff --git a/src/main/java/com/plotsquared/bukkit/object/entity/LivingEntityStats.java b/src/main/java/com/plotsquared/bukkit/object/entity/LivingEntityStats.java
index 9e52a97c0..42ceea6ee 100644
--- a/src/main/java/com/plotsquared/bukkit/object/entity/LivingEntityStats.java
+++ b/src/main/java/com/plotsquared/bukkit/object/entity/LivingEntityStats.java
@@ -1,10 +1,10 @@
package com.plotsquared.bukkit.object.entity;
+import java.util.Collection;
+
import org.bukkit.inventory.ItemStack;
import org.bukkit.potion.PotionEffect;
-import java.util.Collection;
-
public class LivingEntityStats {
public boolean loot;
public String name;
diff --git a/src/main/java/com/plotsquared/bukkit/object/schematic/StateWrapper.java b/src/main/java/com/plotsquared/bukkit/object/schematic/StateWrapper.java
index 2559ce405..aaadc587e 100644
--- a/src/main/java/com/plotsquared/bukkit/object/schematic/StateWrapper.java
+++ b/src/main/java/com/plotsquared/bukkit/object/schematic/StateWrapper.java
@@ -1,21 +1,26 @@
package com.plotsquared.bukkit.object.schematic;
-import com.intellectualcrafters.jnbt.*;
-import com.intellectualcrafters.plot.object.schematic.ItemType;
-import com.intellectualcrafters.plot.object.schematic.PlotItem;
-import com.intellectualcrafters.plot.util.MathMan;
-import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
-import org.bukkit.block.BlockState;
-import org.bukkit.enchantments.Enchantment;
-import org.bukkit.inventory.InventoryHolder;
-import org.bukkit.inventory.ItemStack;
-
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import org.bukkit.block.BlockState;
+import org.bukkit.enchantments.Enchantment;
+import org.bukkit.inventory.InventoryHolder;
+import org.bukkit.inventory.ItemStack;
+
+import com.intellectualcrafters.jnbt.ByteTag;
+import com.intellectualcrafters.jnbt.CompoundTag;
+import com.intellectualcrafters.jnbt.ListTag;
+import com.intellectualcrafters.jnbt.ShortTag;
+import com.intellectualcrafters.jnbt.Tag;
+import com.intellectualcrafters.plot.object.schematic.ItemType;
+import com.intellectualcrafters.plot.object.schematic.PlotItem;
+import com.intellectualcrafters.plot.util.MathMan;
+import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
+
public class StateWrapper {
public BlockState state = null;
diff --git a/src/main/java/com/plotsquared/bukkit/titles/DefaultTitle.java b/src/main/java/com/plotsquared/bukkit/titles/DefaultTitle.java
index a4defce63..4c7e7820f 100644
--- a/src/main/java/com/plotsquared/bukkit/titles/DefaultTitle.java
+++ b/src/main/java/com/plotsquared/bukkit/titles/DefaultTitle.java
@@ -1,8 +1,8 @@
package com.plotsquared.bukkit.titles;
import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.util.AbstractTitle;
import com.plotsquared.bukkit.object.BukkitPlayer;
-import org.bukkit.ChatColor;
public class DefaultTitle extends AbstractTitle {
@Override
diff --git a/src/main/java/com/plotsquared/bukkit/titles/DefaultTitleManager.java b/src/main/java/com/plotsquared/bukkit/titles/DefaultTitleManager.java
index 5fe257c1a..4ccd2e29d 100644
--- a/src/main/java/com/plotsquared/bukkit/titles/DefaultTitleManager.java
+++ b/src/main/java/com/plotsquared/bukkit/titles/DefaultTitleManager.java
@@ -1,15 +1,15 @@
package com.plotsquared.bukkit.titles;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.entity.Player;
-
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.entity.Player;
+
/**
* [ PlotSquared DefaultTitleManager by Maxim Van de Wynckel ]
*
diff --git a/src/main/java/com/plotsquared/bukkit/titles/DefaultTitleManager_183.java b/src/main/java/com/plotsquared/bukkit/titles/DefaultTitleManager_183.java
index 2bd300637..ee8847551 100644
--- a/src/main/java/com/plotsquared/bukkit/titles/DefaultTitleManager_183.java
+++ b/src/main/java/com/plotsquared/bukkit/titles/DefaultTitleManager_183.java
@@ -1,15 +1,15 @@
package com.plotsquared.bukkit.titles;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.entity.Player;
-
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.entity.Player;
+
/**
* [ PlotSquared DefaultTitleManager by Maxim Van de Wynckel ]
*
diff --git a/src/main/java/com/plotsquared/bukkit/titles/DefaultTitle_183.java b/src/main/java/com/plotsquared/bukkit/titles/DefaultTitle_183.java
index 9e412eff4..718b9d886 100644
--- a/src/main/java/com/plotsquared/bukkit/titles/DefaultTitle_183.java
+++ b/src/main/java/com/plotsquared/bukkit/titles/DefaultTitle_183.java
@@ -1,8 +1,8 @@
package com.plotsquared.bukkit.titles;
import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.util.AbstractTitle;
import com.plotsquared.bukkit.object.BukkitPlayer;
-import org.bukkit.ChatColor;
public class DefaultTitle_183 extends AbstractTitle {
@Override
diff --git a/src/main/java/com/plotsquared/bukkit/titles/HackTitle.java b/src/main/java/com/plotsquared/bukkit/titles/HackTitle.java
index f4defdaf1..dc765e23c 100644
--- a/src/main/java/com/plotsquared/bukkit/titles/HackTitle.java
+++ b/src/main/java/com/plotsquared/bukkit/titles/HackTitle.java
@@ -3,8 +3,8 @@ package com.plotsquared.bukkit.titles;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.util.AbstractTitle;
import com.plotsquared.bukkit.object.BukkitPlayer;
-import org.bukkit.ChatColor;
public class HackTitle extends AbstractTitle {
@Override
@@ -13,7 +13,7 @@ public class HackTitle extends AbstractTitle {
final HackTitleManager title = new HackTitleManager(head, sub, in, delay, out);
title.send(((BukkitPlayer) player).player);
} catch (final Throwable e) {
- PS.log("&cYour server version does not support titles!");
+ PS.debug("&cYour server version does not support titles!");
Settings.TITLES = false;
AbstractTitle.TITLE_CLASS = null;
}
diff --git a/src/main/java/com/plotsquared/bukkit/titles/HackTitleManager.java b/src/main/java/com/plotsquared/bukkit/titles/HackTitleManager.java
index 92d22377d..b218280de 100644
--- a/src/main/java/com/plotsquared/bukkit/titles/HackTitleManager.java
+++ b/src/main/java/com/plotsquared/bukkit/titles/HackTitleManager.java
@@ -1,14 +1,14 @@
package com.plotsquared.bukkit.titles;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-import org.bukkit.entity.Player;
-
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.entity.Player;
+
/**
* Minecraft 1.8 Title
*
diff --git a/src/main/java/com/plotsquared/bukkit/util/BukkitHybridUtils.java b/src/main/java/com/plotsquared/bukkit/util/BukkitHybridUtils.java
index bc03af817..0ac44bf8c 100644
--- a/src/main/java/com/plotsquared/bukkit/util/BukkitHybridUtils.java
+++ b/src/main/java/com/plotsquared/bukkit/util/BukkitHybridUtils.java
@@ -1,19 +1,11 @@
package com.plotsquared.bukkit.util;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.config.C;
-import com.intellectualcrafters.plot.flag.Flag;
-import com.intellectualcrafters.plot.flag.FlagManager;
-import com.intellectualcrafters.plot.generator.ClassicPlotWorld;
-import com.intellectualcrafters.plot.generator.HybridUtils;
-import com.intellectualcrafters.plot.object.*;
-import com.intellectualcrafters.plot.util.ChunkManager;
-import com.intellectualcrafters.plot.util.MainUtil;
-import com.intellectualcrafters.plot.util.MathMan;
-import com.intellectualcrafters.plot.util.TaskManager;
-import com.plotsquared.bukkit.BukkitMain;
-import com.plotsquared.bukkit.generator.AugmentedPopulator;
-import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicInteger;
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
@@ -27,8 +19,25 @@ import org.bukkit.material.Directional;
import org.bukkit.material.MaterialData;
import org.bukkit.plugin.Plugin;
-import java.util.*;
-import java.util.concurrent.atomic.AtomicInteger;
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.flag.FlagManager;
+import com.intellectualcrafters.plot.generator.ClassicPlotWorld;
+import com.intellectualcrafters.plot.generator.HybridUtils;
+import com.intellectualcrafters.plot.object.ChunkLoc;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotAnalysis;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.object.RunnableVal;
+import com.intellectualcrafters.plot.util.ChunkManager;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.MathMan;
+import com.intellectualcrafters.plot.util.TaskManager;
+import com.plotsquared.bukkit.BukkitMain;
+import com.plotsquared.bukkit.util.bukkit.BukkitUtil;
public class BukkitHybridUtils extends HybridUtils {
@@ -72,7 +81,7 @@ public class BukkitHybridUtils extends HybridUtils {
final int ctx = tx >> 4;
final int ctz = tz >> 4;
final Random r = new Random();
- AugmentedPopulator.initCache();
+ MainUtil.initCache();
final int width = tx - bx + 1;
final int length = tz - bz + 1;
@@ -102,21 +111,21 @@ public class BukkitHybridUtils extends HybridUtils {
for (int i = 0; i < result.length; i++) {
if (result[i] == null) {
for (int j = 0; j < 4096; j++) {
- int x = AugmentedPopulator.x_loc[i][j] + xb;
+ int x = MainUtil.x_loc[i][j] + xb;
if (x < 0 || x >= width) continue;
- int z = AugmentedPopulator.z_loc[i][j] + zb;
+ int z = MainUtil.z_loc[i][j] + zb;
if (z < 0 || z >= length) continue;
- int y = AugmentedPopulator.y_loc[i][j];
+ int y = MainUtil.y_loc[i][j];
oldblocks[y][x][z] = 0;
}
continue;
}
for (int j = 0; j < result[i].length; j++) {
- int x = AugmentedPopulator.x_loc[i][j] + xb;
+ int x = MainUtil.x_loc[i][j] + xb;
if (x < 0 || x >= width) continue;
- int z = AugmentedPopulator.z_loc[i][j] + zb;
+ int z = MainUtil.z_loc[i][j] + zb;
if (z < 0 || z >= length) continue;
- int y = AugmentedPopulator.y_loc[i][j];
+ int y = MainUtil.y_loc[i][j];
oldblocks[y][x][z] = result[i][j];
}
}
@@ -206,7 +215,7 @@ public class BukkitHybridUtils extends HybridUtils {
}
};
System.gc();
- AugmentedPopulator.initCache();
+ MainUtil.initCache();
TaskManager.index.incrementAndGet();
final Integer currentIndex = TaskManager.index.get();
final Integer task = TaskManager.runTaskRepeat(new Runnable() {
@@ -412,11 +421,11 @@ public class BukkitHybridUtils extends HybridUtils {
public void run() {
count.incrementAndGet();
if (count.intValue() % 20 == 0) {
- PS.log("PROGRESS: " + ((100 * (2048 - chunks.size())) / 2048) + "%");
+ PS.debug("PROGRESS: " + ((100 * (2048 - chunks.size())) / 2048) + "%");
}
if (regions.size() == 0 && chunks.size() == 0) {
BukkitHybridUtils.UPDATE = false;
- PS.log(C.PREFIX.s() + "Finished road conversion");
+ PS.debug(C.PREFIX.s() + "Finished road conversion");
Bukkit.getScheduler().cancelTask(BukkitHybridUtils.this.task);
return;
} else {
@@ -424,8 +433,8 @@ public class BukkitHybridUtils extends HybridUtils {
if (chunks.size() < 1024) {
if (regions.size() > 0) {
final ChunkLoc loc = regions.get(0);
- PS.log("&3Updating .mcr: " + loc.x + ", " + loc.z + " (aprrox 1024 chunks)");
- PS.log(" - Remaining: " + regions.size());
+ PS.debug("&3Updating .mcr: " + loc.x + ", " + loc.z + " (aprrox 1024 chunks)");
+ PS.debug(" - Remaining: " + regions.size());
chunks.addAll(getChunks(loc));
regions.remove(0);
System.gc();
@@ -435,7 +444,7 @@ public class BukkitHybridUtils extends HybridUtils {
long diff = System.currentTimeMillis() + 25;
if (System.currentTimeMillis() - last > 1200 && last != 0) {
last = 0;
- PS.log(C.PREFIX.s() + "Detected low TPS. Rescheduling in 30s");
+ PS.debug(C.PREFIX.s() + "Detected low TPS. Rescheduling in 30s");
while (chunks.size() > 0) {
ChunkLoc chunk = chunks.get(0);
chunks.remove(0);
@@ -464,7 +473,7 @@ public class BukkitHybridUtils extends HybridUtils {
} catch (final Exception e) {
e.printStackTrace();
final ChunkLoc loc = regions.get(0);
- PS.log("&c[ERROR]&7 Could not update '" + world + "/region/r." + loc.x + "." + loc.z + ".mca' (Corrupt chunk?)");
+ PS.debug("&c[ERROR]&7 Could not update '" + world + "/region/r." + loc.x + "." + loc.z + ".mca' (Corrupt chunk?)");
final int sx = loc.x << 5;
final int sz = loc.z << 5;
for (int x = sx; x < (sx + 32); x++) {
@@ -472,8 +481,8 @@ public class BukkitHybridUtils extends HybridUtils {
ChunkManager.manager.unloadChunk(world, new ChunkLoc(x, z), true, true);
}
}
- PS.log("&d - Potentially skipping 1024 chunks");
- PS.log("&d - TODO: recommend chunkster if corrupt");
+ PS.debug("&d - Potentially skipping 1024 chunks");
+ PS.debug("&d - TODO: recommend chunkster if corrupt");
}
}
}
diff --git a/src/main/java/com/plotsquared/bukkit/util/ReflectionUtil.java b/src/main/java/com/plotsquared/bukkit/util/ReflectionUtil.java
index 4a9f76a3a..370e5ce59 100644
--- a/src/main/java/com/plotsquared/bukkit/util/ReflectionUtil.java
+++ b/src/main/java/com/plotsquared/bukkit/util/ReflectionUtil.java
@@ -1,12 +1,12 @@
package com.plotsquared.bukkit.util;
-import org.bukkit.Bukkit;
-
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
+import org.bukkit.Bukkit;
+
/**
* Reflection Utilities for minecraft
*
diff --git a/src/main/java/com/plotsquared/bukkit/util/WorldEditSchematic.java b/src/main/java/com/plotsquared/bukkit/util/WorldEditSchematic.java
index 0f4ffca66..1b2e31b1c 100644
--- a/src/main/java/com/plotsquared/bukkit/util/WorldEditSchematic.java
+++ b/src/main/java/com/plotsquared/bukkit/util/WorldEditSchematic.java
@@ -1,5 +1,9 @@
package com.plotsquared.bukkit.util;
+import java.io.File;
+
+import org.bukkit.Bukkit;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.PlotId;
@@ -8,9 +12,6 @@ import com.sk89q.worldedit.CuboidClipboard;
import com.sk89q.worldedit.EditSession;
import com.sk89q.worldedit.Vector;
import com.sk89q.worldedit.bukkit.BukkitWorld;
-import org.bukkit.Bukkit;
-
-import java.io.File;
public class WorldEditSchematic {
public void saveSchematic(String file, final String world, final PlotId id) {
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitChunkManager.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitChunkManager.java
index a1ceaad2a..00291e0c6 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitChunkManager.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitChunkManager.java
@@ -1,8 +1,62 @@
package com.plotsquared.bukkit.util.bukkit;
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Random;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.bukkit.Bukkit;
+import org.bukkit.Chunk;
+import org.bukkit.DyeColor;
+import org.bukkit.Material;
+import org.bukkit.Note;
+import org.bukkit.SkullType;
+import org.bukkit.World;
+import org.bukkit.block.Banner;
+import org.bukkit.block.Beacon;
+import org.bukkit.block.Block;
+import org.bukkit.block.BlockFace;
+import org.bukkit.block.BlockState;
+import org.bukkit.block.BrewingStand;
+import org.bukkit.block.Chest;
+import org.bukkit.block.CommandBlock;
+import org.bukkit.block.CreatureSpawner;
+import org.bukkit.block.Dispenser;
+import org.bukkit.block.Dropper;
+import org.bukkit.block.Furnace;
+import org.bukkit.block.Hopper;
+import org.bukkit.block.Jukebox;
+import org.bukkit.block.NoteBlock;
+import org.bukkit.block.Sign;
+import org.bukkit.block.Skull;
+import org.bukkit.block.banner.Pattern;
+import org.bukkit.block.banner.PatternType;
+import org.bukkit.entity.Animals;
+import org.bukkit.entity.Creature;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Player;
+import org.bukkit.entity.Vehicle;
+import org.bukkit.generator.BlockPopulator;
+import org.bukkit.inventory.InventoryHolder;
+import org.bukkit.inventory.ItemStack;
+import org.bukkit.plugin.Plugin;
+
import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.object.*;
+import com.intellectualcrafters.plot.object.BlockLoc;
+import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotLoc;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.util.ChunkManager;
import com.intellectualcrafters.plot.util.ClusterManager;
import com.intellectualcrafters.plot.util.MainUtil;
@@ -11,19 +65,6 @@ import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.bukkit.BukkitMain;
import com.plotsquared.bukkit.generator.AugmentedPopulator;
import com.plotsquared.bukkit.object.entity.EntityWrapper;
-import org.bukkit.*;
-import org.bukkit.block.*;
-import org.bukkit.block.banner.Pattern;
-import org.bukkit.block.banner.PatternType;
-import org.bukkit.entity.*;
-import org.bukkit.generator.BlockPopulator;
-import org.bukkit.inventory.InventoryHolder;
-import org.bukkit.inventory.ItemStack;
-import org.bukkit.plugin.Plugin;
-
-import java.io.File;
-import java.util.*;
-import java.util.concurrent.atomic.AtomicInteger;
public class BukkitChunkManager extends ChunkManager {
@Override
@@ -81,7 +122,7 @@ public class BukkitChunkManager extends ChunkManager {
public void run() {
final String directory = world + File.separator + "region" + File.separator + "r." + loc.x + "." + loc.z + ".mca";
final File file = new File(directory);
- PS.log("&6 - Deleting region: " + file.getName() + " (approx 1024 chunks)");
+ PS.debug("&6 - Deleting region: " + file.getName() + " (approx 1024 chunks)");
if (file.exists()) {
file.delete();
}
@@ -100,7 +141,7 @@ public class BukkitChunkManager extends ChunkManager {
for (ChunkLoc loc : chunks) {
final String directory = world + File.separator + "region" + File.separator + "r." + loc.x + "." + loc.z + ".mca";
final File file = new File(directory);
- PS.log("&6 - Deleting file: " + file.getName() + " (max 1024 chunks)");
+ PS.debug("&6 - Deleting file: " + file.getName() + " (max 1024 chunks)");
if (file.exists()) {
file.delete();
}
@@ -508,7 +549,7 @@ public class BukkitChunkManager extends ChunkManager {
try {
entity.spawn(world, x_offset, z_offset);
} catch (final Exception e) {
- PS.log("Failed to restore entity " + entity.x + "," + entity.y + "," + entity.z + " : " + entity.id + " : " + EntityType.fromId(entity.id));
+ PS.debug("Failed to restore entity " + entity.x + "," + entity.y + "," + entity.z + " : " + entity.id + " : " + EntityType.fromId(entity.id));
e.printStackTrace();
}
}
@@ -524,10 +565,10 @@ public class BukkitChunkManager extends ChunkManager {
chest.getInventory().setContents(chestContents.get(loc));
state.update(true);
} else {
- PS.log("&c[WARN] Plot clear failed to regenerate chest: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to regenerate chest: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
- PS.log("&c[WARN] Plot clear failed to regenerate chest: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to regenerate chest: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : signContents.keySet()) {
@@ -543,10 +584,10 @@ public class BukkitChunkManager extends ChunkManager {
}
state.update(true);
} else {
- PS.log("&c[WARN] Plot clear failed to regenerate sign: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to regenerate sign: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
- PS.log("&c[WARN] Plot clear failed to regenerate sign: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to regenerate sign: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : dispenserContents.keySet()) {
@@ -557,10 +598,10 @@ public class BukkitChunkManager extends ChunkManager {
((Dispenser) (state)).getInventory().setContents(dispenserContents.get(loc));
state.update(true);
} else {
- PS.log("&c[WARN] Plot clear failed to regenerate dispenser: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
- PS.log("&c[WARN] Plot clear failed to regenerate dispenser: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : dropperContents.keySet()) {
@@ -571,10 +612,10 @@ public class BukkitChunkManager extends ChunkManager {
((Dropper) (state)).getInventory().setContents(dropperContents.get(loc));
state.update(true);
} else {
- PS.log("&c[WARN] Plot clear failed to regenerate dispenser: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
- PS.log("&c[WARN] Plot clear failed to regenerate dispenser: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : beaconContents.keySet()) {
@@ -585,10 +626,10 @@ public class BukkitChunkManager extends ChunkManager {
((Beacon) (state)).getInventory().setContents(beaconContents.get(loc));
state.update(true);
} else {
- PS.log("&c[WARN] Plot clear failed to regenerate beacon: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to regenerate beacon: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
- PS.log("&c[WARN] Plot clear failed to regenerate beacon: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to regenerate beacon: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : jukeDisc.keySet()) {
@@ -599,10 +640,10 @@ public class BukkitChunkManager extends ChunkManager {
((Jukebox) (state)).setPlaying(Material.getMaterial(jukeDisc.get(loc)));
state.update(true);
} else {
- PS.log("&c[WARN] Plot clear failed to restore jukebox: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to restore jukebox: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
- PS.log("&c[WARN] Plot clear failed to regenerate jukebox: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to regenerate jukebox: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : skullData.keySet()) {
@@ -622,10 +663,10 @@ public class BukkitChunkManager extends ChunkManager {
}
state.update(true);
} else {
- PS.log("&c[WARN] Plot clear failed to restore skull: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to restore skull: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
- PS.log("&c[WARN] Plot clear failed to regenerate skull: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to regenerate skull: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : hopperContents.keySet()) {
@@ -636,10 +677,10 @@ public class BukkitChunkManager extends ChunkManager {
((Hopper) (state)).getInventory().setContents(hopperContents.get(loc));
state.update(true);
} else {
- PS.log("&c[WARN] Plot clear failed to regenerate hopper: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to regenerate hopper: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
- PS.log("&c[WARN] Plot clear failed to regenerate hopper: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to regenerate hopper: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : noteBlockContents.keySet()) {
@@ -650,10 +691,10 @@ public class BukkitChunkManager extends ChunkManager {
((NoteBlock) (state)).setNote(noteBlockContents.get(loc));
state.update(true);
} else {
- PS.log("&c[WARN] Plot clear failed to regenerate note block: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to regenerate note block: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
- PS.log("&c[WARN] Plot clear failed to regenerate note block: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to regenerate note block: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : brewTime.keySet()) {
@@ -663,10 +704,10 @@ public class BukkitChunkManager extends ChunkManager {
if (state instanceof BrewingStand) {
((BrewingStand) (state)).setBrewingTime(brewTime.get(loc));
} else {
- PS.log("&c[WARN] Plot clear failed to restore brewing stand cooking: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to restore brewing stand cooking: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
- PS.log("&c[WARN] Plot clear failed to restore brewing stand cooking: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to restore brewing stand cooking: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : spawnerData.keySet()) {
@@ -677,10 +718,10 @@ public class BukkitChunkManager extends ChunkManager {
((CreatureSpawner) (state)).setCreatureTypeId(spawnerData.get(loc));
state.update(true);
} else {
- PS.log("&c[WARN] Plot clear failed to restore spawner type: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to restore spawner type: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
- PS.log("&c[WARN] Plot clear failed to restore spawner type: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to restore spawner type: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : cmdData.keySet()) {
@@ -691,10 +732,10 @@ public class BukkitChunkManager extends ChunkManager {
((CommandBlock) (state)).setCommand(cmdData.get(loc));
state.update(true);
} else {
- PS.log("&c[WARN] Plot clear failed to restore command block: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to restore command block: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
- PS.log("&c[WARN] Plot clear failed to restore command block: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to restore command block: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : brewingStandContents.keySet()) {
@@ -705,10 +746,10 @@ public class BukkitChunkManager extends ChunkManager {
((BrewingStand) (state)).getInventory().setContents(brewingStandContents.get(loc));
state.update(true);
} else {
- PS.log("&c[WARN] Plot clear failed to regenerate brewing stand: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to regenerate brewing stand: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
- PS.log("&c[WARN] Plot clear failed to regenerate brewing stand: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to regenerate brewing stand: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : furnaceTime.keySet()) {
@@ -720,10 +761,10 @@ public class BukkitChunkManager extends ChunkManager {
((Furnace) (state)).setBurnTime(time[0]);
((Furnace) (state)).setCookTime(time[1]);
} else {
- PS.log("&c[WARN] Plot clear failed to restore furnace cooking: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to restore furnace cooking: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
- PS.log("&c[WARN] Plot clear failed to restore furnace cooking: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to restore furnace cooking: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : furnaceContents.keySet()) {
@@ -734,10 +775,10 @@ public class BukkitChunkManager extends ChunkManager {
((Furnace) (state)).getInventory().setContents(furnaceContents.get(loc));
state.update(true);
} else {
- PS.log("&c[WARN] Plot clear failed to regenerate furnace: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to regenerate furnace: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
- PS.log("&c[WARN] Plot clear failed to regenerate furnace: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to regenerate furnace: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
for (final BlockLoc loc : bannerBase.keySet()) {
@@ -754,10 +795,10 @@ public class BukkitChunkManager extends ChunkManager {
}
state.update(true);
} else {
- PS.log("&c[WARN] Plot clear failed to regenerate banner: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to regenerate banner: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
} catch (final Exception e) {
- PS.log("&c[WARN] Plot clear failed to regenerate banner: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
+ PS.debug("&c[WARN] Plot clear failed to regenerate banner: " + loc.x + x_offset + "," + loc.y + "," + loc.z + z_offset);
}
}
}
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitEconHandler.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitEconHandler.java
index 4333efe12..2f2856bc3 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitEconHandler.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitEconHandler.java
@@ -1,14 +1,16 @@
package com.plotsquared.bukkit.util.bukkit;
+import net.milkbowl.vault.economy.Economy;
+import net.milkbowl.vault.permission.Permission;
+
+import org.bukkit.Bukkit;
+import org.bukkit.plugin.RegisteredServiceProvider;
+
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.EconHandler;
import com.plotsquared.bukkit.object.BukkitOfflinePlayer;
import com.plotsquared.bukkit.object.BukkitPlayer;
-import net.milkbowl.vault.economy.Economy;
-import net.milkbowl.vault.permission.Permission;
-import org.bukkit.Bukkit;
-import org.bukkit.plugin.RegisteredServiceProvider;
public class BukkitEconHandler extends EconHandler {
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitEventUtil.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitEventUtil.java
index 7444cca48..ae4088f13 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitEventUtil.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitEventUtil.java
@@ -1,17 +1,35 @@
package com.plotsquared.bukkit.util.bukkit;
-import com.intellectualcrafters.plot.flag.Flag;
-import com.intellectualcrafters.plot.object.*;
-import com.intellectualcrafters.plot.util.EventUtil;
-import com.plotsquared.bukkit.events.*;
-import com.plotsquared.bukkit.object.BukkitPlayer;
+import java.util.ArrayList;
+import java.util.UUID;
+
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.event.Cancellable;
import org.bukkit.event.Event;
-import java.util.ArrayList;
-import java.util.UUID;
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotCluster;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.util.EventUtil;
+import com.plotsquared.bukkit.events.ClusterFlagRemoveEvent;
+import com.plotsquared.bukkit.events.PlayerClaimPlotEvent;
+import com.plotsquared.bukkit.events.PlayerEnterPlotEvent;
+import com.plotsquared.bukkit.events.PlayerLeavePlotEvent;
+import com.plotsquared.bukkit.events.PlayerPlotDeniedEvent;
+import com.plotsquared.bukkit.events.PlayerPlotHelperEvent;
+import com.plotsquared.bukkit.events.PlayerPlotTrustedEvent;
+import com.plotsquared.bukkit.events.PlayerTeleportToPlotEvent;
+import com.plotsquared.bukkit.events.PlotClearEvent;
+import com.plotsquared.bukkit.events.PlotDeleteEvent;
+import com.plotsquared.bukkit.events.PlotFlagAddEvent;
+import com.plotsquared.bukkit.events.PlotFlagRemoveEvent;
+import com.plotsquared.bukkit.events.PlotMergeEvent;
+import com.plotsquared.bukkit.events.PlotUnlinkEvent;
+import com.plotsquared.bukkit.object.BukkitPlayer;
public class BukkitEventUtil extends EventUtil {
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitInventoryUtil.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitInventoryUtil.java
index 1ceb27001..63f386793 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitInventoryUtil.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitInventoryUtil.java
@@ -1,10 +1,8 @@
package com.plotsquared.bukkit.util.bukkit;
-import com.intellectualcrafters.plot.object.PlotInventory;
-import com.intellectualcrafters.plot.object.PlotItemStack;
-import com.intellectualcrafters.plot.object.PlotPlayer;
-import com.intellectualcrafters.plot.util.InventoryUtil;
-import com.plotsquared.bukkit.object.BukkitPlayer;
+import java.util.ArrayList;
+import java.util.List;
+
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.event.inventory.InventoryType;
@@ -14,8 +12,11 @@ import org.bukkit.inventory.ItemStack;
import org.bukkit.inventory.PlayerInventory;
import org.bukkit.inventory.meta.ItemMeta;
-import java.util.ArrayList;
-import java.util.List;
+import com.intellectualcrafters.plot.object.PlotInventory;
+import com.intellectualcrafters.plot.object.PlotItemStack;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.util.InventoryUtil;
+import com.plotsquared.bukkit.object.BukkitPlayer;
public class BukkitInventoryUtil extends InventoryUtil {
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitPlayerFunctions.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitPlayerFunctions.java
index ef5fe5287..861e4ba5c 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitPlayerFunctions.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitPlayerFunctions.java
@@ -20,18 +20,19 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.util.bukkit;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Set;
+import java.util.UUID;
+
+import org.bukkit.entity.Player;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.UUIDHandler;
-import org.bukkit.entity.Player;
-
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Set;
-import java.util.UUID;
/**
* Functions involving players, plots and locations.
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitPlayerManager.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitPlayerManager.java
deleted file mode 100644
index 3897583f3..000000000
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitPlayerManager.java
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.plotsquared.bukkit.util.bukkit;
-
-import com.intellectualcrafters.plot.object.PlotPlayer;
-import com.intellectualcrafters.plot.util.PlayerManager;
-import com.plotsquared.bukkit.object.BukkitPlayer;
-
-public class BukkitPlayerManager extends PlayerManager {
-
- @Override
- public void kickPlayer(PlotPlayer player, String reason) {
- ((BukkitPlayer) player).player.kickPlayer(reason);
- }
-
-}
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitSchematicHandler.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitSchematicHandler.java
index a7bfac236..d5529e699 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitSchematicHandler.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitSchematicHandler.java
@@ -20,24 +20,31 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.util.bukkit;
-import com.intellectualcrafters.jnbt.*;
-import com.intellectualcrafters.plot.object.ChunkLoc;
-import com.intellectualcrafters.plot.object.Location;
-import com.intellectualcrafters.plot.object.RunnableVal;
-import com.intellectualcrafters.plot.util.SchematicHandler;
-import com.intellectualcrafters.plot.util.TaskManager;
-import com.plotsquared.bukkit.object.schematic.StateWrapper;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Map.Entry;
+
import org.bukkit.Bukkit;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.block.BlockState;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Map.Entry;
+import com.intellectualcrafters.jnbt.ByteArrayTag;
+import com.intellectualcrafters.jnbt.CompoundTag;
+import com.intellectualcrafters.jnbt.IntTag;
+import com.intellectualcrafters.jnbt.ListTag;
+import com.intellectualcrafters.jnbt.ShortTag;
+import com.intellectualcrafters.jnbt.StringTag;
+import com.intellectualcrafters.jnbt.Tag;
+import com.intellectualcrafters.plot.object.ChunkLoc;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.RunnableVal;
+import com.intellectualcrafters.plot.util.SchematicHandler;
+import com.intellectualcrafters.plot.util.TaskManager;
+import com.plotsquared.bukkit.object.schematic.StateWrapper;
/**
* Schematic Handler
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitSetBlockManager.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitSetBlockManager.java
index 70ecf61a8..7bf6eb32c 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitSetBlockManager.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitSetBlockManager.java
@@ -1,13 +1,14 @@
package com.plotsquared.bukkit.util.bukkit;
-import com.intellectualcrafters.plot.object.ChunkLoc;
-import com.intellectualcrafters.plot.util.BlockUpdateUtil;
-import org.bukkit.Chunk;
-import org.bukkit.World;
-
import java.util.ArrayList;
import java.util.Collection;
+import org.bukkit.Chunk;
+import org.bukkit.World;
+
+import com.intellectualcrafters.plot.object.ChunkLoc;
+import com.intellectualcrafters.plot.util.BlockUpdateUtil;
+
public abstract class BukkitSetBlockManager extends BlockUpdateUtil {
public static BukkitSetBlockManager setBlockManager = null;
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitSetupUtils.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitSetupUtils.java
index a050febe2..a2ca7bb9f 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitSetupUtils.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitSetupUtils.java
@@ -1,5 +1,15 @@
package com.plotsquared.bukkit.util.bukkit;
+import java.io.IOException;
+import java.util.Map.Entry;
+
+import org.bukkit.Bukkit;
+import org.bukkit.World;
+import org.bukkit.World.Environment;
+import org.bukkit.WorldCreator;
+import org.bukkit.generator.ChunkGenerator;
+import org.bukkit.plugin.Plugin;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.ConfigurationNode;
import com.intellectualcrafters.plot.generator.PlotGenerator;
@@ -9,16 +19,6 @@ import com.intellectualcrafters.plot.util.SetupUtils;
import com.plotsquared.bukkit.generator.BukkitGeneratorWrapper;
import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
-import org.bukkit.Bukkit;
-import org.bukkit.World;
-import org.bukkit.World.Environment;
-import org.bukkit.WorldCreator;
-import org.bukkit.generator.ChunkGenerator;
-import org.bukkit.plugin.Plugin;
-
-import java.io.IOException;
-import java.util.Map.Entry;
-
public class BukkitSetupUtils extends SetupUtils {
@Override
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitTaskManager.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitTaskManager.java
index 20d0c1637..94b4cabde 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitTaskManager.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitTaskManager.java
@@ -1,8 +1,9 @@
package com.plotsquared.bukkit.util.bukkit;
+import org.bukkit.Bukkit;
+
import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.bukkit.BukkitMain;
-import org.bukkit.Bukkit;
public class BukkitTaskManager extends TaskManager {
@Override
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitUtil.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitUtil.java
index a718541e9..fcc054931 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitUtil.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/BukkitUtil.java
@@ -23,6 +23,7 @@ import org.bukkit.material.Step;
import org.bukkit.material.Tree;
import org.bukkit.material.WoodenStep;
import org.bukkit.material.Wool;
+import org.spongepowered.api.world.extent.Extent;
import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.PlotBlock;
@@ -285,12 +286,12 @@ public class BukkitUtil extends BlockManager {
}
@Override
- public int getBlockIdFromString(final String block) {
+ public PlotBlock getPlotBlockFromString(final String block) {
final Material material = Material.valueOf(block.toUpperCase());
if (material == null) {
- return -1;
+ return new PlotBlock((short) -1, (byte) 0);
}
- return material.getId();
+ return new PlotBlock((short) material.getId(), (byte) 0);
}
@Override
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/Metrics.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/Metrics.java
index e05a46fcb..3ff0460de 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/Metrics.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/Metrics.java
@@ -20,24 +20,36 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.util.bukkit;
-import com.intellectualcrafters.configuration.InvalidConfigurationException;
-import com.intellectualcrafters.configuration.file.YamlConfiguration;
-import com.intellectualcrafters.plot.PS;
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
+import java.lang.reflect.InvocationTargetException;
+import java.net.Proxy;
+import java.net.URL;
+import java.net.URLConnection;
+import java.net.URLEncoder;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.LinkedHashSet;
+import java.util.Set;
+import java.util.UUID;
+import java.util.logging.Level;
+import java.util.zip.GZIPOutputStream;
+
import org.bukkit.Bukkit;
import org.bukkit.entity.Player;
import org.bukkit.plugin.Plugin;
import org.bukkit.plugin.PluginDescriptionFile;
import org.bukkit.scheduler.BukkitTask;
-import java.io.*;
-import java.lang.reflect.InvocationTargetException;
-import java.net.Proxy;
-import java.net.URL;
-import java.net.URLConnection;
-import java.net.URLEncoder;
-import java.util.*;
-import java.util.logging.Level;
-import java.util.zip.GZIPOutputStream;
+import com.intellectualcrafters.configuration.InvalidConfigurationException;
+import com.intellectualcrafters.configuration.file.YamlConfiguration;
+import com.intellectualcrafters.plot.PS;
public class Metrics {
/**
@@ -513,7 +525,7 @@ public class Metrics {
connection.addRequestProperty("Connection", "close");
connection.setDoOutput(true);
if (this.debug) {
- PS.log("[Metrics] Prepared request for " + pluginName + " uncompressed=" + uncompressed.length + " compressed=" + compressed.length);
+ PS.debug("[Metrics] Prepared request for " + pluginName + " uncompressed=" + uncompressed.length + " compressed=" + compressed.length);
}
// Write the data
final OutputStream os = connection.getOutputStream();
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/OfflinePlayerUtil.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/OfflinePlayerUtil.java
index 0dfeca43c..e44498d50 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/OfflinePlayerUtil.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/OfflinePlayerUtil.java
@@ -1,15 +1,21 @@
package com.plotsquared.bukkit.util.bukkit;
-import org.bukkit.Bukkit;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.entity.Entity;
-import org.bukkit.entity.Player;
+import static com.intellectualcrafters.plot.util.ReflectionUtils.callConstructor;
+import static com.intellectualcrafters.plot.util.ReflectionUtils.callMethod;
+import static com.intellectualcrafters.plot.util.ReflectionUtils.getCbClass;
+import static com.intellectualcrafters.plot.util.ReflectionUtils.getNmsClass;
+import static com.intellectualcrafters.plot.util.ReflectionUtils.getUtilClass;
+import static com.intellectualcrafters.plot.util.ReflectionUtils.makeConstructor;
+import static com.intellectualcrafters.plot.util.ReflectionUtils.makeMethod;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
import java.util.UUID;
-import static com.intellectualcrafters.plot.util.ReflectionUtils.*;
+import org.bukkit.Bukkit;
+import org.bukkit.OfflinePlayer;
+import org.bukkit.entity.Entity;
+import org.bukkit.entity.Player;
public class OfflinePlayerUtil {
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/SendChunk.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/SendChunk.java
index 95a12f011..4f963cfda 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/SendChunk.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/SendChunk.java
@@ -1,20 +1,21 @@
package com.plotsquared.bukkit.util.bukkit;
+import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.bukkit.Bukkit;
+import org.bukkit.Chunk;
+import org.bukkit.World;
+
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefClass;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefConstructor;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefField;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
-import org.bukkit.Bukkit;
-import org.bukkit.Chunk;
-import org.bukkit.World;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
/**
* An utility that can be used to send chunks, rather than using bukkit code to do so (uses heavy NMS)
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/SetBlockFast.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/SetBlockFast.java
index e6a47f3c8..95b1378eb 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/SetBlockFast.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/SetBlockFast.java
@@ -20,17 +20,18 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.util.bukkit;
+import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
+
+import java.util.Collection;
+import java.util.HashMap;
+
+import org.bukkit.Chunk;
+
import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefClass;
import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
import com.intellectualcrafters.plot.util.TaskManager;
-import org.bukkit.Chunk;
-
-import java.util.Collection;
-import java.util.HashMap;
-
-import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
/**
* SetBlockFast class
Used to do fast world editing
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/SetBlockFast_1_8.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/SetBlockFast_1_8.java
index b5a0a7c82..989c6137a 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/SetBlockFast_1_8.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/SetBlockFast_1_8.java
@@ -20,15 +20,7 @@
////////////////////////////////////////////////////////////////////////////////////////////////////
package com.plotsquared.bukkit.util.bukkit;
-import com.intellectualcrafters.plot.object.ChunkLoc;
-import com.intellectualcrafters.plot.util.MainUtil;
-import com.intellectualcrafters.plot.util.ReflectionUtils.RefClass;
-import com.intellectualcrafters.plot.util.ReflectionUtils.RefConstructor;
-import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
-import com.intellectualcrafters.plot.util.TaskManager;
-import org.bukkit.Chunk;
-import org.bukkit.World;
-import org.bukkit.block.Block;
+import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
import java.util.ArrayList;
import java.util.Collection;
@@ -36,7 +28,16 @@ import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
-import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
+import org.bukkit.Chunk;
+import org.bukkit.World;
+import org.bukkit.block.Block;
+
+import com.intellectualcrafters.plot.object.ChunkLoc;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.ReflectionUtils.RefClass;
+import com.intellectualcrafters.plot.util.ReflectionUtils.RefConstructor;
+import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod;
+import com.intellectualcrafters.plot.util.TaskManager;
/**
* SetBlockFast class
Used to do fast world editing
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/SetBlockSlow.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/SetBlockSlow.java
index 73641b027..c892dedcd 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/SetBlockSlow.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/SetBlockSlow.java
@@ -1,11 +1,12 @@
package com.plotsquared.bukkit.util.bukkit;
-import com.intellectualcrafters.plot.util.MainUtil;
+import java.util.Collection;
+
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.block.Block;
-import java.util.Collection;
+import com.intellectualcrafters.plot.util.MainUtil;
public class SetBlockSlow extends BukkitSetBlockManager {
@Override
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/SetGenCB.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/SetGenCB.java
index 658438f93..73034696c 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/SetGenCB.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/SetGenCB.java
@@ -1,19 +1,19 @@
package com.plotsquared.bukkit.util.bukkit;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.generator.PlotGenerator;
-import com.intellectualcrafters.plot.util.SetupUtils;
-import com.plotsquared.bukkit.generator.AugmentedPopulator;
-
-import org.bukkit.World;
-import org.bukkit.generator.BlockPopulator;
-import org.bukkit.generator.ChunkGenerator;
-
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.Iterator;
+import org.bukkit.World;
+import org.bukkit.generator.BlockPopulator;
+import org.bukkit.generator.ChunkGenerator;
+
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.generator.PlotGenerator;
+import com.intellectualcrafters.plot.util.SetupUtils;
+import com.plotsquared.bukkit.generator.AugmentedPopulator;
+
public class SetGenCB {
public static void setGenerator(World world) throws Exception {
SetupUtils.manager.updateGenerators();
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/ArrayWrapper.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/ArrayWrapper.java
index d29f9d135..d9d38ea15 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/ArrayWrapper.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/ArrayWrapper.java
@@ -1,11 +1,11 @@
package com.plotsquared.bukkit.util.bukkit.chat;
-import org.apache.commons.lang.Validate;
-
import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Collection;
+import org.apache.commons.lang.Validate;
+
/**
* Represents a wrapper around an array class of an arbitrary reference type,
* which properly implements "value" hash code and equality functions.
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/FancyMessage.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/FancyMessage.java
index 25905bdfd..d2857d4af 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/FancyMessage.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/FancyMessage.java
@@ -1,5 +1,33 @@
package com.plotsquared.bukkit.util.bukkit.chat;
+import static com.plotsquared.bukkit.util.bukkit.chat.TextualComponent.rawText;
+
+import java.io.IOException;
+import java.io.StringWriter;
+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.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.logging.Level;
+
+import org.bukkit.Achievement;
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+import org.bukkit.Material;
+import org.bukkit.Statistic;
+import org.bukkit.Statistic.Type;
+import org.bukkit.command.CommandSender;
+import org.bukkit.entity.EntityType;
+import org.bukkit.entity.Player;
+import org.bukkit.inventory.ItemStack;
+
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
@@ -7,20 +35,6 @@ import com.google.gson.JsonParser;
import com.google.gson.stream.JsonWriter;
import com.intellectualcrafters.configuration.serialization.ConfigurationSerializable;
import com.intellectualcrafters.configuration.serialization.ConfigurationSerialization;
-import org.bukkit.*;
-import org.bukkit.Statistic.Type;
-import org.bukkit.command.CommandSender;
-import org.bukkit.entity.EntityType;
-import org.bukkit.entity.Player;
-import org.bukkit.inventory.ItemStack;
-
-import java.io.IOException;
-import java.io.StringWriter;
-import java.lang.reflect.*;
-import java.util.*;
-import java.util.logging.Level;
-
-import static com.plotsquared.bukkit.util.bukkit.chat.TextualComponent.rawText;
/**
* Represents a formattable message. Such messages can use elements such as colors, formatting codes, hover and click data, and other features provided by the vanilla Minecraft JSON message formatter.
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/JsonRepresentedObject.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/JsonRepresentedObject.java
index 1793ff8c9..82506611f 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/JsonRepresentedObject.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/JsonRepresentedObject.java
@@ -1,9 +1,9 @@
package com.plotsquared.bukkit.util.bukkit.chat;
-import com.google.gson.stream.JsonWriter;
-
import java.io.IOException;
+import com.google.gson.stream.JsonWriter;
+
/**
* Represents an object that can be serialized to a JSON writer instance.
*/
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/JsonString.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/JsonString.java
index 2d9808575..071536ad9 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/JsonString.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/JsonString.java
@@ -1,12 +1,12 @@
package com.plotsquared.bukkit.util.bukkit.chat;
-import com.google.gson.stream.JsonWriter;
-import com.intellectualcrafters.configuration.serialization.ConfigurationSerializable;
-
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
+import com.google.gson.stream.JsonWriter;
+import com.intellectualcrafters.configuration.serialization.ConfigurationSerializable;
+
/**
* Represents a JSON string value.
* Writes by this object will not write name values nor begin/end objects in the JSON stream.
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/MessagePart.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/MessagePart.java
index 1169376c8..c5105b5fd 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/MessagePart.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/MessagePart.java
@@ -1,19 +1,20 @@
package com.plotsquared.bukkit.util.bukkit.chat;
-import com.google.common.collect.BiMap;
-import com.google.common.collect.ImmutableBiMap;
-import com.google.gson.stream.JsonWriter;
-import com.intellectualcrafters.configuration.serialization.ConfigurationSerializable;
-import com.intellectualcrafters.configuration.serialization.ConfigurationSerialization;
-import org.bukkit.Bukkit;
-import org.bukkit.ChatColor;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.logging.Level;
+import org.bukkit.Bukkit;
+import org.bukkit.ChatColor;
+
+import com.google.common.collect.BiMap;
+import com.google.common.collect.ImmutableBiMap;
+import com.google.gson.stream.JsonWriter;
+import com.intellectualcrafters.configuration.serialization.ConfigurationSerializable;
+import com.intellectualcrafters.configuration.serialization.ConfigurationSerialization;
+
/**
* Internal class: Represents a component of a JSON-serializable {@link FancyMessage}.
*/
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/Reflection.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/Reflection.java
index 5b479cfb4..2a8523a12 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/Reflection.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/Reflection.java
@@ -1,13 +1,13 @@
package com.plotsquared.bukkit.util.bukkit.chat;
-import org.bukkit.Bukkit;
-
import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
+import org.bukkit.Bukkit;
+
/**
* A class containing static utility methods and caches which are intended as reflective conveniences.
* Unless otherwise noted, upon failure methods will return {@code null}.
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/TextualComponent.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/TextualComponent.java
index fa83caa9b..d46305fa5 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/TextualComponent.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/chat/TextualComponent.java
@@ -1,15 +1,15 @@
package com.plotsquared.bukkit.util.bukkit.chat;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.Map;
+
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableMap;
import com.google.gson.stream.JsonWriter;
import com.intellectualcrafters.configuration.serialization.ConfigurationSerializable;
import com.intellectualcrafters.configuration.serialization.ConfigurationSerialization;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.Map;
-
/**
* Represents a textual component of a message part.
* This can be used to not only represent string literals in a JSON message,
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/uuid/FileUUIDHandler.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/uuid/FileUUIDHandler.java
index f5c64a3da..3729d8ff5 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/uuid/FileUUIDHandler.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/uuid/FileUUIDHandler.java
@@ -1,5 +1,16 @@
package com.plotsquared.bukkit.util.bukkit.uuid;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FilenameFilter;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.UUID;
+
+import org.bukkit.Bukkit;
+import org.bukkit.World;
+
import com.google.common.collect.HashBiMap;
import com.google.common.io.Files;
import com.google.common.io.InputSupplier;
@@ -10,18 +21,12 @@ import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.object.StringWrapper;
-import com.intellectualcrafters.plot.util.*;
+import com.intellectualcrafters.plot.util.ExpireManager;
+import com.intellectualcrafters.plot.util.NbtFactory;
+import com.intellectualcrafters.plot.util.TaskManager;
+import com.intellectualcrafters.plot.util.UUIDHandler;
+import com.intellectualcrafters.plot.util.UUIDHandlerImplementation;
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
-import org.bukkit.Bukkit;
-import org.bukkit.World;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FilenameFilter;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.UUID;
public class FileUUIDHandler extends UUIDHandlerImplementation {
@@ -50,12 +55,12 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
TaskManager.runTaskAsync(new Runnable() {
@Override
public void run() {
- PS.log(C.PREFIX.s() + "&6Starting player data caching for: " + world);
+ PS.debug(C.PREFIX.s() + "&6Starting player data caching for: " + world);
final HashBiMap toAdd = HashBiMap.create(new HashMap());
toAdd.put(new StringWrapper("*"), DBFunc.everyone);
if (Settings.TWIN_MODE_UUID) {
HashSet all = UUIDHandler.getAllUUIDS();
- PS.log("&aFast mode UUID caching enabled!");
+ PS.debug("&aFast mode UUID caching enabled!");
final File playerdataFolder = new File(container, world + File.separator + "playerdata");
String[] dat = playerdataFolder.list(new FilenameFilter() {
@Override
@@ -81,7 +86,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
}
} catch (final Exception e) {
e.printStackTrace();
- PS.log(C.PREFIX.s() + "Invalid playerdata: " + current);
+ PS.debug(C.PREFIX.s() + "Invalid playerdata: " + current);
}
}
}
@@ -111,7 +116,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
final UUID uuid = UUID.fromString(s);
uuids.add(uuid);
} catch (final Exception e) {
- PS.log(C.PREFIX.s() + "Invalid playerdata: " + current);
+ PS.debug(C.PREFIX.s() + "Invalid playerdata: " + current);
}
}
break;
@@ -151,7 +156,7 @@ public class FileUUIDHandler extends UUIDHandlerImplementation {
ExpireManager.dates.put(uuid, last);
toAdd.put(new StringWrapper(name), uuid);
} catch (final Throwable e) {
- PS.log(C.PREFIX.s() + "&6Invalid playerdata: " + uuid.toString() + ".dat");
+ PS.debug(C.PREFIX.s() + "&6Invalid playerdata: " + uuid.toString() + ".dat");
}
}
for (final String name : names) {
diff --git a/src/main/java/com/plotsquared/bukkit/util/bukkit/uuid/SQLUUIDHandler.java b/src/main/java/com/plotsquared/bukkit/util/bukkit/uuid/SQLUUIDHandler.java
index 52d6e2450..60186d7cc 100644
--- a/src/main/java/com/plotsquared/bukkit/util/bukkit/uuid/SQLUUIDHandler.java
+++ b/src/main/java/com/plotsquared/bukkit/util/bukkit/uuid/SQLUUIDHandler.java
@@ -1,5 +1,20 @@
package com.plotsquared.bukkit.util.bukkit.uuid;
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.UUID;
+
import com.google.common.collect.HashBiMap;
import com.intellectualcrafters.json.JSONObject;
import com.intellectualcrafters.plot.PS;
@@ -14,17 +29,6 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.util.UUIDHandlerImplementation;
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
-import java.io.BufferedReader;
-import java.io.IOException;
-import java.io.InputStreamReader;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.sql.Connection;
-import java.sql.PreparedStatement;
-import java.sql.ResultSet;
-import java.sql.SQLException;
-import java.util.*;
-
public class SQLUUIDHandler extends UUIDHandlerImplementation {
public SQLUUIDHandler(UUIDWrapper wrapper) {
@@ -109,7 +113,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
return;
}
if (!Settings.OFFLINE_MODE) {
- PS.log(C.PREFIX.s() + "&cWill fetch &6" + toFetch.size() + "&c from mojang!");
+ PS.debug(C.PREFIX.s() + "&cWill fetch &6" + toFetch.size() + "&c from mojang!");
int i = 0;
Iterator iterator = toFetch.iterator();
while (iterator.hasNext()) {
@@ -123,7 +127,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
}
currentIteration.add(_uuid);
}
- PS.log(C.PREFIX.s() + "&cWill attempt to fetch &6" + currentIteration.size() + "&c uuids from: &6" + url.toString());
+ PS.debug(C.PREFIX.s() + "&cWill attempt to fetch &6" + currentIteration.size() + "&c uuids from: &6" + url.toString());
try {
HttpURLConnection connection = (HttpURLConnection) new URL(url.toString()).openConnection();
connection.setRequestProperty("User-Agent", "Mozilla/5.0");
@@ -161,7 +165,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
@Override
public void fetchUUID(final String name, final RunnableVal ifFetch) {
- PS.log(C.PREFIX.s() + "UUID for '" + name + "' was null. We'll cache this from the mojang servers!");
+ PS.debug(C.PREFIX.s() + "UUID for '" + name + "' was null. We'll cache this from the mojang servers!");
TaskManager.runTaskAsync(new Runnable() {
@Override
public void run() {
@@ -209,7 +213,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
statement.setString(1, uuid.toString());
statement.setString(2, name.toString());
statement.execute();
- PS.log(C.PREFIX.s() + "&cAdded '&6" + uuid + "&c' - '&6" + name + "&c'");
+ PS.debug(C.PREFIX.s() + "&cAdded '&6" + uuid + "&c' - '&6" + name + "&c'");
} catch (SQLException e) {
e.printStackTrace();
}
@@ -227,7 +231,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
*/
@Deprecated
public String getName__unused__(final UUID uuid) {
- PS.log(C.PREFIX.s() + "Name for '" + uuid + "' was null. We'll cache this from the mojang servers!");
+ PS.debug(C.PREFIX.s() + "Name for '" + uuid + "' was null. We'll cache this from the mojang servers!");
TaskManager.runTaskAsync(new Runnable() {
@Override
public void run() {
@@ -264,7 +268,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
statement.setString(1, name.value);
statement.setString(2, uuid.toString());
statement.execute();
- PS.log(C.PREFIX.s() + "Name change for '" + uuid + "' to '" + name.value + "'");
+ PS.debug(C.PREFIX.s() + "Name change for '" + uuid + "' to '" + name.value + "'");
} catch (SQLException e) {
e.printStackTrace();
}
diff --git a/src/main/java/com/plotsquared/bukkit/uuid/DefaultUUIDWrapper.java b/src/main/java/com/plotsquared/bukkit/uuid/DefaultUUIDWrapper.java
index 890da232e..01284621a 100644
--- a/src/main/java/com/plotsquared/bukkit/uuid/DefaultUUIDWrapper.java
+++ b/src/main/java/com/plotsquared/bukkit/uuid/DefaultUUIDWrapper.java
@@ -1,14 +1,15 @@
package com.plotsquared.bukkit.uuid;
+import java.util.UUID;
+
+import org.bukkit.Bukkit;
+import org.bukkit.OfflinePlayer;
+
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
import com.plotsquared.bukkit.object.BukkitOfflinePlayer;
import com.plotsquared.bukkit.object.BukkitPlayer;
-import org.bukkit.Bukkit;
-import org.bukkit.OfflinePlayer;
-
-import java.util.UUID;
public class DefaultUUIDWrapper extends UUIDWrapper {
@Override
diff --git a/src/main/java/com/plotsquared/bukkit/uuid/LowerOfflineUUIDWrapper.java b/src/main/java/com/plotsquared/bukkit/uuid/LowerOfflineUUIDWrapper.java
index f7b570553..103a77853 100644
--- a/src/main/java/com/plotsquared/bukkit/uuid/LowerOfflineUUIDWrapper.java
+++ b/src/main/java/com/plotsquared/bukkit/uuid/LowerOfflineUUIDWrapper.java
@@ -1,5 +1,14 @@
package com.plotsquared.bukkit.uuid;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.UUID;
+
+import org.bukkit.Bukkit;
+import org.bukkit.OfflinePlayer;
+import org.bukkit.Server;
+import org.bukkit.entity.Player;
+
import com.google.common.base.Charsets;
import com.google.common.collect.BiMap;
import com.intellectualcrafters.plot.PS;
@@ -8,14 +17,6 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.StringWrapper;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.bukkit.object.BukkitOfflinePlayer;
-import org.bukkit.Bukkit;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.Server;
-import org.bukkit.entity.Player;
-
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.UUID;
public class LowerOfflineUUIDWrapper extends OfflineUUIDWrapper {
private Method getOnline = null;
@@ -82,7 +83,7 @@ public class LowerOfflineUUIDWrapper extends OfflineUUIDWrapper {
return p.toArray(new Player[0]);
}
} catch (final Exception e) {
- PS.log("Failed to resolve online players");
+ PS.debug("Failed to resolve online players");
this.getOnline = null;
return Bukkit.getOnlinePlayers().toArray(new Player[0]);
}
diff --git a/src/main/java/com/plotsquared/bukkit/uuid/OfflineUUIDWrapper.java b/src/main/java/com/plotsquared/bukkit/uuid/OfflineUUIDWrapper.java
index 41980956f..60b0782d7 100644
--- a/src/main/java/com/plotsquared/bukkit/uuid/OfflineUUIDWrapper.java
+++ b/src/main/java/com/plotsquared/bukkit/uuid/OfflineUUIDWrapper.java
@@ -1,5 +1,14 @@
package com.plotsquared.bukkit.uuid;
+import java.lang.reflect.Method;
+import java.util.Collection;
+import java.util.UUID;
+
+import org.bukkit.Bukkit;
+import org.bukkit.OfflinePlayer;
+import org.bukkit.Server;
+import org.bukkit.entity.Player;
+
import com.google.common.base.Charsets;
import com.google.common.collect.BiMap;
import com.intellectualcrafters.plot.PS;
@@ -9,14 +18,6 @@ import com.intellectualcrafters.plot.object.StringWrapper;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
import com.plotsquared.bukkit.object.BukkitOfflinePlayer;
-import org.bukkit.Bukkit;
-import org.bukkit.OfflinePlayer;
-import org.bukkit.Server;
-import org.bukkit.entity.Player;
-
-import java.lang.reflect.Method;
-import java.util.Collection;
-import java.util.UUID;
public class OfflineUUIDWrapper extends UUIDWrapper {
private Method getOnline = null;
@@ -83,7 +84,7 @@ public class OfflineUUIDWrapper extends UUIDWrapper {
return p.toArray(new Player[0]);
}
} catch (final Exception e) {
- PS.log("Failed to resolve online players");
+ PS.debug("Failed to resolve online players");
this.getOnline = null;
return Bukkit.getOnlinePlayers().toArray(new Player[0]);
}
diff --git a/src/main/java/com/plotsquared/general/commands/Command.java b/src/main/java/com/plotsquared/general/commands/Command.java
index 159e5ebf9..556a0af53 100644
--- a/src/main/java/com/plotsquared/general/commands/Command.java
+++ b/src/main/java/com/plotsquared/general/commands/Command.java
@@ -1,14 +1,14 @@
package com.plotsquared.general.commands;
-import com.intellectualcrafters.plot.commands.CommandCategory;
-import com.intellectualcrafters.plot.commands.RequiredType;
-
import java.lang.annotation.Annotation;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
+import com.intellectualcrafters.plot.commands.CommandCategory;
+import com.intellectualcrafters.plot.commands.RequiredType;
+
public abstract class Command extends CommandManager {
private RequiredType requiredType = RequiredType.NONE;
@@ -121,6 +121,9 @@ public abstract class Command extends CommandManager {
}
final public String getPermission() {
+ if (this.permission == null || this.permission.length() == 0) {
+ this.permission = "plots." + command.toLowerCase();
+ }
return this.permission;
}
diff --git a/src/main/java/com/plotsquared/general/commands/CommandDeclaration.java b/src/main/java/com/plotsquared/general/commands/CommandDeclaration.java
index 1c2fe202a..a1e04a2cd 100644
--- a/src/main/java/com/plotsquared/general/commands/CommandDeclaration.java
+++ b/src/main/java/com/plotsquared/general/commands/CommandDeclaration.java
@@ -1,13 +1,13 @@
package com.plotsquared.general.commands;
-import com.intellectualcrafters.plot.commands.CommandCategory;
-import com.intellectualcrafters.plot.commands.RequiredType;
-
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
+import com.intellectualcrafters.plot.commands.CommandCategory;
+import com.intellectualcrafters.plot.commands.RequiredType;
+
@Target(ElementType.TYPE)
@Retention(RetentionPolicy.RUNTIME)
public @interface CommandDeclaration {
diff --git a/src/main/java/com/plotsquared/general/commands/CommandManager.java b/src/main/java/com/plotsquared/general/commands/CommandManager.java
index 5ebcfc544..9700f6be4 100644
--- a/src/main/java/com/plotsquared/general/commands/CommandManager.java
+++ b/src/main/java/com/plotsquared/general/commands/CommandManager.java
@@ -1,13 +1,13 @@
package com.plotsquared.general.commands;
-import com.intellectualcrafters.plot.config.C;
-
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.concurrent.ConcurrentHashMap;
+import com.intellectualcrafters.plot.config.C;
+
@SuppressWarnings("unused")
public class CommandManager {
diff --git a/src/main/java/com/plotsquared/listener/APlotListener.java b/src/main/java/com/plotsquared/listener/APlotListener.java
deleted file mode 100644
index 11d616914..000000000
--- a/src/main/java/com/plotsquared/listener/APlotListener.java
+++ /dev/null
@@ -1,13 +0,0 @@
-package com.plotsquared.listener;
-
-import com.intellectualcrafters.plot.object.Plot;
-import com.intellectualcrafters.plot.object.PlotPlayer;
-
-public abstract class APlotListener {
-
- public static APlotListener manager;
-
- public abstract boolean plotEntry(final PlotPlayer player, final Plot plot);
-
- public abstract boolean plotExit(final PlotPlayer player, final Plot plot);
-}
diff --git a/src/main/java/com/plotsquared/bukkit/listeners/PlotListener.java b/src/main/java/com/plotsquared/listener/PlotListener.java
similarity index 65%
rename from src/main/java/com/plotsquared/bukkit/listeners/PlotListener.java
rename to src/main/java/com/plotsquared/listener/PlotListener.java
index 3fa60fccc..3334f895f 100644
--- a/src/main/java/com/plotsquared/bukkit/listeners/PlotListener.java
+++ b/src/main/java/com/plotsquared/listener/PlotListener.java
@@ -18,83 +18,38 @@
// /
// You can contact us via: support@intellectualsites.com /
////////////////////////////////////////////////////////////////////////////////////////////////////
-package com.plotsquared.bukkit.listeners;
+package com.plotsquared.listener;
+
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager;
+import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer;
-import com.intellectualcrafters.plot.util.*;
-import com.plotsquared.bukkit.events.PlayerEnterPlotEvent;
-import com.plotsquared.bukkit.events.PlayerLeavePlotEvent;
-import com.plotsquared.bukkit.object.BukkitPlayer;
-import com.plotsquared.bukkit.titles.AbstractTitle;
-import com.plotsquared.listener.APlotListener;
-
-import org.bukkit.*;
-import org.bukkit.entity.Player;
-
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.util.AbstractTitle;
+import com.intellectualcrafters.plot.util.CommentManager;
+import com.intellectualcrafters.plot.util.EventUtil;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.Permissions;
+import com.intellectualcrafters.plot.util.PlotGamemode;
+import com.intellectualcrafters.plot.util.PlotWeather;
+import com.intellectualcrafters.plot.util.StringMan;
+import com.intellectualcrafters.plot.util.TaskManager;
/**
* @author Citymonstret
* @author Empire92
*/
-public class PlotListener extends APlotListener {
+public class PlotListener {
- // FIXME if we add a few more functions to PlotPlayer, we could make this generic and not implementation specific
- // TODO Alternatively we could move functions into BukkitPlayerManager which seems to be heavily lacking
-
- public void textures(final Player p) {
- if ((Settings.PLOT_SPECIFIC_RESOURCE_PACK.length() > 1) && PS.get().isPlotWorld(p.getWorld().getName())) {
- p.setResourcePack(Settings.PLOT_SPECIFIC_RESOURCE_PACK);
- }
- }
-
- private String getName(final UUID id) {
- if (id == null) {
- return "none";
- }
- final String name = UUIDHandler.getName(id);
- if (name == null) {
- return "unknown";
- }
- return name;
- }
-
- private void setWeather(Player player, String str) {
- switch (str.toLowerCase()) {
- case "clear": {
- player.setPlayerWeather(WeatherType.CLEAR);
- return;
- }
- case "rain": {
- player.setPlayerWeather(WeatherType.DOWNFALL);
- return;
- }
- }
- }
-
- private GameMode getGameMode(final String str) {
- switch (str) {
- case "creative":
- return GameMode.CREATIVE;
- case "survival":
- return GameMode.SURVIVAL;
- case "adventure":
- return GameMode.ADVENTURE;
- default:
- return Bukkit.getDefaultGameMode();
- }
- }
-
- public boolean plotEntry(final PlotPlayer pp, final Plot plot) {
+ public static boolean plotEntry(final PlotPlayer pp, final Plot plot) {
if (plot.isDenied(pp.getUUID()) && !Permissions.hasPermission(pp, "plots.admin.entry.denied")) {
return false;
}
@@ -103,9 +58,7 @@ public class PlotListener extends APlotListener {
plotExit(pp, last);
}
pp.setMeta("lastplot", plot);
- final Player player = ((BukkitPlayer) pp).player;
- final PlayerEnterPlotEvent callEvent = new PlayerEnterPlotEvent(player, plot);
- Bukkit.getPluginManager().callEvent(callEvent);
+ EventUtil.manager.callEntry(pp, plot);
if (plot.hasOwner()) {
HashMap flags = FlagManager.getPlotFlags(plot);
int size = flags.size();
@@ -127,9 +80,9 @@ public class PlotListener extends APlotListener {
final Flag gamemodeFlag = flags.get("gamemode");
if (gamemodeFlag != null) {
- if (player.getGameMode() != getGameMode(gamemodeFlag.getValueString())) {
- if (!player.hasPermission("plots.gamemode.bypass")) {
- player.setGameMode(getGameMode(gamemodeFlag.getValueString()));
+ if (pp.getGamemode() != gamemodeFlag.getValue()) {
+ if (!Permissions.hasPermission(pp, "plots.gamemode.bypass")) {
+ pp.setGamemode((PlotGamemode) gamemodeFlag.getValue());
}
else {
MainUtil.sendMessage(pp, StringMan.replaceAll(C.GAMEMODE_WAS_BYPASSED.s(), "{plot}", plot.id, "{gamemode}", gamemodeFlag.getValue()));
@@ -138,30 +91,30 @@ public class PlotListener extends APlotListener {
}
final Flag flyFlag = flags.get("fly");
if (flyFlag != null) {
- player.setAllowFlight((boolean) flyFlag.getValue());
+ pp.setFlight((boolean) flyFlag.getValue());
}
final Flag timeFlag = flags.get("time");
if (timeFlag != null) {
try {
final long time = (long) timeFlag.getValue();
- player.setPlayerTime(time, false);
+ pp.setTime(time);
} catch (final Exception e) {
FlagManager.removePlotFlag(plot, "time");
}
}
final Flag weatherFlag = flags.get("weather");
if (weatherFlag != null) {
- setWeather(player, weatherFlag.getValueString());
+ pp.setWeather((PlotWeather) weatherFlag.getValue());
}
Flag musicFlag = flags.get("music");
if (musicFlag != null) {
final Integer id = (Integer) musicFlag.getValue();
if ((id >= 2256 && id <= 2267) || id == 0) {
- final org.bukkit.Location loc = player.getLocation();
- org.bukkit.Location lastLoc = (org.bukkit.Location) pp.getMeta("music");
+ Location loc = pp.getLocation();
+ Location lastLoc = (Location) pp.getMeta("music");
if (lastLoc != null) {
- player.playEffect(lastLoc, Effect.RECORD_PLAY, 0);
+ pp.playMusic(lastLoc, 0);
if (id == 0) {
pp.deleteMeta("music");
}
@@ -169,17 +122,17 @@ public class PlotListener extends APlotListener {
if (id != 0) {
try {
pp.setMeta("music", loc);
- player.playEffect(loc, Effect.RECORD_PLAY, Material.getMaterial(id));
+ pp.playMusic(loc, id);
}
catch (Exception e) {}
}
}
}
else {
- org.bukkit.Location lastLoc = (org.bukkit.Location) pp.getMeta("music");
+ Location lastLoc = (Location) pp.getMeta("music");
if (lastLoc != null) {
pp.deleteMeta("music");
- player.playEffect(lastLoc, Effect.RECORD_PLAY, 0);
+ pp.playMusic(lastLoc, 0);
}
}
CommentManager.sendTitle(pp, plot);
@@ -203,7 +156,7 @@ public class PlotListener extends APlotListener {
replacements.put("%world%", plot.world);
replacements.put("%greeting%", greeting);
replacements.put("%alias", plot.toString());
- replacements.put("%s", getName(plot.owner));
+ replacements.put("%s", MainUtil.getName(plot.owner));
String main = StringMan.replaceFromMap(C.TITLE_ENTERED_PLOT.s(), replacements);
String sub = StringMan.replaceFromMap(C.TITLE_ENTERED_PLOT_SUB.s(), replacements);
AbstractTitle.sendTitle(pp, main, sub);
@@ -217,35 +170,40 @@ public class PlotListener extends APlotListener {
return true;
}
- public boolean plotExit(final PlotPlayer pp, final Plot plot) {
+ public static boolean plotExit(final PlotPlayer pp, final Plot plot) {
pp.deleteMeta("lastplot");
- Player player = ((BukkitPlayer) pp).player;
- final PlayerLeavePlotEvent callEvent = new PlayerLeavePlotEvent(player, plot);
- Bukkit.getPluginManager().callEvent(callEvent);
+ EventUtil.manager.callLeave(pp, plot);
if (plot.hasOwner()) {
- if (FlagManager.getPlotFlag(plot, "fly") != null) {
- player.setAllowFlight(Bukkit.getAllowFlight());
+ PlotWorld pw = PS.get().getPlotWorld(pp.getLocation().getWorld());
+ if (pw == null) {
+ return true;
}
if (FlagManager.getPlotFlag(plot, "gamemode") != null) {
- if (player.getGameMode() != Bukkit.getDefaultGameMode()) {
- if (!player.hasPermission("plots.gamemode.bypass")) {
- player.setGameMode(Bukkit.getDefaultGameMode());
+ if (pp.getGamemode() != pw.GAMEMODE) {
+ if (!Permissions.hasPermission(pp, "plots.gamemode.bypass")) {
+ pp.setGamemode(pw.GAMEMODE);
}
else {
- MainUtil.sendMessage(pp, StringMan.replaceAll(C.GAMEMODE_WAS_BYPASSED.s(), "{plot}", plot.world, "{gamemode}", Bukkit.getDefaultGameMode().name().toLowerCase()));
+ MainUtil.sendMessage(pp, StringMan.replaceAll(C.GAMEMODE_WAS_BYPASSED.s(), "{plot}", plot.world, "{gamemode}", pw.GAMEMODE.name().toLowerCase()));
}
}
}
+ if (FlagManager.getPlotFlag(plot, "fly") != null) {
+ PlotGamemode gamemode = pp.getGamemode();
+ if (gamemode == PlotGamemode.SURVIVAL || gamemode == PlotGamemode.ADVENTURE) {
+ pp.setFlight(false);
+ }
+ }
if (FlagManager.getPlotFlag(plot, "time") != null) {
- player.resetPlayerTime();
+ pp.setTime(Long.MAX_VALUE);
}
if (FlagManager.getPlotFlag(plot, "weather") != null) {
- player.resetPlayerWeather();
+ pp.setWeather(PlotWeather.RESET);
}
- org.bukkit.Location lastLoc = (org.bukkit.Location) pp.getMeta("music");
+ Location lastLoc = (Location) pp.getMeta("music");
if (lastLoc != null) {
pp.deleteMeta("music");
- player.playEffect(lastLoc, Effect.RECORD_PLAY, 0);
+ pp.playMusic(lastLoc, 0);
}
}
return true;
diff --git a/src/main/java/com/plotsquared/sponge/PlotGen.java b/src/main/java/com/plotsquared/sponge/PlotGen.java
deleted file mode 100644
index 65d7a6f27..000000000
--- a/src/main/java/com/plotsquared/sponge/PlotGen.java
+++ /dev/null
@@ -1,158 +0,0 @@
-package com.plotsquared.sponge;
-
-import com.flowpowered.math.vector.Vector3i;
-import org.spongepowered.api.block.BlockState;
-import org.spongepowered.api.block.BlockTypes;
-import org.spongepowered.api.world.World;
-import org.spongepowered.api.world.extent.ImmutableBiomeArea;
-import org.spongepowered.api.world.extent.MutableBlockVolume;
-import org.spongepowered.api.world.gen.GeneratorPopulator;
-
-public class PlotGen implements GeneratorPopulator {
-
- public String worldname;
- public long seed;
-
-
- public final int PLOT_HEIGHT = 64; // Plot height of 64
- public final int PLOT_WIDTH = 42; // Plot width of 42
- public final int ROAD_WIDTH = 7; // Road width of 7
-
- public final BlockState ROAD_BLOCK = BlockTypes.QUARTZ_BLOCK.getDefaultState(); // Quartz
- public final BlockState MAIN_BLOCK = BlockTypes.STONE.getDefaultState(); // Stone
- public final BlockState WALL_BLOCK = BlockTypes.BEDROCK.getDefaultState(); // Bedrock
- public final BlockState BORDER_BLOCK = BlockTypes.STONE_SLAB.getDefaultState(); // Stone slab
- public final BlockState[] FLOOR_BLOCK = new BlockState[] {BlockTypes.GRASS.getDefaultState(), BlockTypes.SPONGE.getDefaultState()}; // Grass and sponge
-
- public final int total_width;
- public final int road_width_lower;
- public final int road_width_upper;
-
- /**
- * I'm using my PseudoRandom class as it's more efficient and we don't need secure randomness
- */
- public final PseudoRandom RANDOM = new PseudoRandom();
- private SpongeMain main;
-
- public PlotGen(SpongeMain main, String worldname, long seed) {
- this.main = main;
- this.worldname = worldname;
- this.seed = seed;
-
- total_width = PLOT_WIDTH + ROAD_WIDTH;
-
- // Calculating the bottom and top road portions (this is for a PlotSquared compatible generator, but you can have any offset you want)
- if ((ROAD_WIDTH % 2) == 0) {
- road_width_lower = ROAD_WIDTH / 2 - 1;
- } else {
- road_width_lower = ROAD_WIDTH / 2;
- }
- road_width_upper = road_width_lower + PLOT_WIDTH + 1;
- main.log("LOADED GEN FOR: " + worldname);
- }
-
- /**
- * This simple pairing function is used for the seed for each chunk,
- * - This is useful if you want generation to appear random, but be the same each time
- * - You could also use a simple hash function like `return x + y * 31` - but this looks fancier
- * @param x
- * @param y
- * @return
- */
- public int pair(int x, int y) {
- long hash;
- if (x >= 0) {
- if (y >= 0) {
- hash = (x * x) + (3 * x) + (2 * x * y) + y + (y * y) + 2;
- } else {
- final int y1 = -y;
- hash = (x * x) + (3 * x) + (2 * x * y1) + y1 + (y1 * y1) + 1;
- }
- } else {
- final int x1 = -x;
- if (y >= 0) {
- hash = -((x1 * x1) + (3 * x1) + (2 * x1 * y) + y + (y * y));
- } else {
- final int y1 = -y;
- hash = -((x1 * x1) + (3 * x1) + (2 * x1 * y1) + y1 + (y1 * y1) + 1);
- }
- }
- return (int) (hash % Integer.MAX_VALUE);
- }
-
- @Override
- public void populate(World world, MutableBlockVolume buffer, ImmutableBiomeArea biomeBase) {
- try {
- Vector3i min = buffer.getBlockMin();
- int X = min.getX();
- int Z = min.getZ();
- int cx = X >> 4;
- int cz = Z >> 4;
- main.log("POPULATING " + worldname + " | " + cx + "," + cz);
- // If you have any random elements to your generation, you will want to set the state of the random class
- RANDOM.state = pair(cx, cz);
-
- // TODO set bedrock
-
- // We want all plots to be the same
- // To do this we will need to reduce the coordinates to the same base location
- // To get the world coord from a chunk coord we multiply by 16 `cx << 4`
- // Then we find the remainder of that `(cx << 4) % total_width`
- // We don't want negative numbers though so add the `total_width` if the remainder is less than 0
- // We have to do this as the plot size will not necessarily have to be a multiple of 16, and so it won't always align to the chunk
- // If the total width is a multiple of 16, you can in fact make some neat optimizations, see PlotSquaredMG source for more info
- int bx = (cx << 4) % total_width + (cx < 0 ? total_width : 0);
- int bz = (cz << 4) % total_width + (cz < 0 ? total_width : 0);
-
- // This is our main loop where we go over all the columns in the chunk and set the blocks
- for (int x = 0; x < 16; x++) {
- for (int z = 0; z < 16; z++) {
- // Getting the reduced coordinate
- int xx = (x + bx);
- int zz = (z + bz);
- // If it's greater than the total width, we need to reduce it
- // Although we reduced the chunk coordinates before, that only means the base coordinate of the chunk is reduced
- // The top coordinate could still be outside our desired range
- if (xx >= total_width) xx -= total_width;
- if (zz >= total_width) zz -= total_width;
-
- // ROAD
- if (xx < road_width_lower || zz < road_width_lower || xx > road_width_upper || zz > road_width_upper) {
- for (int y = 0; y < PLOT_HEIGHT; y++) setBlock(buffer, X + x, y, Z + z, ROAD_BLOCK);
- }
- // WALL
- else if (xx == road_width_lower || zz == road_width_lower || xx == road_width_upper || zz == road_width_upper) {
- // Set the wall block
- for (int y = 0; y < PLOT_HEIGHT; y++) setBlock(buffer, X + x, y, Z + z, WALL_BLOCK);
- // Set the border block (on top of the wall)
- setBlock(buffer, X + x, PLOT_HEIGHT, Z + z, BORDER_BLOCK);
- }
- // PLOT
- else {
- // Set the main plot block
- for (int y = 0; y < PLOT_HEIGHT - 1; y++) setBlock(buffer, X + x, y, Z + z, MAIN_BLOCK);
- // Set the plot floor
- setBlock(buffer, X + x, PLOT_HEIGHT - 1, Z + z, FLOOR_BLOCK);
- }
- }
- }
- main.log("SUCCESS " + worldname + " | " + cx + "," + cz);
- }
- catch (Exception e) {
- // Normally if something goes wrong in your code it will fail silently with world generators
- // Having this try/catch will help recover the exception
- e.printStackTrace();
- }
- }
-
- public void setBlock(MutableBlockVolume buffer, int x, int y, int z, BlockState...states) {
- if (states.length == 1) {
- setBlock(buffer, x, y, z, states[0]);
- }
- setBlock(buffer, x, y, z, states[RANDOM.random(states.length)]);
- }
-
- public void setBlock(MutableBlockVolume buffer, int x, int y, int z, BlockState state) {
- buffer.setBlock(x, y, z, state);
- }
-}
diff --git a/src/main/java/com/plotsquared/sponge/PseudoRandom.java b/src/main/java/com/plotsquared/sponge/PseudoRandom.java
deleted file mode 100644
index 6b26446c4..000000000
--- a/src/main/java/com/plotsquared/sponge/PseudoRandom.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.plotsquared.sponge;
-
-public class PseudoRandom {
- public long state = 1;
-
- public long nextLong() {
- final long a = state;
- state = xorShift64(a);
- return a;
- }
-
- public long xorShift64(long a) {
- a ^= (a << 21);
- a ^= (a >>> 35);
- a ^= (a << 4);
- return a;
- }
-
- public int random(final int n) {
- if (n == 1) {
- return 0;
- }
- final long r = ((nextLong() >>> 32) * n) >> 32;
- return (int) r;
- }
-}
diff --git a/src/main/java/com/plotsquared/sponge/SpongeChunkManager.java b/src/main/java/com/plotsquared/sponge/SpongeChunkManager.java
new file mode 100644
index 000000000..ffe030271
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/SpongeChunkManager.java
@@ -0,0 +1,128 @@
+package com.plotsquared.sponge;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.bukkit.Bukkit;
+import org.spongepowered.api.data.DataContainer;
+import org.spongepowered.api.world.Chunk;
+import org.spongepowered.api.world.World;
+import org.spongepowered.api.world.storage.ChunkDataStream;
+import org.spongepowered.api.world.storage.WorldStorage;
+
+import com.google.common.base.Optional;
+import com.google.common.util.concurrent.ListenableFuture;
+import com.intellectualcrafters.plot.object.ChunkLoc;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.util.ChunkManager;
+import com.intellectualcrafters.plot.util.TaskManager;
+import com.intellectualcrafters.plot.util.SetBlockQueue.ChunkWrapper;
+import com.plotsquared.sponge.util.SpongeUtil;
+
+public class SpongeChunkManager extends ChunkManager {
+
+ @Override
+ public void setChunk(ChunkWrapper loc, PlotBlock[][] result) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public int[] countEntities(Plot plot) {
+ // TODO Auto-generated method stub
+ return new int[5];
+ }
+
+ @Override
+ public boolean loadChunk(String world, ChunkLoc loc, boolean force) {
+ World worldObj = SpongeUtil.getWorld(world);
+ return worldObj.loadChunk(loc.x << 4, 0, loc.z << 4, force).isPresent();
+ }
+
+ @Override
+ public boolean unloadChunk(String world, ChunkLoc loc, boolean save, boolean safe) {
+ World worldObj = SpongeUtil.getWorld(world);
+ Optional chunk = worldObj.getChunk(loc.x << 4, 0, loc.z << 4);
+ if (chunk.isPresent()) {
+ return worldObj.unloadChunk(chunk.get());
+ }
+ return false;
+ }
+
+ @Override
+ public List getChunkChunks(String world) {
+ ArrayList chunks = new ArrayList();
+ World worldObj = SpongeUtil.getWorld(world);
+ ChunkDataStream storage = worldObj.getWorldStorage().getGeneratedChunks();
+ while (storage.hasNext()) {
+ DataContainer data = storage.next();
+
+ // TODO get chunk from DataContainer
+ }
+ return chunks;
+ }
+
+ @Override
+ public void regenerateChunk(String world, ChunkLoc loc) {
+ World worldObj = SpongeUtil.getWorld(world);
+ Optional chunk = worldObj.getChunk(loc.x << 4, 0, loc.z << 4);
+ if (chunk.isPresent()) {
+ // TODO regenerate chunk
+ }
+ }
+
+ @Override
+ public void deleteRegionFile(String world, ChunkLoc loc) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void deleteRegionFiles(String world, List chunks) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public Plot hasPlot(String world, ChunkLoc chunk) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean copyRegion(Location pos1, Location pos2, Location newPos, Runnable whenDone) {
+ // TODO Auto-generated method stub
+ TaskManager.runTask(whenDone);
+ return false;
+ }
+
+ @Override
+ public boolean regenerateRegion(Location pos1, Location pos2, Runnable whenDone) {
+ // TODO Auto-generated method stub
+ TaskManager.runTask(whenDone);
+ return false;
+ }
+
+ @Override
+ public void clearAllEntities(Plot plot) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void swap(String world, PlotId id, PlotId plotid) {
+ // TODO Auto-generated method stub
+
+ }
+
+ @Override
+ public void swap(String worldname, Location bot1, Location top1, Location bot2, Location top2) {
+ // TODO Auto-generated method stub
+
+ }
+
+}
diff --git a/src/main/java/com/plotsquared/sponge/SpongeGeneratorWrapper.java b/src/main/java/com/plotsquared/sponge/SpongeGeneratorWrapper.java
deleted file mode 100644
index 799530771..000000000
--- a/src/main/java/com/plotsquared/sponge/SpongeGeneratorWrapper.java
+++ /dev/null
@@ -1,65 +0,0 @@
-package com.plotsquared.sponge;
-
-import com.intellectualcrafters.plot.generator.PlotGenerator;
-import com.intellectualcrafters.plot.object.PlotCluster;
-import com.intellectualcrafters.plot.object.PlotManager;
-import com.intellectualcrafters.plot.object.PlotWorld;
-import com.intellectualcrafters.plot.object.SetupObject;
-
-import org.spongepowered.api.world.gen.WorldGenerator;
-
-public class SpongeGeneratorWrapper extends PlotGenerator{
-
- public SpongeGeneratorWrapper(String world, WorldGenerator generator) {
- super(world, generator);
- // TODO Auto-generated constructor stub
- }
-
- @Override
- public void initialize(PlotWorld plotworld) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void augment(PlotCluster cluster, PlotWorld plotworld) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void setGenerator(String generator) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public PlotWorld getNewPlotWorld(String world) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public PlotManager getPlotManager() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public boolean isFull() {
- // TODO Auto-generated method stub
- return false;
- }
-
- @Override
- public String getName() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void processSetup(SetupObject object) {
- // TODO Auto-generated method stub
- }
-
-}
diff --git a/src/main/java/com/plotsquared/sponge/SpongeMain.java b/src/main/java/com/plotsquared/sponge/SpongeMain.java
index 91006215f..081809b2b 100644
--- a/src/main/java/com/plotsquared/sponge/SpongeMain.java
+++ b/src/main/java/com/plotsquared/sponge/SpongeMain.java
@@ -1,24 +1,29 @@
package com.plotsquared.sponge;
-import com.google.inject.Inject;
-import com.intellectualcrafters.configuration.ConfigurationSection;
-import com.intellectualcrafters.plot.IPlotMain;
-import com.intellectualcrafters.plot.PS;
-import com.intellectualcrafters.plot.config.C;
-import com.intellectualcrafters.plot.config.Settings;
-import com.intellectualcrafters.plot.generator.HybridUtils;
-import com.intellectualcrafters.plot.object.PlotPlayer;
-import com.intellectualcrafters.plot.util.*;
-import com.intellectualcrafters.plot.uuid.UUIDWrapper;
-import com.plotsquared.listener.APlotListener;
+import java.io.File;
+import java.lang.reflect.Field;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+import java.util.Map.Entry;
+import java.util.concurrent.ConcurrentHashMap;
import org.slf4j.Logger;
+import org.spongepowered.api.CatalogType;
import org.spongepowered.api.Game;
-import org.spongepowered.api.GameRegistry;
-import org.spongepowered.api.MinecraftVersion;
import org.spongepowered.api.Server;
+import org.spongepowered.api.block.BlockState;
+import org.spongepowered.api.block.BlockType;
+import org.spongepowered.api.block.BlockTypes;
+import org.spongepowered.api.data.manipulator.block.StoneData;
import org.spongepowered.api.entity.player.Player;
import org.spongepowered.api.entity.player.gamemode.GameModes;
+import org.spongepowered.api.event.EventHandler;
import org.spongepowered.api.event.Subscribe;
import org.spongepowered.api.event.entity.player.PlayerChatEvent;
import org.spongepowered.api.event.state.PreInitializationEvent;
@@ -26,13 +31,56 @@ import org.spongepowered.api.event.state.ServerAboutToStartEvent;
import org.spongepowered.api.plugin.Plugin;
import org.spongepowered.api.plugin.PluginContainer;
import org.spongepowered.api.service.profile.GameProfileResolver;
+import org.spongepowered.api.text.Text;
+import org.spongepowered.api.text.Texts;
+import org.spongepowered.api.text.translation.Translatable;
+import org.spongepowered.api.text.translation.Translation;
import org.spongepowered.api.world.DimensionTypes;
import org.spongepowered.api.world.GeneratorTypes;
import org.spongepowered.api.world.World;
+import org.spongepowered.api.world.gen.WorldGeneratorModifier;
-import java.io.File;
-import java.util.Collection;
-import java.util.UUID;
+import com.google.common.base.Optional;
+import com.google.inject.Inject;
+import com.intellectualcrafters.configuration.ConfigurationSection;
+import com.intellectualcrafters.plot.IPlotMain;
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.config.Configuration;
+import com.intellectualcrafters.plot.config.Settings;
+import com.intellectualcrafters.plot.generator.HybridUtils;
+import com.intellectualcrafters.plot.generator.PlotGenerator;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.object.PlotManager;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.util.AbstractTitle;
+import com.intellectualcrafters.plot.util.BlockManager;
+import com.intellectualcrafters.plot.util.ChunkManager;
+import com.intellectualcrafters.plot.util.ConsoleColors;
+import com.intellectualcrafters.plot.util.EconHandler;
+import com.intellectualcrafters.plot.util.EventUtil;
+import com.intellectualcrafters.plot.util.InventoryUtil;
+import com.intellectualcrafters.plot.util.SchematicHandler;
+import com.intellectualcrafters.plot.util.SetupUtils;
+import com.intellectualcrafters.plot.util.TaskManager;
+import com.intellectualcrafters.plot.util.UUIDHandlerImplementation;
+import com.intellectualcrafters.plot.uuid.UUIDWrapper;
+import com.plotsquared.sponge.generator.SpongeBasicGen;
+import com.plotsquared.sponge.generator.SpongeGeneratorWrapper;
+import com.plotsquared.sponge.generator.WorldModify;
+import com.plotsquared.sponge.listener.MainListener;
+import com.plotsquared.sponge.util.KillRoadMobs;
+import com.plotsquared.sponge.util.SpongeBlockManager;
+import com.plotsquared.sponge.util.SpongeCommand;
+import com.plotsquared.sponge.util.SpongeEventUtil;
+import com.plotsquared.sponge.util.SpongeInventoryUtil;
+import com.plotsquared.sponge.util.SpongeMetrics;
+import com.plotsquared.sponge.util.SpongeTaskManager;
+import com.plotsquared.sponge.util.SpongeUtil;
+import com.plotsquared.sponge.uuid.SpongeLowerOfflineUUIDWrapper;
+import com.plotsquared.sponge.uuid.SpongeOnlineUUIDWrapper;
+import com.plotsquared.sponge.uuid.SpongeUUIDHandler;
/**
* Created by robin on 01/11/2014
@@ -70,7 +118,68 @@ public class SpongeMain implements IPlotMain, PluginContainer {
}
public Object getPlugin() {
- return this.plugin;
+ return plugin;
+ }
+
+ public Text getText(String m) {
+ return Texts.of(m);
+ }
+
+ public Translatable getTranslation(final String m) {
+ return new Translatable() {
+ @Override
+ public Translation getTranslation() {
+ return new Translation() {
+
+ @Override
+ public String getId() {
+ return m;
+ }
+
+ @Override
+ public String get(Locale l, Object... args) {
+ return m;
+ }
+
+ @Override
+ public String get(Locale l) {
+ return m;
+ }
+ };
+ }
+ };
+ }
+
+ private PlotBlock NULL_BLOCK = new PlotBlock((short) 0, (byte) 0);
+ private BlockState[][] blockMap;
+ private Map blockMapReverse;
+
+ public BlockState getBlockState(PlotBlock block) {
+ if (blockMap[block.id] == null) {
+ log("UNKNOWN BLOCK: " + block.toString());
+ return null;
+ }
+ else if (blockMap[block.id].length <= block.data) {
+ log("UNKNOWN BLOCK: " + block.toString() + " -> Using " + block.id + ":0 instead");
+ return blockMap[block.id][0];
+ }
+ return blockMap[block.id][block.data];
+ }
+
+ public BlockState getBlockState(int id) {
+ return blockMap[id][0];
+ }
+
+ public Collection getAllStates() {
+ return this.blockMapReverse.keySet();
+ }
+
+ public PlotBlock getPlotBlock(BlockState state) {
+ PlotBlock val = blockMapReverse.get(state);
+ if (val == null) {
+ return NULL_BLOCK;
+ }
+ return val;
}
/////////
@@ -114,43 +223,159 @@ public class SpongeMain implements IPlotMain, PluginContainer {
log("INIT");
THIS = this;
- // resolver
+ //
resolver = game.getServiceManager().provide(GameProfileResolver.class).get();
plugin = game.getPluginManager().getPlugin("PlotSquared").get().getInstance();
+ log("PLUGIN IS THIS: " + (plugin == this));
+ plugin = this;
+ server = game.getServer();
+ //
PS.instance = new PS(this);
- // Set the generators for each world...
- server = game.getServer();
- Collection worlds = server.getWorlds();
- if (worlds.size() > 0) {
- log("INJECTING WORLDS!!!!!!!");
- for (World world : server.getWorlds()) {
- log("INJECTING WORLD: " + world.getName());
- world.setWorldGenerator(new SpongePlotGenerator(world.getName()));
- }
- }
+ // TODO Until P^2 has json chat stuff for sponge, disable this
+ Settings.FANCY_CHAT = false;
+ // done
+
+ registerBlocks();
ConfigurationSection worldSection = PS.get().config.getConfigurationSection("worlds");
if (worldSection != null) {
for (String world : worldSection.getKeys(false)) {
- this.modify = new WorldModify(this);
+
+ SpongeBasicGen generator = new SpongeBasicGen(world);
+ PS.get().loadWorld(world, new SpongeGeneratorWrapper(world, generator));
+
+ this.modify = new WorldModify(generator);
Game game = event.getGame();
game.getRegistry().registerWorldGeneratorModifier(modify);
- game.getRegistry().getWorldBuilder()
+
+ Optional builder = game.getRegistry().getWorldBuilder()
.name(world)
.enabled(true)
.loadsOnStartup(true)
.keepsSpawnLoaded(true)
.dimensionType(DimensionTypes.OVERWORLD)
- .generator(GeneratorTypes.DEBUG)
+ .generator(GeneratorTypes.FLAT)
.gameMode(GameModes.CREATIVE)
+ .usesMapFeatures(false)
.generatorModifiers(modify)
.build();
+ World worldObj = builder.get();
}
}
}
+ public void registerBlock(PlotBlock block, BlockState state) {
+ BlockState[] val = blockMap[block.id];
+ if (val == null) {
+ blockMap[block.id] = new BlockState[block.data + 1];
+ }
+ else if (val.length <= block.data) {
+ blockMap[block.id] = Arrays.copyOf(val, block.data + 1);
+ }
+ else if (val[block.data] != null) {
+ return;
+ }
+ blockMap[block.id][block.data] = state;
+ blockMapReverse.put(state, block);
+ }
+
+ public PlotBlock registerBlock(BlockState state) {
+ PlotBlock val = blockMapReverse.get(state);
+ if (val != null) {
+ return val;
+ }
+ byte data;
+ if (blockMap[0] == null) {
+ blockMap[0] = new BlockState[1];
+ data = 0;
+ }
+ else {
+ data = (byte) (blockMap[0].length);
+ }
+ PlotBlock block = new PlotBlock((short) 0, data);
+ registerBlock(block, state);
+ return block;
+ }
+
+ public void registerBlocks() {
+ blockMap = new BlockState[256][];
+ blockMapReverse = new ConcurrentHashMap();
+ HashMap states = new HashMap<>();
+
+ PS.get().copyFile("ids.txt", "config");
+ PS.get().copyFile("data.txt", "config");
+
+ try {
+
+ File id_file = new File(getDirectory(), "config" + File.separator + "ids.txt");
+ List id_lines = Files.readAllLines(id_file.toPath(), StandardCharsets.UTF_8);
+
+ File data_file = new File(getDirectory(), "config" + File.separator + "data.txt");
+ List data_lines = Files.readAllLines(data_file.toPath(), StandardCharsets.UTF_8);
+
+ Field[] fields = BlockTypes.class.getDeclaredFields();
+ for (Field field : fields) {
+ BlockType type = (BlockType) field.get(null);
+ BlockState state = type.getDefaultState();
+ if (state != null) {
+ try {
+ states.put(type.getId() + ":" + 0, state);
+ }
+ catch (Exception e) {}
+ }
+ }
+ String packaze = "org.spongepowered.api.data.type.";
+ for (int i = 0; i < data_lines.size(); i++) {
+ String classname = packaze + data_lines.get(i).trim();
+ try {
+ Class> clazz = Class.forName(classname);
+ fields = clazz.getDeclaredFields();
+ for (Field field : fields) {
+ CatalogType type = (CatalogType) field.get(null);
+ String minecraft_id = type.getId();
+ BlockState state = states.get(minecraft_id + ":" + 0);
+ if (state == null) {
+ continue;
+ }
+ state.getManipulator(StoneData.class);
+ }
+ }
+ catch (Throwable e) {}
+ }
+
+ PlotBlock block = null;
+ for (int i = 0; i < id_lines.size(); i++) {
+ String line = id_lines.get(i).trim();
+ switch(i%3) {
+ case 0: {
+ block = Configuration.BLOCK.parseString(line);
+ break;
+ }
+ case 1: {
+ break;
+ }
+ case 2: {
+ String minecraft_id = line;
+ BlockState state = states.remove(minecraft_id + ":" + block.data);
+ if (state == null) {
+ continue;
+ }
+ registerBlock(block, state);
+ break;
+ }
+ }
+ }
+ for (Entry state : states.entrySet()) {
+ log("REGISTERING: " + registerBlock(state.getValue()) + " | " + state.getValue().getType());
+ }
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
@Subscribe
public void onPlayerChat(PlayerChatEvent event) {
// This is how events sort of work?
@@ -160,8 +385,15 @@ public class SpongeMain implements IPlotMain, PluginContainer {
@Override
public void log(String message) {
- message = ConsoleColors.fromString(message);
- logger.info(message);
+ message = C.format(message, C.replacements);
+ if (!Settings.CONSOLE_COLOR) {
+ message = message.replaceAll('\u00a7' + "[a-z|0-9]", "");
+ }
+ if (server == null || server.getConsole() == null) {
+ logger.info(message);
+ return;
+ }
+ server.getConsole().sendMessage(Texts.of(message));
}
@Override
@@ -191,6 +423,66 @@ public class SpongeMain implements IPlotMain, PluginContainer {
String[] split = version.split("\\.");
return new int[] { Integer.parseInt(split[0]), Integer.parseInt(split[1]), (split.length == 3) ? Integer.parseInt(split[2]) : 0 };
}
+
+ @Override
+ public InventoryUtil initInventoryUtil() {
+ return new SpongeInventoryUtil();
+ }
+
+ @Override
+ public SpongeGeneratorWrapper getGenerator(String world, String name) {
+ if (name == null) {
+ return new SpongeGeneratorWrapper(world, null);
+ }
+ if (name.equals("PlotSquared")) {
+ return new SpongeGeneratorWrapper(world, null);
+ }
+ else {
+ throw new UnsupportedOperationException("NOT IMPLEMENTED YET");
+ }
+ }
+
+ @Override
+ public EconHandler getEconomyHandler() {
+ // TODO Auto-generated method stub
+ // Nothing like Vault exists yet
+ PS.log("getEconomyHandler NOT IMPLEMENTED YET");
+ return null;
+ }
+
+ @Override
+ public BlockManager initBlockManager() {
+ return new SpongeBlockManager();
+ }
+
+ @Override
+ public EventUtil initEventUtil() {
+ return new SpongeEventUtil();
+ }
+
+ @Override
+ public ChunkManager initChunkManager() {
+ return new SpongeChunkManager();
+ }
+
+ @Override
+ public SetupUtils initSetupUtils() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public HybridUtils initHybridUtils() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+
+ @Override
+ public SchematicHandler initSchematicHandler() {
+ // TODO Auto-generated method stub
+ return null;
+ }
@Override
public TaskManager getTaskManager() {
@@ -199,20 +491,17 @@ public class SpongeMain implements IPlotMain, PluginContainer {
@Override
public void runEntityTask() {
- // TODO Auto-generated method stub
- log("runEntityTask is not implemented!");
+ new KillRoadMobs().run();
}
@Override
public void registerCommands() {
- // TODO Auto-generated method stub
- log("registerCommands is not implemented!");
+ getGame().getCommandDispatcher().register(plugin, new SpongeCommand(), "plots", "p", "plot", "ps", "plotsquared", "p2");
}
@Override
public void registerPlayerEvents() {
- // TODO Auto-generated method stub
- log("registerPlayerEvents is not implemented!");
+ game.getEventManager().register(this, new MainListener());
}
@Override
@@ -245,42 +534,6 @@ public class SpongeMain implements IPlotMain, PluginContainer {
log("registerTNTListener is not implemented!");
}
- @Override
- public EconHandler getEconomyHandler() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public BlockManager initBlockManager() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public EventUtil initEventUtil() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public ChunkManager initChunkManager() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public SetupUtils initSetupUtils() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public HybridUtils initHybridUtils() {
- // TODO Auto-generated method stub
- return null;
- }
-
@Override
public UUIDHandlerImplementation initUUIDHandler() {
UUIDWrapper wrapper;
@@ -293,57 +546,33 @@ public class SpongeMain implements IPlotMain, PluginContainer {
return new SpongeUUIDHandler(wrapper);
}
- @Override
- public InventoryUtil initInventoryUtil() {
- // TODO Auto-generated method stub
- return null;
- }
-
@Override
public boolean initPlotMeConverter() {
// TODO Auto-generated method stub
+ PS.log("initPlotMeConverter NOT IMPLEMENTED YET");
return false;
}
@Override
public void unregister(PlotPlayer player) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public SpongeGeneratorWrapper getGenerator(String world, String name) {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public APlotListener initPlotListener() {
- // TODO Auto-generated method stub
- return null;
+ SpongeUtil.removePlayer(player.getName());
}
@Override
public void registerChunkProcessor() {
// TODO Auto-generated method stub
-
+ PS.log("registerChunkProcessor NOT IMPLEMENTED YET");
}
@Override
public void registerWorldEvents() {
// TODO Auto-generated method stub
-
- }
-
- @Override
- public PlayerManager initPlayerManager() {
- // TODO Auto-generated method stub
- return null;
+ PS.log("registerWorldEvents NOT IMPLEMENTED YET");
}
@Override
public String getServerName() {
- // TODO FIXME
+ // TODO FIXME
throw new UnsupportedOperationException("NOT IMPLEMENTED YET");
}
@@ -360,7 +589,11 @@ public class SpongeMain implements IPlotMain, PluginContainer {
@Override
public void setGenerator(String world) {
- // TODO Auto-generated method stub
-
+ // THIS IS DONE DURING STARTUP ALREADY
+ }
+
+ @Override
+ public AbstractTitle initTitleManager() {
+ return new SpongeTitleManager();
}
}
\ No newline at end of file
diff --git a/src/main/java/com/plotsquared/sponge/SpongePlayer.java b/src/main/java/com/plotsquared/sponge/SpongePlayer.java
index 5c9f2289d..acd2900e1 100644
--- a/src/main/java/com/plotsquared/sponge/SpongePlayer.java
+++ b/src/main/java/com/plotsquared/sponge/SpongePlayer.java
@@ -4,13 +4,17 @@ import java.util.HashMap;
import java.util.HashSet;
import java.util.UUID;
-import org.bukkit.Bukkit;
-import org.bukkit.permissions.Permission;
-import org.bukkit.permissions.PermissionDefault;
import org.spongepowered.api.entity.player.Player;
+import org.spongepowered.api.entity.player.gamemode.GameMode;
+import org.spongepowered.api.entity.player.gamemode.GameModes;
+import org.spongepowered.api.service.permission.PermissionService;
+import org.spongepowered.api.text.Texts;
import org.spongepowered.api.text.chat.ChatTypes;
+import org.spongepowered.api.text.title.Title;
+import org.spongepowered.api.world.World;
import com.flowpowered.math.vector.Vector3d;
+import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.commands.RequiredType;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
@@ -18,7 +22,10 @@ import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.EconHandler;
import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.PlotGamemode;
+import com.intellectualcrafters.plot.util.PlotWeather;
import com.intellectualcrafters.plot.util.UUIDHandler;
+import com.plotsquared.sponge.util.SpongeUtil;
public class SpongePlayer implements PlotPlayer {
@@ -97,12 +104,13 @@ public class SpongePlayer implements PlotPlayer {
@Override
public void teleport(Location loc) {
String world = player.getWorld().getName();
- if (world != loc.getWorld()) {
- player.transferToWorld(world, new Vector3d(loc.getX(), loc.getY(), loc.getZ()));
+ if (!world.equals(loc.getWorld())) {
+ player.transferToWorld(loc.getWorld(), new Vector3d(loc.getX(), loc.getY(), loc.getZ()));
}
else {
org.spongepowered.api.world.Location current = player.getLocation();
- player.setLocationSafely(current.setPosition(new Vector3d(loc.getX(), loc.getY(), loc.getZ())));
+ current = current.setPosition(new Vector3d(loc.getX(), loc.getY(), loc.getZ()));
+ player.setLocation(current);
}
}
@@ -188,13 +196,10 @@ public class SpongePlayer implements PlotPlayer {
@Override
public boolean getAttribute(String key) {
key = "plotsquared_user_attributes." + key;
- Permission perm = Bukkit.getServer().getPluginManager().getPermission(key);
- if (perm == null) {
- perm = new Permission(key, PermissionDefault.FALSE);
- Bukkit.getServer().getPluginManager().addPermission(perm);
- Bukkit.getServer().getPluginManager().recalculatePermissionDefaults(perm);
- }
- return player.hasPermission(key);
+
+ // TODO register attributes
+
+ return false;
}
@Override
@@ -202,4 +207,71 @@ public class SpongePlayer implements PlotPlayer {
key = "plotsquared_user_attributes." + key;
EconHandler.manager.setPermission(this, key, false);
}
+
+ @Override
+ public void setWeather(PlotWeather weather) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("NOT IMPLEMENTED YET");
+ }
+
+ @Override
+ public PlotGamemode getGamemode() {
+ // TODO Auto-generated method stub
+ GameMode gamemode = player.getGameModeData().getValue();
+ if (gamemode == GameModes.ADVENTURE) {
+ return PlotGamemode.ADVENTURE;
+ }
+ if (gamemode == GameModes.CREATIVE) {
+ return PlotGamemode.CREATIVE;
+ }
+ if (gamemode == GameModes.SPECTATOR) {
+ return PlotGamemode.SPECTATOR;
+ }
+ if (gamemode == GameModes.SURVIVAL) {
+ return PlotGamemode.SURVIVAL;
+ }
+ throw new UnsupportedOperationException("INVALID GAMEMODE");
+ }
+
+ @Override
+ public void setGamemode(PlotGamemode gamemode) {
+ // TODO Auto-generated method stub
+ switch (gamemode) {
+ case ADVENTURE:
+ player.getGameModeData().setGameMode(GameModes.ADVENTURE);
+ return;
+ case CREATIVE:
+ player.getGameModeData().setGameMode(GameModes.CREATIVE);
+ return;
+ case SPECTATOR:
+ player.getGameModeData().setGameMode(GameModes.SPECTATOR);
+ return;
+ case SURVIVAL:
+ player.getGameModeData().setGameMode(GameModes.SURVIVAL);
+ return;
+ }
+ }
+
+ @Override
+ public void setTime(long time) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("NOT IMPLEMENTED YET");
+ }
+
+ @Override
+ public void setFlight(boolean fly) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("NOT IMPLEMENTED YET");
+ }
+
+ @Override
+ public void playMusic(Location loc, int id) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("NOT IMPLEMENTED YET");
+ }
+
+ @Override
+ public void kick(String message) {
+ player.kick(SpongeMain.THIS.getText(message));
+ }
}
diff --git a/src/main/java/com/plotsquared/sponge/SpongePlotGenerator.java b/src/main/java/com/plotsquared/sponge/SpongePlotGenerator.java
deleted file mode 100644
index 8c27f1209..000000000
--- a/src/main/java/com/plotsquared/sponge/SpongePlotGenerator.java
+++ /dev/null
@@ -1,50 +0,0 @@
-package com.plotsquared.sponge;
-
-import org.spongepowered.api.world.gen.BiomeGenerator;
-import org.spongepowered.api.world.gen.GeneratorPopulator;
-import org.spongepowered.api.world.gen.Populator;
-import org.spongepowered.api.world.gen.WorldGenerator;
-
-import java.util.List;
-
-public class SpongePlotGenerator implements WorldGenerator {
-
- public SpongePlotGenerator(String world) {
- }
-
- @Override
- public GeneratorPopulator getBaseGeneratorPopulator() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public BiomeGenerator getBiomeGenerator() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public List getGeneratorPopulators() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public List getPopulators() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public void setBaseGeneratorPopulator(GeneratorPopulator arg0) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void setBiomeGenerator(BiomeGenerator arg0) {
- // TODO Auto-generated method stub
-
- }
-}
diff --git a/src/main/java/com/plotsquared/sponge/SpongeTitleManager.java b/src/main/java/com/plotsquared/sponge/SpongeTitleManager.java
new file mode 100644
index 000000000..a4f177b89
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/SpongeTitleManager.java
@@ -0,0 +1,15 @@
+package com.plotsquared.sponge;
+
+import org.spongepowered.api.text.title.Title;
+
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.util.AbstractTitle;
+
+public class SpongeTitleManager extends AbstractTitle {
+
+ @Override
+ public void sendTitle(PlotPlayer player, String head, String sub, int in, int delay, int out) {
+ ((SpongePlayer) player).player.sendTitle(new Title(SpongeMain.THIS.getText(head), SpongeMain.THIS.getText(sub), in * 20, delay * 20, out * 20, false, false));
+ }
+}
diff --git a/src/main/java/com/plotsquared/sponge/SpongeUtil.java b/src/main/java/com/plotsquared/sponge/SpongeUtil.java
deleted file mode 100644
index 615a1a9fc..000000000
--- a/src/main/java/com/plotsquared/sponge/SpongeUtil.java
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.plotsquared.sponge;
-
-import org.spongepowered.api.entity.Entity;
-
-import com.flowpowered.math.vector.Vector3d;
-import com.flowpowered.math.vector.Vector3i;
-import com.intellectualcrafters.plot.object.Location;
-import com.intellectualcrafters.plot.util.MathMan;
-
-public class SpongeUtil {
-
- public static Location getLocation(Entity player) {
- String world = player.getWorld().getName();
- org.spongepowered.api.world.Location loc = player.getLocation();
- Vector3i pos = loc.getBlockPosition();
- return new Location(world, pos.getX(), pos.getY(), pos.getZ());
- }
-
- public static Location getLocationFull(Entity player) {
- String world = player.getWorld().getName();
- Vector3d rot = player.getRotation();
- float[] pitchYaw = MathMan.getPitchAndYaw((float) rot.getX(), (float) rot.getY(), (float) rot.getZ());
- org.spongepowered.api.world.Location loc = player.getLocation();
- Vector3i pos = loc.getBlockPosition();
- return new Location(world, pos.getX(), pos.getY(), pos.getZ(), pitchYaw[1], pitchYaw[0]);
- }
-
-}
diff --git a/src/main/java/com/plotsquared/sponge/WorldModify.java b/src/main/java/com/plotsquared/sponge/WorldModify.java
deleted file mode 100644
index 28ab822c9..000000000
--- a/src/main/java/com/plotsquared/sponge/WorldModify.java
+++ /dev/null
@@ -1,29 +0,0 @@
-package com.plotsquared.sponge;
-
-import org.spongepowered.api.data.DataContainer;
-import org.spongepowered.api.world.WorldCreationSettings;
-import org.spongepowered.api.world.gen.WorldGenerator;
-import org.spongepowered.api.world.gen.WorldGeneratorModifier;
-
-public class WorldModify implements WorldGeneratorModifier {
- private SpongeMain main;
-
- public WorldModify(SpongeMain main) {
- this.main = main;
- }
-
- @Override
- public void modifyWorldGenerator(WorldCreationSettings world, DataContainer settings, WorldGenerator worldGenerator) {
- worldGenerator.setBaseGeneratorPopulator(new PlotGen(main, world.getWorldName(), world.getSeed()));
- }
-
- @Override
- public String getName() {
- return "PlotSquared";
- }
-
- @Override
- public String getId() {
- return "PlotSquared";
- }
-}
diff --git a/src/main/java/com/plotsquared/sponge/events/ClusterFlagRemoveEvent.java b/src/main/java/com/plotsquared/sponge/events/ClusterFlagRemoveEvent.java
new file mode 100644
index 000000000..5f4bc362f
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/events/ClusterFlagRemoveEvent.java
@@ -0,0 +1,47 @@
+package com.plotsquared.sponge.events;
+
+import org.spongepowered.api.event.AbstractEvent;
+import org.spongepowered.api.event.Cancellable;
+
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.object.PlotCluster;
+
+public class ClusterFlagRemoveEvent extends AbstractEvent implements Cancellable {
+
+ private final PlotCluster cluster;
+ private final Flag flag;
+ private boolean cancelled;
+
+ public ClusterFlagRemoveEvent(final Flag flag, final PlotCluster cluster) {
+ this.cluster = cluster;
+ this.flag = flag;
+ }
+
+ /**
+ * Get the cluster involved
+ *
+ * @return PlotCluster
+ */
+ public PlotCluster getCluster() {
+ return this.cluster;
+ }
+
+ /**
+ * Get the flag involved
+ *
+ * @return Flag
+ */
+ public Flag getFlag() {
+ return this.flag;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ }
+ }
\ No newline at end of file
diff --git a/src/main/java/com/plotsquared/sponge/events/PlayerClaimPlotEvent.java b/src/main/java/com/plotsquared/sponge/events/PlayerClaimPlotEvent.java
new file mode 100644
index 000000000..fc5790244
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/events/PlayerClaimPlotEvent.java
@@ -0,0 +1,51 @@
+package com.plotsquared.sponge.events;
+
+import org.spongepowered.api.entity.player.Player;
+import org.spongepowered.api.event.Cancellable;
+
+import com.intellectualcrafters.plot.object.Plot;
+
+public class PlayerClaimPlotEvent extends PlayerEvent implements Cancellable {
+
+ private final Plot plot;
+ private final boolean auto;
+ private boolean cancelled;
+
+ /**
+ * PlayerClaimPlotEvent: Called when a plot is claimed
+ *
+ * @param player Player that claimed the plot
+ * @param plot Plot that was claimed
+ */
+ public PlayerClaimPlotEvent(final Player player, final Plot plot, final boolean auto) {
+ super(player);
+ this.plot = plot;
+ this.auto = auto;
+ }
+
+ /**
+ * Get the plot involved
+ *
+ * @return Plot
+ */
+ public Plot getPlot() {
+ return this.plot;
+ }
+
+ /**
+ * @return true if it was an automated claim, else false
+ */
+ public boolean wasAuto() {
+ return this.auto;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ }
+ }
\ No newline at end of file
diff --git a/src/main/java/com/plotsquared/sponge/events/PlayerEnterPlotEvent.java b/src/main/java/com/plotsquared/sponge/events/PlayerEnterPlotEvent.java
new file mode 100644
index 000000000..9ff6d895e
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/events/PlayerEnterPlotEvent.java
@@ -0,0 +1,31 @@
+package com.plotsquared.sponge.events;
+
+import org.spongepowered.api.entity.player.Player;
+
+import com.intellectualcrafters.plot.object.Plot;
+
+public class PlayerEnterPlotEvent extends PlayerEvent {
+
+ private final Plot plot;
+ private boolean cancelled;
+
+ /**
+ * PlayerEnterPlotEvent: Called when a player leaves a plot
+ *
+ * @param player Player that entered the plot
+ * @param plot Plot that was entered
+ */
+ public PlayerEnterPlotEvent(final Player player, final Plot plot) {
+ super(player);
+ this.plot = plot;
+ }
+
+ /**
+ * Get the plot involved
+ *
+ * @return Plot
+ */
+ public Plot getPlot() {
+ return this.plot;
+ }
+ }
\ No newline at end of file
diff --git a/src/main/java/com/plotsquared/sponge/events/PlayerEvent.java b/src/main/java/com/plotsquared/sponge/events/PlayerEvent.java
new file mode 100644
index 000000000..474aa70cc
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/events/PlayerEvent.java
@@ -0,0 +1,18 @@
+package com.plotsquared.sponge.events;
+
+import org.spongepowered.api.entity.player.Player;
+import org.spongepowered.api.event.AbstractEvent;
+
+public abstract class PlayerEvent extends AbstractEvent {
+
+ public final Player player;
+
+ public PlayerEvent(Player player) {
+ this.player = player;
+ }
+
+ public Player getPlayer() {
+ return this.player;
+ }
+
+}
diff --git a/src/main/java/com/plotsquared/sponge/events/PlayerLeavePlotEvent.java b/src/main/java/com/plotsquared/sponge/events/PlayerLeavePlotEvent.java
new file mode 100644
index 000000000..4af5b76c7
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/events/PlayerLeavePlotEvent.java
@@ -0,0 +1,31 @@
+package com.plotsquared.sponge.events;
+
+import org.spongepowered.api.entity.player.Player;
+
+import com.intellectualcrafters.plot.object.Plot;
+
+public class PlayerLeavePlotEvent extends PlayerEvent {
+
+ private final Plot plot;
+ private boolean cancelled;
+
+ /**
+ * PlayerLeavePlotEvent: Called when a player leaves a plot
+ *
+ * @param player Player that left the plot
+ * @param plot Plot that was left
+ */
+ public PlayerLeavePlotEvent(final Player player, final Plot plot) {
+ super(player);
+ this.plot = plot;
+ }
+
+ /**
+ * Get the plot involved
+ *
+ * @return Plot
+ */
+ public Plot getPlot() {
+ return this.plot;
+ }
+ }
\ No newline at end of file
diff --git a/src/main/java/com/plotsquared/sponge/events/PlayerPlotDeniedEvent.java b/src/main/java/com/plotsquared/sponge/events/PlayerPlotDeniedEvent.java
new file mode 100644
index 000000000..f6a0157c2
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/events/PlayerPlotDeniedEvent.java
@@ -0,0 +1,56 @@
+package com.plotsquared.sponge.events;
+
+import java.util.UUID;
+
+import org.spongepowered.api.entity.player.Player;
+
+import com.intellectualcrafters.plot.object.Plot;
+
+public class PlayerPlotDeniedEvent extends PlotEvent {
+
+ private final Player initiator;
+ private final boolean added;
+ private final UUID player;
+
+ /**
+ * PlayerPlotDeniedEvent: Called when the denied UUID list is modified for a plot
+ *
+ * @param initiator Player that initiated the event
+ * @param plot Plot in which the event occurred
+ * @param player Player that was denied/un-denied
+ * @param added true of add to deny list, false if removed
+ */
+ public PlayerPlotDeniedEvent(final Player initiator, final Plot plot, final UUID player, final boolean added) {
+ super(plot);
+ this.initiator = initiator;
+ this.added = added;
+ this.player = player;
+ }
+
+ /**
+ * If a user was added
+ *
+ * @return boolean
+ */
+ public boolean wasAdded() {
+ return this.added;
+ }
+
+ /**
+ * The player added/removed
+ *
+ * @return UUID
+ */
+ public UUID getPlayer() {
+ return this.player;
+ }
+
+ /**
+ * The player initiating the action
+ *
+ * @return Player
+ */
+ public Player getInitiator() {
+ return this.initiator;
+ }
+ }
\ No newline at end of file
diff --git a/src/main/java/com/plotsquared/sponge/events/PlayerPlotHelperEvent.java b/src/main/java/com/plotsquared/sponge/events/PlayerPlotHelperEvent.java
new file mode 100644
index 000000000..9e40411fa
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/events/PlayerPlotHelperEvent.java
@@ -0,0 +1,56 @@
+package com.plotsquared.sponge.events;
+
+import java.util.UUID;
+
+import org.spongepowered.api.entity.player.Player;
+
+import com.intellectualcrafters.plot.object.Plot;
+
+public class PlayerPlotHelperEvent extends PlotEvent {
+
+ private final Player initiator;
+ private final boolean added;
+ private final UUID player;
+
+ /**
+ * PlayerPlotHelperEvent: Called when a plot helper is added/removed
+ *
+ * @param initiator Player that initiated the event
+ * @param plot Plot in which the event occurred
+ * @param player Player that was added/removed from the helper list
+ * @param added true of the player was added, false if the player was removed
+ */
+ public PlayerPlotHelperEvent(final Player initiator, final Plot plot, final UUID player, final boolean added) {
+ super(plot);
+ this.initiator = initiator;
+ this.added = added;
+ this.player = player;
+ }
+
+ /**
+ * If a user was added
+ *
+ * @return boolean
+ */
+ public boolean wasAdded() {
+ return this.added;
+ }
+
+ /**
+ * The player added/removed
+ *
+ * @return UUID
+ */
+ public UUID getPlayer() {
+ return this.player;
+ }
+
+ /**
+ * The player initiating the action
+ *
+ * @return Player
+ */
+ public Player getInitiator() {
+ return this.initiator;
+ }
+ }
\ No newline at end of file
diff --git a/src/main/java/com/plotsquared/sponge/events/PlayerPlotTrustedEvent.java b/src/main/java/com/plotsquared/sponge/events/PlayerPlotTrustedEvent.java
new file mode 100644
index 000000000..2886cd768
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/events/PlayerPlotTrustedEvent.java
@@ -0,0 +1,56 @@
+package com.plotsquared.sponge.events;
+
+import java.util.UUID;
+
+import org.spongepowered.api.entity.player.Player;
+
+import com.intellectualcrafters.plot.object.Plot;
+
+public class PlayerPlotTrustedEvent extends PlotEvent {
+
+ private final Player initiator;
+ private final boolean added;
+ private final UUID player;
+
+ /**
+ * PlayerPlotTrustedEvent: Called when a plot trusted user is added/removed
+ *
+ * @param initiator Player that initiated the event
+ * @param plot Plot in which the event occurred
+ * @param player Player that was added/removed from the trusted list
+ * @param added true of the player was added, false if the player was removed
+ */
+ public PlayerPlotTrustedEvent(final Player initiator, final Plot plot, final UUID player, final boolean added) {
+ super(plot);
+ this.initiator = initiator;
+ this.added = added;
+ this.player = player;
+ }
+
+ /**
+ * If a user was added
+ *
+ * @return boolean
+ */
+ public boolean wasAdded() {
+ return this.added;
+ }
+
+ /**
+ * The player added/removed
+ *
+ * @return UUID
+ */
+ public UUID getPlayer() {
+ return this.player;
+ }
+
+ /**
+ * The player initiating the action
+ *
+ * @return Player
+ */
+ public Player getInitiator() {
+ return this.initiator;
+ }
+ }
\ No newline at end of file
diff --git a/src/main/java/com/plotsquared/sponge/events/PlayerTeleportToPlotEvent.java b/src/main/java/com/plotsquared/sponge/events/PlayerTeleportToPlotEvent.java
new file mode 100644
index 000000000..f7b5ca5c0
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/events/PlayerTeleportToPlotEvent.java
@@ -0,0 +1,55 @@
+package com.plotsquared.sponge.events;
+
+import org.spongepowered.api.entity.player.Player;
+import org.spongepowered.api.event.Cancellable;
+
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+
+public class PlayerTeleportToPlotEvent extends PlayerEvent implements Cancellable {
+
+ private final Location from;
+ private final Plot plot;
+ private boolean cancelled;
+
+ /**
+ * PlayerTeleportToPlotEvent: Called when a player teleports to a plot
+ *
+ * @param player That was teleported
+ * @param from Start location
+ * @param plot Plot to which the player was teleported
+ */
+ public PlayerTeleportToPlotEvent(final Player player, final Location from, final Plot plot) {
+ super(player);
+ this.from = from;
+ this.plot = plot;
+ }
+
+ /**
+ * Get the from location
+ *
+ * @return Location
+ */
+ public Location getFrom() {
+ return this.from;
+ }
+
+ /**
+ * Get the plot involved
+ *
+ * @return Plot
+ */
+ public Plot getPlot() {
+ return this.plot;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ }
+ }
\ No newline at end of file
diff --git a/src/main/java/com/plotsquared/sponge/events/PlotClearEvent.java b/src/main/java/com/plotsquared/sponge/events/PlotClearEvent.java
new file mode 100644
index 000000000..108ee2a41
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/events/PlotClearEvent.java
@@ -0,0 +1,51 @@
+package com.plotsquared.sponge.events;
+
+import org.spongepowered.api.event.AbstractEvent;
+import org.spongepowered.api.event.Cancellable;
+
+import com.intellectualcrafters.plot.object.PlotId;
+
+public class PlotClearEvent extends AbstractEvent implements Cancellable {
+ private final PlotId id;
+ private final String world;
+ private boolean cancelled;
+
+ /**
+ * PlotDeleteEvent: Called when a plot is cleared
+ *
+ * @param world The world in which the plot was cleared
+ * @param id The plot that was cleared
+ */
+ public PlotClearEvent(final String world, final PlotId id) {
+ this.id = id;
+ this.world = world;
+ }
+
+ /**
+ * Get the PlotId
+ *
+ * @return PlotId
+ */
+ public PlotId getPlotId() {
+ return this.id;
+ }
+
+ /**
+ * Get the world name
+ *
+ * @return String
+ */
+ public String getWorld() {
+ return this.world;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ }
+ }
\ No newline at end of file
diff --git a/src/main/java/com/plotsquared/sponge/events/PlotDeleteEvent.java b/src/main/java/com/plotsquared/sponge/events/PlotDeleteEvent.java
new file mode 100644
index 000000000..c667bcd21
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/events/PlotDeleteEvent.java
@@ -0,0 +1,39 @@
+package com.plotsquared.sponge.events;
+
+import org.spongepowered.api.event.AbstractEvent;
+
+import com.intellectualcrafters.plot.object.PlotId;
+
+public class PlotDeleteEvent extends AbstractEvent {
+ private final PlotId id;
+ private final String world;
+
+ /**
+ * PlotDeleteEvent: Called when a plot is deleted
+ *
+ * @param world The world in which the plot was deleted
+ * @param id The ID of the plot that was deleted
+ */
+ public PlotDeleteEvent(final String world, final PlotId id) {
+ this.id = id;
+ this.world = world;
+ }
+
+ /**
+ * Get the PlotId
+ *
+ * @return PlotId
+ */
+ public PlotId getPlotId() {
+ return this.id;
+ }
+
+ /**
+ * Get the world name
+ *
+ * @return String
+ */
+ public String getWorld() {
+ return this.world;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/plotsquared/sponge/events/PlotEvent.java b/src/main/java/com/plotsquared/sponge/events/PlotEvent.java
new file mode 100644
index 000000000..da2eb1143
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/events/PlotEvent.java
@@ -0,0 +1,19 @@
+package com.plotsquared.sponge.events;
+
+import org.spongepowered.api.event.AbstractEvent;
+
+import com.intellectualcrafters.plot.object.Plot;
+
+public abstract class PlotEvent extends AbstractEvent {
+
+ private final Plot plot;
+
+ public PlotEvent(final Plot plot) {
+ this.plot = plot;
+ }
+
+ public final Plot getPlot() {
+ return this.plot;
+ }
+
+}
diff --git a/src/main/java/com/plotsquared/sponge/events/PlotFlagAddEvent.java b/src/main/java/com/plotsquared/sponge/events/PlotFlagAddEvent.java
new file mode 100644
index 000000000..0040da65f
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/events/PlotFlagAddEvent.java
@@ -0,0 +1,41 @@
+package com.plotsquared.sponge.events;
+
+import org.spongepowered.api.event.Cancellable;
+
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.object.Plot;
+
+public class PlotFlagAddEvent extends PlotEvent implements Cancellable {
+ private final Flag flag;
+ private boolean cancelled;
+
+ /**
+ * PlotFlagAddEvent: Called when a Flag is added to a plot
+ *
+ * @param flag Flag that was added
+ * @param plot Plot to which the flag was added
+ */
+ public PlotFlagAddEvent(final Flag flag, final Plot plot) {
+ super(plot);
+ this.flag = flag;
+ }
+
+ /**
+ * Get the flag involved
+ *
+ * @return Flag
+ */
+ public Flag getFlag() {
+ return this.flag;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ }
+ }
\ No newline at end of file
diff --git a/src/main/java/com/plotsquared/sponge/events/PlotFlagRemoveEvent.java b/src/main/java/com/plotsquared/sponge/events/PlotFlagRemoveEvent.java
new file mode 100644
index 000000000..b0e140869
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/events/PlotFlagRemoveEvent.java
@@ -0,0 +1,41 @@
+package com.plotsquared.sponge.events;
+
+import org.spongepowered.api.event.Cancellable;
+
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.object.Plot;
+
+public class PlotFlagRemoveEvent extends PlotEvent implements Cancellable {
+ private final Flag flag;
+ private boolean cancelled;
+
+ /**
+ * PlotFlagRemoveEvent: Called when a flag is removed from a plot
+ *
+ * @param flag Flag that was removed
+ * @param plot Plot from which the flag was removed
+ */
+ public PlotFlagRemoveEvent(final Flag flag, final Plot plot) {
+ super(plot);
+ this.flag = flag;
+ }
+
+ /**
+ * Get the flag involved
+ *
+ * @return Flag
+ */
+ public Flag getFlag() {
+ return this.flag;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ }
+ }
\ No newline at end of file
diff --git a/src/main/java/com/plotsquared/sponge/events/PlotMergeEvent.java b/src/main/java/com/plotsquared/sponge/events/PlotMergeEvent.java
new file mode 100644
index 000000000..317340434
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/events/PlotMergeEvent.java
@@ -0,0 +1,60 @@
+package com.plotsquared.sponge.events;
+
+import java.util.ArrayList;
+
+import org.spongepowered.api.event.AbstractEvent;
+import org.spongepowered.api.event.Cancellable;
+import org.spongepowered.api.world.World;
+
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotId;
+
+public class PlotMergeEvent extends AbstractEvent implements Cancellable {
+ private final ArrayList plots;
+ private boolean cancelled;
+ private Plot plot;
+ private World world;
+
+ /**
+ * PlotMergeEvent: Called when plots are merged
+ *
+ * @param world World in which the event occurred
+ * @param plot Plot that was merged
+ * @param plots A list of plots involved in the event
+ */
+ public PlotMergeEvent(final World world, final Plot plot, final ArrayList plots) {
+ this.plots = plots;
+ }
+
+ /**
+ * Get the plots being added;
+ *
+ * @return Plot
+ */
+ public ArrayList getPlots() {
+ return this.plots;
+ }
+
+ /**
+ * Get the main plot
+ *
+ * @return Plot
+ */
+ public Plot getPlot() {
+ return this.plot;
+ }
+
+ public World getWorld() {
+ return this.world;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ }
+ }
\ No newline at end of file
diff --git a/src/main/java/com/plotsquared/sponge/events/PlotRateEvent.java b/src/main/java/com/plotsquared/sponge/events/PlotRateEvent.java
new file mode 100644
index 000000000..c7eb835d7
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/events/PlotRateEvent.java
@@ -0,0 +1,28 @@
+package com.plotsquared.sponge.events;
+
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.Rating;
+
+public class PlotRateEvent extends PlotEvent {
+ private final PlotPlayer rater;
+ private Rating rating;
+
+ public PlotRateEvent(final PlotPlayer rater, final Rating rating, final Plot plot) {
+ super(plot);
+ this.rater = rater;
+ this.rating = rating;
+ }
+
+ public PlotPlayer getRater() {
+ return this.rater;
+ }
+
+ public void setRating(Rating rating) {
+ this.rating = rating;
+ }
+
+ public Rating getRating() {
+ return this.rating;
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/com/plotsquared/sponge/events/PlotUnlinkEvent.java b/src/main/java/com/plotsquared/sponge/events/PlotUnlinkEvent.java
new file mode 100644
index 000000000..b657b2aac
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/events/PlotUnlinkEvent.java
@@ -0,0 +1,49 @@
+package com.plotsquared.sponge.events;
+
+import java.util.ArrayList;
+
+import org.spongepowered.api.event.AbstractEvent;
+import org.spongepowered.api.event.Cancellable;
+import org.spongepowered.api.world.World;
+
+import com.intellectualcrafters.plot.object.PlotId;
+
+public class PlotUnlinkEvent extends AbstractEvent implements Cancellable {
+ private final ArrayList plots;
+ private final World world;
+ private boolean cancelled;
+
+ /**
+ * Called when a mega-plot is unlinked.
+ *
+ * @param world World in which the event occurred
+ * @param plots Plots that are involved in the event
+ */
+ public PlotUnlinkEvent(final World world, final ArrayList plots) {
+ this.plots = plots;
+ this.world = world;
+ }
+
+ /**
+ * Get the plots involved
+ *
+ * @return PlotId
+ */
+ public ArrayList getPlots() {
+ return this.plots;
+ }
+
+ public World getWorld() {
+ return this.world;
+ }
+
+ @Override
+ public boolean isCancelled() {
+ return cancelled;
+ }
+
+ @Override
+ public void setCancelled(boolean cancel) {
+ cancelled = cancel;
+ }
+ }
\ No newline at end of file
diff --git a/src/main/java/com/plotsquared/sponge/generator/SpongeBasicBiomeProvider.java b/src/main/java/com/plotsquared/sponge/generator/SpongeBasicBiomeProvider.java
new file mode 100644
index 000000000..8d8bbe74d
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/generator/SpongeBasicBiomeProvider.java
@@ -0,0 +1,38 @@
+package com.plotsquared.sponge.generator;
+
+import org.spongepowered.api.world.biome.BiomeType;
+import org.spongepowered.api.world.biome.BiomeTypes;
+import org.spongepowered.api.world.extent.MutableBiomeArea;
+import org.spongepowered.api.world.gen.BiomeGenerator;
+
+import com.flowpowered.math.vector.Vector2i;
+import com.intellectualcrafters.plot.object.PlotWorld;
+
+public class SpongeBasicBiomeProvider implements BiomeGenerator {
+
+ private PlotWorld plotworld;
+
+ public SpongeBasicBiomeProvider(PlotWorld plotworld) {
+ this.plotworld = plotworld;
+ }
+
+ @Override
+ public void generateBiomes(MutableBiomeArea biomeBase) {
+ Vector2i min = biomeBase.getBiomeMin();
+ int bx = min.getX();
+ int bz = min.getY();
+ BiomeType biome = BiomeTypes.FOREST;
+ try {
+ biome = (BiomeType) BiomeTypes.class.getField(plotworld.PLOT_BIOME.toUpperCase()).get(null);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ for (int x = bx; x < bx + 16; x++) {
+ for (int z = bz; z < bz + 16; z++) {
+ biomeBase.setBiome(x, z, biome);
+ }
+ }
+ }
+
+}
diff --git a/src/main/java/com/plotsquared/sponge/generator/SpongeBasicGen.java b/src/main/java/com/plotsquared/sponge/generator/SpongeBasicGen.java
new file mode 100644
index 000000000..97ada8997
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/generator/SpongeBasicGen.java
@@ -0,0 +1,135 @@
+package com.plotsquared.sponge.generator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.spongepowered.api.block.BlockState;
+import org.spongepowered.api.block.BlockTypes;
+import org.spongepowered.api.world.gen.BiomeGenerator;
+
+import com.intellectualcrafters.plot.generator.HybridPlotManager;
+import com.intellectualcrafters.plot.generator.HybridPlotWorld;
+import com.intellectualcrafters.plot.object.PlotManager;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.plotsquared.sponge.SpongeMain;
+
+public class SpongeBasicGen extends SpongePlotGenerator {
+
+ public final BlockState ROAD_BLOCK = BlockTypes.QUARTZ_BLOCK.getDefaultState(); // Quartz
+ public final BlockState MAIN_BLOCK = BlockTypes.STONE.getDefaultState(); // Stone
+ public final BlockState WALL_BLOCK = BlockTypes.BEDROCK.getDefaultState(); // Bedrock
+ public final BlockState BORDER_BLOCK = BlockTypes.STONE_SLAB.getDefaultState(); // Stone slab
+ public final BlockState[] FLOOR_BLOCK = new BlockState[] {BlockTypes.GRASS.getDefaultState(), BlockTypes.SPONGE.getDefaultState(), BlockTypes.PLANKS.getDefaultState() }; // Grass and sponge
+
+ private static HybridPlotManager manager;
+ public HybridPlotWorld plotworld;
+
+ public SpongeBasicGen(String world) {
+ super(world);
+ }
+
+ /**
+ * Some generator specific variables (implementation dependent)
+ *
+ * TODO USE THESE
+ *
+ */
+ public int plotsize;
+ public int pathsize;
+ public int size;
+ public int roadheight;
+ public int wallheight;
+ public int plotheight;
+ public short pathWidthLower;
+ public short pathWidthUpper;
+ public boolean doState = false;
+
+ BlockState wall;
+ BlockState wallfilling;
+ BlockState roadblock;
+ BlockState[] plotfloors;
+ BlockState[] filling;
+
+ @Override
+ public void init(PlotWorld plotworld) {
+ if (plotworld != null) {
+ this.plotworld = (HybridPlotWorld) plotworld;
+ }
+ this.plotsize = this.plotworld.PLOT_WIDTH;
+ this.pathsize = this.plotworld.ROAD_WIDTH;
+ this.size = this.pathsize + this.plotsize;
+ this.wallheight = this.plotworld.WALL_HEIGHT;
+ this.roadheight = this.plotworld.ROAD_HEIGHT;
+ this.plotheight = this.plotworld.PLOT_HEIGHT;
+ if (this.pathsize == 0) {
+ this.pathWidthLower = (short) -1;
+ this.pathWidthUpper = (short) (this.plotsize + 1);
+ }
+ else {
+ if ((this.pathsize % 2) == 0) {
+ this.pathWidthLower = (short) (Math.floor(this.pathsize / 2) - 1);
+ } else {
+ this.pathWidthLower = (short) (Math.floor(this.pathsize / 2));
+ }
+ this.pathWidthUpper = (short) (this.pathWidthLower + this.plotsize + 1);
+ }
+
+ this.roadblock = SpongeMain.THIS.getBlockState(this.plotworld.ROAD_BLOCK);
+ this.wallfilling = SpongeMain.THIS.getBlockState(this.plotworld.WALL_FILLING);
+ this.wall = SpongeMain.THIS.getBlockState(this.plotworld.WALL_BLOCK);
+ this.plotfloors = new BlockState[this.plotworld.TOP_BLOCK.length];
+ for (int i = 0; i < this.plotworld.TOP_BLOCK.length; i++) {
+ this.plotfloors[i] = SpongeMain.THIS.getBlockState(this.plotworld.TOP_BLOCK[i]);
+ }
+ this.filling = new BlockState[this.plotworld.MAIN_BLOCK.length];
+ for (int i = 0; i < this.plotworld.MAIN_BLOCK.length; i++) {
+ this.filling[i] = SpongeMain.THIS.getBlockState(this.plotworld.MAIN_BLOCK[i]);
+ }
+ if ((this.filling.length > 1) || (this.plotfloors.length > 1)) {
+ this.doState = true;
+ }
+ }
+
+ @Override
+ public PlotWorld getNewPlotWorld(String world) {
+ if (this.plotworld == null) {
+ this.plotworld = new HybridPlotWorld(world);
+ }
+ return this.plotworld;
+ }
+
+ @Override
+ public PlotManager getPlotManager() {
+ if (SpongeBasicGen.manager == null) {
+ SpongeBasicGen.manager = new HybridPlotManager();
+ }
+ return SpongeBasicGen.manager;
+ }
+
+ @Override
+ public List getPlotPopulators() {
+ // TODO Auto-generated method stub
+ return new ArrayList<>();
+ }
+
+ private SpongeBasicPop generator;
+
+ @Override
+ public SpongePlotPopulator getGenerator() {
+ if (generator == null) {
+ generator = new SpongeBasicPop(this);
+ }
+ return generator;
+ }
+
+ private BiomeGenerator biome;
+
+ @Override
+ public BiomeGenerator getPlotBiomeProvider() {
+ if (biome == null) {
+ biome = new SpongeBasicBiomeProvider(plotworld);
+ }
+ return biome;
+ }
+
+}
diff --git a/src/main/java/com/plotsquared/sponge/generator/SpongeBasicPop.java b/src/main/java/com/plotsquared/sponge/generator/SpongeBasicPop.java
new file mode 100644
index 000000000..66d2585f3
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/generator/SpongeBasicPop.java
@@ -0,0 +1,99 @@
+package com.plotsquared.sponge.generator;
+
+import java.util.HashMap;
+import java.util.HashSet;
+
+import org.spongepowered.api.world.World;
+
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.object.PlotLoc;
+import com.intellectualcrafters.plot.object.PseudoRandom;
+import com.intellectualcrafters.plot.object.RegionWrapper;
+import com.intellectualcrafters.plot.object.schematic.PlotItem;
+import com.intellectualcrafters.plot.util.BlockManager;
+import com.plotsquared.sponge.SpongeMain;
+
+public class SpongeBasicPop extends SpongePlotPopulator {
+
+ public SpongeBasicPop(SpongeBasicGen generator) {
+ super(generator);
+ }
+
+ @Override
+ public void populate(World world, RegionWrapper requiredRegion, PseudoRandom random, int cx, int cz) {
+ int sx = (short) ((this.X - generator.plotworld.ROAD_OFFSET_X) % generator.size);
+ int sz = (short) ((this.Z - generator.plotworld.ROAD_OFFSET_Z) % generator.size);
+ if (sx < 0) {
+ sx += generator.size;
+ }
+ if (sz < 0) {
+ sz += generator.size;
+ }
+
+ for (short x = 0; x < 16; x++) {
+ for (short z = 0; z < 16; z++) {
+ final int absX = ((sx + x) % generator.size);
+ final int absZ = ((sz + z) % generator.size);
+ final boolean gx = absX > generator.pathWidthLower;
+ final boolean gz = absZ > generator.pathWidthLower;
+ final boolean lx = absX < generator.pathWidthUpper;
+ final boolean lz = absZ < generator.pathWidthUpper;
+ // inside plot
+ if (gx && gz && lx && lz) {
+ for (short y = 1; y < generator.plotheight; y++) {
+ setBlock(x, y, z, generator.filling);
+ }
+ setBlock(x, (short) generator.plotheight, z, generator.plotfloors);
+ if (generator.plotworld.PLOT_SCHEMATIC) {
+ final PlotLoc loc = new PlotLoc(absX, absZ);
+ final HashMap blocks = generator.plotworld.G_SCH.get(loc);
+ if (blocks != null) {
+ final HashMap datas = generator.plotworld.G_SCH_DATA.get(loc);
+ for (final short y : blocks.keySet()) {
+ Byte data = datas.get(y);
+ setBlock(x, (short) (generator.plotheight + y), z, SpongeMain.THIS.getBlockState(new PlotBlock(blocks.get(y), data == null ? 0 : data)));
+ }
+ }
+ if (generator.plotworld.G_SCH_STATE != null) {
+ HashSet states = generator.plotworld.G_SCH_STATE.get(loc);
+ if (states != null) {
+ for (PlotItem items : states) {
+ items.x = this.X + x;
+ items.z = this.Z + z;
+ BlockManager.manager.addItems(generator.plotworld.worldname, items);
+ }
+ }
+ }
+ }
+ } else if (generator.pathsize != 0) {
+ // wall
+ if (((absX >= generator.pathWidthLower) && (absX <= generator.pathWidthUpper) && (absZ >= generator.pathWidthLower) && (absZ <= generator.pathWidthUpper))) {
+ for (short y = 1; y <= generator.wallheight; y++) {
+ setBlock(x, y, z, generator.wallfilling);
+ }
+ if (!generator.plotworld.ROAD_SCHEMATIC_ENABLED) {
+ setBlock(x, generator.wallheight + 1, z, generator.wall);
+ }
+ }
+ // road
+ else {
+ for (short y = 1; y <= generator.roadheight; y++) {
+ setBlock(x, y, z, generator.roadblock);
+ }
+ }
+ if (generator.plotworld.ROAD_SCHEMATIC_ENABLED) {
+ final PlotLoc loc = new PlotLoc(absX, absZ);
+ final HashMap blocks = generator.plotworld.G_SCH.get(loc);
+ if (blocks != null) {
+ final HashMap datas = generator.plotworld.G_SCH_DATA.get(loc);
+ for (final short y : blocks.keySet()) {
+ Byte data = datas.get(y);
+ setBlock(x, (short) (generator.plotheight + y), z, SpongeMain.THIS.getBlockState(new PlotBlock(blocks.get(y), data == null ? 0 : data)));
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/src/main/java/com/plotsquared/sponge/generator/SpongeGeneratorWrapper.java b/src/main/java/com/plotsquared/sponge/generator/SpongeGeneratorWrapper.java
new file mode 100644
index 000000000..5f7e3d542
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/generator/SpongeGeneratorWrapper.java
@@ -0,0 +1,91 @@
+package com.plotsquared.sponge.generator;
+
+import org.spongepowered.api.world.gen.WorldGenerator;
+
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.generator.PlotGenerator;
+import com.intellectualcrafters.plot.object.PlotCluster;
+import com.intellectualcrafters.plot.object.PlotManager;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.object.SetupObject;
+
+public class SpongeGeneratorWrapper extends PlotGenerator{
+
+ public final boolean full;
+
+ public SpongeGeneratorWrapper(String world, WorldGenerator generator) {
+ super(world, generator);
+ full = (generator instanceof SpongePlotGenerator);
+ }
+
+ @Override
+ public void initialize(PlotWorld plotworld) {
+ if (generator instanceof SpongePlotGenerator) {
+ ((SpongePlotGenerator) generator).init(plotworld);
+ }
+ }
+
+ @Override
+ public void augment(PlotCluster cluster, PlotWorld plotworld) {
+ if (generator instanceof SpongePlotGenerator) {
+ SpongePlotGenerator plotgen = (SpongePlotGenerator) generator;
+ if (cluster != null) {
+ // TODO Augment partial
+ throw new UnsupportedOperationException("NOT IMPLEMENTED YET");
+ }
+ else {
+ // TODO augment full
+ throw new UnsupportedOperationException("NOT IMPLEMENTED YET");
+ }
+ }
+ }
+
+ @Override
+ public void setGenerator(String gen_string) {
+ if (gen_string == null) {
+ generator = new SpongeBasicGen(world);
+ } else {
+ PlotGenerator gen_wrapper = (PlotGenerator) PS.get().IMP.getGenerator(world, gen_string);
+ if (gen_wrapper != null) {
+ generator = gen_wrapper.generator;
+ }
+ }
+ }
+
+ @Override
+ public PlotWorld getNewPlotWorld(String world) {
+ if (!(generator instanceof SpongePlotGenerator)) {
+ return null;
+ }
+ return ((SpongePlotGenerator) generator).getNewPlotWorld(world);
+ }
+
+ @Override
+ public PlotManager getPlotManager() {
+ if (!(generator instanceof SpongePlotGenerator)) {
+ return null;
+ }
+ return ((SpongePlotGenerator) generator).getPlotManager();
+ }
+
+ @Override
+ public boolean isFull() {
+ return full;
+ }
+
+ @Override
+ public String getName() {
+ if (generator == null) {
+ return "Null";
+ }
+ return generator.getClass().getName();
+ }
+
+ @Override
+ public void processSetup(SetupObject object) {
+ if (generator instanceof SpongePlotGenerator) {
+ ((SpongePlotGenerator) generator).processSetup(object);
+ }
+ }
+
+}
diff --git a/src/main/java/com/plotsquared/sponge/generator/SpongePlotGenerator.java b/src/main/java/com/plotsquared/sponge/generator/SpongePlotGenerator.java
new file mode 100644
index 000000000..fb8eb7b79
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/generator/SpongePlotGenerator.java
@@ -0,0 +1,91 @@
+package com.plotsquared.sponge.generator;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.spongepowered.api.world.gen.BiomeGenerator;
+import org.spongepowered.api.world.gen.GeneratorPopulator;
+import org.spongepowered.api.world.gen.Populator;
+import org.spongepowered.api.world.gen.WorldGenerator;
+
+import com.intellectualcrafters.plot.object.PlotManager;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.object.SetupObject;
+
+public abstract class SpongePlotGenerator implements WorldGenerator {
+
+ public final String world;
+
+ public SpongePlotGenerator(String world) {
+ this.world = world;
+ }
+
+ @Override
+ public GeneratorPopulator getBaseGeneratorPopulator() {
+ return getGenerator();
+ }
+
+ @Override
+ public BiomeGenerator getBiomeGenerator() {
+ return getPlotBiomeProvider();
+ }
+
+ @Override
+ public List getGeneratorPopulators() {
+ List pops = new ArrayList<>();
+ pops.addAll(this.getPlotPopulators());
+ return pops;
+ }
+
+ @Override
+ public List getPopulators() {
+ return new ArrayList<>();
+ }
+
+ @Override
+ public void setBaseGeneratorPopulator(GeneratorPopulator arg0) {
+ // TODO Auto-generated method stub
+ throw new UnsupportedOperationException("NOT IMPLEMENTED YET");
+
+ }
+
+ @Override
+ public void setBiomeGenerator(BiomeGenerator biomeGenerator) {
+ // TODO
+ throw new UnsupportedOperationException("NOT IMPLEMENTED YET");
+ }
+
+ public abstract SpongePlotPopulator getGenerator();
+
+ public abstract BiomeGenerator getPlotBiomeProvider();
+
+ public abstract List getPlotPopulators();
+
+ /**
+ * This is called when the generator is initialized.
+ * You don't need to do anything with it necessarily.
+ * @param plotworld
+ */
+ public abstract void init(PlotWorld plotworld);
+
+ /**
+ * Return a new instance of the PlotWorld for a world
+ * @param world
+ * @return
+ */
+ public abstract PlotWorld getNewPlotWorld(final String world);
+
+ /**
+ * Get the PlotManager class for this generator
+ * @return
+ */
+ public abstract PlotManager getPlotManager();
+
+ /**
+ * If you need to do anything fancy for /plot setup
+ * - Otherwise it will just use the PlotWorld configuration
+ * Feel free to extend BukkitSetupUtils and customize world creation
+ * @param object
+ */
+ public void processSetup(SetupObject object) {}
+}
diff --git a/src/main/java/com/plotsquared/sponge/generator/SpongePlotPopulator.java b/src/main/java/com/plotsquared/sponge/generator/SpongePlotPopulator.java
new file mode 100644
index 000000000..f9c57dd55
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/generator/SpongePlotPopulator.java
@@ -0,0 +1,97 @@
+package com.plotsquared.sponge.generator;
+
+import org.spongepowered.api.block.BlockState;
+import org.spongepowered.api.world.World;
+import org.spongepowered.api.world.extent.ImmutableBiomeArea;
+import org.spongepowered.api.world.extent.MutableBlockVolume;
+import org.spongepowered.api.world.gen.GeneratorPopulator;
+
+import com.flowpowered.math.vector.Vector3i;
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.object.PseudoRandom;
+import com.intellectualcrafters.plot.object.RegionWrapper;
+import com.intellectualcrafters.plot.util.ChunkManager;
+
+public abstract class SpongePlotPopulator implements GeneratorPopulator {
+
+ public int X;
+ public int Z;
+ public String worldname;
+ private World world;
+ private PseudoRandom random = new PseudoRandom();
+ private MutableBlockVolume buffer;
+ public final T generator;
+
+ public SpongePlotPopulator(T generator) {
+ this.generator = generator;
+ }
+
+// @Override
+// public void populate(Chunk chunk, Random random) {
+// this.world = chunk.getWorld();
+// this.worldname = world.getName();
+// Vector3i min = chunk.getBlockMin();
+
+// }
+
+ public void populate(World world, MutableBlockVolume buffer, ImmutableBiomeArea biomeBase) {
+ try {
+ this.world = world;
+ this.worldname = world.getName();
+ this.buffer = buffer;
+ Vector3i min = buffer.getBlockMin();
+ this.X = min.getX();
+ this.Z = min.getZ();
+ int cx = X >> 4;
+ int cz = Z >> 4;
+ int h = 1;
+ final int prime = 13;
+ h = (prime * h) + cx;
+ h = (prime * h) + cz;
+ this.random.state = h;
+
+ // TODO plot clearing stuff
+
+ populate(world, ChunkManager.CURRENT_PLOT_CLEAR, random, cx, cz);
+ }
+ catch (Exception e) {
+ PS.debug("ERROR GENERATING CHUNK!");
+ e.printStackTrace();
+ }
+ };
+
+ public abstract void populate(World world, RegionWrapper requiredRegion, PseudoRandom random, int cx, int cz);
+
+ /**
+ * Set the id and data at a location. (x, y, z) must be between [0,15], [0,255], [0,15]
+ * @param x
+ * @param y
+ * @param z
+ * @param id
+ * @param data
+ */
+ public void setBlock(int x, int y, int z, BlockState state) {
+ buffer.setBlock(X + x, y, Z + z, state);
+ }
+
+ public void setBlock(int x, int y, int z, BlockState[] states) {
+ if (states.length == 1) {
+ setBlock(x,y,z,states[0]);
+ }
+ setBlock(x,y,z,states[random.random(states.length)]);
+ }
+
+ /**
+ * check if a region contains a location. (x, z) must be between [0,15], [0,15]
+ * @param plot
+ * @param x
+ * @param z
+ * @return
+ */
+ public boolean contains(final RegionWrapper plot, final int x, final int z) {
+ int xx = X + x;
+ int zz = Z + z;
+ return ((xx >= plot.minX) && (xx <= plot.maxX) && (zz >= plot.minZ) && (zz <= plot.maxZ));
+ }
+
+}
diff --git a/src/main/java/com/plotsquared/sponge/generator/WorldModify.java b/src/main/java/com/plotsquared/sponge/generator/WorldModify.java
new file mode 100644
index 000000000..6fa618e37
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/generator/WorldModify.java
@@ -0,0 +1,40 @@
+package com.plotsquared.sponge.generator;
+
+import org.spongepowered.api.data.DataContainer;
+import org.spongepowered.api.world.WorldCreationSettings;
+import org.spongepowered.api.world.gen.WorldGenerator;
+import org.spongepowered.api.world.gen.WorldGeneratorModifier;
+import org.spongepowered.common.world.gen.SpongeWorldGenerator;
+
+import com.intellectualcrafters.plot.PS;
+import com.plotsquared.sponge.SpongeMain;
+
+public class WorldModify implements WorldGeneratorModifier {
+
+ private SpongePlotGenerator plotgen;
+
+ public WorldModify(SpongePlotGenerator plotgen) {
+ this.plotgen = plotgen;
+ }
+
+ @Override
+ public void modifyWorldGenerator(WorldCreationSettings world, DataContainer settings, WorldGenerator gen) {
+ gen.setBaseGeneratorPopulator(plotgen.getBaseGeneratorPopulator());
+ gen.setBiomeGenerator(plotgen.getBiomeGenerator());
+// if (gen instanceof SpongeWorldGenerator) {
+// SpongePlotGenerator plotgen = (SpongePlotGenerator) gen;
+// plotgen.setBaseGeneratorPopulator(plotgen.getGenerator());
+// plotgen.setBiomeGenerator(plotgen.getPlotBiomeProvider());
+// }
+ }
+
+ @Override
+ public String getName() {
+ return "PlotSquared";
+ }
+
+ @Override
+ public String getId() {
+ return "PlotSquared";
+ }
+}
diff --git a/src/main/java/com/plotsquared/sponge/listener/MainListener.java b/src/main/java/com/plotsquared/sponge/listener/MainListener.java
new file mode 100644
index 000000000..c25baff15
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/listener/MainListener.java
@@ -0,0 +1,836 @@
+package com.plotsquared.sponge.listener;
+
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_ADMIN_BUILD_OTHER;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_ADMIN_BUILD_ROAD;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_ADMIN_BUILD_UNOWNED;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_ADMIN_DESTROY_OTHER;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_ADMIN_DESTROY_ROAD;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_ADMIN_DESTROY_UNOWNED;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_ADMIN_ENTRY_DENIED;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_ADMIN_EXIT_DENIED;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_ADMIN_INTERACT_OTHER;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_ADMIN_INTERACT_ROAD;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_ADMIN_INTERACT_UNOWNED;
+import static com.intellectualcrafters.plot.object.StaticStrings.PERMISSION_COMMANDS_CHAT;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.UUID;
+
+import org.spongepowered.api.block.BlockState;
+import org.spongepowered.api.entity.Entity;
+import org.spongepowered.api.entity.EntityTypes;
+import org.spongepowered.api.entity.player.Player;
+import org.spongepowered.api.event.Cancellable;
+import org.spongepowered.api.event.Subscribe;
+import org.spongepowered.api.event.block.BlockMoveEvent;
+import org.spongepowered.api.event.block.BlockRedstoneUpdateEvent;
+import org.spongepowered.api.event.block.FloraGrowEvent;
+import org.spongepowered.api.event.entity.EntityChangeBlockEvent;
+import org.spongepowered.api.event.entity.EntityExplosionEvent;
+import org.spongepowered.api.event.entity.EntitySpawnEvent;
+import org.spongepowered.api.event.entity.EntityTeleportEvent;
+import org.spongepowered.api.event.entity.player.PlayerBreakBlockEvent;
+import org.spongepowered.api.event.entity.player.PlayerChangeWorldEvent;
+import org.spongepowered.api.event.entity.player.PlayerChatEvent;
+import org.spongepowered.api.event.entity.player.PlayerInteractBlockEvent;
+import org.spongepowered.api.event.entity.player.PlayerJoinEvent;
+import org.spongepowered.api.event.entity.player.PlayerMessageEvent;
+import org.spongepowered.api.event.entity.player.PlayerMoveEvent;
+import org.spongepowered.api.event.entity.player.PlayerPlaceBlockEvent;
+import org.spongepowered.api.event.entity.player.PlayerQuitEvent;
+import org.spongepowered.api.event.message.CommandEvent;
+import org.spongepowered.api.event.network.PlayerConnectionEvent;
+import org.spongepowered.api.event.world.ChunkLoadEvent;
+import org.spongepowered.api.event.world.ChunkPreGenerateEvent;
+import org.spongepowered.api.event.world.ChunkPrePopulateEvent;
+import org.spongepowered.api.network.PlayerConnection;
+import org.spongepowered.api.text.Text;
+import org.spongepowered.api.text.Texts;
+import org.spongepowered.api.util.command.CommandSource;
+import org.spongepowered.api.util.event.callback.EventCallback;
+import org.spongepowered.api.world.World;
+import org.spongepowered.api.world.extent.Extent;
+
+import com.flowpowered.math.vector.Vector3d;
+import com.flowpowered.math.vector.Vector3i;
+import com.google.common.base.Predicate;
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.config.C;
+import com.intellectualcrafters.plot.config.Settings;
+import com.intellectualcrafters.plot.database.DBFunc;
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.flag.FlagManager;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotManager;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.object.PlotWorld;
+import com.intellectualcrafters.plot.object.StringWrapper;
+import com.intellectualcrafters.plot.util.EventUtil;
+import com.intellectualcrafters.plot.util.ExpireManager;
+import com.intellectualcrafters.plot.util.MainUtil;
+import com.intellectualcrafters.plot.util.Permissions;
+import com.intellectualcrafters.plot.util.StringMan;
+import com.intellectualcrafters.plot.util.TaskManager;
+import com.intellectualcrafters.plot.util.UUIDHandler;
+import com.plotsquared.bukkit.object.BukkitPlayer;
+import com.plotsquared.listener.PlotListener;
+import com.plotsquared.sponge.SpongeMain;
+import com.plotsquared.sponge.SpongePlayer;
+import com.plotsquared.sponge.util.SpongeUtil;
+
+public class MainListener {
+
+ /*
+ * TODO:
+ * - Anything marked with a TODO below
+ * - BlockSpreadEvent
+ * - BlockPhysicsEvent
+ * - BlockFormEvent
+ * - BlockFadeEvent
+ * - BlockFromToEvent
+ * - BlockDamageEvent
+ * - Structure (tree etc)
+ * - Per plot mob caps
+ * - PlayerIgniteBlockEvent
+ * - PlayerBucketEmptyEvent
+ * - PlayerBucketFillEvent
+ * - VehicleCreateEvent
+ * - HangingPlaceEvent
+ * - HangingBreakEvent
+ * - PVP
+ * - PVE
+ * - VehicleDestroy
+ * - Projectile
+ */
+
+ @Subscribe
+ public void onMobSpawn(EntitySpawnEvent event) {
+ Entity entity = event.getEntity();
+ if (entity instanceof Player) {
+ return;
+ }
+ final Location loc = SpongeUtil.getLocation(event.getLocation());
+ final String world = loc.getWorld();
+ if (!PS.get().isPlotWorld(world)) {
+ return;
+ }
+ Plot plot = MainUtil.getPlot(loc);
+ if (plot == null) {
+ if (MainUtil.isPlotRoad(loc)) {
+ event.setCancelled(true);
+ }
+ return;
+ }
+ final PlotWorld pW = PS.get().getPlotWorld(world);
+
+ // TODO selectively cancel depending on spawn reason
+ // - Not sure if possible to get spawn reason (since there are no callbacks)
+
+ event.setCancelled(true);
+ }
+
+ @Subscribe
+ public void onBlockChange(EntityChangeBlockEvent event) {
+ Entity entity = event.getEntity();
+ if (entity.getType() == EntityTypes.PLAYER) {
+ return;
+ }
+ if (PS.get().isPlotWorld(entity.getWorld().getName())) {
+ event.setCancelled(true);
+ }
+ }
+
+ @Subscribe
+ public void onCommand(CommandEvent event) {
+ switch (event.getCommand().toLowerCase()) {
+ case "plotme": {
+ CommandSource source = event.getSource();
+ if (Settings.USE_PLOTME_ALIAS) {
+ SpongeMain.THIS.getGame().getCommandDispatcher().process(source, ("plots " + event.getArguments()).trim());
+ } else {
+ source.sendMessage(SpongeMain.THIS.getText(C.NOT_USING_PLOTME.s()));
+ }
+ event.setCancelled(true);
+ }
+ }
+ // TODO
+ }
+
+ @Subscribe
+ public void onBlockMove(BlockMoveEvent event) {
+ org.spongepowered.api.world.Location block = event.getBlocks().get(0);
+ Extent extent = block.getExtent();
+ if (extent instanceof World) {
+ World world = (World) extent;
+ final String worldname = world.getName();
+ if (!PS.get().isPlotWorld(worldname)) {
+ return;
+ }
+ event.filter(new Predicate() {
+ @Override
+ public boolean apply(org.spongepowered.api.world.Location loc) {
+ if (MainUtil.isPlotRoad(SpongeUtil.getLocation(worldname, loc))) {
+ return false;
+ }
+ return true;
+ }
+ });
+ }
+ }
+
+ @Subscribe
+ public void onFloraGrow(FloraGrowEvent event) {
+ org.spongepowered.api.world.Location block = event.getBlock();
+ Extent extent = block.getExtent();
+ if (extent instanceof World) {
+ World world = (World) extent;
+ final String worldname = world.getName();
+ if (!PS.get().isPlotWorld(worldname)) {
+ return;
+ }
+ if (MainUtil.isPlotRoad(SpongeUtil.getLocation(worldname, block))) {
+ event.setCancelled(true);
+ }
+ }
+ }
+
+ @Subscribe
+ public void onChat(PlayerChatEvent event) {
+ final Player player = event.getEntity();
+ final String world = player.getWorld().getName();
+ if (!PS.get().isPlotWorld(world)) {
+ return;
+ }
+ final PlotWorld plotworld = PS.get().getPlotWorld(world);
+ final PlotPlayer plr = SpongeUtil.getPlayer(player);
+ if (!plotworld.PLOT_CHAT && (plr.getMeta("chat") == null || !(Boolean) plr.getMeta("chat"))) {
+ return;
+ }
+ final Location loc = SpongeUtil.getLocation(player);
+ final Plot plot = MainUtil.getPlot(loc);
+ if (plot == null) {
+ return;
+ }
+ Text message = event.getUnformattedMessage();
+
+ // TODO use display name rather than username
+ // - Getting displayname currently causes NPE, so wait until sponge fixes that
+
+ String sender = player.getName();
+ PlotId id = plot.id;
+ String newMessage = StringMan.replaceAll(C.PLOT_CHAT_FORMAT.s(), "%plot_id%", id.x + ";" + id.y, "%sender%", sender);
+ String forcedMessage = StringMan.replaceAll(C.PLOT_CHAT_FORCED.s(), "%plot_id%", id.x + ";" + id.y, "%sender%", sender);
+ for (PlotPlayer user : UUIDHandler.getPlayers().values()) {
+ String toSend;
+ if (plot.equals(MainUtil.getPlot(user.getLocation()))) {
+ toSend = newMessage;
+ }
+ else if (Permissions.hasPermission(user, PERMISSION_COMMANDS_CHAT)) {
+ toSend = forcedMessage;
+ }
+ else {
+ continue;
+ }
+ String[] split = (toSend + " ").split("%msg%");
+ List components = new ArrayList<>();
+ Text prefix = null;
+ for (String part : split) {
+ if (prefix != null) {
+ components.add(prefix);
+ }
+ else {
+ prefix = message;
+ }
+ components.add(Texts.of(part));
+ }
+ ((SpongePlayer) user).player.sendMessage(Texts.join(components));
+ }
+ event.setNewMessage(Texts.of());
+ event.setCancelled(true);
+ }
+
+ @Subscribe
+ public void onBigBoom(final EntityExplosionEvent event) {
+ Location loc = SpongeUtil.getLocation(event.getExplosionLocation());
+ final String world = loc.getWorld();
+ if (!PS.get().isPlotWorld(world)) {
+ return;
+ }
+ final Plot plot = MainUtil.getPlot(loc);
+ if ((plot != null) && plot.hasOwner()) {
+ if (FlagManager.isPlotFlagTrue(plot, "explosion")) {
+ event.filter(new Predicate() {
+ @Override
+ public boolean apply(org.spongepowered.api.world.Location loc) {
+ if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(loc)))) {
+ return false;
+ }
+ return true;
+ }
+ });
+ return;
+ }
+ }
+ if (MainUtil.isPlotArea(loc)) {
+ event.setYield(0);
+ } else {
+ if (FlagManager.isPlotFlagTrue(plot, "explosion")) {
+ event.filter(new Predicate() {
+ @Override
+ public boolean apply(org.spongepowered.api.world.Location loc) {
+ if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(loc)))) {
+ return false;
+ }
+ return true;
+ }
+ });
+ return;
+ }
+ }
+ }
+
+ @Subscribe
+ public void onChunkPreGenerator(ChunkPreGenerateEvent event) {
+ org.spongepowered.api.world.Chunk chunk = event.getChunk();
+ World world = chunk.getWorld();
+ final String worldname = world.getName();
+ if (MainUtil.worldBorder.containsKey(worldname)) {
+ final int border = MainUtil.getBorder(worldname);
+ Vector3i min = world.getBlockMin();
+ final int x = Math.abs(min.getX());
+ final int z = Math.abs(min.getZ());
+ if ((x > border) || (z > border)) {
+ // TODO cancel this chunk from loading
+ // - Currently not possible / this event doesn't seem to be called
+ }
+ }
+ }
+
+
+ @Subscribe
+ public void onRedstoneEvent(BlockRedstoneUpdateEvent event) {
+ org.spongepowered.api.world.Location block = event.getBlock();
+ Location loc = SpongeUtil.getLocation(block);
+ if (loc == null || !PS.get().isPlotWorld(loc.getWorld())) {
+ return;
+ }
+ Plot plot = MainUtil.getPlot(loc);
+ if (plot == null || !plot.hasOwner()) {
+ return;
+ }
+ if (event.getOldSignalStrength() > event.getNewSignalStrength()) {
+ return;
+ }
+ if (Settings.REDSTONE_DISABLER) {
+ if (UUIDHandler.getPlayer(plot.owner) == null) {
+ boolean disable = true;
+ for (UUID trusted : plot.getTrusted()) {
+ if (UUIDHandler.getPlayer(trusted) != null) {
+ disable = false;
+ break;
+ }
+ }
+ if (disable) {
+ event.setNewSignalStrength(0);
+ return;
+ }
+ }
+ }
+ Flag redstone = FlagManager.getPlotFlag(plot, "redstone");
+ if (FlagManager.isPlotFlagFalse(plot, "redstone")) {
+ event.setNewSignalStrength(0);
+ // TODO only disable clocks
+ }
+ }
+
+ @Subscribe
+ public void onBlockBreak(PlayerBreakBlockEvent event) {
+ Player player = event.getEntity();
+ World world = player.getWorld();
+ String worldname = world.getName();
+ org.spongepowered.api.world.Location blockLoc = event.getBlock();
+ final Location loc = SpongeUtil.getLocation(worldname, event.getBlock());
+ final Plot plot = MainUtil.getPlot(loc);
+ if (plot != null) {
+ if (event.getBlock().getY() == 0) {
+ event.setCancelled(true);
+ return;
+ }
+ if (!plot.hasOwner()) {
+ final PlotPlayer pp = SpongeUtil.getPlayer(player);
+ if (Permissions.hasPermission(pp, PERMISSION_ADMIN_DESTROY_UNOWNED)) {
+ return;
+ }
+ MainUtil.sendMessage(pp, C.NO_PERMISSION, PERMISSION_ADMIN_DESTROY_UNOWNED);
+ event.setCancelled(true);
+ return;
+ }
+ final PlotPlayer pp = SpongeUtil.getPlayer(player);
+ if (!plot.isAdded(pp.getUUID())) {
+ final Flag destroy = FlagManager.getPlotFlag(plot, "break");
+ BlockState state = blockLoc.getBlock();
+ if ((destroy != null) && ((HashSet) destroy.getValue()).contains(SpongeMain.THIS.getPlotBlock(state))) {
+ return;
+ }
+ if (Permissions.hasPermission(pp, PERMISSION_ADMIN_DESTROY_OTHER)) {
+ return;
+ }
+ MainUtil.sendMessage(pp, C.NO_PERMISSION, PERMISSION_ADMIN_DESTROY_OTHER);
+ event.setCancelled(true);
+ }
+ return;
+ }
+ final PlotPlayer pp = SpongeUtil.getPlayer(player);
+ if (Permissions.hasPermission(pp, PERMISSION_ADMIN_DESTROY_ROAD)) {
+ return;
+ }
+ if (MainUtil.isPlotArea(loc)) {
+ MainUtil.sendMessage(pp, C.NO_PERMISSION, PERMISSION_ADMIN_DESTROY_ROAD);
+ event.setCancelled(true);
+ }
+ }
+
+ @Subscribe
+ public void onBlockPlace(PlayerPlaceBlockEvent event) {
+ Player player = event.getEntity();
+ World world = player.getWorld();
+ String worldname = world.getName();
+ org.spongepowered.api.world.Location blockLoc = event.getBlock();
+ final Location loc = SpongeUtil.getLocation(worldname, event.getBlock());
+ final Plot plot = MainUtil.getPlot(loc);
+ if (plot != null) {
+ if (event.getBlock().getY() == 0) {
+ event.setCancelled(true);
+ return;
+ }
+ if (!plot.hasOwner()) {
+ final PlotPlayer pp = SpongeUtil.getPlayer(player);
+ if (Permissions.hasPermission(pp, PERMISSION_ADMIN_BUILD_UNOWNED)) {
+ return;
+ }
+ MainUtil.sendMessage(pp, C.NO_PERMISSION, PERMISSION_ADMIN_BUILD_UNOWNED);
+ event.setCancelled(true);
+ return;
+ }
+ final PlotPlayer pp = SpongeUtil.getPlayer(player);
+ if (!plot.isAdded(pp.getUUID())) {
+ final Flag destroy = FlagManager.getPlotFlag(plot, "place");
+ BlockState state = blockLoc.getBlock();
+ if ((destroy != null) && ((HashSet) destroy.getValue()).contains(SpongeMain.THIS.getPlotBlock(state))) {
+ return;
+ }
+ if (Permissions.hasPermission(pp, PERMISSION_ADMIN_BUILD_OTHER)) {
+ return;
+ }
+ MainUtil.sendMessage(pp, C.NO_PERMISSION, PERMISSION_ADMIN_DESTROY_OTHER);
+ event.setCancelled(true);
+ }
+ return;
+ }
+ final PlotPlayer pp = SpongeUtil.getPlayer(player);
+ if (Permissions.hasPermission(pp, PERMISSION_ADMIN_BUILD_ROAD)) {
+ return;
+ }
+ if (MainUtil.isPlotArea(loc)) {
+ MainUtil.sendMessage(pp, C.NO_PERMISSION, PERMISSION_ADMIN_BUILD_ROAD);
+ event.setCancelled(true);
+ }
+ }
+
+ @Subscribe
+ public void onBlockInteract(PlayerInteractBlockEvent event) {
+ Player player = event.getEntity();
+ World world = player.getWorld();
+ String worldname = world.getName();
+ org.spongepowered.api.world.Location blockLoc = event.getBlock();
+ final Location loc = SpongeUtil.getLocation(worldname, event.getBlock());
+ final Plot plot = MainUtil.getPlot(loc);
+ if (plot != null) {
+ if (event.getBlock().getY() == 0) {
+ event.setCancelled(true);
+ return;
+ }
+ if (!plot.hasOwner()) {
+ final PlotPlayer pp = SpongeUtil.getPlayer(player);
+ if (Permissions.hasPermission(pp, PERMISSION_ADMIN_INTERACT_UNOWNED)) {
+ return;
+ }
+ MainUtil.sendMessage(pp, C.NO_PERMISSION, PERMISSION_ADMIN_INTERACT_UNOWNED);
+ event.setCancelled(true);
+ return;
+ }
+ final PlotPlayer pp = SpongeUtil.getPlayer(player);
+ if (!plot.isAdded(pp.getUUID())) {
+ final Flag destroy = FlagManager.getPlotFlag(plot, "use");
+ BlockState state = blockLoc.getBlock();
+ if ((destroy != null) && ((HashSet) destroy.getValue()).contains(SpongeMain.THIS.getPlotBlock(state))) {
+ return;
+ }
+ if (Permissions.hasPermission(pp, PERMISSION_ADMIN_INTERACT_OTHER)) {
+ return;
+ }
+ MainUtil.sendMessage(pp, C.NO_PERMISSION, PERMISSION_ADMIN_INTERACT_OTHER);
+ event.setCancelled(true);
+ }
+ return;
+ }
+ final PlotPlayer pp = SpongeUtil.getPlayer(player);
+ if (Permissions.hasPermission(pp, PERMISSION_ADMIN_INTERACT_ROAD)) {
+ return;
+ }
+ if (MainUtil.isPlotArea(loc)) {
+ MainUtil.sendMessage(pp, C.NO_PERMISSION, PERMISSION_ADMIN_INTERACT_ROAD);
+ event.setCancelled(true);
+ }
+ }
+
+ @Subscribe
+ public void onConnect(PlayerConnectionEvent event) {
+ PlayerConnection connection = event.getConnection();
+ Player player = connection.getPlayer();
+ String name = player.getName();
+ PlotPlayer pp = SpongeUtil.getPlayer(player);
+ if (name.equals("PlotSquared") || pp.getUUID().equals(DBFunc.everyone)) {
+ player.kick();
+ SpongeUtil.removePlayer(pp.getName());
+ }
+ }
+
+ @Subscribe
+ public void onJoin(PlayerJoinEvent event) {
+ final Player player = event.getUser();
+ SpongeUtil.removePlayer(player.getName());
+ final PlotPlayer pp = SpongeUtil.getPlayer(player);
+ final String username = pp.getName();
+ final StringWrapper name = new StringWrapper(username);
+ final UUID uuid = pp.getUUID();
+ UUIDHandler.add(name, uuid);
+ ExpireManager.dates.put(uuid, System.currentTimeMillis());
+
+ // TODO worldedit bypass
+
+ if (PS.get().update != null && pp.hasPermission("plots.admin")) {
+ TaskManager.runTaskLater(new Runnable() {
+ @Override
+ public void run() {
+ MainUtil.sendMessage(pp, "&6An update for PlotSquared is available: &7/plot update");
+ }
+ }, 20);
+ }
+ final Location loc = SpongeUtil.getLocation(player);
+ final Plot plot = MainUtil.getPlot(loc);
+ if (plot == null) {
+ return;
+ }
+ if (Settings.TELEPORT_ON_LOGIN) {
+ MainUtil.teleportPlayer(pp, pp.getLocation(), plot);
+ MainUtil.sendMessage(pp, C.TELEPORTED_TO_ROAD);
+ }
+ PlotListener.plotEntry(pp, plot);
+ }
+
+ @Subscribe
+ public void onQuit(PlayerQuitEvent event) {
+ Player player = event.getEntity();
+ PlotPlayer pp = SpongeUtil.getPlayer(player);
+ ExpireManager.dates.put(pp.getUUID(), System.currentTimeMillis());
+ EventUtil.unregisterPlayer(pp);
+
+ // TODO unregister WorldEdit manager
+ // TODO delete plots on ban
+
+ SpongeUtil.removePlayer(pp.getName());
+ }
+
+ public int getInt(double value) {
+ return (int) (value < 0 ? value - 1 : value);
+ }
+
+ @Subscribe
+ public void onMove(PlayerMoveEvent event) {
+ org.spongepowered.api.world.Location from = event.getOldLocation();
+ org.spongepowered.api.world.Location to = event.getNewLocation();
+ int x2;
+ if (getInt(from.getX()) != (x2 = getInt(to.getX()))) {
+ Extent extent = to.getExtent();
+ if (!(extent instanceof World)) {
+ return;
+ }
+ World world = (World) extent;
+ String worldname = ((World) extent).getName();
+ PlotWorld plotworld = PS.get().getPlotWorld(worldname);
+ if (plotworld == null) {
+ return;
+ }
+ PlotManager plotManager = PS.get().getPlotManager(worldname);
+ PlotId id = plotManager.getPlotId(plotworld, x2, 0, getInt(to.getZ()));
+ Player player = event.getUser();
+ PlotPlayer pp = SpongeUtil.getPlayer(player);
+ Plot lastPlot = (Plot) pp.getMeta("lastplot");
+ if (id == null) {
+ if (lastPlot == null) {
+ return;
+ }
+ if (!PlotListener.plotExit(pp, lastPlot)) {
+ MainUtil.sendMessage(pp, C.NO_PERMISSION, PERMISSION_ADMIN_EXIT_DENIED);
+ if (lastPlot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) {
+ event.setNewLocation(from);
+ }
+ else {
+ event.setNewLocation(world.getSpawnLocation());
+ }
+ return;
+ }
+ }
+ else if (lastPlot != null && id.equals(lastPlot.id)) {
+ return;
+ }
+ else {
+ Plot plot = MainUtil.getPlot(worldname, id);
+ if (!PlotListener.plotEntry(pp, plot)) {
+ MainUtil.sendMessage(pp, C.NO_PERMISSION, PERMISSION_ADMIN_ENTRY_DENIED);
+ if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) {
+ event.setNewLocation(from);
+ }
+ else {
+ event.setNewLocation(world.getSpawnLocation());
+ }
+ return;
+ }
+ }
+ Integer border = MainUtil.worldBorder.get(worldname);
+ if (border != null) {
+ if (x2 > border) {
+ Vector3d pos = to.getPosition();
+ to = to.setPosition(new Vector3d(border - 4, pos.getY(), pos.getZ()));
+ event.setNewLocation(to);
+ MainUtil.sendMessage(pp, C.BORDER);
+ }
+ else if (x2 < -border) {
+ Vector3d pos = to.getPosition();
+ to = to.setPosition(new Vector3d(-border + 4, pos.getY(), pos.getZ()));
+ event.setNewLocation(to);
+ MainUtil.sendMessage(pp, C.BORDER);
+ }
+ }
+ return;
+ }
+ int z2;
+ if (getInt(from.getZ()) != (z2 = getInt(to.getZ())) ) {
+ Extent extent = to.getExtent();
+ if (!(extent instanceof World)) {
+ return;
+ }
+ World world = (World) extent;
+ String worldname = ((World) extent).getName();
+ PlotWorld plotworld = PS.get().getPlotWorld(worldname);
+ if (plotworld == null) {
+ return;
+ }
+ PlotManager plotManager = PS.get().getPlotManager(worldname);
+ PlotId id = plotManager.getPlotId(plotworld, x2, 0, z2);
+ Player player = event.getUser();
+ PlotPlayer pp = SpongeUtil.getPlayer(player);
+ Plot lastPlot = (Plot) pp.getMeta("lastplot");
+ if (id == null) {
+ if (lastPlot == null) {
+ return;
+ }
+ if (!PlotListener.plotExit(pp, lastPlot)) {
+ MainUtil.sendMessage(pp, C.NO_PERMISSION, PERMISSION_ADMIN_EXIT_DENIED);
+ if (lastPlot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) {
+ event.setNewLocation(from);
+ }
+ else {
+ event.setNewLocation(world.getSpawnLocation());
+ }
+ return;
+ }
+ }
+ else if (lastPlot != null && id.equals(lastPlot.id)) {
+ return;
+ }
+ else {
+ Plot plot = MainUtil.getPlot(worldname, id);
+ if (!PlotListener.plotEntry(pp, plot)) {
+ MainUtil.sendMessage(pp, C.NO_PERMISSION, PERMISSION_ADMIN_ENTRY_DENIED);
+ if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) {
+ event.setNewLocation(from);
+ }
+ else {
+ event.setNewLocation(world.getSpawnLocation());
+ }
+ return;
+ }
+ }
+ Integer border = MainUtil.worldBorder.get(worldname);
+ if (border != null) {
+ if (z2 > border) {
+ Vector3d pos = to.getPosition();
+ to = to.setPosition(new Vector3d(pos.getX(), pos.getY(), border - 4));
+ event.setNewLocation(to);
+ MainUtil.sendMessage(pp, C.BORDER);
+ }
+ else if (z2 < -border) {
+ Vector3d pos = to.getPosition();
+ to = to.setPosition(new Vector3d(pos.getX(), pos.getY(), -border + 4));
+ event.setNewLocation(to);
+ MainUtil.sendMessage(pp, C.BORDER);
+ }
+ }
+ }
+ }
+
+ @Subscribe
+ public void onWorldChange(EntityTeleportEvent event) {
+ Entity entity = event.getEntity();
+ if (entity instanceof Player) {
+ org.spongepowered.api.world.Location from = event.getOldLocation();
+ org.spongepowered.api.world.Location to = event.getNewLocation();
+ int x2;
+ if (getInt(from.getX()) != (x2 = getInt(to.getX()))) {
+ Extent extent = to.getExtent();
+ if (!(extent instanceof World)) {
+ return;
+ }
+ World world = (World) extent;
+ String worldname = ((World) extent).getName();
+ PlotWorld plotworld = PS.get().getPlotWorld(worldname);
+ if (plotworld == null) {
+ return;
+ }
+ PlotManager plotManager = PS.get().getPlotManager(worldname);
+ PlotId id = plotManager.getPlotId(plotworld, x2, 0, getInt(to.getZ()));
+ Player player = (Player) entity;
+ PlotPlayer pp = SpongeUtil.getPlayer(player);
+ Plot lastPlot = (Plot) pp.getMeta("lastplot");
+ if (id == null) {
+ if (lastPlot == null) {
+ return;
+ }
+ if (!PlotListener.plotExit(pp, lastPlot)) {
+ MainUtil.sendMessage(pp, C.NO_PERMISSION, PERMISSION_ADMIN_EXIT_DENIED);
+ if (lastPlot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) {
+ event.setNewLocation(from);
+ }
+ else {
+ event.setNewLocation(world.getSpawnLocation());
+ }
+ return;
+ }
+ }
+ else if (lastPlot != null && id.equals(lastPlot.id)) {
+ return;
+ }
+ else {
+ Plot plot = MainUtil.getPlot(worldname, id);
+ if (!PlotListener.plotEntry(pp, plot)) {
+ MainUtil.sendMessage(pp, C.NO_PERMISSION, PERMISSION_ADMIN_ENTRY_DENIED);
+ if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) {
+ event.setNewLocation(from);
+ }
+ else {
+ event.setNewLocation(world.getSpawnLocation());
+ }
+ return;
+ }
+ }
+ Integer border = MainUtil.worldBorder.get(worldname);
+ if (border != null) {
+ if (x2 > border) {
+ Vector3d pos = to.getPosition();
+ to = to.setPosition(new Vector3d(border - 4, pos.getY(), pos.getZ()));
+ event.setNewLocation(to);
+ MainUtil.sendMessage(pp, C.BORDER);
+ }
+ else if (x2 < -border) {
+ Vector3d pos = to.getPosition();
+ to = to.setPosition(new Vector3d(-border + 4, pos.getY(), pos.getZ()));
+ event.setNewLocation(to);
+ MainUtil.sendMessage(pp, C.BORDER);
+ }
+ }
+ return;
+ }
+ int z2;
+ if (getInt(from.getZ()) != (z2 = getInt(to.getZ())) ) {
+ Extent extent = to.getExtent();
+ if (!(extent instanceof World)) {
+ return;
+ }
+ World world = (World) extent;
+ String worldname = ((World) extent).getName();
+ PlotWorld plotworld = PS.get().getPlotWorld(worldname);
+ if (plotworld == null) {
+ return;
+ }
+ PlotManager plotManager = PS.get().getPlotManager(worldname);
+ PlotId id = plotManager.getPlotId(plotworld, x2, 0, z2);
+ Player player = (Player) entity;
+ PlotPlayer pp = SpongeUtil.getPlayer(player);
+ Plot lastPlot = (Plot) pp.getMeta("lastplot");
+ if (id == null) {
+ if (lastPlot == null) {
+ return;
+ }
+ if (!PlotListener.plotExit(pp, lastPlot)) {
+ MainUtil.sendMessage(pp, C.NO_PERMISSION, PERMISSION_ADMIN_EXIT_DENIED);
+ if (lastPlot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) {
+ event.setNewLocation(from);
+ }
+ else {
+ event.setNewLocation(player.getWorld().getSpawnLocation());
+ }
+ return;
+ }
+ }
+ else if (lastPlot != null && id.equals(lastPlot.id)) {
+ return;
+ }
+ else {
+ Plot plot = MainUtil.getPlot(worldname, id);
+ if (!PlotListener.plotEntry(pp, plot)) {
+ MainUtil.sendMessage(pp, C.NO_PERMISSION, PERMISSION_ADMIN_ENTRY_DENIED);
+ if (!plot.equals(MainUtil.getPlot(SpongeUtil.getLocation(worldname, from)))) {
+ event.setNewLocation(from);
+ }
+ else {
+ event.setNewLocation(player.getWorld().getSpawnLocation());
+ }
+ return;
+ }
+ }
+ Integer border = MainUtil.worldBorder.get(worldname);
+ if (border != null) {
+ if (z2 > border) {
+ Vector3d pos = to.getPosition();
+ to = to.setPosition(new Vector3d(pos.getX(), pos.getY(), border - 4));
+ event.setNewLocation(to);
+ MainUtil.sendMessage(pp, C.BORDER);
+ }
+ else if (z2 < -border) {
+ Vector3d pos = to.getPosition();
+ to = to.setPosition(new Vector3d(pos.getX(), pos.getY(), -border + 4));
+ event.setNewLocation(to);
+ MainUtil.sendMessage(pp, C.BORDER);
+ }
+ }
+ }
+ }
+ }
+
+ @Subscribe
+ public void onWorldChange(PlayerChangeWorldEvent event) {
+ final PlotPlayer player = SpongeUtil.getPlayer(event.getUser());
+
+ // TODO worldedit mask
+
+ ((BukkitPlayer) player).hasPerm = new HashSet<>();
+ ((BukkitPlayer) player).noPerm = new HashSet<>();
+ }
+}
diff --git a/src/main/java/com/plotsquared/sponge/util/KillRoadMobs.java b/src/main/java/com/plotsquared/sponge/util/KillRoadMobs.java
new file mode 100644
index 000000000..3a60e99b4
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/util/KillRoadMobs.java
@@ -0,0 +1,7 @@
+package com.plotsquared.sponge.util;
+
+public class KillRoadMobs {
+ public void run() {
+ // TODO kill road mobs
+ }
+}
diff --git a/src/main/java/com/plotsquared/sponge/util/SpongeBlockManager.java b/src/main/java/com/plotsquared/sponge/util/SpongeBlockManager.java
new file mode 100644
index 000000000..802abb53b
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/util/SpongeBlockManager.java
@@ -0,0 +1,202 @@
+package com.plotsquared.sponge.util;
+
+import java.util.List;
+
+import org.spongepowered.api.block.BlockState;
+import org.spongepowered.api.block.BlockType;
+import org.spongepowered.api.block.BlockTypes;
+import org.spongepowered.api.block.tileentity.Sign;
+import org.spongepowered.api.data.manipulator.tileentity.SignData;
+import org.spongepowered.api.text.Text;
+import org.spongepowered.api.world.World;
+import org.spongepowered.api.world.biome.BiomeType;
+import org.spongepowered.api.world.biome.BiomeTypes;
+
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.PlotBlock;
+import com.intellectualcrafters.plot.object.schematic.PlotItem;
+import com.intellectualcrafters.plot.util.BlockManager;
+import com.intellectualcrafters.plot.util.MathMan;
+import com.intellectualcrafters.plot.util.StringComparison;
+import com.plotsquared.sponge.SpongeMain;
+
+public class SpongeBlockManager extends BlockManager {
+
+ @Override
+ public boolean isBlockSolid(PlotBlock block) {
+ BlockState state = SpongeMain.THIS.getBlockState(block);
+ BlockType type = state.getType();
+ return type.isSolidCube() && !type.isAffectedByGravity();
+ }
+
+ @Override
+ public StringComparison.ComparisonResult getClosestBlock(String name) {
+ try {
+ double match;
+ short id;
+ byte data;
+ String[] split = name.split(":");
+ if (split.length == 2) {
+ data = Byte.parseByte(split[1]);
+ name = split[0];
+ }
+ else {
+ data = 0;
+ }
+ if (MathMan.isInteger(split[0])) {
+ id = Short.parseShort(split[0]);
+ match = 0;
+ }
+ else {
+ StringComparison.ComparisonResult comparison = new StringComparison(name, SpongeMain.THIS.getAllStates()) {
+ public String getString(BlockState o) {
+ return o.getType().getId();
+ };
+ }.getBestMatchAdvanced();
+ match = comparison.match;
+ id = SpongeMain.THIS.getPlotBlock(comparison.best).id;
+ }
+ PlotBlock block = new PlotBlock(id, data);
+ StringComparison outer = new StringComparison();
+ return outer.new ComparisonResult(match, block);
+
+ }
+ catch (Exception e) {}
+ return null;
+ }
+
+ @Override
+ public String getClosestMatchingName(PlotBlock block) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public String[] getBiomeList() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public boolean addItems(String world, PlotItem items) {
+ // TODO Auto-generated method stub
+ return false;
+ }
+
+ @Override
+ public int getBiomeFromString(String biome) {
+ // TODO Auto-generated method stub
+ return 0;
+ }
+
+ @Override
+ public PlotBlock getPlotBlockFromString(String block) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public int getHeighestBlock(String worldname, int x, int z) {
+ World world = SpongeUtil.getWorld(worldname);
+ for (int y = 255; y > 0; y--) {
+ BlockState block = world.getBlock(x, y, z);
+ if (block != null && block.getType() != BlockTypes.AIR) {
+ return y+1;
+ }
+ }
+ return 64;
+ }
+
+ @Override
+ public String getBiome(String world, int x, int z) {
+ return SpongeUtil.getWorld(world).getBiome(x, z).getName().toUpperCase();
+ }
+
+ @Override
+ public PlotBlock getBlock(Location loc) {
+ BlockState state = SpongeUtil.getWorld(loc.getWorld()).getBlock(loc.getX(), loc.getY(), loc.getZ());
+ PlotBlock block = SpongeMain.THIS.getPlotBlock(state);
+ if (block == null) {
+ block = SpongeMain.THIS.registerBlock(state);
+ }
+ return block;
+ }
+
+ @Override
+ public Location getSpawn(String world) {
+ return SpongeUtil.getLocation(world, SpongeUtil.getWorld(world).getSpawnLocation());
+ }
+
+ @Override
+ public String[] getSign(Location loc) {
+ BlockState block = SpongeUtil.getWorld(loc.getWorld()).getBlock(loc.getX(), loc.getY(), loc.getZ());
+ if (!(block instanceof Sign)) {
+ return null;
+ }
+ Sign sign = (Sign) block;
+ String[] result = new String[4];
+ List lines = sign.getData().get().getLines();
+ for (int i = 0; i < 4; i++) {
+ result[i] = lines.get(i).toString();
+ }
+ return result;
+ }
+
+ @Override
+ public boolean isWorld(String world) {
+ return SpongeUtil.getWorld(world) != null;
+ }
+
+ @Override
+ public void functionSetBlocks(String worldname, int[] xv, int[] yv, int[] zv, int[] id, byte[] data) {
+ for (int i = 0; i < xv.length; i++) {
+ functionSetBlock(worldname, xv[i], yv[i], zv[i], id[i], data[i]);
+ }
+ }
+
+ @Override
+ public void functionSetSign(String worldname, int x, int y, int z, String[] lines) {
+ World world = SpongeUtil.getWorld(worldname);
+ world.setBlock(x, y, z, BlockTypes.WALL_SIGN.getDefaultState());
+ BlockState block = world.getBlock(x, y, z);
+ if (!(block instanceof Sign)) {
+ return;
+ }
+ Sign sign = (Sign) block;
+ SignData data = sign.getData().get();
+ for (int i = 0; i < 4; i++) {
+ data.setLine(i, SpongeMain.THIS.getText(lines[i]));
+ }
+ }
+
+ @Override
+ public void functionSetBlock(String worldname, int x, int y, int z, int id, byte data) {
+ BlockState state;
+ if (data == 0) {
+ state = SpongeMain.THIS.getBlockState(id);
+ }
+ else {
+ state = SpongeMain.THIS.getBlockState(new PlotBlock((short) id, data));
+ }
+ if (state == null) {
+ return;
+ }
+ SpongeUtil.getWorld(worldname).setBlock(x, y, z, state);
+ }
+
+ @Override
+ public void functionSetBiomes(String worldname, int[] xv, int[] zv, String biomeName) {
+ BiomeType biome;
+ try {
+ biome = (BiomeType) BiomeTypes.class.getField(biomeName.toUpperCase()).get(null);
+ } catch (Exception e) {
+ e.printStackTrace();
+ biome = BiomeTypes.FOREST;
+ }
+ for (int i = 0; i < xv.length; i++) {
+ SpongeUtil.getWorld(worldname).setBiome(xv[i], zv[i], biome);
+ }
+ }
+
+}
diff --git a/src/main/java/com/plotsquared/sponge/util/SpongeCommand.java b/src/main/java/com/plotsquared/sponge/util/SpongeCommand.java
new file mode 100644
index 000000000..24d8d67ef
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/util/SpongeCommand.java
@@ -0,0 +1,71 @@
+package com.plotsquared.sponge.util;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.UUID;
+
+import org.spongepowered.api.entity.player.Player;
+import org.spongepowered.api.text.Text;
+import org.spongepowered.api.text.Texts;
+import org.spongepowered.api.util.command.CommandCallable;
+import org.spongepowered.api.util.command.CommandException;
+import org.spongepowered.api.util.command.CommandResult;
+import org.spongepowered.api.util.command.CommandSource;
+
+import com.google.common.base.Optional;
+import com.intellectualcrafters.plot.PS;
+import com.intellectualcrafters.plot.commands.MainCommand;
+import com.intellectualcrafters.plot.object.ConsolePlayer;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.plotsquared.sponge.SpongeMain;
+
+public class SpongeCommand implements CommandCallable {
+
+ @Override
+ public CommandResult process(CommandSource cmd, String string) throws CommandException {
+ String id = cmd.getIdentifier();
+ PlotPlayer pp;
+ try {
+ UUID uuid = UUID.fromString(id);
+ Player player = SpongeMain.THIS.getServer().getPlayer(uuid).get();
+ pp = SpongeUtil.getPlayer(player);
+ }
+ catch (Exception e) {
+ pp = ConsolePlayer.getConsole();
+ }
+ if (MainCommand.onCommand(pp, cmd.getName(), string.split(" "))) {
+ return CommandResult.success();
+ }
+ else {
+ return CommandResult.empty();
+ }
+ }
+
+ @Override
+ public List getSuggestions(CommandSource cmd, String string) throws CommandException {
+ // TODO Auto-generated method stub
+ return new ArrayList<>(Arrays.asList("TEST"));
+ }
+
+ @Override
+ public boolean testPermission(CommandSource cmd) {
+ return true;
+ }
+
+ @Override
+ public Optional extends Text> getShortDescription(CommandSource cmd) {
+ return Optional.of(Texts.of("Shows plot help"));
+ }
+
+ @Override
+ public Optional extends Text> getHelp(CommandSource cmd) {
+ return Optional.of(Texts.of("/plot help"));
+ }
+
+ @Override
+ public Text getUsage(CommandSource cmd) {
+ return Texts.of("/plot ");
+ }
+
+}
diff --git a/src/main/java/com/plotsquared/sponge/util/SpongeEventUtil.java b/src/main/java/com/plotsquared/sponge/util/SpongeEventUtil.java
new file mode 100644
index 000000000..28492860d
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/util/SpongeEventUtil.java
@@ -0,0 +1,119 @@
+package com.plotsquared.sponge.util;
+
+import java.util.ArrayList;
+import java.util.UUID;
+
+import org.spongepowered.api.event.Cancellable;
+import org.spongepowered.api.event.Event;
+import org.spongepowered.api.service.event.EventManager;
+
+import com.intellectualcrafters.plot.flag.Flag;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.Plot;
+import com.intellectualcrafters.plot.object.PlotCluster;
+import com.intellectualcrafters.plot.object.PlotId;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.util.EventUtil;
+import com.plotsquared.sponge.SpongeMain;
+import com.plotsquared.sponge.events.ClusterFlagRemoveEvent;
+import com.plotsquared.sponge.events.PlayerClaimPlotEvent;
+import com.plotsquared.sponge.events.PlayerEnterPlotEvent;
+import com.plotsquared.sponge.events.PlayerLeavePlotEvent;
+import com.plotsquared.sponge.events.PlayerPlotDeniedEvent;
+import com.plotsquared.sponge.events.PlayerPlotHelperEvent;
+import com.plotsquared.sponge.events.PlayerPlotTrustedEvent;
+import com.plotsquared.sponge.events.PlayerTeleportToPlotEvent;
+import com.plotsquared.sponge.events.PlotClearEvent;
+import com.plotsquared.sponge.events.PlotDeleteEvent;
+import com.plotsquared.sponge.events.PlotFlagAddEvent;
+import com.plotsquared.sponge.events.PlotFlagRemoveEvent;
+import com.plotsquared.sponge.events.PlotMergeEvent;
+import com.plotsquared.sponge.events.PlotUnlinkEvent;
+
+public class SpongeEventUtil extends EventUtil {
+
+ public EventManager events;
+
+ public SpongeEventUtil() {
+ this.events = SpongeMain.THIS.getGame().getEventManager();
+ }
+
+ public boolean callEvent(Event event) {
+ events.post(event);
+ if (event instanceof Cancellable) {
+ return !((Cancellable) event).isCancelled();
+ }
+ return true;
+ }
+
+ @Override
+ public boolean callClaim(PlotPlayer player, Plot plot, boolean auto) {
+ return callEvent(new PlayerClaimPlotEvent(SpongeUtil.getPlayer(player), plot, auto));
+ }
+
+ @Override
+ public boolean callTeleport(PlotPlayer player, Location from, Plot plot) {
+ return callEvent(new PlayerTeleportToPlotEvent(SpongeUtil.getPlayer(player), from, plot));
+ }
+
+ @Override
+ public boolean callClear(String world, PlotId id) {
+ return callEvent(new PlotClearEvent(world, id));
+ }
+
+ @Override
+ public void callDelete(String world, PlotId id) {
+ callEvent(new PlotDeleteEvent(world, id));
+ }
+
+ @Override
+ public boolean callFlagAdd(Flag flag, Plot plot) {
+ return callEvent(new PlotFlagAddEvent(flag, plot));
+ }
+
+ @Override
+ public boolean callFlagRemove(Flag flag, Plot plot) {
+ return callEvent(new PlotFlagRemoveEvent(flag, plot));
+ }
+
+ @Override
+ public boolean callMerge(String world, Plot plot, ArrayList plots) {
+ return callEvent(new PlotMergeEvent(SpongeUtil.getWorld(world), plot, plots));
+ }
+
+ @Override
+ public boolean callUnlink(String world, ArrayList plots) {
+ return callEvent(new PlotUnlinkEvent(SpongeUtil.getWorld(world), plots));
+ }
+
+ @Override
+ public void callEntry(PlotPlayer player, Plot plot) {
+ callEvent(new PlayerEnterPlotEvent(SpongeUtil.getPlayer(player), plot));
+ }
+
+ @Override
+ public void callLeave(PlotPlayer player, Plot plot) {
+ callEvent(new PlayerLeavePlotEvent(SpongeUtil.getPlayer(player), plot));
+ }
+
+ @Override
+ public void callDenied(PlotPlayer initiator, Plot plot, UUID player, boolean added) {
+ callEvent(new PlayerPlotDeniedEvent(SpongeUtil.getPlayer(initiator), plot, player, added));
+ }
+
+ @Override
+ public void callTrusted(PlotPlayer initiator, Plot plot, UUID player, boolean added) {
+ callEvent(new PlayerPlotHelperEvent(SpongeUtil.getPlayer(initiator), plot, player, added));
+ }
+
+ @Override
+ public void callMember(PlotPlayer initiator, Plot plot, UUID player, boolean added) {
+ callEvent(new PlayerPlotTrustedEvent(SpongeUtil.getPlayer(initiator), plot, player, added));
+ }
+
+ @Override
+ public boolean callFlagRemove(Flag flag, PlotCluster cluster) {
+ return callEvent(new ClusterFlagRemoveEvent(flag, cluster));
+ }
+
+}
diff --git a/src/main/java/com/plotsquared/sponge/util/SpongeInventoryUtil.java b/src/main/java/com/plotsquared/sponge/util/SpongeInventoryUtil.java
new file mode 100644
index 000000000..942d2ec49
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/util/SpongeInventoryUtil.java
@@ -0,0 +1,116 @@
+package com.plotsquared.sponge.util;
+
+import java.util.ArrayList;
+import java.util.Locale;
+
+import org.spongepowered.api.entity.player.Player;
+import org.spongepowered.api.item.ItemType;
+import org.spongepowered.api.item.ItemTypes;
+import org.spongepowered.api.item.inventory.Carrier;
+import org.spongepowered.api.item.inventory.Inventories;
+import org.spongepowered.api.item.inventory.Inventory;
+import org.spongepowered.api.item.inventory.ItemStack;
+import org.spongepowered.api.item.inventory.ItemStackBuilder;
+import org.spongepowered.api.item.inventory.custom.CustomInventory;
+import org.spongepowered.api.item.inventory.property.SlotIndex;
+import org.spongepowered.api.item.inventory.type.CarriedInventory;
+
+import com.intellectualcrafters.plot.object.PlotInventory;
+import com.intellectualcrafters.plot.object.PlotItemStack;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.util.InventoryUtil;
+import com.plotsquared.sponge.SpongeMain;
+import com.plotsquared.sponge.SpongePlayer;
+
+public class SpongeInventoryUtil extends InventoryUtil {
+
+ public ItemStackBuilder builder;
+
+ public SpongeInventoryUtil() {
+ this.builder = SpongeMain.THIS.getGame().getRegistry().getItemBuilder();
+ }
+
+ @Override
+ public void open(PlotInventory inv) {
+ // TODO Auto-generated method stub
+ SpongePlayer sp = (SpongePlayer) inv.player;
+ Player player = sp.player;
+
+ CustomInventory inventory = Inventories.customInventoryBuilder().name(SpongeMain.THIS.getTranslation(inv.getTitle())).size(inv.size).build();
+ PlotItemStack[] items = inv.getItems();
+ for (int i = 0; i < inv.size * 9; i++) {
+ PlotItemStack item = items[i];
+ if (item != null) {
+ inventory.set(new SlotIndex(i), getItem(item));
+ }
+ }
+ inv.player.setMeta("inventory", inv);
+ player.openInventory(inventory);
+ }
+
+
+ public ItemStack getItem(PlotItemStack item) {
+ // FIXME item type, item data, item name, item lore
+ return builder.itemType(ItemTypes.SPONGE).quantity(item.amount).build();
+ }
+
+
+ @Override
+ public void close(PlotInventory inv) {
+ if (!inv.isOpen()) {
+ return;
+ }
+ inv.player.deleteMeta("inventory");
+ SpongePlayer sp = (SpongePlayer) inv.player;
+ sp.player.closeInventory();
+ }
+
+ @Override
+ public void setItem(PlotInventory inv, int index, PlotItemStack item) {
+ if (!inv.isOpen()) {
+ return;
+ }
+ SpongePlayer sp = (SpongePlayer) inv.player;
+ Player player = sp.player;
+ Inventory inventory = player.getOpenInventory().get();
+ throw new UnsupportedOperationException("NOT IMPLEMENTED YET");
+
+ }
+
+ public PlotItemStack getItem(ItemStack item) {
+ if (item == null) {
+ return null;
+ }
+ ItemType type = item.getItem();
+ String id = type.getId();
+ int amount = item.getQuantity();
+ // TODO name / lore
+ return new PlotItemStack(id, amount, null);
+ }
+
+ @Override
+ public PlotItemStack[] getItems(PlotPlayer player) {
+ SpongePlayer sp = (SpongePlayer) player;
+ CarriedInventory extends Carrier> inv = sp.player.getInventory();
+ ArrayList list = new ArrayList();
+
+ throw new UnsupportedOperationException("NOT IMPLEMENTED YET");
+
+// return list.toArray();
+ }
+
+ @Override
+ public boolean isOpen(PlotInventory inv) {
+ if (!inv.isOpen()) {
+ return false;
+ }
+ SpongePlayer sp = (SpongePlayer) inv.player;
+ Player player = sp.player;
+ if (player.isViewingInventory()) {
+ CarriedInventory extends Carrier> inventory = player.getInventory();
+ return inv.getTitle().equals(inventory.getName().getTranslation().get(Locale.ENGLISH));
+ }
+ return false;
+ }
+
+}
diff --git a/src/main/java/com/plotsquared/sponge/SpongeMetrics.java b/src/main/java/com/plotsquared/sponge/util/SpongeMetrics.java
similarity index 98%
rename from src/main/java/com/plotsquared/sponge/SpongeMetrics.java
rename to src/main/java/com/plotsquared/sponge/util/SpongeMetrics.java
index 980f64ebd..3c49f9c09 100644
--- a/src/main/java/com/plotsquared/sponge/SpongeMetrics.java
+++ b/src/main/java/com/plotsquared/sponge/util/SpongeMetrics.java
@@ -1,4 +1,4 @@
-package com.plotsquared.sponge;
+package com.plotsquared.sponge.util;
/*
* Copyright 2011-2013 Tyler Blair. All rights reserved.
@@ -28,16 +28,13 @@ package com.plotsquared.sponge;
* either expressed or implied, of anybody else.
*/
-import ninja.leaping.configurate.commented.CommentedConfigurationNode;
-import ninja.leaping.configurate.hocon.HoconConfigurationLoader;
-import ninja.leaping.configurate.loader.ConfigurationLoader;
-import org.spongepowered.api.Game;
-import org.spongepowered.api.plugin.PluginContainer;
-import org.spongepowered.api.service.scheduler.Task;
-import org.spongepowered.api.service.scheduler.TaskBuilder;
-
-import javax.inject.Inject;
-import java.io.*;
+import java.io.BufferedReader;
+import java.io.ByteArrayOutputStream;
+import java.io.File;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.io.UnsupportedEncodingException;
import java.net.Proxy;
import java.net.URL;
import java.net.URLConnection;
@@ -46,6 +43,17 @@ import java.util.UUID;
import java.util.concurrent.TimeUnit;
import java.util.zip.GZIPOutputStream;
+import javax.inject.Inject;
+
+import ninja.leaping.configurate.commented.CommentedConfigurationNode;
+import ninja.leaping.configurate.hocon.HoconConfigurationLoader;
+import ninja.leaping.configurate.loader.ConfigurationLoader;
+
+import org.spongepowered.api.Game;
+import org.spongepowered.api.plugin.PluginContainer;
+import org.spongepowered.api.service.scheduler.Task;
+import org.spongepowered.api.service.scheduler.TaskBuilder;
+
public class SpongeMetrics {
/**
diff --git a/src/main/java/com/plotsquared/sponge/SpongeTaskManager.java b/src/main/java/com/plotsquared/sponge/util/SpongeTaskManager.java
similarity index 81%
rename from src/main/java/com/plotsquared/sponge/SpongeTaskManager.java
rename to src/main/java/com/plotsquared/sponge/util/SpongeTaskManager.java
index c12e4c30d..199518a12 100644
--- a/src/main/java/com/plotsquared/sponge/SpongeTaskManager.java
+++ b/src/main/java/com/plotsquared/sponge/util/SpongeTaskManager.java
@@ -1,4 +1,4 @@
-package com.plotsquared.sponge;
+package com.plotsquared.sponge.util;
import java.util.HashMap;
import java.util.concurrent.atomic.AtomicInteger;
@@ -7,6 +7,7 @@ import org.spongepowered.api.service.scheduler.Task;
import org.spongepowered.api.service.scheduler.TaskBuilder;
import com.intellectualcrafters.plot.util.TaskManager;
+import com.plotsquared.sponge.SpongeMain;
public class SpongeTaskManager extends TaskManager {
@@ -27,25 +28,25 @@ public class SpongeTaskManager extends TaskManager {
@Override
public void taskAsync(Runnable r) {
TaskBuilder builder = SpongeMain.THIS.getGame().getScheduler().getTaskBuilder();
- builder.async().execute(r);
+ builder.async().execute(r).submit(SpongeMain.THIS.getPlugin());
}
@Override
public void task(Runnable r) {
TaskBuilder builder = SpongeMain.THIS.getGame().getScheduler().getTaskBuilder();
- builder.execute(r);
+ builder.execute(r).submit(SpongeMain.THIS.getPlugin());
}
@Override
public void taskLater(Runnable r, int delay) {
TaskBuilder builder = SpongeMain.THIS.getGame().getScheduler().getTaskBuilder();
- builder.delay(delay).execute(r);
+ builder.delay(delay).execute(r).submit(SpongeMain.THIS.getPlugin());
}
@Override
public void taskLaterAsync(Runnable r, int delay) {
TaskBuilder builder = SpongeMain.THIS.getGame().getScheduler().getTaskBuilder();
- builder.async().delay(delay).execute(r);
+ builder.async().delay(delay).execute(r).submit(SpongeMain.THIS.getPlugin());
}
@Override
diff --git a/src/main/java/com/plotsquared/sponge/util/SpongeUtil.java b/src/main/java/com/plotsquared/sponge/util/SpongeUtil.java
new file mode 100644
index 000000000..c6165d5df
--- /dev/null
+++ b/src/main/java/com/plotsquared/sponge/util/SpongeUtil.java
@@ -0,0 +1,86 @@
+package com.plotsquared.sponge.util;
+
+import org.spongepowered.api.entity.Entity;
+import org.spongepowered.api.entity.player.Player;
+import org.spongepowered.api.world.World;
+import org.spongepowered.api.world.extent.Extent;
+
+import com.flowpowered.math.vector.Vector3d;
+import com.flowpowered.math.vector.Vector3i;
+import com.google.common.base.Optional;
+import com.intellectualcrafters.plot.object.Location;
+import com.intellectualcrafters.plot.object.PlotPlayer;
+import com.intellectualcrafters.plot.util.MathMan;
+import com.intellectualcrafters.plot.util.UUIDHandler;
+import com.plotsquared.sponge.SpongeMain;
+import com.plotsquared.sponge.SpongePlayer;
+
+public class SpongeUtil {
+
+ public static Location getLocation(Entity player) {
+ String world = player.getWorld().getName();
+ org.spongepowered.api.world.Location loc = player.getLocation();
+ Vector3i pos = loc.getBlockPosition();
+ return new Location(world, pos.getX(), pos.getY(), pos.getZ());
+ }
+
+ public static Location getLocation(org.spongepowered.api.world.Location block) {
+ Extent extent = block.getExtent();
+ if (extent instanceof World) {
+ return getLocation(((World) extent).getName(), block);
+ }
+ return null;
+ }
+
+ public static Location getLocationFull(Entity player) {
+ String world = player.getWorld().getName();
+ Vector3d rot = player.getRotation();
+ float[] pitchYaw = MathMan.getPitchAndYaw((float) rot.getX(), (float) rot.getY(), (float) rot.getZ());
+ org.spongepowered.api.world.Location loc = player.getLocation();
+ Vector3i pos = loc.getBlockPosition();
+ return new Location(world, pos.getX(), pos.getY(), pos.getZ(), pitchYaw[1], pitchYaw[0]);
+ }
+
+ private static Player lastPlayer = null;
+ private static PlotPlayer lastPlotPlayer = null;
+
+ public static PlotPlayer getPlayer(Player player) {
+ if (player == lastPlayer) {
+ return lastPlotPlayer;
+ }
+ String name = player.getName();
+ PlotPlayer pp = UUIDHandler.getPlayers().get(name);
+ if (pp != null) {
+ return pp;
+ }
+ lastPlotPlayer = new SpongePlayer(player);
+ UUIDHandler.getPlayers().put(name, lastPlotPlayer);
+ lastPlayer = player;
+ return lastPlotPlayer;
+ }
+
+ public static Player getPlayer(PlotPlayer player) {
+ if (player instanceof SpongePlayer) {
+ return ((SpongePlayer) player).player;
+ }
+ return null;
+ }
+
+ public static World getWorld(String world) {
+ Optional optional = SpongeMain.THIS.getServer().getWorld(world);
+ if (!optional.isPresent()) {
+ return null;
+ }
+ return optional.get();
+ }
+
+ public static void removePlayer(String player) {
+ lastPlayer = null;
+ lastPlotPlayer = null;
+ UUIDHandler.getPlayers().remove(player);
+ }
+
+ public static Location getLocation(String world, org.spongepowered.api.world.Location spawn) {
+ return new Location(world, spawn.getBlockX(), spawn.getBlockY(), spawn.getBlockZ());
+ }
+}
diff --git a/src/main/java/com/plotsquared/sponge/SpongeLowerOfflineUUIDWrapper.java b/src/main/java/com/plotsquared/sponge/uuid/SpongeLowerOfflineUUIDWrapper.java
similarity index 93%
rename from src/main/java/com/plotsquared/sponge/SpongeLowerOfflineUUIDWrapper.java
rename to src/main/java/com/plotsquared/sponge/uuid/SpongeLowerOfflineUUIDWrapper.java
index 9456e32b8..ec5d68b69 100644
--- a/src/main/java/com/plotsquared/sponge/SpongeLowerOfflineUUIDWrapper.java
+++ b/src/main/java/com/plotsquared/sponge/uuid/SpongeLowerOfflineUUIDWrapper.java
@@ -1,18 +1,16 @@
-package com.plotsquared.sponge;
+package com.plotsquared.sponge.uuid;
import java.util.UUID;
-import java.util.concurrent.ExecutionException;
import org.spongepowered.api.GameProfile;
import org.spongepowered.api.entity.player.Player;
-import org.spongepowered.api.service.profile.GameProfileResolver;
import com.google.common.base.Charsets;
-import com.google.inject.Inject;
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
+import com.plotsquared.sponge.SpongeMain;
public class SpongeLowerOfflineUUIDWrapper extends UUIDWrapper {
diff --git a/src/main/java/com/plotsquared/sponge/SpongeOnlineUUIDWrapper.java b/src/main/java/com/plotsquared/sponge/uuid/SpongeOnlineUUIDWrapper.java
similarity index 93%
rename from src/main/java/com/plotsquared/sponge/SpongeOnlineUUIDWrapper.java
rename to src/main/java/com/plotsquared/sponge/uuid/SpongeOnlineUUIDWrapper.java
index 94915fb58..10464e82f 100644
--- a/src/main/java/com/plotsquared/sponge/SpongeOnlineUUIDWrapper.java
+++ b/src/main/java/com/plotsquared/sponge/uuid/SpongeOnlineUUIDWrapper.java
@@ -1,12 +1,13 @@
-package com.plotsquared.sponge;
+package com.plotsquared.sponge.uuid;
import java.util.UUID;
-import java.util.concurrent.ExecutionException;
import com.intellectualcrafters.plot.object.OfflinePlotPlayer;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
+import com.plotsquared.sponge.SpongeMain;
+import com.plotsquared.sponge.SpongePlayer;
public class SpongeOnlineUUIDWrapper extends UUIDWrapper {
diff --git a/src/main/java/com/plotsquared/sponge/SpongeUUIDHandler.java b/src/main/java/com/plotsquared/sponge/uuid/SpongeUUIDHandler.java
similarity index 90%
rename from src/main/java/com/plotsquared/sponge/SpongeUUIDHandler.java
rename to src/main/java/com/plotsquared/sponge/uuid/SpongeUUIDHandler.java
index 9a5b9c7d3..1d511d8c0 100644
--- a/src/main/java/com/plotsquared/sponge/SpongeUUIDHandler.java
+++ b/src/main/java/com/plotsquared/sponge/uuid/SpongeUUIDHandler.java
@@ -1,18 +1,16 @@
-package com.plotsquared.sponge;
+package com.plotsquared.sponge.uuid;
-import java.util.Collection;
import java.util.UUID;
import org.spongepowered.api.GameProfile;
-import org.spongepowered.api.service.profile.GameProfileResolver;
-import com.google.inject.Inject;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.object.StringWrapper;
import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandlerImplementation;
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
+import com.plotsquared.sponge.SpongeMain;
public class SpongeUUIDHandler extends UUIDHandlerImplementation {
diff --git a/src/main/resources/data.txt b/src/main/resources/data.txt
new file mode 100644
index 000000000..91bc2de45
--- /dev/null
+++ b/src/main/resources/data.txt
@@ -0,0 +1,40 @@
+Arts
+BannerPatternShapes
+BigMushroomTypes
+BodyParts
+BrickTypes
+Careers
+CoalTypes
+Comparisons
+CookedFishes
+DirtTypes
+DisguisedBlockTypes
+DoubleSizePlantTypes
+DyeColors
+Fishes
+GoldenApples
+Hinges
+HorseColors
+HorseStyles
+HorseVariants
+InstrumentTypes
+NotePitches
+OcelotTypes
+PistonTypes
+PlantTypes
+PortionTypes
+PrismarineTypes
+Professions
+QuartzTypes
+RabbitTypes
+RailDirections
+SandstoneTypes
+SandTypes
+ShrubTypes
+SkeletonTypes
+SkullTypes
+SlabTypes
+StairShapes
+StoneTypes
+TreeTypes
+WallTypes
\ No newline at end of file
diff --git a/src/main/resources/ids.txt b/src/main/resources/ids.txt
new file mode 100644
index 000000000..f40c897d9
--- /dev/null
+++ b/src/main/resources/ids.txt
@@ -0,0 +1,1068 @@
+0
+Air
+minecraft:air
+1
+Stone
+minecraft:stone
+1:1
+Granite
+minecraft:stone
+1:2
+Polished_Granite
+minecraft:stone
+1:3
+Diorite
+minecraft:stone
+1:4
+Polished_Diorite
+minecraft:stone
+1:5
+Andesite
+minecraft:stone
+1:6
+Polished_Andesite
+minecraft:stone
+2
+Grass
+minecraft:grass
+3
+Dirt
+minecraft:dirt
+3:1
+Coarse_Dirt
+minecraft:dirt
+3:2
+Podzol
+minecraft:dirt
+4
+Cobblestone
+minecraft:cobblestone
+5
+Oak_Wood_Plank
+minecraft:planks
+5:1
+Spruce_Wood_Plank
+minecraft:planks
+5:2
+Birch_Wood_Plank
+minecraft:planks
+5:3
+Jungle_Wood_Plank
+minecraft:planks
+5:4
+Acacia_Wood_Plank
+minecraft:planks
+5:5
+Dark_Oak_Wood_Plank
+minecraft:planks
+6
+Oak_Sapling
+minecraft:sapling
+6:1
+Spruce_Sapling
+minecraft:sapling
+6:2
+Birch_Sapling
+minecraft:sapling
+6:3
+Jungle_Sapling
+minecraft:sapling
+6:4
+Acacia_Sapling
+minecraft:sapling
+6:5
+Dark_Oak_Sapling
+minecraft:sapling
+7
+Bedrock
+minecraft:bedrock
+8
+Flowing_Water
+minecraft:flowing_water
+9
+Still_Water
+minecraft:water
+10
+Flowing_Lava
+minecraft:flowing_lava
+11
+Still_Lava
+minecraft:lava
+12
+Sand
+minecraft:sand
+12:1
+Red_Sand
+minecraft:sand
+13
+Gravel
+minecraft:gravel
+14
+Gold_Ore
+minecraft:gold_ore
+15
+Iron_Ore
+minecraft:iron_ore
+16
+Coal_Ore
+minecraft:coal_ore
+17
+Oak_Wood
+minecraft:log
+17:1
+Spruce_Wood
+minecraft:log
+17:2
+Birch_Wood
+minecraft:log
+17:3
+Jungle_Wood
+minecraft:log
+18
+Oak_Leaves
+minecraft:leaves
+18:1
+Spruce_Leaves
+minecraft:leaves
+18:2
+Birch_Leaves
+minecraft:leaves
+18:3
+Jungle_Leaves
+minecraft:leaves
+19
+Sponge
+minecraft:sponge
+19:1
+Wet_Sponge
+minecraft:sponge
+20
+Glass
+minecraft:glass
+21
+Lapis_Lazuli_Ore
+minecraft:lapis_ore
+22
+Lapis_Lazuli_Block
+minecraft:lapis_block
+23
+Dispenser
+minecraft:dispenser
+24
+Sandstone
+minecraft:sandstone
+24:1
+Chiseled_Sandstone
+minecraft:sandstone
+24:2
+Smooth_Sandstone
+minecraft:sandstone
+25
+Note_Block
+minecraft:noteblock
+26
+Bed
+minecraft:bed
+27
+Powered_Rail
+minecraft:golden_rail
+28
+Detector_Rail
+minecraft:detector_rail
+29
+Sticky_Piston
+minecraft:sticky_piston
+30
+Cobweb
+minecraft:web
+31
+Dead_Shrub
+minecraft:tallgrass
+31:1
+Grass
+minecraft:tallgrass
+31:2
+Fern
+minecraft:tallgrass
+32
+Dead_Bush
+minecraft:deadbush
+33
+Piston
+minecraft:piston
+34
+Piston_Head
+minecraft:piston_head
+35
+White_Wool
+minecraft:wool
+35:1
+Orange_Wool
+minecraft:wool
+35:2
+Magenta_Wool
+minecraft:wool
+35:3
+Light_Blue_Wool
+minecraft:wool
+35:4
+Yellow_Wool
+minecraft:wool
+35:5
+Lime_Wool
+minecraft:wool
+35:6
+Pink_Wool
+minecraft:wool
+35:7
+Gray_Wool
+minecraft:wool
+35:8
+Light_Gray_Wool
+minecraft:wool
+35:9
+Cyan_Wool
+minecraft:wool
+35:10
+Purple_Wool
+minecraft:wool
+35:11
+Blue_Wool
+minecraft:wool
+35:12
+Brown_Wool
+minecraft:wool
+35:13
+Green_Wool
+minecraft:wool
+35:14
+Red_Wool
+minecraft:wool
+35:15
+Black_Wool
+minecraft:wool
+37
+Dandelion
+minecraft:yellow_flower
+38
+Poppy
+minecraft:red_flower
+38:1
+Blue_Orchid
+minecraft:red_flower
+38:2
+Allium
+minecraft:red_flower
+38:3
+Azure_Bluet
+minecraft:red_flower
+38:4
+Red_Tulip
+minecraft:red_flower
+38:5
+Orange_Tulip
+minecraft:red_flower
+38:6
+White_Tulip
+minecraft:red_flower
+38:7
+Pink_Tulip
+minecraft:red_flower
+38:8
+Oxeye_Daisy
+minecraft:red_flower
+39
+Brown_Mushroom
+minecraft:brown_mushroom
+40
+Red_Mushroom
+minecraft:red_mushroom
+41
+Gold_Block
+minecraft:gold_block
+42
+Iron_Block
+minecraft:iron_block
+43
+Double_Stone_Slab
+minecraft:double_stone_slab
+43:1
+Double_Sandstone_Slab
+minecraft:double_stone_slab
+43:2
+Double_Wooden_Slab
+minecraft:double_stone_slab
+43:3
+Double_Cobblestone_Slab
+minecraft:double_stone_slab
+43:4
+Double_Brick_Slab
+minecraft:double_stone_slab
+43:5
+Double_Stone_Brick_Slab
+minecraft:double_stone_slab
+43:6
+Double_Nether_Brick_Slab
+minecraft:double_stone_slab
+43:7
+Double_Quartz_Slab
+minecraft:double_stone_slab
+44
+Stone_Slab
+minecraft:stone_slab
+44:1
+Sandstone_Slab
+minecraft:stone_slab
+44:2
+Wooden_Slab
+minecraft:stone_slab
+44:3
+Cobblestone_Slab
+minecraft:stone_slab
+44:4
+Brick_Slab
+minecraft:stone_slab
+44:5
+Stone_Brick_Slab
+minecraft:stone_slab
+44:6
+Nether_Brick_Slab
+minecraft:stone_slab
+44:7
+Quartz_Slab
+minecraft:stone_slab
+45
+Bricks
+minecraft:brick_block
+46
+TNT
+minecraft:tnt
+47
+Bookshelf
+minecraft:bookshelf
+48
+Moss_Stone
+minecraft:mossy_cobblestone
+49
+Obsidian
+minecraft:obsidian
+50
+Torch
+minecraft:torch
+51
+Fire
+minecraft:fire
+52
+Monster_Spawner
+minecraft:mob_spawner
+53
+Oak_Wood_Stairs
+minecraft:oak_stairs
+54
+Chest
+minecraft:chest
+55
+Redstone_Wire
+minecraft:redstone_wire
+56
+Diamond_Ore
+minecraft:diamond_ore
+57
+Diamond_Block
+minecraft:diamond_block
+58
+Crafting_Table
+minecraft:crafting_table
+59
+Wheat_Crops
+minecraft:wheat
+60
+Farmland
+minecraft:farmland
+61
+Furnace
+minecraft:furnace
+62
+Burning_Furnace
+minecraft:lit_furnace
+63
+Standing_Sign_Block
+minecraft:standing_sign
+64
+Oak_Door_Block
+minecraft:wooden_door
+65
+Ladder
+minecraft:ladder
+66
+Rail
+minecraft:rail
+67
+Cobblestone_Stairs
+minecraft:stone_stairs
+68
+Wall-mounted_Sign_Block
+minecraft:wall_sign
+69
+Lever
+minecraft:lever
+70
+Stone_Pressure_Plate
+minecraft:stone_pressure_plate
+71
+Iron_Door_Block
+minecraft:iron_door
+72
+Wooden_Pressure_Plate
+minecraft:wooden_pressure_plate
+73
+Redstone_Ore
+minecraft:redstone_ore
+74
+Glowing_Redstone_Ore
+minecraft:lit_redstone_ore
+75
+Redstone_Torch_off
+minecraft:unlit_redstone_torch
+76
+Redstone_Torch_on
+minecraft:redstone_torch
+77
+Stone_Button
+minecraft:stone_button
+78
+Snow
+minecraft:snow_layer
+79
+Ice
+minecraft:ice
+80
+Snow_Block
+minecraft:snow
+81
+Cactus
+minecraft:cactus
+82
+Clay
+minecraft:clay
+83
+Sugar_Canes
+minecraft:reeds
+84
+Jukebox
+minecraft:jukebox
+85
+Oak_Fence
+minecraft:fence
+86
+Pumpkin
+minecraft:pumpkin
+87
+Netherrack
+minecraft:netherrack
+88
+Soul_Sand
+minecraft:soul_sand
+89
+Glowstone
+minecraft:glowstone
+90
+Nether_Portal
+minecraft:portal
+91
+Jack_o'Lantern
+minecraft:lit_pumpkin
+92
+Cake_Block
+minecraft:cake
+93
+Redstone_Repeater_Block_off
+minecraft:unpowered_repeater
+94
+Redstone_Repeater_Block_on
+minecraft:powered_repeater
+95
+White_Stained_Glass
+minecraft:stained_glass
+95:1
+Orange_Stained_Glass
+minecraft:stained_glass
+95:2
+Magenta_Stained_Glass
+minecraft:stained_glass
+95:3
+Light_Blue_Stained_Glass
+minecraft:stained_glass
+95:4
+Yellow_Stained_Glass
+minecraft:stained_glass
+95:5
+Lime_Stained_Glass
+minecraft:stained_glass
+95:6
+Pink_Stained_Glass
+minecraft:stained_glass
+95:7
+Gray_Stained_Glass
+minecraft:stained_glass
+95:8
+Light_Gray_Stained_Glass
+minecraft:stained_glass
+95:9
+Cyan_Stained_Glass
+minecraft:stained_glass
+95:10
+Purple_Stained_Glass
+minecraft:stained_glass
+95:11
+Blue_Stained_Glass
+minecraft:stained_glass
+95:12
+Brown_Stained_Glass
+minecraft:stained_glass
+95:13
+Green_Stained_Glass
+minecraft:stained_glass
+95:14
+Red_Stained_Glass
+minecraft:stained_glass
+95:15
+Black_Stained_Glass
+minecraft:stained_glass
+96
+Wooden_Trapdoor
+minecraft:trapdoor
+97
+Stone_Monster_Egg
+minecraft:monster_egg
+97:1
+Cobblestone_Monster_Egg
+minecraft:monster_egg
+97:2
+Stone_Brick_Monster_Egg
+minecraft:monster_egg
+97:3
+Mossy_Stone_Brick_Monster_Egg
+minecraft:monster_egg
+97:4
+Cracked_Stone_Brick_Monster_Egg
+minecraft:monster_egg
+97:5
+Chiseled_Stone_Brick_Monster_Egg
+minecraft:monster_egg
+98
+Stone_Bricks
+minecraft:stonebrick
+98:1
+Mossy_Stone_Bricks
+minecraft:stonebrick
+98:2
+Cracked_Stone_Bricks
+minecraft:stonebrick
+98:3
+Chiseled_Stone_Bricks
+minecraft:stonebrick
+99
+Brown_Mushroom_Block
+minecraft:brown_mushroom_block
+100
+Red_Mushroom_Block
+minecraft:red_mushroom_block
+101
+Iron_Bars
+minecraft:iron_bars
+102
+Glass_Pane
+minecraft:glass_pane
+103
+Melon_Block
+minecraft:melon_block
+104
+Pumpkin_Stem
+minecraft:pumpkin_stem
+105
+Melon_Stem
+minecraft:melon_stem
+106
+Vines
+minecraft:vine
+107
+Oak_Fence_Gate
+minecraft:fence_gate
+108
+Brick_Stairs
+minecraft:brick_stairs
+109
+Stone_Brick_Stairs
+minecraft:stone_brick_stairs
+110
+Mycelium
+minecraft:mycelium
+111
+Lily_Pad
+minecraft:waterlily
+112
+Nether_Brick
+minecraft:nether_brick
+113
+Nether_Brick_Fence
+minecraft:nether_brick_fence
+114
+Nether_Brick_Stairs
+minecraft:nether_brick_stairs
+115
+Nether_Wart
+minecraft:nether_wart
+116
+Enchantment_Table
+minecraft:enchanting_table
+117
+Brewing_Stand
+minecraft:brewing_stand
+118
+Cauldron
+minecraft:cauldron
+119
+End_Portal
+minecraft:end_portal
+120
+End_Portal_Frame
+minecraft:end_portal_frame
+121
+End_Stone
+minecraft:end_stone
+122
+Dragon_Egg
+minecraft:dragon_egg
+123
+Redstone_Lamp_inactive
+minecraft:redstone_lamp
+124
+Redstone_Lamp_active
+minecraft:lit_redstone_lamp
+125
+Double_Oak_Wood_Slab
+minecraft:double_wooden_slab
+125:1
+Double_Spruce_Wood_Slab
+minecraft:double_wooden_slab
+125:2
+Double_Birch_Wood_Slab
+minecraft:double_wooden_slab
+125:3
+Double_Jungle_Wood_Slab
+minecraft:double_wooden_slab
+125:4
+Double_Acacia_Wood_Slab
+minecraft:double_wooden_slab
+125:5
+Double_Dark_Oak_Wood_Slab
+minecraft:double_wooden_slab
+126
+Oak_Wood_Slab
+minecraft:wooden_slab
+126:1
+Spruce_Wood_Slab
+minecraft:wooden_slab
+126:2
+Birch_Wood_Slab
+minecraft:wooden_slab
+126:3
+Jungle_Wood_Slab
+minecraft:wooden_slab
+126:4
+Acacia_Wood_Slab
+minecraft:wooden_slab
+126:5
+Dark_Oak_Wood_Slab
+minecraft:wooden_slab
+127
+Cocoa
+minecraft:cocoa
+128
+Sandstone_Stairs
+minecraft:sandstone_stairs
+129
+Emerald_Ore
+minecraft:emerald_ore
+130
+Ender_Chest
+minecraft:ender_chest
+131
+Tripwire_Hook
+minecraft:tripwire_hook
+132
+Tripwire
+minecraft:tripwire_hook
+133
+Emerald_Block
+minecraft:emerald_block
+134
+Spruce_Wood_Stairs
+minecraft:spruce_stairs
+135
+Birch_Wood_Stairs
+minecraft:birch_stairs
+136
+Jungle_Wood_Stairs
+minecraft:jungle_stairs
+137
+Command_Block
+minecraft:command_block
+138
+Beacon
+minecraft:beacon
+139
+Cobblestone_Wall
+minecraft:cobblestone_wall
+139:1
+Mossy_Cobblestone_Wall
+minecraft:cobblestone_wall
+140
+Flower_Pot
+minecraft:flower_pot
+141
+Carrots
+minecraft:carrots
+142
+Potatoes
+minecraft:potatoes
+143
+Wooden_Button
+minecraft:wooden_button
+144
+Mob_Head
+minecraft:skull
+145
+Anvil
+minecraft:anvil
+146
+Trapped_Chest
+minecraft:trapped_chest
+147
+Weighted_Pressure_Plate_light
+minecraft:light_weighted_pressure_plate
+148
+Weighted_Pressure_Plate_heavy
+minecraft:heavy_weighted_pressure_plate
+149
+Redstone_Comparator_inactive
+minecraft:unpowered_comparator
+150
+Redstone_Comparator_active
+minecraft:powered_comparator
+151
+Daylight_Sensor
+minecraft:daylight_detector
+152
+Redstone_Block
+minecraft:redstone_block
+153
+Nether_Quartz_Ore
+minecraft:quartz_ore
+154
+Hopper
+minecraft:hopper
+155
+Quartz_Block
+minecraft:quartz_block
+155:1
+Chiseled_Quartz_Block
+minecraft:quartz_block
+155:2
+Pillar_Quartz_Block
+minecraft:quartz_block
+156
+Quartz_Stairs
+minecraft:quartz_stairs
+157
+Activator_Rail
+minecraft:activator_rail
+158
+Dropper
+minecraft:dropper
+159
+White_Stained_Clay
+minecraft:stained_hardened_clay
+159:1
+Orange_Stained_Clay
+minecraft:stained_hardened_clay
+159:2
+Magenta_Stained_Clay
+minecraft:stained_hardened_clay
+159:3
+Light_Blue_Stained_Clay
+minecraft:stained_hardened_clay
+159:4
+Yellow_Stained_Clay
+minecraft:stained_hardened_clay
+159:5
+Lime_Stained_Clay
+minecraft:stained_hardened_clay
+159:6
+Pink_Stained_Clay
+minecraft:stained_hardened_clay
+159:7
+Gray_Stained_Clay
+minecraft:stained_hardened_clay
+159:8
+Light_Gray_Stained_Clay
+minecraft:stained_hardened_clay
+159:9
+Cyan_Stained_Clay
+minecraft:stained_hardened_clay
+159:10
+Purple_Stained_Clay
+minecraft:stained_hardened_clay
+159:11
+Blue_Stained_Clay
+minecraft:stained_hardened_clay
+159:12
+Brown_Stained_Clay
+minecraft:stained_hardened_clay
+159:13
+Green_Stained_Clay
+minecraft:stained_hardened_clay
+159:14
+Red_Stained_Clay
+minecraft:stained_hardened_clay
+159:15
+Black_Stained_Clay
+minecraft:stained_hardened_clay
+160
+White_Stained_Glass_Pane
+minecraft:stained_glass_pane
+160:1
+Orange_Stained_Glass_Pane
+minecraft:stained_glass_pane
+160:2
+Magenta_Stained_Glass_Pane
+minecraft:stained_glass_pane
+160:3
+Light_Blue_Stained_Glass_Pane
+minecraft:stained_glass_pane
+160:4
+Yellow_Stained_Glass_Pane
+minecraft:stained_glass_pane
+160:5
+Lime_Stained_Glass_Pane
+minecraft:stained_glass_pane
+160:6
+Pink_Stained_Glass_Pane
+minecraft:stained_glass_pane
+160:7
+Gray_Stained_Glass_Pane
+minecraft:stained_glass_pane
+160:8
+Light_Gray_Stained_Glass_Pane
+minecraft:stained_glass_pane
+160:9
+Cyan_Stained_Glass_Pane
+minecraft:stained_glass_pane
+160:10
+Purple_Stained_Glass_Pane
+minecraft:stained_glass_pane
+160:11
+Blue_Stained_Glass_Pane
+minecraft:stained_glass_pane
+160:12
+Brown_Stained_Glass_Pane
+minecraft:stained_glass_pane
+160:13
+Green_Stained_Glass_Pane
+minecraft:stained_glass_pane
+160:14
+Red_Stained_Glass_Pane
+minecraft:stained_glass_pane
+160:15
+Black_Stained_Glass_Pane
+minecraft:stained_glass_pane
+161
+Acacia_Leaves
+minecraft:leaves2
+161:1
+Dark_Oak_Leaves
+minecraft:leaves2
+162
+Acacia_Wood
+minecraft:log2
+162:1
+Dark_Oak_Wood
+minecraft:log2
+163
+Acacia_Wood_Stairs
+minecraft:acacia_stairs
+164
+Dark_Oak_Wood_Stairs
+minecraft:dark_oak_stairs
+165
+Slime_Block
+minecraft:slime
+166
+Barrier
+minecraft:barrier
+167
+Iron_Trapdoor
+minecraft:iron_trapdoor
+168
+Prismarine
+minecraft:prismarine
+168:1
+Prismarine_Bricks
+minecraft:prismarine
+168:2
+Dark_Prismarine
+minecraft:prismarine
+169
+Sea_Lantern
+minecraft:sea_lantern
+170
+Hay_Bale
+minecraft:hay_block
+171
+White_Carpet
+minecraft:carpet
+171:1
+Orange_Carpet
+minecraft:carpet
+171:2
+Magenta_Carpet
+minecraft:carpet
+171:3
+Light_Blue_Carpet
+minecraft:carpet
+171:4
+Yellow_Carpet
+minecraft:carpet
+171:5
+Lime_Carpet
+minecraft:carpet
+171:6
+Pink_Carpet
+minecraft:carpet
+171:7
+Gray_Carpet
+minecraft:carpet
+171:8
+Light_Gray_Carpet
+minecraft:carpet
+171:9
+Cyan_Carpet
+minecraft:carpet
+171:10
+Purple_Carpet
+minecraft:carpet
+171:11
+Blue_Carpet
+minecraft:carpet
+171:12
+Brown_Carpet
+minecraft:carpet
+171:13
+Green_Carpet
+minecraft:carpet
+171:14
+Red_Carpet
+minecraft:carpet
+171:15
+Black_Carpet
+minecraft:carpet
+172
+Hardened_Clay
+minecraft:hardened_clay
+173
+Block_of_Coal
+minecraft:coal_block
+174
+Packed_Ice
+minecraft:packed_ice
+175
+Sunflower
+minecraft:double_plant
+175:1
+Lilac
+minecraft:double_plant
+175:2
+Double_Tallgrass
+minecraft:double_plant
+175:3
+Large_Fern
+minecraft:double_plant
+175:4
+Rose_Bush
+minecraft:double_plant
+175:5
+Peony
+minecraft:double_plant
+176
+Free-standing_Banner
+minecraft:standing_banner
+177
+Wall-mounted_Banner
+minecraft:wall_banner
+178
+Inverted_Daylight_Sensor
+minecraft:daylight_detector_inverted
+179
+Red_Sandstone
+minecraft:red_sandstone
+179:1
+Chiseled_Red_Sandstone
+minecraft:red_sandstone
+179:2
+Smooth_Red_Sandstone
+minecraft:red_sandstone
+180
+Red_Sandstone_Stairs
+minecraft:red_sandstone_stairs
+181
+Double_Red_Sandstone_Slab
+minecraft:stone_slab2
+182
+Red_Sandstone_Slab
+minecraft:double_stone_slab2
+183
+Spruce_Fence_Gate
+minecraft:spruce_fence_gate
+184
+Birch_Fence_Gate
+minecraft:birch_fence_gate
+185
+Jungle_Fence_Gate
+minecraft:jungle_fence_gate
+186
+Dark_Oak_Fence_Gate
+minecraft:dark_oak_fence_gate
+187
+Acacia_Fence_Gate
+minecraft:acacia_fence_gate
+188
+Spruce_Fence
+minecraft:spruce_fence
+189
+Birch_Fence
+minecraft:birch_fence
+190
+Jungle_Fence
+minecraft:jungle_fence
+191
+Dark_Oak_Fence
+minecraft:dark_oak_fence
+192
+Acacia_Fence
+minecraft:acacia_fence
+193
+Spruce_Door_Block
+minecraft:spruce_door
+194
+Birch_Door_Block
+minecraft:birch_door
+195
+Jungle_Door_Block
+minecraft:jungle_door
+196
+Acacia_Door_Block
+minecraft:acacia_door
+197
+Dark_Oak_Door_Block
+minecraft:dark_oak_door
\ No newline at end of file