Fixing some more things

This commit is contained in:
boy0001 2015-07-31 00:25:16 +10:00
parent bfa877e607
commit e1dad77d8f
264 changed files with 6920 additions and 2146 deletions

View File

@ -134,7 +134,7 @@
<dependency> <dependency>
<groupId>org.spongepowered</groupId> <groupId>org.spongepowered</groupId>
<artifactId>spongeapi</artifactId> <artifactId>spongeapi</artifactId>
<version>2.1-20150716.174735-128</version> <version>2.1-SNAPSHOT</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.bukkit</groupId> <groupId>org.bukkit</groupId>

View File

@ -1,6 +1,11 @@
package com.intellectualcrafters.configuration; 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. * A type of {@link ConfigurationSection} that is stored in memory.

View File

@ -1,13 +1,24 @@
package com.intellectualcrafters.configuration.file; 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.Configuration;
import com.intellectualcrafters.configuration.InvalidConfigurationException; import com.intellectualcrafters.configuration.InvalidConfigurationException;
import com.intellectualcrafters.configuration.MemoryConfiguration; 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 * This is a base class for all File based implementations of {@link

View File

@ -1,14 +1,5 @@
package com.intellectualcrafters.configuration.file; 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.File;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -17,6 +8,16 @@ import java.nio.file.Files;
import java.nio.file.StandardCopyOption; import java.nio.file.StandardCopyOption;
import java.util.Map; 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. * An implementation of {@link Configuration} which saves all files in Yaml.
* Note that this implementation is not synchronized. * Note that this implementation is not synchronized.
@ -186,11 +187,11 @@ public class YamlConfiguration extends FileConfiguration {
dest = new File(file.getAbsolutePath() + "_broken_" + i++); dest = new File(file.getAbsolutePath() + "_broken_" + i++);
} }
Files.copy( file.toPath(), dest.toPath() , StandardCopyOption.REPLACE_EXISTING); Files.copy( file.toPath(), dest.toPath() , StandardCopyOption.REPLACE_EXISTING);
PS.log("&dCould not read: &7" + file); PS.debug("&dCould not read: &7" + file);
PS.log("&drenamed to: &7" + dest.getName()); PS.debug("&drenamed to: &7" + dest.getName());
PS.log("&c============ Full stacktrace ============"); PS.debug("&c============ Full stacktrace ============");
ex.printStackTrace(); ex.printStackTrace();
PS.log("&c========================================="); PS.debug("&c=========================================");
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
@ -222,11 +223,11 @@ public class YamlConfiguration extends FileConfiguration {
try { try {
config.load(stream); config.load(stream);
} catch (IOException ex) { } catch (IOException ex) {
PS.log("Cannot load configuration from stream"); PS.debug("Cannot load configuration from stream");
ex.printStackTrace(); ex.printStackTrace();
} catch (InvalidConfigurationException ex) { } catch (InvalidConfigurationException ex) {
ex.printStackTrace(); ex.printStackTrace();
PS.log("Cannot load configuration from stream"); PS.debug("Cannot load configuration from stream");
} }
return config; return config;
@ -252,10 +253,10 @@ public class YamlConfiguration extends FileConfiguration {
try { try {
config.load(reader); config.load(reader);
} catch (IOException ex) { } catch (IOException ex) {
PS.log("Cannot load configuration from stream"); PS.debug("Cannot load configuration from stream");
ex.printStackTrace(); ex.printStackTrace();
} catch (InvalidConfigurationException ex) { } catch (InvalidConfigurationException ex) {
PS.log("Cannot load configuration from stream"); PS.debug("Cannot load configuration from stream");
ex.printStackTrace(); ex.printStackTrace();
} }

View File

@ -1,13 +1,14 @@
package com.intellectualcrafters.configuration.file; 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.constructor.SafeConstructor;
import org.yaml.snakeyaml.error.YAMLException; import org.yaml.snakeyaml.error.YAMLException;
import org.yaml.snakeyaml.nodes.Node; import org.yaml.snakeyaml.nodes.Node;
import org.yaml.snakeyaml.nodes.Tag; import org.yaml.snakeyaml.nodes.Tag;
import java.util.LinkedHashMap; import com.intellectualcrafters.configuration.serialization.ConfigurationSerialization;
import java.util.Map;
public class YamlConstructor extends SafeConstructor { public class YamlConstructor extends SafeConstructor {

View File

@ -1,13 +1,14 @@
package com.intellectualcrafters.configuration.file; 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.ConfigurationSection;
import com.intellectualcrafters.configuration.serialization.ConfigurationSerializable; import com.intellectualcrafters.configuration.serialization.ConfigurationSerializable;
import com.intellectualcrafters.configuration.serialization.ConfigurationSerialization; 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 { public class YamlRepresenter extends Representer {

View File

@ -1,7 +1,5 @@
package com.intellectualcrafters.configuration.serialization; package com.intellectualcrafters.configuration.serialization;
import com.intellectualcrafters.configuration.Configuration;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
@ -11,6 +9,8 @@ import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
import java.util.logging.Logger; import java.util.logging.Logger;
import com.intellectualcrafters.configuration.Configuration;
/** /**
* Utility class for storing and retrieving classes for {@link Configuration}. * Utility class for storing and retrieving classes for {@link Configuration}.
*/ */

View File

@ -1,10 +1,10 @@
package com.intellectualcrafters.jnbt; package com.intellectualcrafters.jnbt;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import static com.google.common.base.Preconditions.checkNotNull;
/** /**
* Helps create compound tags. * Helps create compound tags.
*/ */

View File

@ -1,11 +1,11 @@
package com.intellectualcrafters.jnbt; package com.intellectualcrafters.jnbt;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.Collections; import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.NoSuchElementException; import java.util.NoSuchElementException;
import static com.google.common.base.Preconditions.checkNotNull;
/** /**
* The {@code TAG_List} tag. * The {@code TAG_List} tag.

View File

@ -1,12 +1,12 @@
package com.intellectualcrafters.jnbt; package com.intellectualcrafters.jnbt;
import static com.google.common.base.Preconditions.checkNotNull;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import static com.google.common.base.Preconditions.checkNotNull;
/** /**
* Helps create list tags. * Helps create list tags.
*/ */

View File

@ -6,8 +6,15 @@ import java.io.Writer;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.lang.reflect.Modifier; 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.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 * A JSONObject is an unordered collection of name/value pairs. Its external form is a string wrapped in curly braces

View File

@ -1,6 +1,11 @@
package com.intellectualcrafters.json; 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 * A JSONTokener takes a source string and extracts characters and tokens from it. It is used by the JSONObject and

View File

@ -1,14 +1,20 @@
package com.intellectualcrafters.plot; 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.HybridUtils;
import com.intellectualcrafters.plot.generator.PlotGenerator; import com.intellectualcrafters.plot.generator.PlotGenerator;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.*; import com.intellectualcrafters.plot.util.AbstractTitle;
import com.plotsquared.listener.APlotListener; import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.ChunkManager;
import java.io.File; import com.intellectualcrafters.plot.util.EconHandler;
import java.util.UUID; 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 { public interface IPlotMain {
@ -43,6 +49,12 @@ public interface IPlotMain {
*/ */
int[] getServerVersion(); int[] getServerVersion();
/**
* Get the schematic handler
* @return
*/
SchematicHandler initSchematicHandler();
/** /**
* The task manager will run and manage minecraft tasks * The task manager will run and manage minecraft tasks
* @return * @return
@ -168,13 +180,6 @@ public interface IPlotMain {
*/ */
PlotGenerator<?> getGenerator(String world, String name); 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 * 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(); 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 * Get the name of the server
* @return * @return
*/ */
String getServerName(); String getServerName();
/**
* Get the class that will manage player titles
* @return
*/
AbstractTitle initTitleManager();
} }

View File

@ -1,33 +1,85 @@
package com.intellectualcrafters.plot; package com.intellectualcrafters.plot;
import com.intellectualcrafters.configuration.ConfigurationSection; import java.io.BufferedReader;
import com.intellectualcrafters.configuration.file.YamlConfiguration; import java.io.File;
import com.intellectualcrafters.plot.config.C; import java.io.FileInputStream;
import com.intellectualcrafters.plot.config.Configuration; import java.io.FileOutputStream;
import com.intellectualcrafters.plot.config.Settings; import java.io.IOException;
import com.intellectualcrafters.plot.database.*; import java.io.InputStream;
import com.intellectualcrafters.plot.flag.AbstractFlag; import java.io.InputStreamReader;
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.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.nio.file.Files; import java.nio.file.Files;
import java.sql.Connection; import java.sql.Connection;
import java.sql.DatabaseMetaData; import java.sql.DatabaseMetaData;
import java.sql.SQLException; 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.Map.Entry;
import java.util.Set;
import java.util.UUID;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import java.util.zip.ZipEntry; import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream; import java.util.zip.ZipInputStream;
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, * An implementation of the core,
* with a static getter for easy access * with a static getter for easy access
@ -143,10 +195,10 @@ public class PS {
BlockManager.manager = IMP.initBlockManager(); BlockManager.manager = IMP.initBlockManager();
// Set chunk // Set chunk
ChunkManager.manager = IMP.initChunkManager(); ChunkManager.manager = IMP.initChunkManager();
// Plot listener // Schematic handler
APlotListener.manager = IMP.initPlotListener(); SchematicHandler.manager = IMP.initSchematicHandler();
// Player manager // Titles
PlayerManager.manager = IMP.initPlayerManager(); AbstractTitle.TITLE_CLASS = IMP.initTitleManager();
// Check for updates // Check for updates
TaskManager.runTaskAsync(new Runnable() { TaskManager.runTaskAsync(new Runnable() {
@ -249,6 +301,18 @@ public class PS {
get().IMP.log(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 * Get the database object
* *
@ -724,7 +788,7 @@ public class PS {
* @param world The world to load * @param world The world to load
* @param generator The generator for that world, or null if no generator * @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); PlotWorld plotWorld = getPlotWorld(world);
if (plotWorld != null) { if (plotWorld != null) {
if (generator != null) { if (generator != null) {
@ -733,7 +797,7 @@ public class PS {
return; return;
} }
final Set<String> worlds = (config.contains("worlds") ? config.getConfigurationSection("worlds").getKeys(false) : new HashSet<String>()); final Set<String> worlds = (config.contains("worlds") ? config.getConfigurationSection("worlds").getKeys(false) : new HashSet<String>());
final PlotGenerator plotGenerator; final PlotGenerator<?> plotGenerator;
final PlotManager plotManager; final PlotManager plotManager;
final String path = "worlds." + world; final String path = "worlds." + world;
if (!LOADING_WORLD && (generator.isFull())) { if (!LOADING_WORLD && (generator.isFull())) {
@ -981,18 +1045,18 @@ public class PS {
stream.close(); stream.close();
in.close(); in.close();
if (new_ver == null || !canUpdate(cur_ver, new_ver)) { 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; return null;
} }
if (link == null) { if (link == null) {
PS.log("&dCould not check for updates"); PS.debug("&dCould not check for updates");
PS.log("&7 - Manually check for updates: " + url); PS.debug("&7 - Manually check for updates: " + url);
return null; return null;
} }
return link; return link;
} catch (Exception e) { } catch (Exception e) {
PS.log("&dCould not check for updates"); PS.debug("&dCould not check for updates");
PS.log("&7 - Manually check for updates: " + url); PS.debug("&7 - Manually check for updates: " + url);
return null; return null;
} }
} }
@ -1205,20 +1269,23 @@ public class PS {
FlagManager.addFlag(new AbstractFlag("ice-met", new FlagValue.BooleanValue())); FlagManager.addFlag(new AbstractFlag("ice-met", new FlagValue.BooleanValue()));
FlagManager.addFlag(new AbstractFlag("gamemode") { FlagManager.addFlag(new AbstractFlag("gamemode") {
public String parseValueRaw(final String value) { public PlotGamemode parseValueRaw(final String value) {
switch (value) { switch (value.toLowerCase()) {
case "creative":
case "c":
case "1":
return "creative";
case "survival": case "survival":
case "s": case "s":
case "0": case "0":
return "survival"; return PlotGamemode.SURVIVAL;
case "creative":
case "c":
case "1":
return PlotGamemode.CREATIVE;
case "adventure": case "adventure":
case "a": case "a":
case "2": case "2":
return "adventure"; return PlotGamemode.ADVENTURE;
case "spectator":
case "3":
return PlotGamemode.SPECTATOR;
default: default:
return null; return null;
} }
@ -1226,26 +1293,25 @@ public class PS {
public String getValueDesc() { 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("price", new FlagValue.UnsignedDoubleValue()));
FlagManager.addFlag(new AbstractFlag("time", new FlagValue.LongValue())); FlagManager.addFlag(new AbstractFlag("time", new FlagValue.LongValue()));
FlagManager.addFlag(new AbstractFlag("weather") { FlagManager.addFlag(new AbstractFlag("weather") {
public String parseValueRaw(final String value) { public PlotWeather parseValueRaw(final String value) {
switch (value) { switch (value) {
case "rain": case "rain":
case "storm": case "storm":
case "on": case "on":
return "rain";
case "lightning": case "lightning":
case "thunder": case "thunder":
return "thunder"; return PlotWeather.RAIN;
case "clear": case "clear":
case "off": case "off":
case "sun": case "sun":
return "clear"; return PlotWeather.CLEAR;
default: default:
return null; return null;
} }

View File

@ -21,6 +21,15 @@
package com.intellectualcrafters.plot.api; 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.configuration.file.YamlConfiguration;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.commands.MainCommand; 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.config.C;
import com.intellectualcrafters.plot.flag.AbstractFlag; import com.intellectualcrafters.plot.flag.AbstractFlag;
import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.object.*; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.util.*; 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.intellectualcrafters.plot.uuid.UUIDWrapper;
import com.plotsquared.bukkit.util.bukkit.BukkitSetBlockManager; import com.plotsquared.bukkit.util.bukkit.BukkitSetBlockManager;
import com.plotsquared.bukkit.util.bukkit.BukkitUtil; 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 * PlotSquared API

View File

@ -20,6 +20,8 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import java.util.UUID;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; 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.Argument;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.util.UUID;
@CommandDeclaration( @CommandDeclaration(
command = "add", command = "add",
aliases = {"a"}, aliases = {"a"},

View File

@ -23,7 +23,12 @@ package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings; 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.ClusterManager;
import com.intellectualcrafters.plot.util.EconHandler; import com.intellectualcrafters.plot.util.EconHandler;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;

View File

@ -26,7 +26,12 @@ import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager; 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.EconHandler;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.UUIDHandler;

View File

@ -23,8 +23,16 @@ package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.*; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.util.*; 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.intellectualcrafters.plot.util.SchematicHandler.Schematic;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;

View File

@ -20,6 +20,8 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import java.util.Set;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings; 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.Plot;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotPlayer; 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 com.plotsquared.general.commands.CommandDeclaration;
import java.util.Set;
@CommandDeclaration( @CommandDeclaration(
command = "clear", command = "clear",
description = "Clear a plot", description = "Clear a plot",

View File

@ -20,22 +20,34 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; 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.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.*; import com.intellectualcrafters.plot.object.BlockLoc;
import com.intellectualcrafters.plot.util.*; 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.AugmentedPopulator;
import com.plotsquared.bukkit.generator.BukkitPlotGenerator; import com.plotsquared.bukkit.generator.BukkitPlotGenerator;
import com.plotsquared.bukkit.generator.HybridGen; import com.plotsquared.bukkit.generator.HybridGen;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import org.bukkit.generator.ChunkGenerator;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.UUID;
@CommandDeclaration( @CommandDeclaration(
command = "cluster", command = "cluster",
aliases = {"clusters"}, aliases = {"clusters"},

View File

@ -20,6 +20,8 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import java.util.Arrays;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot; 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.object.comment.PlotComment;
import com.intellectualcrafters.plot.util.CommentManager; import com.intellectualcrafters.plot.util.CommentManager;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.StringMan;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import org.apache.commons.lang.StringUtils;
import java.util.Arrays;
@CommandDeclaration( @CommandDeclaration(
command = "comment", command = "comment",
aliases = {"msg"}, aliases = {"msg"},
@ -48,12 +47,12 @@ public class Comment extends SubCommand {
@Override @Override
public boolean onCommand(PlotPlayer player, String[] args) { public boolean onCommand(PlotPlayer player, String[] args) {
if (args.length < 2) { 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; return false;
} }
CommentInbox inbox = CommentManager.inboxes.get(args[0].toLowerCase()); CommentInbox inbox = CommentManager.inboxes.get(args[0].toLowerCase());
if (inbox == null) { 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; return false;
} }
Plot plot; Plot plot;
@ -62,7 +61,7 @@ public class Comment extends SubCommand {
int index; int index;
if (id != null) { if (id != null) {
if (args.length < 4) { 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; return false;
} }
index = 2; index = 2;
@ -76,12 +75,12 @@ public class Comment extends SubCommand {
sendMessage(player, C.NO_PERM_INBOX, ""); sendMessage(player, C.NO_PERM_INBOX, "");
return false; 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()); PlotComment comment = new PlotComment(loc.getWorld(), id, message, player.getName(), inbox.toString(), System.currentTimeMillis());
boolean result = inbox.addComment(plot, comment); boolean result = inbox.addComment(plot, comment);
if (!result) { if (!result) {
sendMessage(player, C.NO_PLOT_INBOX, ""); 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; return false;
} }
sendMessage(player, C.COMMENT_ADDED); sendMessage(player, C.COMMENT_ADDED);

View File

@ -20,17 +20,20 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; 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.PS;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.MathMan;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import org.apache.commons.lang.StringUtils;
import java.util.*;
import java.util.Set;
@CommandDeclaration( @CommandDeclaration(
command = "condense", command = "condense",
@ -43,10 +46,6 @@ public class Condense extends SubCommand {
public static boolean TASK = false; public static boolean TASK = false;
public static void sendMessage(final String message) {
PS.log("&3PlotSquared -> Plot condense&8: &7" + message);
}
@Override @Override
public boolean onCommand(final PlotPlayer plr, String ... args) { public boolean onCommand(final PlotPlayer plr, String ... args) {
if ((args.length != 2) && (args.length != 3)) { if ((args.length != 2) && (args.length != 3)) {
@ -72,7 +71,7 @@ public class Condense extends SubCommand {
MainUtil.sendMessage(plr, "/plot condense " + worldname + " start <radius>"); MainUtil.sendMessage(plr, "/plot condense " + worldname + " start <radius>");
return false; return false;
} }
if (!StringUtils.isNumeric(args[2])) { if (!MathMan.isInteger(args[2])) {
MainUtil.sendMessage(plr, "INVALID RADIUS"); MainUtil.sendMessage(plr, "INVALID RADIUS");
return false; return false;
} }
@ -102,7 +101,7 @@ public class Condense extends SubCommand {
@Override @Override
public void run() { public void run() {
if (!TASK) { if (!TASK) {
sendMessage("CONDENSE TASK CANCELLED"); MainUtil.sendMessage(plr, "CONDENSE TASK CANCELLED");
return; return;
} }
to_move.remove(0); to_move.remove(0);
@ -130,16 +129,16 @@ public class Condense extends SubCommand {
free.remove(0); free.remove(0);
} }
if (to_move.size() == 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; TASK = false;
return; return;
} }
if (free.size() == 0) { if (free.size() == 0) {
sendMessage("TASK FAILED. NO FREE PLOTS FOUND!"); MainUtil.sendMessage(plr, "TASK FAILED. NO FREE PLOTS FOUND!");
TASK = false; TASK = false;
return; 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); 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 <radius>"); MainUtil.sendMessage(plr, "/plot condense " + worldname + " info <radius>");
return false; return false;
} }
if (!StringUtils.isNumeric(args[2])) { if (!MathMan.isInteger(args[2])) {
MainUtil.sendMessage(plr, "INVALID RADIUS"); MainUtil.sendMessage(plr, "INVALID RADIUS");
return false; return false;
} }

View File

@ -1,5 +1,10 @@
package com.intellectualcrafters.plot.commands; 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.PS;
import com.intellectualcrafters.plot.database.MySQL; import com.intellectualcrafters.plot.database.MySQL;
import com.intellectualcrafters.plot.database.SQLManager; import com.intellectualcrafters.plot.database.SQLManager;
@ -11,11 +16,6 @@ import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.sql.Connection;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.UUID;
@CommandDeclaration( @CommandDeclaration(
command = "database", command = "database",
aliases = {"convert"}, aliases = {"convert"},
@ -30,7 +30,7 @@ public class Database extends SubCommand {
private static boolean sendMessageU(final UUID uuid, final String msg) { private static boolean sendMessageU(final UUID uuid, final String msg) {
if (uuid == null) { if (uuid == null) {
PS.log(msg); PS.debug(msg);
} else { } else {
final PlotPlayer p = UUIDHandler.getPlayer(uuid); final PlotPlayer p = UUIDHandler.getPlayer(uuid);
if ((p != null) && p.isOnline()) { if ((p != null) && p.isOnline()) {
@ -127,11 +127,7 @@ public class Database extends SubCommand {
} }
private boolean sendMessage(final PlotPlayer player, final String msg) { 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; return true;
} }
} }

View File

@ -1,13 +1,13 @@
package com.intellectualcrafters.plot.commands; 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.ArrayList;
import java.util.List; import java.util.List;
import java.util.UUID; import java.util.UUID;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotPlayer;
import com.plotsquared.general.commands.CommandDeclaration;
@CommandDeclaration( @CommandDeclaration(
command = "debugallowunsafe", command = "debugallowunsafe",
description = "Allow unsafe actions until toggled off", description = "Allow unsafe actions until toggled off",

View File

@ -20,17 +20,28 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import java.util.ArrayList;
import java.util.UUID;
import com.google.common.collect.BiMap; import com.google.common.collect.BiMap;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.*; import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.util.*; 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 com.plotsquared.general.commands.CommandDeclaration;
import java.util.ArrayList;
import java.util.UUID;
@CommandDeclaration( @CommandDeclaration(
command = "debugclaimtest", 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", 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",

View File

@ -20,23 +20,36 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.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.File;
import java.io.FileNotFoundException; import java.io.FileNotFoundException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.sql.Timestamp; 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( @CommandDeclaration(
command = "debugexec", command = "debugexec",
@ -93,7 +106,7 @@ public class DebugExec extends SubCommand {
PlotAnalysis.calcOptimalModifiers(new Runnable() { PlotAnalysis.calcOptimalModifiers(new Runnable() {
@Override @Override
public void run() { public void run() {
PS.log("$1Thank you for calibrating PlotSquared plot expiry"); MainUtil.sendMessage(player, "$1Thank you for calibrating PlotSquared plot expiry");
} }
}, threshold); }, threshold);
return true; return true;
@ -122,7 +135,7 @@ public class DebugExec extends SubCommand {
} }
case "start-rgar": { case "start-rgar": {
if (args.length != 2) { if (args.length != 2) {
PS.log("&cInvalid syntax: /plot debugexec start-rgar <world>"); MainUtil.sendMessage(player, "&cInvalid syntax: /plot debugexec start-rgar <world>");
return false; return false;
} }
boolean result; boolean result;
@ -137,26 +150,26 @@ public class DebugExec extends SubCommand {
result = HybridUtils.manager.scheduleRoadUpdate(args[1], 0); result = HybridUtils.manager.scheduleRoadUpdate(args[1], 0);
} }
if (!result) { 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 false;
} }
return true; return true;
} }
case "stop-rgar": { case "stop-rgar": {
if (((BukkitHybridUtils)(HybridUtils.manager)).task == 0) { if (((BukkitHybridUtils)(HybridUtils.manager)).task == 0) {
PS.log("&cTASK NOT RUNNING!"); MainUtil.sendMessage(player, "&cTASK NOT RUNNING!");
return false; return false;
} }
((BukkitHybridUtils)(HybridUtils.manager)).task = 0; ((BukkitHybridUtils)(HybridUtils.manager)).task = 0;
Bukkit.getScheduler().cancelTask(((BukkitHybridUtils)(HybridUtils.manager)).task); Bukkit.getScheduler().cancelTask(((BukkitHybridUtils)(HybridUtils.manager)).task);
PS.log("&cCancelling task..."); MainUtil.sendMessage(player, "&cCancelling task...");
while (BukkitHybridUtils.chunks.size() > 0) { while (BukkitHybridUtils.chunks.size() > 0) {
ChunkLoc chunk = BukkitHybridUtils.chunks.get(0); ChunkLoc chunk = BukkitHybridUtils.chunks.get(0);
BukkitHybridUtils.chunks.remove(0); BukkitHybridUtils.chunks.remove(0);
HybridUtils.manager.regenerateRoad(BukkitHybridUtils.world, chunk, 0); HybridUtils.manager.regenerateRoad(BukkitHybridUtils.world, chunk, 0);
ChunkManager.manager.unloadChunk(BukkitHybridUtils.world, chunk, true, true); ChunkManager.manager.unloadChunk(BukkitHybridUtils.world, chunk, true, true);
} }
PS.log("&cCancelled!"); MainUtil.sendMessage(player, "&cCancelled!");
return true; return true;
} }
case "start-expire": { 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; return true;
} }
} }

View File

@ -20,6 +20,10 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; 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.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; 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.Argument;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
@CommandDeclaration( @CommandDeclaration(
command = "debugfixflags", command = "debugfixflags",
usage = "/plot debugfixflags <world>", usage = "/plot debugfixflags <world>",

View File

@ -20,13 +20,13 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import java.lang.reflect.Field;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.lang.reflect.Field;
@CommandDeclaration( @CommandDeclaration(
command = "debugloadtest", command = "debugloadtest",
permission = "plots.debugloadtest", permission = "plots.debugloadtest",
@ -44,9 +44,9 @@ public class DebugLoadTest extends SubCommand {
fPlots.setAccessible(true); fPlots.setAccessible(true);
fPlots.set(null, DBFunc.getPlots()); fPlots.set(null, DBFunc.getPlots());
} catch (final Exception e) { } catch (final Exception e) {
PS.log("&3===FAILED&3==="); PS.debug("&3===FAILED&3===");
e.printStackTrace(); e.printStackTrace();
PS.log("&3===END OF STACKTRACE==="); PS.debug("&3===END OF STACKTRACE===");
} }
return true; return true;
} }

View File

@ -1,5 +1,11 @@
package com.intellectualcrafters.plot.commands; 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.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
@ -7,11 +13,6 @@ import com.intellectualcrafters.plot.util.HastebinUtility;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.bukkit.BukkitMain; import com.plotsquared.bukkit.BukkitMain;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import org.bukkit.Bukkit;
import org.bukkit.plugin.Plugin;
import java.io.File;
import java.io.IOException;
@CommandDeclaration( @CommandDeclaration(
command = "debugpaste", command = "debugpaste",

View File

@ -20,6 +20,8 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import java.util.ArrayList;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
@ -27,8 +29,6 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.util.ArrayList;
@CommandDeclaration( @CommandDeclaration(
command = "debugsavetest", command = "debugsavetest",
permission = "plots.debugsavetest", permission = "plots.debugsavetest",

View File

@ -20,6 +20,16 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; 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.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings; 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.PlotPlayer;
import com.intellectualcrafters.plot.object.StringWrapper; import com.intellectualcrafters.plot.object.StringWrapper;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.PlayerManager;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
import com.plotsquared.bukkit.uuid.DefaultUUIDWrapper; import com.plotsquared.bukkit.uuid.DefaultUUIDWrapper;
import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper; import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper;
import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper; import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper;
import com.intellectualcrafters.plot.uuid.UUIDWrapper;
import com.plotsquared.general.commands.Argument; import com.plotsquared.general.commands.Argument;
import com.plotsquared.general.commands.CommandDeclaration; 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( @CommandDeclaration(
command = "uuidconvert", command = "uuidconvert",
@ -115,7 +115,9 @@ public class DebugUUID extends SubCommand {
MainUtil.sendConsoleMessage("&6Beginning UUID mode conversion"); MainUtil.sendConsoleMessage("&6Beginning UUID mode conversion");
MainUtil.sendConsoleMessage("&7 - Disconnecting players"); MainUtil.sendConsoleMessage("&7 - Disconnecting players");
for (PlotPlayer user : UUIDHandler.getPlayers().values()) { 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"); MainUtil.sendConsoleMessage("&7 - Initializing map");
@ -145,7 +147,7 @@ public class DebugUUID extends SubCommand {
final UUID uuid = UUID.fromString(s); final UUID uuid = UUID.fromString(s);
uuids.add(uuid); uuids.add(uuid);
} catch (final Exception e) { } 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); uCReverse.put(uuid2, uuid);
} }
} catch (final Throwable e) { } 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) { for (final String name : names) {

View File

@ -27,7 +27,12 @@ import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.PlotWorld; 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; import com.plotsquared.general.commands.CommandDeclaration;
@CommandDeclaration( @CommandDeclaration(

View File

@ -20,18 +20,22 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import java.util.UUID;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer; 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.bukkit.util.bukkit.uuid.SQLUUIDHandler;
import com.plotsquared.general.commands.Argument; import com.plotsquared.general.commands.Argument;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.util.UUID;
@CommandDeclaration( @CommandDeclaration(
command = "deny", command = "deny",
aliases = {"d"}, aliases = {"d"},

View File

@ -1,5 +1,7 @@
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import java.net.URL;
import com.intellectualcrafters.jnbt.CompoundTag; import com.intellectualcrafters.jnbt.CompoundTag;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
@ -13,8 +15,6 @@ import com.intellectualcrafters.plot.util.SchematicHandler;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.net.URL;
@CommandDeclaration( @CommandDeclaration(
command = "download", command = "download",
aliases = {"dl"}, aliases = {"dl"},

View File

@ -20,6 +20,12 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; 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.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.flag.AbstractFlag; 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.MainUtil;
import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.Permissions;
import com.plotsquared.general.commands.CommandDeclaration; 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( @CommandDeclaration(
command = "flag", command = "flag",
@ -122,7 +123,7 @@ public class FlagCmd extends SubCommand {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase()); MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
return false; 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); final Object parsed = af.parseValueRaw(value);
if (parsed == null) { if (parsed == null) {
MainUtil.sendMessage(player, "&c" + af.getValueDesc()); MainUtil.sendMessage(player, "&c" + af.getValueDesc());
@ -161,7 +162,7 @@ public class FlagCmd extends SubCommand {
return false; return false;
} }
if ((args.length == 3) && flag.getAbstractFlag().isList()) { 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); ((FlagValue.ListValue) flag.getAbstractFlag().value).remove(flag.getValue(), value);
DBFunc.setFlags(plot, plot.getSettings().flags.values()); DBFunc.setFlags(plot, plot.getSettings().flags.values());
} else { } else {
@ -192,7 +193,7 @@ public class FlagCmd extends SubCommand {
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase()); MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase());
return false; 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); final Object parsed = af.parseValueRaw(value);
if (parsed == null) { if (parsed == null) {
MainUtil.sendMessage(player, "&c" + af.getValueDesc()); MainUtil.sendMessage(player, "&c" + af.getValueDesc());
@ -233,7 +234,7 @@ public class FlagCmd extends SubCommand {
String message = ""; String message = "";
String prefix = ""; String prefix = "";
for (final String flag : flags.keySet()) { 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"; prefix = "\n";
} }
MainUtil.sendMessage(player, message); MainUtil.sendMessage(player, message);

View File

@ -13,7 +13,6 @@ import com.plotsquared.general.commands.CommandDeclaration;
@CommandDeclaration( @CommandDeclaration(
command = "help", command = "help",
description = "Get this help menu", description = "Get this help menu",
permission = "",
aliases = {"he"}, aliases = {"he"},
category = CommandCategory.INFO category = CommandCategory.INFO
) )

View File

@ -20,6 +20,8 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import java.util.ArrayList;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
@ -27,8 +29,6 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.util.ArrayList;
@CommandDeclaration( @CommandDeclaration(
command = "home", command = "home",
aliases = {"h"}, aliases = {"h"},

View File

@ -20,6 +20,11 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; 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.config.C;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
@ -31,11 +36,6 @@ import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.StringMan;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import org.apache.commons.lang.StringUtils;
import java.util.ArrayList;
import java.util.List;
@CommandDeclaration( @CommandDeclaration(
command = "inbox", command = "inbox",
description = "Review the comments for a plot", 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()); final CommentInbox inbox = CommentManager.inboxes.get(args[0].toLowerCase());
if (inbox == null) { 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; return false;
} }
player.setMeta("inbox:" + inbox.toString(), System.currentTimeMillis()); player.setMeta("inbox:" + inbox.toString(), System.currentTimeMillis());

View File

@ -20,6 +20,14 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; 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.C;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc; 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.PlotInventory;
import com.intellectualcrafters.plot.object.PlotItemStack; import com.intellectualcrafters.plot.object.PlotItemStack;
import com.intellectualcrafters.plot.object.PlotPlayer; 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 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( @CommandDeclaration(
command = "info", command = "info",
aliases = {"i"}, aliases = {"i"},
@ -221,7 +224,7 @@ public class Info extends SubCommand {
Flag descriptionFlag = FlagManager.getPlotFlag(plot, "description"); Flag descriptionFlag = FlagManager.getPlotFlag(plot, "description");
final String description = descriptionFlag == null ? C.NONE.s() : descriptionFlag.getValueString(); 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()); final boolean build = plot.isAdded(player.getUUID());
String owner = plot.owner == null ? "unowned" : getPlayerList(plot.getOwners()); String owner = plot.owner == null ? "unowned" : getPlayerList(plot.getOwners());

View File

@ -1,5 +1,9 @@
package com.intellectualcrafters.plot.commands; 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.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings; 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.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
@CommandDeclaration( @CommandDeclaration(
command = "load", command = "load",
aliases = {"restore"}, aliases = {"restore"},

View File

@ -20,9 +20,13 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; 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.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.object.ConsolePlayer; import com.intellectualcrafters.plot.object.ConsolePlayer;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId; 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.CommandHandlingOutput;
import com.plotsquared.general.commands.CommandManager; 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 * PlotSquared command class
* *
@ -61,39 +59,68 @@ public class MainCommand extends CommandManager<PlotPlayer> {
private MainCommand() { private MainCommand() {
super(null, new ArrayList<Command<PlotPlayer>>()); super(null, new ArrayList<Command<PlotPlayer>>());
List<SubCommand> toAdd = new ArrayList<>(Arrays.asList( createCommand(new Buy());
new Buy(), new Save(), new Load(), createCommand(new Save());
new Template(), new Download(), createCommand(new Load());
new Update(), new Template(), createCommand(new Template());
new Setup(), new DebugUUID(), createCommand(new Download());
new DebugFill(), new DebugSaveTest(), createCommand(new Update());
new DebugLoadTest(), new CreateRoadSchematic(), createCommand(new Template());
new DebugAllowUnsafe(), new RegenAllRoads(), createCommand(new Setup());
new DebugClear(), new Claim(), // createCommand(new DebugUUID());
new Auto(), new Home(), new Visit(), createCommand(new DebugFill());
new TP(), new Set(), new Toggle(), createCommand(new DebugSaveTest());
new Clear(), new Delete(), new SetOwner(), createCommand(new DebugLoadTest());
new Trust(), new Add(), new Deny(), createCommand(new CreateRoadSchematic());
new Untrust(), new Remove(), new Undeny(), createCommand(new DebugAllowUnsafe());
new Info(), new list(), new Help(), createCommand(new RegenAllRoads());
new Debug(), new SchematicCmd(), new plugin(), createCommand(new DebugClear());
new Purge(), new Reload(), new Merge(), createCommand(new Claim());
new DebugPaste(), new Unlink(), new Kick(), createCommand(new Auto());
new Rate(), new DebugClaimTest(), new Inbox(), createCommand(new Home());
new Comment(), new Database(), new Swap(), createCommand(new Visit());
new MusicSubcommand(), new DebugRoadRegen(), createCommand(new TP());
new Trust(), new DebugExec(), new FlagCmd(), createCommand(new Set());
new Target(), new DebugFixFlags(), new Move(), createCommand(new Toggle());
new Condense(), new Condense(), new Copy(), createCommand(new Clear());
new Chat())); createCommand(new Delete());
if (Settings.ENABLE_CLUSTERS) { createCommand(new SetOwner());
toAdd.add(new Cluster()); createCommand(new Trust());
} createCommand(new Add());
for (final SubCommand cmd : toAdd) { createCommand(new Deny());
if (!createCommand(cmd)) { createCommand(new Untrust());
PS.log("Failed to create command: " + cmd.getClass()); 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) { public static boolean no_permission(final PlotPlayer player, final String permission) {

View File

@ -20,18 +20,28 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.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.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.UUID; 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( @CommandDeclaration(
command = "merge", command = "merge",
aliases = {"m"}, aliases = {"m"},
@ -91,7 +101,7 @@ public class Merge extends SubCommand {
return false; return false;
} }
if (args.length < 1) { 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()))); MainUtil.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(loc.getYaw())));
return false; return false;
} }
@ -103,7 +113,7 @@ public class Merge extends SubCommand {
} }
} }
if (direction == -1) { 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()))); MainUtil.sendMessage(plr, C.DIRECTION.s().replaceAll("%dir%", direction(loc.getYaw())));
return false; return false;
} }

View File

@ -22,7 +22,11 @@ package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.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.MainUtil;
import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.Permissions;
import com.plotsquared.general.commands.Argument; import com.plotsquared.general.commands.Argument;

View File

@ -23,7 +23,12 @@ package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager; 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.BlockManager;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;

View File

@ -20,6 +20,11 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; 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.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
@ -30,11 +35,6 @@ import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
@CommandDeclaration( @CommandDeclaration(
command = "purge", command = "purge",

View File

@ -20,25 +20,33 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.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.ArrayList;
import java.util.Collections; import java.util.Collections;
import java.util.Comparator; import java.util.Comparator;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.UUID; 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( @CommandDeclaration(
command = "rate", command = "rate",
permission = "plots.rate", permission = "plots.rate",
@ -118,13 +126,11 @@ public class Rate extends SubCommand {
// handle ratings // handle ratings
int rV = rating.intValue(); int rV = rating.intValue();
// CALL THE EVENT // CALL THE EVENT
PlotRateEvent rateEvent = new PlotRateEvent(player, rV, plot); PlotRateEvent rateEvent = new PlotRateEvent(player, new Rating(rV), plot);
Bukkit.getPluginManager().callEvent(rateEvent); Bukkit.getPluginManager().callEvent(rateEvent);
// DONE CALLING THE EVENT // DONE CALLING THE EVENT
// get new rating
rV = rateEvent.getRating();
// set rating // set rating
plot.getSettings().ratings.put(player.getUUID(), rV); plot.getSettings().ratings.put(player.getUUID(), rateEvent.getRating().getAggregate());
DBFunc.setRating(plot, player.getUUID(), rV); DBFunc.setRating(plot, player.getUUID(), rV);
sendMessage(player, C.RATING_APPLIED, plot.getId().toString()); sendMessage(player, C.RATING_APPLIED, plot.getId().toString());
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; return false;
} }
}; };
inventory.setItem(0, new PlotItemStack(35, (short) 12, 0, "0/8", null)); inventory.setItem(0, new PlotItemStack(35, (short) 12, 0, "0/8"));
inventory.setItem(1, new PlotItemStack(35, (short) 14, 1, "1/8", null)); inventory.setItem(1, new PlotItemStack(35, (short) 14, 1, "1/8"));
inventory.setItem(2, new PlotItemStack(35, (short) 1, 2, "2/8", null)); inventory.setItem(2, new PlotItemStack(35, (short) 1, 2, "2/8"));
inventory.setItem(3, new PlotItemStack(35, (short) 4, 3, "3/8", null)); inventory.setItem(3, new PlotItemStack(35, (short) 4, 3, "3/8"));
inventory.setItem(4, new PlotItemStack(35, (short) 5, 4, "4/8", null)); inventory.setItem(4, new PlotItemStack(35, (short) 5, 4, "4/8"));
inventory.setItem(5, new PlotItemStack(35, (short) 9, 5, "5/8", null)); inventory.setItem(5, new PlotItemStack(35, (short) 9, 5, "5/8"));
inventory.setItem(6, new PlotItemStack(35, (short) 11, 6, "6/8", null)); inventory.setItem(6, new PlotItemStack(35, (short) 11, 6, "6/8"));
inventory.setItem(7, new PlotItemStack(35, (short) 10, 7, "7/8", null)); inventory.setItem(7, new PlotItemStack(35, (short) 10, 7, "7/8"));
inventory.setItem(8, new PlotItemStack(35, (short) 2, 8, "8/8", null)); inventory.setItem(8, new PlotItemStack(35, (short) 2, 8, "8/8"));
inventory.openInventory(); inventory.openInventory();
} }
}; };
@ -169,7 +175,7 @@ public class Rate extends SubCommand {
} }
final int rating; 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); rating = Integer.parseInt(arg);
if (rating > 10) { if (rating > 10) {
sendMessage(player, C.RATING_NOT_VALID); sendMessage(player, C.RATING_NOT_VALID);

View File

@ -20,6 +20,8 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import java.util.List;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.generator.HybridPlotManager; 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.Argument;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.util.List;
@CommandDeclaration( @CommandDeclaration(
command = "regenallroads", command = "regenallroads",
description = "Regenerate all roads in the map using the set road schematic", description = "Regenerate all roads in the map using the set road schematic",
@ -70,13 +70,13 @@ public class RegenAllRoads extends SubCommand {
return false; return false;
} }
final List<ChunkLoc> chunks = ChunkManager.manager.getChunkChunks(name); final List<ChunkLoc> chunks = ChunkManager.manager.getChunkChunks(name);
PS.log("&cIf no schematic is set, the following will not do anything"); MainUtil.sendMessage(plr, "&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"); MainUtil.sendMessage(plr, "&7 - To set a schematic, stand in a plot and use &c/plot createroadschematic");
PS.log("&6Potential chunks to update: &7" + (chunks.size() * 1024)); MainUtil.sendMessage(plr, "&6Potential chunks to update: &7" + (chunks.size() * 1024));
PS.log("&6Estimated time: &7" + (chunks.size()) + " seconds"); MainUtil.sendMessage(plr, "&6Estimated time: &7" + (chunks.size()) + " seconds");
final boolean result = HybridUtils.manager.scheduleRoadUpdate(name, height); final boolean result = HybridUtils.manager.scheduleRoadUpdate(name, height);
if (!result) { 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 false;
} }
return true; return true;

View File

@ -20,6 +20,10 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; 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.config.C;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot; 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.Argument;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.UUID;
@CommandDeclaration( @CommandDeclaration(
command = "remove", command = "remove",
aliases = {"r"}, aliases = {"r"},

View File

@ -1,5 +1,9 @@
package com.intellectualcrafters.plot.commands; 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.jnbt.CompoundTag;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
@ -14,10 +18,6 @@ import com.intellectualcrafters.plot.util.SchematicHandler;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.net.URL;
import java.util.List;
import java.util.UUID;
@CommandDeclaration( @CommandDeclaration(
command = "save", command = "save",
aliases = {"backup"}, aliases = {"backup"},

View File

@ -20,10 +20,21 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; 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.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.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.MainUtil;
import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.SchematicHandler; 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.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.general.commands.CommandDeclaration; 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 // TODO Add sub-subcommands
@CommandDeclaration( @CommandDeclaration(
@ -193,8 +198,8 @@ public class SchematicCmd extends SubCommand {
return false; return false;
} }
else { else {
PS.log("&3PlotSquared&8->&3Schemaitc&8: &7Mass export has started. This may take a while."); MainUtil.sendMessage(plr, "&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: &7Found &c" + plotmap.size() + "&7 plots...");
} }
break; break;
} }

View File

@ -20,22 +20,35 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; 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.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Configuration; import com.intellectualcrafters.plot.config.Configuration;
import com.intellectualcrafters.plot.flag.AbstractFlag; import com.intellectualcrafters.plot.flag.AbstractFlag;
import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.object.*; import com.intellectualcrafters.plot.object.BlockLoc;
import com.intellectualcrafters.plot.util.*; 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.general.commands.CommandDeclaration;
import com.plotsquared.listener.APlotListener; import com.plotsquared.listener.PlotListener;
import org.apache.commons.lang.StringUtils;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
// TODO Make sub-subcommands // TODO Make sub-subcommands
@ -86,8 +99,8 @@ public class Set extends SubCommand {
} }
if (args[0].equalsIgnoreCase("flag")) { if (args[0].equalsIgnoreCase("flag")) {
if (args.length < 2) { if (args.length < 2) {
final String message = StringMan.replaceFromMap("$2" + (StringUtils.join(FlagManager.getFlags(plr), "$1, $2")), C.replacements); final String message = StringMan.replaceFromMap("$2" + (StringMan.join(FlagManager.getFlags(plr), "$1, $2")), C.replacements);
// final String message = StringUtils.join(FlagManager.getFlags(plr), "&c, &6"); // final String message = StringMan.join(FlagManager.getFlags(plr), "&c, &6");
MainUtil.sendMessage(plr, C.NEED_KEY.s().replaceAll("%values%", message)); MainUtil.sendMessage(plr, C.NEED_KEY.s().replaceAll("%values%", message));
return false; return false;
} }
@ -116,11 +129,11 @@ public class Set extends SubCommand {
return false; return false;
} }
MainUtil.sendMessage(plr, C.FLAG_REMOVED); MainUtil.sendMessage(plr, C.FLAG_REMOVED);
APlotListener.manager.plotEntry(plr, plot); PlotListener.plotEntry(plr, plot);
return true; return true;
} }
try { 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); final Object parsed_value = af.parseValueRaw(value);
if (parsed_value == null) { if (parsed_value == null) {
MainUtil.sendMessage(plr, af.getValueDesc()); MainUtil.sendMessage(plr, af.getValueDesc());
@ -133,7 +146,7 @@ public class Set extends SubCommand {
return false; return false;
} }
MainUtil.sendMessage(plr, C.FLAG_ADDED); MainUtil.sendMessage(plr, C.FLAG_ADDED);
APlotListener.manager.plotEntry(plr, plot); PlotListener.plotEntry(plr, plot);
return true; return true;
} catch (final Exception e) { } catch (final Exception e) {
MainUtil.sendMessage(plr, "&c" + e.getMessage()); MainUtil.sendMessage(plr, "&c" + e.getMessage());

View File

@ -20,6 +20,9 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import java.util.ArrayList;
import java.util.UUID;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings; 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.Argument;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.util.ArrayList;
import java.util.UUID;
@CommandDeclaration( @CommandDeclaration(
command = "setowner", command = "setowner",
permission = "plots.set.owner", permission = "plots.set.owner",

View File

@ -20,6 +20,13 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; 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.C;
import com.intellectualcrafters.plot.config.ConfigurationNode; import com.intellectualcrafters.plot.config.ConfigurationNode;
import com.intellectualcrafters.plot.config.Settings; 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.BlockManager;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.SetupUtils; 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 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( @CommandDeclaration(
command = "setup", command = "setup",
permission = "plots.admin.command.setup", permission = "plots.admin.command.setup",
@ -104,7 +101,7 @@ public class Setup extends SubCommand {
case 0: { // choose generator case 0: { // choose generator
if ((args.length != 1) || !SetupUtils.generators.containsKey(args[0])) { if ((args.length != 1) || !SetupUtils.generators.containsKey(args[0])) {
final String prefix = "\n&8 - &7"; 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); sendMessage(plr, C.SETUP_INIT);
return false; return false;
} }

View File

@ -20,16 +20,21 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import java.util.ArrayList;
import com.intellectualcrafters.plot.config.C; 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.ChunkManager;
import com.intellectualcrafters.plot.util.ClusterManager; import com.intellectualcrafters.plot.util.ClusterManager;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.Permissions; import com.intellectualcrafters.plot.util.Permissions;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.util.ArrayList;
@CommandDeclaration( @CommandDeclaration(
command = "swap", command = "swap",
description = "Swap two plots", description = "Swap two plots",

View File

@ -20,6 +20,7 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Location; 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.object.PlotPlayer;
import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.MathMan;
import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.Argument; import com.plotsquared.general.commands.Argument;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import org.apache.commons.lang.StringUtils;
@CommandDeclaration( @CommandDeclaration(
command = "tp", command = "tp",
@ -84,7 +85,7 @@ public class TP extends SubCommand {
int index = 0; int index = 0;
if (a.contains(";")) { if (a.contains(";")) {
final String[] split = a.split(";"); 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]); index = Integer.parseInt(split[1]);
} }
a = split[0]; a = split[0];

View File

@ -20,18 +20,6 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; 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.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.FileOutputStream; import java.io.FileOutputStream;
@ -41,6 +29,22 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream; import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream; 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( @CommandDeclaration(
command = "template", command = "template",
permission = "plots.admin", permission = "plots.admin",

View File

@ -20,15 +20,6 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.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.io.File;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.Path; import java.nio.file.Path;
@ -37,6 +28,19 @@ import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashSet; 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( @CommandDeclaration(
command = "trim", command = "trim",
permission = "plots.admin", permission = "plots.admin",
@ -72,7 +76,7 @@ public class Trim extends SubCommand {
final ChunkLoc loc = new ChunkLoc(x, z); final ChunkLoc loc = new ChunkLoc(x, z);
empty.add(loc); empty.add(loc);
} catch (final Exception e) { } catch (final Exception e) {
PS.log("INVALID MCA: " + name); PS.debug("INVALID MCA: " + name);
} }
} else { } else {
final Path path = Paths.get(file.getPath()); final Path path = Paths.get(file.getPath());
@ -89,7 +93,7 @@ public class Trim extends SubCommand {
final ChunkLoc loc = new ChunkLoc(x, z); final ChunkLoc loc = new ChunkLoc(x, z);
empty.add(loc); empty.add(loc);
} catch (final Exception e) { } catch (final Exception e) {
PS.log("INVALID MCA: " + name); PS.debug("INVALID MCA: " + name);
} }
} }
} catch (final Exception e) { } catch (final Exception e) {
@ -156,7 +160,7 @@ public class Trim extends SubCommand {
} }
public static void sendMessage(final String message) { 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) { public PlotId getId(final String id) {

View File

@ -20,6 +20,8 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import java.util.UUID;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; 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.Argument;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.util.UUID;
@CommandDeclaration( @CommandDeclaration(
command = "trust", command = "trust",
aliases = {"t"}, aliases = {"t"},

View File

@ -20,6 +20,9 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import java.util.ArrayList;
import java.util.UUID;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot; 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.Argument;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.util.ArrayList;
import java.util.UUID;
@CommandDeclaration( @CommandDeclaration(
command = "undeny", command = "undeny",
aliases = {"ud"}, aliases = {"ud"},

View File

@ -20,6 +20,9 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import java.util.ArrayList;
import java.util.UUID;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot; 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.Argument;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.util.ArrayList;
import java.util.UUID;
// UNTRUST("untrust", "ut"), // UNTRUST("untrust", "ut"),
@CommandDeclaration( @CommandDeclaration(

View File

@ -20,15 +20,15 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; package com.intellectualcrafters.plot.commands;
import java.net.MalformedURLException;
import java.net.URL;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.net.MalformedURLException;
import java.net.URL;
@CommandDeclaration( @CommandDeclaration(
command = "update", command = "update",
permission = "plots.admin", permission = "plots.admin",

View File

@ -20,6 +20,10 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; 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.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.object.Plot; 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.Argument;
import com.plotsquared.general.commands.CommandDeclaration; import com.plotsquared.general.commands.CommandDeclaration;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
@CommandDeclaration( @CommandDeclaration(
command = "visit", command = "visit",
permission = "plots.visit", permission = "plots.visit",

View File

@ -20,6 +20,16 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; 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.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings; 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.Plot;
import com.intellectualcrafters.plot.object.PlotPlayer; import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.Rating; 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.object.BukkitPlayer;
import com.plotsquared.bukkit.util.bukkit.chat.FancyMessage; import com.plotsquared.bukkit.util.bukkit.chat.FancyMessage;
import com.plotsquared.general.commands.CommandDeclaration; 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( @CommandDeclaration(
command = "list", command = "list",
aliases = {"l"}, aliases = {"l"},
@ -357,7 +365,7 @@ public class list extends SubCommand {
ChatColor.translateAlternateColorCodes('&', ChatColor.translateAlternateColorCodes('&',
C.PLOT_INFO_MEMBERS.s().replaceAll("%members%", Info.getPlayerList(plot.getMembers()))))) C.PLOT_INFO_MEMBERS.s().replaceAll("%members%", Info.getPlayerList(plot.getMembers())))))
.color(ChatColor.GOLD); .color(ChatColor.GOLD);
String strFlags = StringUtils.join(plot.getSettings().flags.values(), ","); String strFlags = StringMan.join(plot.getSettings().flags.values(), ",");
if (strFlags.length() == 0) { if (strFlags.length() == 0) {
strFlags = C.NONE.s(); strFlags = C.NONE.s();
} }

View File

@ -20,17 +20,17 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.commands; 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.BufferedReader;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.net.URL; import java.net.URL;
import java.net.URLConnection; import java.net.URLConnection;
import java.util.ArrayList; 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( @CommandDeclaration(
command = "plugin", command = "plugin",
permission = "plots.use", permission = "plots.use",

View File

@ -20,16 +20,20 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.config; 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.ConfigurationSection;
import com.intellectualcrafters.configuration.file.YamlConfiguration; import com.intellectualcrafters.configuration.file.YamlConfiguration;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.StringMan;
import com.plotsquared.general.commands.CommandCaller; import com.plotsquared.general.commands.CommandCaller;
import org.bukkit.ChatColor;
import java.io.File;
import java.util.*;
/** /**
* Captions class. * Captions class.
@ -377,6 +381,7 @@ public enum C {
* Info * Info
*/ */
NONE("None", "Info"), NONE("None", "Info"),
UNKNOWN("Unknown", "Info"),
PLOT_UNOWNED("$2The current plot must have an owner to perform this action", "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_UNCLAIMED("$2Plot $1%s$2 is not yet claimed", "Info"),
PLOT_INFO_HEADER("$3&m---------&r $1INFO $3&m---------", false, "Info"), PLOT_INFO_HEADER("$3&m---------&r $1INFO $3&m---------", false, "Info"),
@ -672,13 +677,8 @@ public enum C {
return this.prefix; return this.prefix;
} }
/** public String formatted() {
* @return translated and color decoded return StringMan.replaceFromMap(s(), replacements);
*
* @see org.bukkit.ChatColor#translateAlternateColorCodes(char, String)
*/
public String translated() {
return ChatColor.translateAlternateColorCodes('&', this.s());
} }
public String getCat() { public String getCat() {

View File

@ -20,12 +20,12 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.config; package com.intellectualcrafters.plot.config;
import java.util.ArrayList;
import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.StringComparison; import com.intellectualcrafters.plot.util.StringComparison;
import java.util.ArrayList;
/** /**
* Main Configuration Utility * Main Configuration Utility
* *

View File

@ -20,14 +20,14 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.config; 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.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; 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 * Configuration Node
* *

View File

@ -20,12 +20,22 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.database; 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.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 * @author Citymonstret

View File

@ -20,14 +20,24 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.database; 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.ResultSet;
import java.sql.ResultSetMetaData; import java.sql.ResultSetMetaData;
import java.sql.SQLException; 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 * DB Functions

View File

@ -20,7 +20,11 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.database; 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 * Connects to and uses a MySQL database

View File

@ -20,19 +20,38 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.database; 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.PS;
import com.intellectualcrafters.plot.config.Settings; import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager; 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.object.comment.PlotComment;
import com.intellectualcrafters.plot.util.ClusterManager; import com.intellectualcrafters.plot.util.ClusterManager;
import com.intellectualcrafters.plot.util.StringMan; import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import org.bukkit.block.Biome;
import java.sql.*;
import java.util.*;
/** /**
* @author Citymonstret * @author Citymonstret
@ -111,7 +130,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); 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) { catch (SQLException e) {
e.printStackTrace(); 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 { try {
connection.commit(); connection.commit();
connection.setAutoCommit(true); connection.setAutoCommit(true);
@ -212,7 +231,7 @@ public class SQLManager implements AbstractDB {
}); });
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); 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 { try {
connection.commit(); connection.commit();
connection.setAutoCommit(true); connection.setAutoCommit(true);
@ -369,7 +388,7 @@ public class SQLManager implements AbstractDB {
last = subList.size(); last = subList.size();
preparedStmt.addBatch(); 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.executeBatch();
preparedStmt.clearParameters(); preparedStmt.clearParameters();
preparedStmt.close(); preparedStmt.close();
@ -378,7 +397,7 @@ public class SQLManager implements AbstractDB {
} catch (Exception e) { } catch (Exception e) {
if (Settings.DB.USE_MYSQL) { if (Settings.DB.USE_MYSQL) {
e.printStackTrace(); e.printStackTrace();
PS.log("&cERROR 1: " + " | " + objList.get(0).getClass().getCanonicalName()); PS.debug("&cERROR 1: " + " | " + objList.get(0).getClass().getCanonicalName());
} }
} }
try { try {
@ -410,14 +429,14 @@ public class SQLManager implements AbstractDB {
last = subList.size(); last = subList.size();
preparedStmt.addBatch(); 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.executeBatch();
preparedStmt.clearParameters(); preparedStmt.clearParameters();
preparedStmt.close(); preparedStmt.close();
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
PS.log("&cERROR 2: " + " | " + objList.get(0).getClass().getCanonicalName()); PS.debug("&cERROR 2: " + " | " + objList.get(0).getClass().getCanonicalName());
PS.log("&6[WARN] " + "Could not bulk save!"); PS.debug("&6[WARN] " + "Could not bulk save!");
try { try {
PreparedStatement preparedStmt = null; PreparedStatement preparedStmt = null;
String nonBulk = mod.getCreateSQL(); String nonBulk = mod.getCreateSQL();
@ -427,15 +446,15 @@ public class SQLManager implements AbstractDB {
mod.setSQL(preparedStmt, obj); mod.setSQL(preparedStmt, obj);
preparedStmt.addBatch(); preparedStmt.addBatch();
} catch (final Exception e3) { } 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.executeBatch();
preparedStmt.close(); preparedStmt.close();
} catch (Exception e3) { } catch (Exception e3) {
e3.printStackTrace(); e3.printStackTrace();
PS.log("&c[ERROR] " + "Failed to save all!"); PS.debug("&c[ERROR] " + "Failed to save all!");
} }
} }
if (whenDone != null) whenDone.run(); if (whenDone != null) whenDone.run();
@ -627,7 +646,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final Exception e) { } catch (final Exception e) {
e.printStackTrace(); 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(); stmt.close();
} catch (final Exception e) { } catch (final Exception e) {
e.printStackTrace(); 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; boolean add_constraint;
add_constraint = create == tables.length; add_constraint = create == tables.length;
PS.log("Creating tables"); PS.debug("Creating tables");
final Statement stmt = this.connection.createStatement(); final Statement stmt = this.connection.createStatement();
if (mysql) { 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"); 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(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); 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"} ) { 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"); 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()) { if (result.next()) {
PS.log("BACKING UP: " + table); PS.debug("BACKING UP: " + table);
result.close(); result.close();
statement.executeUpdate("CREATE TABLE " + table + "_tmp AS SELECT * FROM " + this.prefix + table + " GROUP BY plot_plot_id, user_uuid"); 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("DROP TABLE " + this.prefix + table);
statement.executeUpdate("CREATE TABLE " + this.prefix + table + " AS SELECT * FROM " + table + "_tmp"); statement.executeUpdate("CREATE TABLE " + this.prefix + table + " AS SELECT * FROM " + table + "_tmp");
statement.executeUpdate("DROP TABLE " + this.prefix + table + "_tmp"); statement.executeUpdate("DROP TABLE " + this.prefix + table + "_tmp");
PS.log("RESTORING: " + table); PS.debug("RESTORING: " + table);
} }
} }
statement.close(); statement.close();
@ -943,7 +962,7 @@ public class SQLManager implements AbstractDB {
} }
plot.getSettings().ratings.put(user, r.getInt("rating")); plot.getSettings().ratings.put(user, r.getInt("rating"));
} else { } 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) { if (plot != null) {
plot.getTrusted().add(user); plot.getTrusted().add(user);
} else { } 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) { if (plot != null) {
plot.getMembers().add(user); plot.getMembers().add(user);
} else { } 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) { if (plot != null) {
plot.getDenied().add(user); plot.getDenied().add(user);
} else { } 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<PlotId, Plot>()); newplots.put(plot.world, new HashMap<PlotId, Plot>());
} }
newplots.get(plot.world).put(plot.id, plot); 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"); final String alias = r.getString("alias");
if (alias != null) { if (alias != null) {
plot.getSettings().setAlias(alias); plot.getSettings().setAlias(alias);
@ -1083,18 +1094,18 @@ public class SQLManager implements AbstractDB {
Flag flag = new Flag(FlagManager.getFlag(element, true), ""); Flag flag = new Flag(FlagManager.getFlag(element, true), "");
flags.put(flag.getKey(), flag); flags.put(flag.getKey(), flag);
} else { } else {
PS.log("INVALID FLAG: " + element); PS.debug("INVALID FLAG: " + element);
} }
} }
} }
if (exception) { if (exception) {
PS.log("&cPlot " + id + " had an invalid flag. A fix has been attempted."); PS.debug("&cPlot " + id + " had an invalid flag. A fix has been attempted.");
PS.log("&c" + myflags); PS.debug("&c" + myflags);
setFlags(id, flags.values()); setFlags(id, flags.values());
} }
plot.getSettings().flags = flags; plot.getSettings().flags = flags;
} else { } 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; boolean invalidPlot = false;
for (final String worldname : noExist.keySet()) { for (final String worldname : noExist.keySet()) {
invalidPlot = true; 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) { 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) { } catch (final SQLException e) {
PS.log("&7[WARN] " + "Failed to load plots."); PS.debug("&7[WARN] " + "Failed to load plots.");
e.printStackTrace(); e.printStackTrace();
} }
return newplots; return newplots;
@ -1136,7 +1147,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); 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(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); 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(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); 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.executeUpdate();
stmt.close(); stmt.close();
} catch (final SQLException e) { } 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(); e.printStackTrace();
} }
} }
@ -1300,11 +1311,11 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PS.log("&c[ERROR] " + "FAILED TO PURGE WORLD '" + world + "'!"); PS.debug("&c[ERROR] " + "FAILED TO PURGE WORLD '" + world + "'!");
return; return;
} }
} }
PS.log("&6[INFO] " + "SUCCESSFULLY PURGED WORLD '" + world + "'!"); PS.debug("&6[INFO] " + "SUCCESSFULLY PURGED WORLD '" + world + "'!");
} }
@Override @Override
@ -1333,7 +1344,7 @@ public class SQLManager implements AbstractDB {
} }
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); 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.executeUpdate();
stmt.close(); stmt.close();
} catch (final SQLException e) { } 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(); e.printStackTrace();
} }
} }
@ -1399,7 +1410,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
r.close(); r.close();
} catch (final SQLException e) { } 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(); e.printStackTrace();
} }
return h; return h;
@ -1429,7 +1440,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); 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(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); 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(); statement.close();
set.close(); set.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PS.log("&7[WARN] " + "Failed to fetch comment"); PS.debug("&7[WARN] " + "Failed to fetch comment");
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -1524,7 +1535,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); 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(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); 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(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); 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.executeUpdate();
statement.close(); statement.close();
} catch (final SQLException e) { } 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(); e.printStackTrace();
} }
} }
@ -1598,7 +1609,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate(); statement.executeUpdate();
statement.close(); statement.close();
} catch (final SQLException e) { } 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(); e.printStackTrace();
} }
} }
@ -1617,7 +1628,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate(); statement.executeUpdate();
statement.close(); statement.close();
} catch (final SQLException e) { } 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(); e.printStackTrace();
} }
} }
@ -1637,7 +1648,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); 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.executeUpdate();
statement.close(); statement.close();
} catch (final SQLException e) { } 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(); e.printStackTrace();
} }
} }
@ -1677,7 +1688,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
set.close(); set.close();
} catch (final SQLException e) { } 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(); e.printStackTrace();
} }
return map; return map;
@ -1696,7 +1707,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate(); statement.executeUpdate();
statement.close(); statement.close();
} catch (final SQLException e) { } 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(); e.printStackTrace();
} }
} }
@ -1728,7 +1739,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); 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) { if (cluster != null) {
cluster.helpers.add(user); cluster.helpers.add(user);
} else { } 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) { if (cluster != null) {
cluster.invited.add(user); cluster.invited.add(user);
} else { } 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`"); r = stmt.executeQuery("SELECT * FROM `" + this.prefix + "cluster_settings`");
@ -1846,14 +1857,6 @@ public class SQLManager implements AbstractDB {
id = r.getInt("cluster_id"); id = r.getInt("cluster_id");
cluster = clusters.get(id); cluster = clusters.get(id);
if (cluster != null) { 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"); final String alias = r.getString("alias");
if (alias != null) { if (alias != null) {
cluster.settings.setAlias(alias); cluster.settings.setAlias(alias);
@ -1913,12 +1916,12 @@ public class SQLManager implements AbstractDB {
} }
} }
if (exception) { if (exception) {
PS.log("&cCluster " + id + " had an invalid flag. A fix has been attempted."); PS.debug("&cCluster " + id + " had an invalid flag. A fix has been attempted.");
PS.log("&c" + myflags); PS.debug("&c" + myflags);
} }
cluster.settings.flags = flags; cluster.settings.flags = flags;
} else { } 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(); stmt.close();
@ -1933,13 +1936,13 @@ public class SQLManager implements AbstractDB {
boolean invalidPlot = false; boolean invalidPlot = false;
for (final String w : noExist.keySet()) { for (final String w : noExist.keySet()) {
invalidPlot = true; 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) { 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) { } catch (final SQLException e) {
PS.log("&7[WARN] " + "Failed to load clusters."); PS.debug("&7[WARN] " + "Failed to load clusters.");
e.printStackTrace(); e.printStackTrace();
} }
return newClusters; return newClusters;
@ -1967,7 +1970,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); 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.executeUpdate();
stmt.close(); stmt.close();
} catch (final SQLException e) { } 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(); e.printStackTrace();
} }
} }
@ -2007,7 +2010,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); 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.executeUpdate();
statement.close(); statement.close();
} catch (final SQLException e) { } 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(); e.printStackTrace();
} }
} }
@ -2056,7 +2059,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final Exception e) { } catch (final Exception e) {
e.printStackTrace(); 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.executeUpdate();
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PS.log("&7[WARN] " + "Failed to rezize cluster " + current); PS.debug("&7[WARN] " + "Failed to rezize cluster " + current);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -2102,7 +2105,7 @@ public class SQLManager implements AbstractDB {
stmt.executeUpdate(); stmt.executeUpdate();
stmt.close(); stmt.close();
} catch (final SQLException e) { } 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(); e.printStackTrace();
} }
} }
@ -2151,7 +2154,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
r.close(); r.close();
} catch (final SQLException e) { } 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(); e.printStackTrace();
} }
return h; return h;
@ -2170,7 +2173,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); 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.executeUpdate();
statement.close(); statement.close();
} catch (final SQLException e) { } 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(); e.printStackTrace();
} }
} }

View File

@ -20,11 +20,15 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.database; package com.intellectualcrafters.plot.database;
import com.intellectualcrafters.plot.PS;
import java.io.File; import java.io.File;
import java.io.IOException; 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 * Connects to and uses a SQLite database
@ -58,7 +62,7 @@ public class SQLite extends Database {
try { try {
file.createNewFile(); file.createNewFile();
} catch (final IOException e) { } catch (final IOException e) {
PS.log("&cUnable to create database!"); PS.debug("&cUnable to create database!");
} }
} }
Class.forName("org.sqlite.JDBC"); Class.forName("org.sqlite.JDBC");

View File

@ -1,10 +1,10 @@
package com.intellectualcrafters.plot.database; package com.intellectualcrafters.plot.database;
import com.intellectualcrafters.plot.util.StringMan;
import java.sql.PreparedStatement; import java.sql.PreparedStatement;
import java.sql.SQLException; import java.sql.SQLException;
import com.intellectualcrafters.plot.util.StringMan;
public abstract class StmtMod<T> { public abstract class StmtMod<T> {
public abstract String getCreateMySQL(int size); public abstract String getCreateMySQL(int size);

View File

@ -20,15 +20,24 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.flag; 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.PS;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; 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.EventUtil;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import java.util.*;
/** /**
* Flag Manager Utility * Flag Manager Utility
* *
@ -91,7 +100,7 @@ public class FlagManager {
} }
public static boolean addFlag(AbstractFlag af, boolean reserved) { 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()) { for (PlotWorld plotworld : PS.get().getPlotWorldObjects()) {
Flag flag = ((HashMap<String, Flag>) plotworld.DEFAULT_FLAGS.clone()).get(af.getKey()); Flag flag = ((HashMap<String, Flag>) plotworld.DEFAULT_FLAGS.clone()).get(af.getKey());
if (flag != null) { if (flag != null) {

View File

@ -1,13 +1,13 @@
package com.intellectualcrafters.plot.flag; package com.intellectualcrafters.plot.flag;
import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.util.StringMan;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.util.StringMan;
/** /**
* Created 2014-11-17 for PlotSquared * Created 2014-11-17 for PlotSquared
* *

View File

@ -1,11 +1,16 @@
package com.intellectualcrafters.plot.generator; 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.MainUtil;
import com.intellectualcrafters.plot.util.SetBlockQueue; 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) * A plot manager with square plots which tesselate on a square grid with the following sections: ROAD, WALL, BORDER (wall), PLOT, FLOOR (plot)
*/ */

View File

@ -20,14 +20,6 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.generator; 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.File;
import java.io.IOException; import java.io.IOException;
import java.nio.file.Files; import java.nio.file.Files;
@ -35,6 +27,21 @@ import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; 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 { public class HybridPlotManager extends ClassicPlotManager {
@Override @Override

View File

@ -20,6 +20,9 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.generator; package com.intellectualcrafters.plot.generator;
import java.util.HashMap;
import java.util.HashSet;
import com.intellectualcrafters.configuration.ConfigurationSection; import com.intellectualcrafters.configuration.ConfigurationSection;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C; 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.Dimension;
import com.intellectualcrafters.plot.util.SchematicHandler.Schematic; import com.intellectualcrafters.plot.util.SchematicHandler.Schematic;
import java.util.HashMap;
import java.util.HashSet;
public class HybridPlotWorld extends ClassicPlotWorld { public class HybridPlotWorld extends ClassicPlotWorld {
public boolean ROAD_SCHEMATIC_ENABLED; public boolean ROAD_SCHEMATIC_ENABLED;
public short SCHEMATIC_HEIGHT; public short SCHEMATIC_HEIGHT;
@ -68,7 +68,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
try { try {
setupSchematics(); setupSchematics();
} catch (final Exception e) { } 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)) { 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; return;
} }
this.ROAD_SCHEMATIC_ENABLED = true; this.ROAD_SCHEMATIC_ENABLED = true;
@ -196,6 +196,8 @@ public class HybridPlotWorld extends ClassicPlotWorld {
return data; return data;
} }
// FIXME depends on block ids
// Possibly make abstract?
public static byte rotate(final short id, byte data) { public static byte rotate(final short id, byte data) {
switch (id) { switch (id) {
case 162: case 162:

View File

@ -1,16 +1,24 @@
package com.intellectualcrafters.plot.generator; package com.intellectualcrafters.plot.generator;
import java.io.File;
import java.util.HashMap;
import com.intellectualcrafters.jnbt.CompoundTag; import com.intellectualcrafters.jnbt.CompoundTag;
import com.intellectualcrafters.plot.PS; 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.BlockManager;
import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.ChunkManager;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.SchematicHandler; import com.intellectualcrafters.plot.util.SchematicHandler;
import java.io.File;
import java.util.HashMap;
public abstract class HybridUtils { public abstract class HybridUtils {
public static HybridUtils manager; public static HybridUtils manager;

View File

@ -5,7 +5,6 @@ import com.intellectualcrafters.plot.object.Location;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotId; import com.intellectualcrafters.plot.object.PlotId;
import com.intellectualcrafters.plot.object.PlotWorld; import com.intellectualcrafters.plot.object.PlotWorld;
import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.ChunkManager;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;

View File

@ -16,7 +16,7 @@ public abstract class SquarePlotWorld extends GridPlotWorld {
@Override @Override
public void loadConfiguration(final ConfigurationSection config) { public void loadConfiguration(final ConfigurationSection config) {
if (!config.contains("plot.height")) { 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.PLOT_WIDTH = config.getInt("plot.size");
this.ROAD_WIDTH = config.getInt("road.width"); this.ROAD_WIDTH = config.getInt("road.width");

View File

@ -20,8 +20,6 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.object; 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. * Wrapper class for blocks, using pure data rather than the object.

View File

@ -1,14 +1,16 @@
package com.intellectualcrafters.plot.object; 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.PS;
import com.intellectualcrafters.plot.commands.RequiredType; import com.intellectualcrafters.plot.commands.RequiredType;
import com.intellectualcrafters.plot.config.C; import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import com.intellectualcrafters.plot.util.PlotGamemode;
import java.util.HashMap; import com.intellectualcrafters.plot.util.PlotWeather;
import java.util.Set;
import java.util.UUID;
public class ConsolePlayer implements PlotPlayer { public class ConsolePlayer implements PlotPlayer {
@ -135,4 +137,27 @@ public class ConsolePlayer implements PlotPlayer {
return RequiredType.CONSOLE; 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) {}
} }

View File

@ -20,18 +20,18 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.object; 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.Collection;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.UUID; import java.util.UUID;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.util.ChunkManager;
import com.intellectualcrafters.plot.util.MainUtil;
/** /**
* The plot class * The plot class
* *

View File

@ -1,5 +1,13 @@
package com.intellectualcrafters.plot.object; 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.configuration.file.YamlConfiguration;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.Flag;
@ -9,14 +17,6 @@ import com.intellectualcrafters.plot.util.MathMan;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.bukkit.util.BukkitHybridUtils; 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 class PlotAnalysis {
public int changes; public int changes;
public int faces; public int faces;
@ -87,21 +87,21 @@ public class PlotAnalysis {
*/ */
public static void calcOptimalModifiers(final Runnable whenDone, final double threshold) { public static void calcOptimalModifiers(final Runnable whenDone, final double threshold) {
if (running) { if (running) {
PS.log("Calibration task already in progress!"); PS.debug("Calibration task already in progress!");
return; return;
} }
if (threshold <= 0 || threshold >= 1) { 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; return;
} }
running = true; running = true;
PS.log(" - Fetching all plots"); PS.debug(" - Fetching all plots");
final ArrayList<Plot> plots = new ArrayList<>(PS.get().getPlots()); final ArrayList<Plot> plots = new ArrayList<>(PS.get().getPlots());
TaskManager.runTaskAsync(new Runnable() { TaskManager.runTaskAsync(new Runnable() {
@Override @Override
public void run() { public void run() {
Iterator<Plot> iter = plots.iterator(); Iterator<Plot> 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()) { while (iter.hasNext()) {
Plot plot = iter.next(); Plot plot = iter.next();
if (plot.getSettings().ratings == null || plot.getSettings().ratings.size() == 0) { if (plot.getSettings().ratings == null || plot.getSettings().ratings.size() == 0) {
@ -111,10 +111,10 @@ public class PlotAnalysis {
MainUtil.runners.put(plot, 1); MainUtil.runners.put(plot, 1);
} }
} }
PS.log(" - | Reduced to " + plots.size() + " plots"); PS.debug(" - | Reduced to " + plots.size() + " plots");
if (plots.size() < 3) { 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; running = false;
for (Plot plot : plots) { for (Plot plot : plots) {
MainUtil.runners.remove(plot); MainUtil.runners.remove(plot);
@ -122,7 +122,7 @@ public class PlotAnalysis {
return; 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[] changes = new int[plots.size()];
final int[] faces = new int[plots.size()]; final int[] faces = new int[plots.size()];
@ -147,7 +147,7 @@ public class PlotAnalysis {
int i = mi.intValue(); int i = mi.intValue();
Plot plot = plots.get(i); Plot plot = plots.get(i);
ratings[i] = (int) ((plot.getAverageRating() + plot.getSettings().ratings.size()) * 100); 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) { if (queuePlot == null) {
break; break;
} }
PS.log(" | " + queuePlot); PS.debug(" | " + queuePlot);
final Object lock = new Object(); final Object lock = new Object();
TaskManager.runTask(new Runnable() { TaskManager.runTask(new Runnable() {
@Override @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 { try {
ratingAnalysis.join(); ratingAnalysis.join();
} catch (InterruptedException e) { } catch (InterruptedException e) {
e.printStackTrace(); 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++) { for (int i = 0; i < plots.size(); i++) {
Plot plot = plots.get(i); Plot plot = plots.get(i);
PS.log(" | " + plot); PS.debug(" | " + plot);
PlotAnalysis analysis = plot.getComplexity(); PlotAnalysis analysis = plot.getComplexity();
changes[i] = analysis.changes; changes[i] = analysis.changes;
@ -214,16 +214,16 @@ public class PlotAnalysis {
variety_sd[i] = analysis.variety_sd; variety_sd[i] = analysis.variety_sd;
} }
PS.log(" - $1Calculating rankings"); PS.debug(" - $1Calculating rankings");
int[] rank_ratings = rank(ratings); int[] rank_ratings = rank(ratings);
int n = rank_ratings.length; int n = rank_ratings.length;
int optimal_index = (int) Math.round((1 - threshold) * (n - 1)); int optimal_index = (int) Math.round((1 - threshold) * (n - 1));
PS.log(" - $1Calculating rank correlation: "); PS.debug(" - $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.debug(" - 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(" - The calculated correlation constant will then be used to calibrate the threshold for auto plot clearing");
int[] rank_changes = rank(changes); int[] rank_changes = rank(changes);
int[] sd_changes = getSD(rank_changes, rank_ratings); int[] sd_changes = getSD(rank_changes, rank_ratings);
@ -231,7 +231,7 @@ public class PlotAnalysis {
int sum_changes = sum(variance_changes); int sum_changes = sum(variance_changes);
double factor_changes = getCC(n, sum_changes); double factor_changes = getCC(n, sum_changes);
PlotAnalysis.MODIFIERS.changes = factor_changes == 1 ? 0 : (int) (factor_changes * 1000 / MathMan.getMean(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[] rank_faces = rank(faces);
int[] sd_faces = getSD(rank_faces, rank_ratings); int[] sd_faces = getSD(rank_faces, rank_ratings);
@ -239,7 +239,7 @@ public class PlotAnalysis {
int sum_faces = sum(variance_faces); int sum_faces = sum(variance_faces);
double factor_faces = getCC(n, sum_faces); double factor_faces = getCC(n, sum_faces);
PlotAnalysis.MODIFIERS.faces = factor_faces == 1 ? 0 : (int) (factor_faces * 1000 / MathMan.getMean(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[] rank_data = rank(data);
int[] sd_data = getSD(rank_data, rank_ratings); int[] sd_data = getSD(rank_data, rank_ratings);
@ -247,7 +247,7 @@ public class PlotAnalysis {
int sum_data = sum(variance_data); int sum_data = sum(variance_data);
double factor_data = getCC(n, sum_data); double factor_data = getCC(n, sum_data);
PlotAnalysis.MODIFIERS.data = factor_data == 1 ? 0 : (int) (factor_data * 1000 / MathMan.getMean(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[] rank_air = rank(air);
int[] sd_air = getSD(rank_air, rank_ratings); int[] sd_air = getSD(rank_air, rank_ratings);
@ -255,7 +255,7 @@ public class PlotAnalysis {
int sum_air = sum(variance_air); int sum_air = sum(variance_air);
double factor_air = getCC(n, sum_air); double factor_air = getCC(n, sum_air);
PlotAnalysis.MODIFIERS.air = factor_air == 1 ? 0 : (int) (factor_air * 1000 / MathMan.getMean(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[] rank_variety = rank(variety);
int[] sd_variety = getSD(rank_variety, rank_ratings); int[] sd_variety = getSD(rank_variety, rank_ratings);
@ -263,7 +263,7 @@ public class PlotAnalysis {
int sum_variety = sum(variance_variety); int sum_variety = sum(variance_variety);
double factor_variety = getCC(n, sum_variety); double factor_variety = getCC(n, sum_variety);
PlotAnalysis.MODIFIERS.variety = factor_variety == 1 ? 0 : (int) (factor_variety * 1000 / MathMan.getMean(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[] rank_changes_sd = rank(changes_sd);
int[] sd_changes_sd = getSD(rank_changes_sd, rank_ratings); 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); int sum_changes_sd = sum(variance_changes_sd);
double factor_changes_sd = getCC(n, sum_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)); 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[] rank_faces_sd = rank(faces_sd);
int[] sd_faces_sd = getSD(rank_faces_sd, rank_ratings); 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); int sum_faces_sd = sum(variance_faces_sd);
double factor_faces_sd = getCC(n, sum_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)); 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[] rank_data_sd = rank(data_sd);
int[] sd_data_sd = getSD(rank_data_sd, rank_ratings); 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); int sum_data_sd = sum(variance_data_sd);
double factor_data_sd = getCC(n, sum_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)); 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[] rank_air_sd = rank(air_sd);
int[] sd_air_sd = getSD(rank_air_sd, rank_ratings); 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); int sum_air_sd = sum(variance_air_sd);
double factor_air_sd = getCC(n, sum_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)); 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[] rank_variety_sd = rank(variety_sd);
int[] sd_variety_sd = getSD(rank_variety_sd, rank_ratings); 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); int sum_variety_sd = sum(variance_variety_sd);
double factor_variety_sd = getCC(n, sum_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)); 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]; int[] complexity = new int[n];
PS.log(" $1Calculating threshold"); PS.debug(" $1Calculating threshold");
int max = 0; int max = 0;
int min = 0; int min = 0;
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
@ -337,7 +337,7 @@ public class PlotAnalysis {
logln("Correlation: "); logln("Correlation: ");
logln(getCC(n, sum(square(getSD(rank_complexity, rank_ratings))))); logln(getCC(n, sum(square(getSD(rank_complexity, rank_ratings)))));
if (optimal_complexity == Integer.MAX_VALUE) { 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; running = false;
for (Plot plot : plots) { for (Plot plot : plots) {
MainUtil.runners.remove(plot); MainUtil.runners.remove(plot);
@ -356,7 +356,7 @@ public class PlotAnalysis {
} }
// Save calibration // Save calibration
PS.log(" $1Saving calibration"); PS.debug(" $1Saving calibration");
YamlConfiguration config = PS.get().config; YamlConfiguration config = PS.get().config;
config.set("clear.auto.threshold", optimal_complexity); config.set("clear.auto.threshold", optimal_complexity);
config.set("clear.auto.calibration.changes", PlotAnalysis.MODIFIERS.changes); config.set("clear.auto.calibration.changes", PlotAnalysis.MODIFIERS.changes);
@ -375,7 +375,7 @@ public class PlotAnalysis {
e.printStackTrace(); e.printStackTrace();
} }
PS.log("$1Done!"); PS.debug("$1Done!");
running = false; running = false;
for (Plot plot : plots) { for (Plot plot : plots) {
MainUtil.runners.remove(plot); MainUtil.runners.remove(plot);

View File

@ -1,10 +1,10 @@
package com.intellectualcrafters.plot.object; package com.intellectualcrafters.plot.object;
import com.intellectualcrafters.plot.database.DBFunc;
import java.util.HashSet; import java.util.HashSet;
import java.util.UUID; import java.util.UUID;
import com.intellectualcrafters.plot.database.DBFunc;
public class PlotCluster { public class PlotCluster {
public final String world; public final String world;
public PlotSettings settings; public PlotSettings settings;

View File

@ -1,14 +1,14 @@
package com.intellectualcrafters.plot.object; 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.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import java.util.UUID; 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 class PlotHandler {
public static HashSet<UUID> getOwners(Plot plot) { public static HashSet<UUID> getOwners(Plot plot) {
if (plot.owner == null) { if (plot.owner == null) {

View File

@ -1,5 +1,7 @@
package com.intellectualcrafters.plot.object; package com.intellectualcrafters.plot.object;
import com.intellectualcrafters.plot.util.BlockManager;
public class PlotItemStack { public class PlotItemStack {
public final int id; public final int id;
public final short data; public final short data;
@ -7,6 +9,7 @@ public class PlotItemStack {
public final String name; public final String name;
public final String[] lore; public final String[] lore;
@Deprecated
public PlotItemStack(int id, short data, int amount, String name, String... lore) { public PlotItemStack(int id, short data, int amount, String name, String... lore) {
this.id = id; this.id = id;
this.data = data; this.data = data;
@ -14,4 +17,13 @@ public class PlotItemStack {
this.name = name; this.name = name;
this.lore = lore; 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;
}
} }

View File

@ -20,13 +20,13 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.object; package com.intellectualcrafters.plot.object;
import com.intellectualcrafters.plot.commands.Template;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.HashSet; import java.util.HashSet;
import com.intellectualcrafters.plot.commands.Template;
public abstract class PlotManager { public abstract class PlotManager {
/* /*
* Plot locations (methods with Abs in them will not need to consider mega * Plot locations (methods with Abs in them will not need to consider mega

View File

@ -1,9 +1,11 @@
package com.intellectualcrafters.plot.object; package com.intellectualcrafters.plot.object;
import com.plotsquared.general.commands.CommandCaller;
import java.util.UUID; 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 * Created 2015-02-20 for PlotSquared
* *
@ -60,4 +62,18 @@ public interface PlotPlayer extends CommandCaller {
void setMeta(String key, Object value); void setMeta(String key, Object value);
Object getMeta(String key); Object getMeta(String key);
void deleteMeta(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);
} }

View File

@ -20,17 +20,17 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.object; 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.Flag;
import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.object.comment.PlotComment; import com.intellectualcrafters.plot.object.comment.PlotComment;
import com.intellectualcrafters.plot.util.BlockManager; import com.intellectualcrafters.plot.util.BlockManager;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.UUID;
/** /**
* plot settings * plot settings
* *

View File

@ -20,6 +20,11 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.object; 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.configuration.ConfigurationSection;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.Configuration; 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.Flag;
import com.intellectualcrafters.plot.flag.FlagManager; import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.util.EconHandler; import com.intellectualcrafters.plot.util.EconHandler;
import com.intellectualcrafters.plot.util.PlotGamemode;
import com.intellectualcrafters.plot.util.StringMan; 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 * @author Jesse Boyd
*/ */
@ -60,6 +61,7 @@ public abstract class PlotWorld {
public final static boolean WORLD_BORDER_DEFAULT = false; public final static boolean WORLD_BORDER_DEFAULT = false;
public final static int MAX_PLOT_MEMBERS_DEFAULT = 128; public final static int MAX_PLOT_MEMBERS_DEFAULT = 128;
public final static int MAX_BUILD_HEIGHT_DEFAULT = 256; public final static int MAX_BUILD_HEIGHT_DEFAULT = 256;
public final static PlotGamemode GAMEMODE_DEFAULT = PlotGamemode.CREATIVE;
// are plot clusters enabled // are plot clusters enabled
// require claim in cluster // require claim in cluster
// TODO make this configurable // TODO make this configurable
@ -95,6 +97,7 @@ public abstract class PlotWorld {
public boolean HOME_ALLOW_NONMEMBER; public boolean HOME_ALLOW_NONMEMBER;
public PlotLoc DEFAULT_HOME; public PlotLoc DEFAULT_HOME;
public int MAX_BUILD_HEIGHT; public int MAX_BUILD_HEIGHT;
public PlotGamemode GAMEMODE = PlotGamemode.CREATIVE;
public PlotWorld(final String worldname) { public PlotWorld(final String worldname) {
this.worldname = worldname; this.worldname = worldname;
@ -152,6 +155,26 @@ public abstract class PlotWorld {
this.WORLD_BORDER = config.getBoolean("world.border"); this.WORLD_BORDER = config.getBoolean("world.border");
this.MAX_BUILD_HEIGHT = config.getInt("world.max_height"); 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"); this.HOME_ALLOW_NONMEMBER = config.getBoolean("home.allow-nonmembers");
String homeDefault = config.getString("home.default"); String homeDefault = config.getString("home.default");
if (homeDefault.equalsIgnoreCase("side")) { if (homeDefault.equalsIgnoreCase("side")) {
@ -188,7 +211,7 @@ public abstract class PlotWorld {
this.DEFAULT_FLAGS = FlagManager.parseFlags(flags); this.DEFAULT_FLAGS = FlagManager.parseFlags(flags);
} catch (final Exception e) { } catch (final Exception e) {
e.printStackTrace(); 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.DEFAULT_FLAGS = new HashMap<>();
} }
this.PVP = config.getBoolean("event.pvp"); this.PVP = config.getBoolean("event.pvp");
@ -232,6 +255,7 @@ public abstract class PlotWorld {
options.put("home.default", "side"); options.put("home.default", "side");
options.put("home.allow-nonmembers", false); options.put("home.allow-nonmembers", false);
options.put("world.max_height", PlotWorld.MAX_BUILD_HEIGHT_DEFAULT); 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)) { if (Settings.ENABLE_CLUSTERS && (this.TYPE != 0)) {
options.put("generator.terrain", this.TERRAIN); options.put("generator.terrain", this.TERRAIN);

View File

@ -1,12 +1,12 @@
package com.intellectualcrafters.plot.object; package com.intellectualcrafters.plot.object;
import com.intellectualcrafters.plot.config.Settings;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map.Entry; import java.util.Map.Entry;
import com.intellectualcrafters.plot.config.Settings;
public class Rating { public class Rating {
/** /**
@ -14,6 +14,9 @@ public class Rating {
*/ */
private HashMap<String, Integer> ratingMap; private HashMap<String, Integer> ratingMap;
private boolean changed;
private int initial;
public Rating(int value) { public Rating(int value) {
ratingMap = new HashMap<>(); ratingMap = new HashMap<>();
if (Settings.RATING_CATEGORIES != null && Settings.RATING_CATEGORIES.size() > 1) { if (Settings.RATING_CATEGORIES != null && Settings.RATING_CATEGORIES.size() > 1) {
@ -25,6 +28,7 @@ public class Rating {
else { else {
ratingMap.put(null, value); ratingMap.put(null, value);
} }
this.initial = value;
} }
public List<String> getCategories() { public List<String> getCategories() {
@ -46,5 +50,30 @@ public class Rating {
return ratingMap.get(category); 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);
}
}
} }

View File

@ -1,5 +1,7 @@
package com.intellectualcrafters.plot.object.comment; package com.intellectualcrafters.plot.object.comment;
import java.util.ArrayList;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotHandler; 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.Permissions;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import java.util.ArrayList;
public class InboxOwner extends CommentInbox { public class InboxOwner extends CommentInbox {
@Override @Override

View File

@ -1,5 +1,7 @@
package com.intellectualcrafters.plot.object.comment; package com.intellectualcrafters.plot.object.comment;
import java.util.ArrayList;
import com.intellectualcrafters.plot.database.DBFunc; import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotHandler; 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.Permissions;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import java.util.ArrayList;
public class InboxPublic extends CommentInbox { public class InboxPublic extends CommentInbox {
@Override @Override

View File

@ -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 com.intellectualcrafters.plot.object.PlotPlayer;
import org.bukkit.ChatColor;
public abstract class AbstractTitle { public abstract class AbstractTitle {
public static AbstractTitle TITLE_CLASS; public static AbstractTitle TITLE_CLASS;
public static void sendTitle(PlotPlayer player, String head, String sub) { public static void sendTitle(PlotPlayer player, String head, String sub) {
if (ConsolePlayer.isConsole(player)) {
return;
}
if (TITLE_CLASS != null && !player.getAttribute("disabletitles")) { if (TITLE_CLASS != null && !player.getAttribute("disabletitles")) {
TITLE_CLASS.sendTitle(player, head, sub, 1, 2, 1); TITLE_CLASS.sendTitle(player, head, sub, 1, 2, 1);
} }

View File

@ -19,7 +19,7 @@ public abstract class BlockManager {
public abstract int getBiomeFromString(String biome); 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); public abstract int getHeighestBlock(String world, int x, int z);

View File

@ -1,9 +1,9 @@
package com.intellectualcrafters.plot.util; package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.object.ChunkLoc;
import java.util.Collection; import java.util.Collection;
import com.intellectualcrafters.plot.object.ChunkLoc;
public abstract class BlockUpdateUtil { public abstract class BlockUpdateUtil {
public static BlockUpdateUtil setBlockManager = null; public static BlockUpdateUtil setBlockManager = null;

View File

@ -1,12 +1,19 @@
package com.intellectualcrafters.plot.util; package com.intellectualcrafters.plot.util;
import com.intellectualcrafters.plot.object.*;
import com.intellectualcrafters.plot.util.SetBlockQueue.ChunkWrapper;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; 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 abstract class ChunkManager {
public static ChunkManager manager = null; public static ChunkManager manager = null;

Some files were not shown because too many files have changed in this diff Show More