# Conflicts:

#	Bukkit/src/main/java/com/plotsquared/bukkit/listeners/PlayerEvents.java

#	Bukkit/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_9.java
This commit is contained in:
Jesse Boyd
2016-05-13 03:04:43 +10:00
122 changed files with 1175 additions and 1478 deletions

View File

@ -4,10 +4,10 @@ package com.intellectualcrafters.configuration;
* Various settings for controlling the input and output of a {@link
* Configuration}
*/
public class ConfigurationOptions {
class ConfigurationOptions {
private final Configuration configuration;
private char pathSeparator = '.';
private boolean copyDefaults = false;
private final Configuration configuration;
protected ConfigurationOptions(final Configuration configuration) {
this.configuration = configuration;

View File

@ -76,8 +76,7 @@ public class MemorySection implements ConfigurationSection {
if (obj instanceof String) {
try {
return Double.parseDouble((String) obj);
} catch (NumberFormatException ignored) {
}
} catch (NumberFormatException ignored) {}
} else if (obj instanceof List) {
List<?> val = (List<?>) obj;
if (!val.isEmpty()) {
@ -94,8 +93,7 @@ public class MemorySection implements ConfigurationSection {
if (obj instanceof String) {
try {
return Integer.parseInt((String) obj);
} catch (NumberFormatException ignored) {
}
} catch (NumberFormatException ignored) {}
} else if (obj instanceof List) {
List<?> val = (List<?>) obj;
if (!val.isEmpty()) {
@ -112,8 +110,7 @@ public class MemorySection implements ConfigurationSection {
if (obj instanceof String) {
try {
return Long.parseLong((String) obj);
} catch (NumberFormatException ignored) {
}
} catch (NumberFormatException ignored) {}
} else if (obj instanceof List) {
List<?> val = (List<?>) obj;
if (!val.isEmpty()) {
@ -569,8 +566,7 @@ public class MemorySection implements ConfigurationSection {
} else if (object instanceof String) {
try {
result.add(Integer.valueOf((String) object));
} catch (NumberFormatException ignored) {
}
} catch (NumberFormatException ignored) {}
} else if (object instanceof Character) {
result.add((int) (Character) object);
} else if (object instanceof Number) {
@ -614,8 +610,7 @@ public class MemorySection implements ConfigurationSection {
} else if (object instanceof String) {
try {
result.add(Double.valueOf((String) object));
} catch (NumberFormatException ignored) {
}
} catch (NumberFormatException ignored) {}
} else if (object instanceof Character) {
result.add((double) (Character) object);
} else if (object instanceof Number) {
@ -638,8 +633,7 @@ public class MemorySection implements ConfigurationSection {
} else if (object instanceof String) {
try {
result.add(Float.valueOf((String) object));
} catch (NumberFormatException ignored) {
}
} catch (NumberFormatException ignored) {}
} else if (object instanceof Character) {
result.add((float) (Character) object);
} else if (object instanceof Number) {
@ -662,8 +656,7 @@ public class MemorySection implements ConfigurationSection {
} else if (object instanceof String) {
try {
result.add(Long.valueOf((String) object));
} catch (NumberFormatException ignored) {
}
} catch (NumberFormatException ignored) {}
} else if (object instanceof Character) {
result.add((long) (Character) object);
} else if (object instanceof Number) {
@ -686,8 +679,7 @@ public class MemorySection implements ConfigurationSection {
} else if (object instanceof String) {
try {
result.add(Byte.valueOf((String) object));
} catch (NumberFormatException ignored) {
}
} catch (NumberFormatException ignored) {}
} else if (object instanceof Character) {
result.add((byte) ((Character) object).charValue());
} else if (object instanceof Number) {
@ -733,8 +725,7 @@ public class MemorySection implements ConfigurationSection {
} else if (object instanceof String) {
try {
result.add(Short.valueOf((String) object));
} catch (NumberFormatException ignored) {
}
} catch (NumberFormatException ignored) {}
} else if (object instanceof Character) {
result.add((short) ((Character) object).charValue());
} else if (object instanceof Number) {

View File

@ -25,8 +25,7 @@ public abstract class FileConfiguration extends MemoryConfiguration {
/**
* Creates an empty {@link FileConfiguration} with no default values.
*/
public FileConfiguration() {
}
FileConfiguration() {}
/**
* Creates an empty {@link FileConfiguration} using the specified {@link
@ -54,9 +53,6 @@ public abstract class FileConfiguration extends MemoryConfiguration {
* @throws IllegalArgumentException Thrown when file is null.
*/
public void save(File file) throws IOException {
if (file == null) {
throw new NullPointerException("File cannot be null");
}
file.getParentFile().mkdirs();
String data = saveToString();
@ -65,30 +61,7 @@ public abstract class FileConfiguration extends MemoryConfiguration {
writer.write(data);
}
}
/**
* Saves this {@link FileConfiguration} to the specified location.
* <p>
* If the file does not exist, it will be created. If already exists, it
* will be overwritten. If it cannot be overwritten or created, an
* exception will be thrown.
* <p>
* This method will save using the system default encoding, or possibly
* using UTF8.
*
* @param file File to save to.
* @throws IOException Thrown when the given file cannot be written to for
* any reason.
* @throws IllegalArgumentException Thrown when file is null.
*/
public void save(String file) throws IOException {
if (file == null) {
throw new NullPointerException("File cannot be null");
}
save(new File(file));
}
/**
* Saves this {@link FileConfiguration} to a string, and returns it.
*

View File

@ -21,8 +21,8 @@ import java.util.Map;
* Note that this implementation is not synchronized.
*/
public class YamlConfiguration extends FileConfiguration {
protected static final String COMMENT_PREFIX = "# ";
protected static final String BLANK_CONFIG = "{}\n";
private static final String COMMENT_PREFIX = "# ";
private static final String BLANK_CONFIG = "{}\n";
private final DumperOptions yamlOptions = new DumperOptions();
private final Representer yamlRepresenter = new YamlRepresenter();
private final Yaml yaml = new Yaml(new YamlConstructor(), yamlRepresenter, yamlOptions);
@ -40,7 +40,7 @@ public class YamlConfiguration extends FileConfiguration {
* @return Resulting configuration
* @throws IllegalArgumentException Thrown if file is null
*/
public static YamlConfiguration loadConfiguration(final File file) {
public static YamlConfiguration loadConfiguration(File file) {
if (file == null) {
throw new NullPointerException("File cannot be null");
}
@ -51,7 +51,6 @@ public class YamlConfiguration extends FileConfiguration {
config.load(file);
} catch (InvalidConfigurationException | IOException ex) {
try {
file.getAbsolutePath();
File dest = new File(file.getAbsolutePath() + "_broken");
int i = 0;
while (dest.exists()) {
@ -126,7 +125,7 @@ public class YamlConfiguration extends FileConfiguration {
input = (Map<?, ?>) yaml.load(contents);
} catch (final YAMLException e) {
throw new InvalidConfigurationException(e);
} catch (final ClassCastException e) {
} catch (final ClassCastException ignored) {
throw new InvalidConfigurationException("Top level is not a Map.");
}
@ -164,7 +163,7 @@ public class YamlConfiguration extends FileConfiguration {
if (line.startsWith(COMMENT_PREFIX)) {
if (i > 0) {
result.append("\n");
result.append('\n');
}
if (line.length() > COMMENT_PREFIX.length()) {
@ -173,7 +172,7 @@ public class YamlConfiguration extends FileConfiguration {
foundHeader = true;
} else if (foundHeader && line.isEmpty()) {
result.append("\n");
result.append('\n');
} else if (foundHeader) {
readingHeader = false;
}
@ -189,9 +188,9 @@ public class YamlConfiguration extends FileConfiguration {
if (options().copyHeader()) {
final Configuration def = getDefaults();
if (def != null && def instanceof FileConfiguration) {
final FileConfiguration filedefaults = (FileConfiguration) def;
final String defaultsHeader = filedefaults.buildHeader();
if (def instanceof FileConfiguration) {
final FileConfiguration fileDefaults = (FileConfiguration) def;
final String defaultsHeader = fileDefaults.buildHeader();
if ((defaultsHeader != null) && !defaultsHeader.isEmpty()) {
return defaultsHeader;
@ -208,7 +207,7 @@ public class YamlConfiguration extends FileConfiguration {
boolean startedHeader = false;
for (int i = lines.length - 1; i >= 0; i--) {
builder.insert(0, "\n");
builder.insert(0, '\n');
if (startedHeader || !lines[i].isEmpty()) {
builder.insert(0, lines[i]);

View File

@ -7,7 +7,7 @@ package com.intellectualcrafters.configuration.file;
public class YamlConfigurationOptions extends FileConfigurationOptions {
private int indent = 2;
protected YamlConfigurationOptions(final YamlConfiguration configuration) {
YamlConfigurationOptions(final YamlConfiguration configuration) {
super(configuration);
}

View File

@ -11,7 +11,7 @@ import java.util.Map;
public class YamlConstructor extends SafeConstructor {
public YamlConstructor() {
YamlConstructor() {
yamlConstructors.put(Tag.MAP, new ConstructCustomObject());
}

View File

@ -9,7 +9,7 @@ import org.yaml.snakeyaml.representer.Representer;
import java.util.LinkedHashMap;
import java.util.Map;
public class YamlRepresenter extends Representer {
class YamlRepresenter extends Representer {
public YamlRepresenter() {
this.multiRepresenters.put(ConfigurationSection.class, new RepresentConfigurationSection());

View File

@ -17,8 +17,7 @@ import java.util.logging.Logger;
public class ConfigurationSerialization {
public static final String SERIALIZED_TYPE_KEY = "==";
private static final Map<String, Class<? extends ConfigurationSerializable>> aliases =
new HashMap<String, Class<? extends ConfigurationSerializable>>();
private static final Map<String, Class<? extends ConfigurationSerializable>> aliases = new HashMap<>();
private final Class<? extends ConfigurationSerializable> clazz;
protected ConfigurationSerialization(Class<? extends ConfigurationSerializable> clazz) {
@ -128,8 +127,7 @@ public class ConfigurationSerialization {
* @param clazz Class to unregister
*/
public static void unregisterClass(Class<? extends ConfigurationSerializable> clazz) {
while (aliases.values().remove(clazz)) {
}
while (aliases.values().remove(clazz)) {}
}
/**
@ -154,7 +152,7 @@ public class ConfigurationSerialization {
DelegateDeserialization delegate = clazz.getAnnotation(DelegateDeserialization.class);
if (delegate != null) {
if ((delegate.value() == null) || (delegate.value() == clazz)) {
if (delegate.value() == clazz) {
delegate = null;
} else {
return getAlias(delegate.value());
@ -182,9 +180,7 @@ public class ConfigurationSerialization {
}
return method;
} catch (NoSuchMethodException ex) {
return null;
} catch (SecurityException ex) {
} catch (NoSuchMethodException | SecurityException ignored) {
return null;
}
}
@ -192,9 +188,7 @@ public class ConfigurationSerialization {
protected Constructor<? extends ConfigurationSerializable> getConstructor() {
try {
return this.clazz.getConstructor(Map.class);
} catch (NoSuchMethodException ex) {
return null;
} catch (SecurityException ex) {
} catch (NoSuchMethodException | SecurityException ignored) {
return null;
}
}
@ -209,7 +203,7 @@ public class ConfigurationSerialization {
} else {
return result;
}
} catch (Throwable ex) {
} catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException ex) {
Logger.getLogger(ConfigurationSerialization.class.getName())
.log(Level.SEVERE, "Could not call method '" + method.toString() + "' of " + this.clazz
+ " for deserialization",
@ -222,7 +216,7 @@ public class ConfigurationSerialization {
protected ConfigurationSerializable deserializeViaCtor(Constructor<? extends ConfigurationSerializable> ctor, Map<String, ?> args) {
try {
return ctor.newInstance(args);
} catch (Throwable ex) {
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException | InstantiationException ex) {
Logger.getLogger(ConfigurationSerialization.class.getName())
.log(Level.SEVERE, "Could not call constructor '" + ctor.toString() + "' of " + this.clazz
+ " for deserialization",
@ -238,22 +232,17 @@ public class ConfigurationSerialization {
}
ConfigurationSerializable result = null;
Method method = getMethod("deserialize", true);
if (method != null) {
result = deserializeViaMethod(method, args);
}
if (result == null) {
method = getMethod("valueOf", true);
if (method != null) {
result = deserializeViaMethod(method, args);
}
}
if (result == null) {
Constructor<? extends ConfigurationSerializable> constructor = getConstructor();
if (constructor != null) {
result = deserializeViaCtor(constructor, args);
}

View File

@ -44,7 +44,7 @@ public final class ByteArrayTag extends Tag {
}
String name = getName();
String append = "";
if (name != null && !name.equals("")) {
if (name != null && !name.isEmpty()) {
append = "(\"" + getName() + "\")";
}
return "TAG_Byte_Array" + append + ": " + hex;

View File

@ -36,7 +36,7 @@ public final class ByteTag extends Tag {
public String toString() {
String name = getName();
String append = "";
if (name != null && !name.equals("")) {
if (name != null && !name.isEmpty()) {
append = "(\"" + getName() + "\")";
}
return "TAG_Byte" + append + ": " + this.value;

View File

@ -373,7 +373,7 @@ public final class CompoundTag extends Tag {
public String toString() {
String name = getName();
String append = "";
if (name != null && !name.equals("")) {
if (name != null && !name.isEmpty()) {
append = "(\"" + getName() + "\")";
}
StringBuilder bldr = new StringBuilder();

View File

@ -16,7 +16,7 @@ public class CompoundTagBuilder {
* Create a new instance.
*/
CompoundTagBuilder() {
this.entries = new HashMap<String, Tag>();
this.entries = new HashMap<>();
}
/**

View File

@ -36,7 +36,7 @@ public final class DoubleTag extends Tag {
public String toString() {
String name = getName();
String append = "";
if (name != null && !name.equals("")) {
if (name != null && !name.isEmpty()) {
append = "(\"" + getName() + "\")";
}
return "TAG_Double" + append + ": " + this.value;

View File

@ -8,8 +8,7 @@ public final class EndTag extends Tag {
/**
* Creates the tag.
*/
public EndTag() {
}
public EndTag() {}
@Override
public Object getValue() {

View File

@ -36,7 +36,7 @@ public final class FloatTag extends Tag {
public String toString() {
String name = getName();
String append = "";
if (name != null && !name.equals("")) {
if (name != null && !name.isEmpty()) {
append = "(\"" + getName() + "\")";
}
return "TAG_Float" + append + ": " + this.value;

View File

@ -48,7 +48,7 @@ public final class IntArrayTag extends Tag {
}
String name = getName();
String append = "";
if (name != null && !name.equals("")) {
if (name != null && !name.isEmpty()) {
append = "(\"" + getName() + "\")";
}
return "TAG_Int_Array" + append + ": " + hex;

View File

@ -36,7 +36,7 @@ public final class IntTag extends Tag {
public String toString() {
String name = getName();
String append = "";
if (name != null && !name.equals("")) {
if (name != null && !name.isEmpty()) {
append = "(\"" + getName() + "\")";
}
return "TAG_Int" + append + ": " + this.value;

View File

@ -378,7 +378,7 @@ public final class ListTag extends Tag {
public String toString() {
String name = getName();
String append = "";
if (name != null && !name.equals("")) {
if (name != null && !name.isEmpty()) {
append = "(\"" + getName() + "\")";
}
StringBuilder bldr = new StringBuilder();

View File

@ -23,7 +23,7 @@ public class ListTagBuilder {
ListTagBuilder(Class<? extends Tag> type) {
checkNotNull(type);
this.type = type;
this.entries = new ArrayList<Tag>();
this.entries = new ArrayList<>();
}
/**

View File

@ -36,7 +36,7 @@ public final class LongTag extends Tag {
public String toString() {
String name = getName();
String append = "";
if (name != null && !name.equals("")) {
if (name != null && !name.isEmpty()) {
append = "(\"" + getName() + "\")";
}
return "TAG_Long" + append + ": " + this.value;

View File

@ -16,8 +16,7 @@ public final class NBTConstants {
/**
* Default private constructor.
*/
private NBTConstants() {
}
private NBTConstants() {}
/**
* Convert a type ID to its corresponding {@link Tag} class.

View File

@ -10,8 +10,7 @@ public final class NBTUtils {
/**
* Default private constructor.
*/
private NBTUtils() {
}
private NBTUtils() {}
/**
* Gets the type name of a tag.

View File

@ -36,7 +36,7 @@ public final class ShortTag extends Tag {
public String toString() {
String name = getName();
String append = "";
if (name != null && !name.equals("")) {
if (name != null && !name.isEmpty()) {
append = "(\"" + getName() + "\")";
}
return "TAG_Short" + append + ": " + this.value;

View File

@ -40,7 +40,7 @@ public final class StringTag extends Tag {
public String toString() {
String name = getName();
String append = "";
if (name != null && !name.equals("")) {
if (name != null && !name.isEmpty()) {
append = "(\"" + getName() + "\")";
}
return "TAG_String" + append + ": " + this.value;

View File

@ -88,8 +88,7 @@ public class JSONObject {
for (String name : names) {
try {
putOnce(name, jo.opt(name));
} catch (JSONException ignore) {
}
} catch (JSONException ignore) {}
}
}
@ -194,8 +193,7 @@ public class JSONObject {
for (String name : names) {
try {
putOpt(name, c.getField(name).get(object));
} catch (JSONException | SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException ignore) {
}
} catch (JSONException | SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException ignore) {}
}
}
@ -461,8 +459,7 @@ public class JSONObject {
}
}
}
} catch (NumberFormatException ignore) {
}
} catch (NumberFormatException ignore) {}
}
return string;
}
@ -586,7 +583,7 @@ public class JSONObject {
return object.toString();
}
return new JSONObject(object);
} catch (JSONException exception) {
} catch (JSONException ignored) {
return null;
}
}
@ -734,7 +731,7 @@ public class JSONObject {
Object object = get(key);
try {
return object instanceof Number ? ((Number) object).doubleValue() : Double.parseDouble((String) object);
} catch (NumberFormatException e) {
} catch (NumberFormatException ignored) {
throw new JSONException("JSONObject[" + quote(key) + "] is not a number.");
}
}
@ -752,7 +749,7 @@ public class JSONObject {
Object object = get(key);
try {
return object instanceof Number ? ((Number) object).intValue() : Integer.parseInt((String) object);
} catch (NumberFormatException e) {
} catch (NumberFormatException ignored) {
throw new JSONException("JSONObject[" + quote(key) + "] is not an int.");
}
}
@ -804,7 +801,7 @@ public class JSONObject {
Object object = get(key);
try {
return object instanceof Number ? ((Number) object).longValue() : Long.parseLong((String) object);
} catch (NumberFormatException e) {
} catch (NumberFormatException ignored) {
throw new JSONException("JSONObject[" + quote(key) + "] is not a long.");
}
}
@ -953,7 +950,7 @@ public class JSONObject {
public boolean optBoolean(String key, boolean defaultValue) {
try {
return getBoolean(key);
} catch (JSONException e) {
} catch (JSONException ignored) {
return defaultValue;
}
}
@ -982,7 +979,7 @@ public class JSONObject {
public double optDouble(String key, double defaultValue) {
try {
return getDouble(key);
} catch (JSONException e) {
} catch (JSONException ignored) {
return defaultValue;
}
}
@ -1011,7 +1008,7 @@ public class JSONObject {
public int optInt(String key, int defaultValue) {
try {
return getInt(key);
} catch (JSONException e) {
} catch (JSONException ignored) {
return defaultValue;
}
}
@ -1066,7 +1063,7 @@ public class JSONObject {
public long optLong(String key, long defaultValue) {
try {
return getLong(key);
} catch (JSONException e) {
} catch (JSONException ignored) {
return defaultValue;
}
}
@ -1127,8 +1124,7 @@ public class JSONObject {
}
}
}
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ignore) {
}
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ignore) {}
}
}
@ -1330,7 +1326,7 @@ public class JSONObject {
}
}
return true;
} catch (Throwable exception) {
} catch (JSONException ignored) {
return false;
}
}
@ -1370,7 +1366,7 @@ public class JSONObject {
public String toString() {
try {
return this.toString(0);
} catch (JSONException e) {
} catch (JSONException ignored) {
return null;
}
}
@ -1476,7 +1472,7 @@ public class JSONObject {
protected final Object clone() {
try {
return super.clone();
} catch (CloneNotSupportedException e) {
} catch (CloneNotSupportedException ignored) {
return this;
}
}

View File

@ -12,5 +12,5 @@ public interface JSONString {
*
* @return A strictly syntactically correct JSON text.
*/
public String toJSONString();
String toJSONString();
}

View File

@ -342,7 +342,7 @@ public class JSONTokener {
}
back();
string = sb.toString().trim();
if (string != null && string.isEmpty()) {
if (string.isEmpty()) {
throw syntaxError("Missing value");
}
return JSONObject.stringToValue(string);
@ -370,7 +370,7 @@ public class JSONTokener {
index = startIndex;
character = startCharacter;
line = startLine;
return c;
return 0;
}
} while (c != to);
} catch (final IOException exception) {

View File

@ -245,8 +245,7 @@ class XML {
if (value.toString().equals(string)) {
return value;
}
} catch (NumberFormatException ignored) {
}
} catch (NumberFormatException ignored) {}
}
return string;
}

View File

@ -137,7 +137,7 @@ public class PS {
try {
URL url = PS.class.getProtectionDomain().getCodeSource().getLocation();
this.file = new File(new URL(url.toURI().toString().split("\\!")[0].replaceAll("jar:file", "file")).toURI().getPath());
} catch (MalformedURLException | URISyntaxException | SecurityException | NullPointerException e) {
} catch (MalformedURLException | URISyntaxException | SecurityException e) {
e.printStackTrace();
this.file = new File(this.IMP.getDirectory().getParentFile(), "PlotSquared.jar");
if (!this.file.exists()) {
@ -489,11 +489,10 @@ public class PS {
return areas[0];
} else if (id == null) {
return null;
} else {
for (PlotArea area : areas) {
if (StringMan.isEqual(id, area.id)) {
return area;
}
}
for (PlotArea area : areas) {
if (StringMan.isEqual(id, area.id)) {
return area;
}
}
return null;
@ -830,7 +829,7 @@ public class PS {
return result;
}
public ArrayList<Plot> sortPlotsByTemp(Collection<Plot> plots) {
public List<Plot> sortPlotsByTemp(Collection<Plot> plots) {
int max = 0;
int overflowCount = 0;
for (Plot plot : plots) {
@ -1474,7 +1473,7 @@ public class PS {
return;
}
if (type == 1) {
throw new IllegalArgumentException("Invalid type for multi-area world. Expected `2`, got `" + type + "`");
throw new IllegalArgumentException("Invalid type for multi-area world. Expected `2`, got `" + 1 + "`");
}
for (String areaId : areasSection.getKeys(false)) {
PS.log(C.PREFIX + "&3 - " + areaId);
@ -1762,7 +1761,7 @@ public class PS {
// Close the connection
DBFunc.close();
UUIDHandler.handleShutdown();
} catch (NullPointerException e) {
} catch (NullPointerException ignored) {
PS.log("&cCould not close database connection!");
}
}
@ -2100,7 +2099,7 @@ public class PS {
}
this.config = YamlConfiguration.loadConfiguration(this.configFile);
setupConfig();
} catch (IOException err_trans) {
} catch (IOException ignored) {
PS.log("Failed to save settings.yml");
}
try {
@ -2112,7 +2111,7 @@ public class PS {
}
this.storage = YamlConfiguration.loadConfiguration(this.storageFile);
setupStorage();
} catch (IOException err_trans) {
} catch (IOException ignored) {
PS.log("Failed to save storage.yml");
}
try {
@ -2124,7 +2123,7 @@ public class PS {
}
this.commands = YamlConfiguration.loadConfiguration(this.commandsFile);
setupStorage();
} catch (IOException err_trans) {
} catch (IOException ignored) {
PS.log("Failed to save commands.yml");
}
try {

View File

@ -112,7 +112,7 @@ public class Area extends SubCommand {
object.plotManager = "PlotSquared";
object.setupGenerator = "PlotSquared";
object.step = area.getSettingNodes();
final String path = "worlds." + area.worldname + ".areas." + area.id + "-" + object.min + "-" + object.max;
final String path = "worlds." + area.worldname + ".areas." + area.id + '-' + object.min + '-' + object.max;
Runnable run = new Runnable() {
@Override
public void run() {
@ -254,7 +254,7 @@ public class Area extends SubCommand {
}
};
if (hasConfirmation(player)) {
CmdConfirm.addPending(player, getCommandString() + " " + StringMan.join(args, " "), run);
CmdConfirm.addPending(player, getCommandString() + ' ' + StringMan.join(args, " "), run);
} else {
run.run();
}
@ -310,11 +310,11 @@ public class Area extends SubCommand {
int claimed = area.getPlotCount();
int clusters = area.getClusters().size();
String region;
String generator = area.getGenerator() + "";
String generator = String.valueOf(area.getGenerator());
if (area.TYPE == 2) {
PlotId min = area.getMin();
PlotId max = area.getMax();
name = area.worldname + ";" + area.id + ";" + min + ";" + max;
name = area.worldname + ';' + area.id + ';' + min + ';' + max;
int size = (max.x - min.x + 1) * (max.y - min.y + 1);
percent = claimed == 0 ? 0 : size / (double) claimed;
region = area.getRegion().toString();
@ -326,7 +326,7 @@ public class Area extends SubCommand {
String value = "&r$1NAME: " + name
+ "\n$1Type: $2" + area.TYPE
+ "\n$1Terrain: $2" + area.TERRAIN
+ "\n$1Usage: $2" + String.format("%.2f", percent) + "%"
+ "\n$1Usage: $2" + String.format("%.2f", percent) + '%'
+ "\n$1Claimed: $2" + claimed
+ "\n$1Clusters: $2" + clusters
+ "\n$1Region: $2" + region
@ -363,11 +363,11 @@ public class Area extends SubCommand {
int claimed = area.getPlotCount();
int clusters = area.getClusters().size();
String region;
String generator = area.getGenerator() + "";
String generator = String.valueOf(area.getGenerator());
if (area.TYPE == 2) {
PlotId min = area.getMin();
PlotId max = area.getMax();
name = area.worldname + ";" + area.id + ";" + min + ";" + max;
name = area.worldname + ';' + area.id + ';' + min + ';' + max;
int size = (max.x - min.x + 1) * (max.y - min.y + 1);
percent = claimed == 0 ? 0 : size / (double) claimed;
region = area.getRegion().toString();
@ -377,18 +377,18 @@ public class Area extends SubCommand {
region = "N/A";
}
PlotMessage tooltip = new PlotMessage()
.text("Claimed=").color("$1").text("" + claimed).color("$2")
.text("\nUsage=").color("$1").text(String.format("%.2f", percent) + "%").color("$2")
.text("\nClusters=").color("$1").text("" + clusters).color("$2")
.text("Claimed=").color("$1").text(String.valueOf(claimed)).color("$2")
.text("\nUsage=").color("$1").text(String.format("%.2f", percent) + '%').color("$2")
.text("\nClusters=").color("$1").text(String.valueOf(clusters)).color("$2")
.text("\nRegion=").color("$1").text(region).color("$2")
.text("\nGenerator=").color("$1").text(generator).color("$2");
// type / terrain
String visit = "/plot area tp " + area.toString();
message.text("[").color("$3")
.text(i + "").command(visit).tooltip(visit).color("$1")
.text(String.valueOf(i)).command(visit).tooltip(visit).color("$1")
.text("]").color("$3")
.text(" " + name).tooltip(tooltip).command(getCommandString() + " info " + area).color("$1").text(" - ")
.text(' ' + name).tooltip(tooltip).command(getCommandString() + " info " + area).color("$1").text(" - ")
.color("$2")
.text(area.TYPE + ":" + area.TERRAIN).color("$3");
}

View File

@ -72,7 +72,7 @@ public class Auto extends SubCommand {
if (args.length > 1) {
schematic = args[1];
}
} catch (NumberFormatException e) {
} catch (NumberFormatException ignored) {
size_x = 1;
size_z = 1;
schematic = args[0];

View File

@ -43,7 +43,7 @@ public class Buy extends SubCommand {
return false;
}
plots = plot.getConnectedPlots();
} catch (Exception e) {
} catch (Exception ignored) {
return sendMessage(plr, C.NOT_VALID_PLOT_ID);
}
} else {

View File

@ -27,7 +27,7 @@ public class Continue extends SubCommand {
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
return false;
}
if (!plot.getFlags().containsKey("done")) {
if (!plot.hasFlag(Flags.DONE)) {
MainUtil.sendMessage(plr, C.DONE_NOT_DONE);
return false;
}

View File

@ -18,6 +18,7 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map.Entry;
@CommandDeclaration(
@ -30,7 +31,7 @@ import java.util.Map.Entry;
usage = "/plots database [area] <sqlite|mysql|import>")
public class Database extends SubCommand {
public static void insertPlots(final SQLManager manager, final ArrayList<Plot> plots, final PlotPlayer player) {
public static void insertPlots(final SQLManager manager, final List<Plot> plots, final PlotPlayer player) {
TaskManager.runTaskAsync(new Runnable() {
@Override
public void run() {
@ -61,7 +62,7 @@ public class Database extends SubCommand {
MainUtil.sendMessage(player, "/plot database [area] <sqlite|mysql|import>");
return false;
}
ArrayList<Plot> plots;
List<Plot> plots;
PlotArea area = PS.get().getPlotAreaByString(args[0]);
if (area != null) {
plots = PS.get().sortPlotsByTemp(area.getPlots());

View File

@ -92,7 +92,7 @@ public class DebugClaimTest extends SubCommand {
}
if (uuid != null) {
MainUtil.sendMessage(plr, " - &aFound plot: " + plot.getId() + " : " + line);
plot.owner = uuid;
plot.setOwner(uuid);
plots.add(plot);
} else {
MainUtil.sendMessage(plr, " - &cInvalid PlayerName: " + plot.getId() + " : " + line);

View File

@ -80,8 +80,7 @@ public class DebugExec extends SubCommand {
this.engine.eval(script, this.scope);
}
}
} catch (IOException | ScriptException ignored) {
}
} catch (IOException | ScriptException ignored) {}
}
public ScriptEngine getEngine() {
@ -360,12 +359,7 @@ public class DebugExec extends SubCommand {
@Override
public void run(Integer i, File file, PlotMessage message) {
String name = file.getName();
message.text("[").color("$3")
.text(i + "").color("$1")
.text("]").color("$3")
.text(" " + name).color("$1");
message.text("[").color("$3").text(String.valueOf(i)).color("$1").text("]").color("$3").text(' ' + name).color("$1");
}
}, "/plot debugexec list-scripts", "List of scripts");
return true;

View File

@ -12,8 +12,6 @@ import com.intellectualcrafters.plot.util.Permissions;
import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.general.commands.CommandDeclaration;
import java.util.HashSet;
@CommandDeclaration(
command = "delete",
permission = "plots.delete",
@ -40,7 +38,7 @@ public class Delete extends SubCommand {
return !sendMessage(plr, C.NO_PLOT_PERMS);
}
final PlotArea plotworld = plot.getArea();
final HashSet<Plot> plots = plot.getConnectedPlots();
final java.util.Set<Plot> plots = plot.getConnectedPlots();
Runnable run = new Runnable() {
@Override
public void run() {
@ -57,7 +55,7 @@ public class Delete extends SubCommand {
double value = plotworld.PRICES.get("sell") * plots.size();
if (value > 0d) {
EconHandler.manager.depositMoney(plr, value);
sendMessage(plr, C.ADDED_BALANCE, value + "");
sendMessage(plr, C.ADDED_BALANCE, String.valueOf(value));
}
}
MainUtil.sendMessage(plr, C.CLEARING_DONE, System.currentTimeMillis() - start);

View File

@ -2,8 +2,6 @@ package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.flag.Flags;
import com.intellectualcrafters.plot.generator.HybridUtils;
import com.intellectualcrafters.plot.object.Location;
@ -34,7 +32,7 @@ public class Done extends SubCommand {
MainUtil.sendMessage(plr, C.NO_PLOT_PERMS);
return false;
}
if (plot.getFlags().containsKey("done")) {
if (plot.hasFlag(Flags.DONE)) {
MainUtil.sendMessage(plr, C.DONE_ALREADY_DONE);
return false;
}
@ -50,8 +48,7 @@ public class Done extends SubCommand {
plot.removeRunning();
if ((value == null) || (value.getComplexity() >= Settings.CLEAR_THRESHOLD)) {
long flagValue = System.currentTimeMillis() / 1000;
Flag flag = Flags.DONE;
FlagManager.addPlotFlag(plot, flag, flagValue);
plot.setFlag(Flags.DONE,flagValue);
MainUtil.sendMessage(plr, C.DONE_SUCCESS);
} else {
MainUtil.sendMessage(plr, C.DONE_INSUFFICIENT_COMPLEXITY);

View File

@ -31,11 +31,6 @@ import java.util.Map;
permission = "plots.flag")
public class FlagCmd extends SubCommand {
@Override
public String getUsage() {
return super.getUsage();
}
@Override
public boolean onCommand(PlotPlayer player, String[] args) {

View File

@ -5,6 +5,7 @@ import com.intellectualcrafters.plot.util.StringMan;
import com.plotsquared.general.commands.Command;
import java.io.File;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.util.ArrayList;
@ -58,7 +59,7 @@ public class GenerateDocs {
String comment = GenerateDocs.getComments(lines);
GenerateDocs.log("#### Description");
GenerateDocs.log("`" + command.getDescription() + "`");
GenerateDocs.log('`' + command.getDescription() + '`');
if (!comment.isEmpty()) {
GenerateDocs.log("##### Comments");
GenerateDocs.log("``` java");
@ -76,18 +77,18 @@ public class GenerateDocs {
GenerateDocs.log(" - `" + StringMan.join(usages, "`\n - `") + "` ");
GenerateDocs.log("");
} else {
GenerateDocs.log("`" + mainUsage + "` ");
GenerateDocs.log('`' + mainUsage + "` ");
}
if (command.getRequiredType() != RequiredType.NONE) {
GenerateDocs.log("#### Required callers");
GenerateDocs.log("`" + command.getRequiredType().name() + "`");
GenerateDocs.log('`' + command.getRequiredType().name() + '`');
}
List<String> aliases = command.getAliases();
if (!aliases.isEmpty()) {
GenerateDocs.log("#### Aliases");
GenerateDocs.log("`" + StringMan.getString(command.getAliases()) + "`");
GenerateDocs.log('`' + StringMan.getString(command.getAliases()) + '`');
}
GenerateDocs.log("#### Permissions");
@ -96,21 +97,21 @@ public class GenerateDocs {
GenerateDocs.log(" - `" + command.getPermission() + "` ");
GenerateDocs.log("");
GenerateDocs.log("##### Other");
GenerateDocs.log(" - `" + StringMan.join(perms, "`\n - `") + "`");
GenerateDocs.log(" - `" + StringMan.join(perms, "`\n - `") + '`');
GenerateDocs.log("");
} else {
GenerateDocs.log("`" + command.getPermission() + "` ");
GenerateDocs.log('`' + command.getPermission() + "` ");
}
GenerateDocs.log("***");
GenerateDocs.log("");
} catch (Exception e) {
} catch (IOException e) {
e.printStackTrace();
}
}
public static List<String> getUsage(String cmd, List<String> lines) {
Pattern p = Pattern.compile("\"([^\"]*)\"");
HashSet<String> usages = new HashSet<String>();
HashSet<String> usages = new HashSet<>();
for (String line : lines) {
if (line.contains("COMMAND_SYNTAX") && !line.contains("getUsage()")) {
Matcher m = p.matcher(line);
@ -203,7 +204,7 @@ public class GenerateDocs {
line = line.trim();
if (line.startsWith("/** ") || line.startsWith("*/ ") || line.startsWith("* ")) {
line = line.replaceAll("/[*][*] ", "").replaceAll("[*]/ ", "").replaceAll("[*] ", "").trim();
result.append(line + "\n");
result.append(line + '\n');
}
}
return result.toString().trim();

View File

@ -101,7 +101,7 @@ public class ListCmd extends SubCommand {
if (page < 0) {
page = 0;
}
} catch (Exception e) {
} catch (NumberFormatException ignored) {
page = -1;
}
}
@ -245,12 +245,10 @@ public class ListCmd extends SubCommand {
}
plots = new ArrayList<>();
for (Plot plot : PS.get().getPlots()) {
/*
Flag price = FlagManager.getPlotFlagRaw(plot, "price");
if (price != null) {
Optional<Double> price = plot.getFlag(Flags.PRICE);
if (price.isPresent()) {
plots.add(plot);
}
*/
}
break;
case "unowned":
@ -315,8 +313,7 @@ public class ListCmd extends SubCommand {
if (uuid == null) {
try {
uuid = UUID.fromString(args[0]);
} catch (Exception ignored) {
}
} catch (Exception ignored) {}
}
if (uuid != null) {
if (!Permissions.hasPermission(plr, "plots.list.player")) {

View File

@ -68,14 +68,14 @@ public class Load extends SubCommand {
String schematic;
try {
schematic = schematics.get(Integer.parseInt(args[0]) - 1);
} catch (NumberFormatException e) {
} catch (NumberFormatException ignored) {
// use /plot load <index>
MainUtil.sendMessage(plr, C.NOT_VALID_NUMBER, "(1, " + schematics.size() + ")");
MainUtil.sendMessage(plr, C.NOT_VALID_NUMBER, "(1, " + schematics.size() + ')');
return false;
}
final URL url;
try {
url = new URL(Settings.WEB_URL + "saves/" + plr.getUUID() + "/" + schematic + ".schematic");
url = new URL(Settings.WEB_URL + "saves/" + plr.getUUID() + '/' + schematic + ".schematic");
} catch (MalformedURLException e) {
e.printStackTrace();
MainUtil.sendMessage(plr, C.LOAD_FAILED);
@ -147,7 +147,7 @@ public class Load extends SubCommand {
}
String time = secToTime((System.currentTimeMillis() / 1000) - Long.parseLong(split[0]));
String world = split[1];
PlotId id = PlotId.fromString(split[2] + ";" + split[3]);
PlotId id = PlotId.fromString(split[2] + ';' + split[3]);
String size = split[4];
String server = split[5].replaceAll(".schematic", "");
String color;
@ -157,7 +157,7 @@ public class Load extends SubCommand {
color = "$1";
}
MainUtil.sendMessage(player,
"$3[$2" + (i + 1) + "$3] " + color + time + "$3 | " + color + world + ";" + id + "$3 | " + color + size + "x" + size);
"$3[$2" + (i + 1) + "$3] " + color + time + "$3 | " + color + world + ';' + id + "$3 | " + color + size + 'x' + size);
} catch (Exception e) {
e.printStackTrace();
}

View File

@ -14,7 +14,6 @@ import com.intellectualcrafters.plot.util.StringMan;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.CommandDeclaration;
import java.util.HashSet;
import java.util.UUID;
@CommandDeclaration(command = "merge",
@ -74,7 +73,7 @@ public class Merge extends SubCommand {
final PlotArea plotworld = plot.getArea();
final double price = plotworld.PRICES.containsKey("merge") ? plotworld.PRICES.get("merge") : 0;
if (EconHandler.manager != null && plotworld.USE_ECONOMY && price > 0d && EconHandler.manager.getMoney(plr) < price) {
sendMessage(plr, C.CANNOT_AFFORD_MERGE, price + "");
sendMessage(plr, C.CANNOT_AFFORD_MERGE, String.valueOf(price));
return false;
}
final int size = plot.getConnectedPlots().size();
@ -108,7 +107,7 @@ public class Merge extends SubCommand {
if (plot.autoMerge(-1, maxSize, uuid, terrain)) {
if (EconHandler.manager != null && plotworld.USE_ECONOMY && price > 0d) {
EconHandler.manager.withdrawMoney(plr, price);
sendMessage(plr, C.REMOVED_BALANCE, price + "");
sendMessage(plr, C.REMOVED_BALANCE, String.valueOf(price));
}
MainUtil.sendMessage(plr, C.SUCCESS_MERGE);
return true;
@ -138,7 +137,7 @@ public class Merge extends SubCommand {
if (plot.autoMerge(direction, maxSize - size, uuid, terrain)) {
if (EconHandler.manager != null && plotworld.USE_ECONOMY && price > 0d) {
EconHandler.manager.withdrawMoney(plr, price);
sendMessage(plr, C.REMOVED_BALANCE, price + "");
sendMessage(plr, C.REMOVED_BALANCE, String.valueOf(price));
}
MainUtil.sendMessage(plr, C.SUCCESS_MERGE);
return true;
@ -152,7 +151,7 @@ public class Merge extends SubCommand {
MainUtil.sendMessage(plr, C.NO_PERMISSION, C.PERMISSION_MERGE_OTHER);
return false;
}
HashSet<UUID> uuids = adjacent.getOwners();
java.util.Set<UUID> uuids = adjacent.getOwners();
boolean isOnline = false;
for (final UUID owner : uuids) {
final PlotPlayer accepter = UUIDHandler.getPlayer(owner);
@ -173,11 +172,11 @@ public class Merge extends SubCommand {
}
if (EconHandler.manager != null && plotworld.USE_ECONOMY && price > 0d) {
if (EconHandler.manager.getMoney(plr) < price) {
sendMessage(plr, C.CANNOT_AFFORD_MERGE, price + "");
sendMessage(plr, C.CANNOT_AFFORD_MERGE, String.valueOf(price));
return;
}
EconHandler.manager.withdrawMoney(plr, price);
sendMessage(plr, C.REMOVED_BALANCE, price + "");
sendMessage(plr, C.REMOVED_BALANCE, String.valueOf(price));
}
MainUtil.sendMessage(plr, C.SUCCESS_MERGE);
}

View File

@ -11,7 +11,7 @@ import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler;
import com.plotsquared.general.commands.CommandDeclaration;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
@CommandDeclaration(
@ -27,15 +27,14 @@ public class Owner extends SetCommand {
@Override
public boolean set(final PlotPlayer plr, final Plot plot, String value) {
HashSet<Plot> plots = plot.getConnectedPlots();
Set<Plot> plots = plot.getConnectedPlots();
UUID uuid = null;
String name = null;
if (value.length() == 36) {
try {
uuid = UUID.fromString(value);
name = MainUtil.getName(uuid);
} catch (Exception ignored) {
}
} catch (Exception ignored) {}
} else {
uuid = UUIDHandler.getUUID(value, null);
name = UUIDHandler.getName(uuid);
@ -43,7 +42,7 @@ public class Owner extends SetCommand {
}
if (uuid == null) {
if (value.equalsIgnoreCase("none")) {
HashSet<Plot> connected = plot.getConnectedPlots();
Set<Plot> connected = plot.getConnectedPlots();
plot.unlinkPlot(false, false);
for (Plot current : connected) {
current.unclaim();

View File

@ -4,6 +4,7 @@ import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.flag.Flags;
import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotInventory;
import com.intellectualcrafters.plot.object.PlotItemStack;
@ -61,7 +62,7 @@ public class Rate extends SubCommand {
});
UUID uuid = player.getUUID();
for (Plot p : plots) {
if ((!Settings.REQUIRE_DONE || p.getFlags().containsKey("done")) && p.isBasePlot() && (p.hasRatings() || !p.getRatings()
if ((!Settings.REQUIRE_DONE || p.hasFlag(Flags.DONE)) && p.isBasePlot() && (p.hasRatings() || !p.getRatings()
.containsKey(uuid)) && !p.isAdded(uuid)) {
p.teleportPlayer(player);
MainUtil.sendMessage(player, C.RATE_THIS);
@ -84,7 +85,7 @@ public class Rate extends SubCommand {
sendMessage(player, C.RATING_NOT_YOUR_OWN);
return false;
}
if (Settings.REQUIRE_DONE && !plot.getFlags().containsKey("done")) {
if (Settings.REQUIRE_DONE && !plot.hasFlag(Flags.DONE)) {
sendMessage(player, C.RATING_NOT_DONE);
return false;
}

View File

@ -47,7 +47,7 @@ public class RegenAllRoads extends SubCommand {
}
String name = args[0];
PlotManager manager = area.getPlotManager();
if ((manager == null) || !(manager instanceof HybridPlotManager)) {
if (!(manager instanceof HybridPlotManager)) {
MainUtil.sendMessage(plr, C.NOT_VALID_PLOT_WORLD);
return false;
}

View File

@ -1,6 +1,7 @@
package com.intellectualcrafters.plot.commands;
import com.intellectualcrafters.configuration.ConfigurationSection;
import com.intellectualcrafters.configuration.InvalidConfigurationException;
import com.intellectualcrafters.configuration.MemorySection;
import com.intellectualcrafters.configuration.file.YamlConfiguration;
import com.intellectualcrafters.plot.PS;
@ -11,6 +12,7 @@ import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.util.MainUtil;
import com.plotsquared.general.commands.CommandDeclaration;
import java.io.IOException;
import java.util.Objects;
@CommandDeclaration(command = "reload",
@ -77,7 +79,7 @@ public class Reload extends SubCommand {
});
PS.get().config.save(PS.get().configFile);
MainUtil.sendMessage(plr, C.RELOADED_CONFIGS);
} catch (Exception e) {
} catch (InvalidConfigurationException | IOException e) {
e.printStackTrace();
MainUtil.sendMessage(plr, C.RELOAD_FAILED);
}

View File

@ -65,8 +65,8 @@ public class Setup extends SubCommand {
if (object.setup_index > 0) {
object.setup_index--;
ConfigurationNode node = object.step[object.setup_index];
sendMessage(plr, C.SETUP_STEP, object.setup_index + 1 + "", node.getDescription(), node.getType().getType(),
node.getDefaultValue() + "");
sendMessage(plr, C.SETUP_STEP, object.setup_index + 1, node.getDescription(), node.getType().getType(),
String.valueOf(node.getDefaultValue()));
return false;
} else if (object.current > 0) {
object.current--;
@ -127,8 +127,8 @@ public class Setup extends SubCommand {
return true;
}
ConfigurationNode step = object.step[object.setup_index];
sendMessage(plr, C.SETUP_STEP, object.setup_index + 1 + "", step.getDescription(), step.getType().getType(),
step.getDefaultValue() + "");
sendMessage(plr, C.SETUP_STEP, object.setup_index + 1, step.getDescription(), step.getType().getType(),
String.valueOf(step.getDefaultValue()));
} else {
if (gen.isFull()) {
object.plotManager = object.setupGenerator;
@ -216,8 +216,8 @@ public class Setup extends SubCommand {
.getNewPlotArea("CheckingPlotSquaredGenerator", null, null, null).getSettingNodes();
}
ConfigurationNode step = object.step[object.setup_index];
sendMessage(plr, C.SETUP_STEP, object.setup_index + 1 + "", step.getDescription(), step.getType().getType(),
step.getDefaultValue() + "");
sendMessage(plr, C.SETUP_STEP, object.setup_index + 1, step.getDescription(), step.getType().getType(),
String.valueOf(step.getDefaultValue()));
break;
}
case 6: // world setup
@ -229,8 +229,8 @@ public class Setup extends SubCommand {
}
ConfigurationNode step = object.step[object.setup_index];
if (args.length < 1) {
sendMessage(plr, C.SETUP_STEP, object.setup_index + 1 + "", step.getDescription(), step.getType().getType(),
step.getDefaultValue() + "");
sendMessage(plr, C.SETUP_STEP, object.setup_index + 1, step.getDescription(), step.getType().getType(),
String.valueOf(step.getDefaultValue()));
return false;
}
boolean valid = step.isValid(args[0]);
@ -243,13 +243,13 @@ public class Setup extends SubCommand {
return false;
}
step = object.step[object.setup_index];
sendMessage(plr, C.SETUP_STEP, object.setup_index + 1 + "", step.getDescription(), step.getType().getType(),
step.getDefaultValue() + "");
sendMessage(plr, C.SETUP_STEP, object.setup_index + 1, step.getDescription(), step.getType().getType(),
String.valueOf(step.getDefaultValue()));
return false;
} else {
sendMessage(plr, C.SETUP_INVALID_ARG, args[0], step.getConstant());
sendMessage(plr, C.SETUP_STEP, object.setup_index + 1 + "", step.getDescription(), step.getType().getType(),
step.getDefaultValue() + "");
sendMessage(plr, C.SETUP_STEP, object.setup_index + 1, step.getDescription(), step.getType().getType(),
String.valueOf(step.getDefaultValue()));
return false;
}
case 7:

View File

@ -52,15 +52,7 @@ public class Trim extends SubCommand {
String name = file.getName();
if (name.endsWith("mca")) {
if (file.getTotalSpace() <= 8192) {
try {
String[] split = name.split("\\.");
int x = Integer.parseInt(split[1]);
int z = Integer.parseInt(split[2]);
ChunkLoc loc = new ChunkLoc(x, z);
empty.add(loc);
} catch (NumberFormatException e) {
PS.debug("INVALID MCA: " + name);
}
checkMca(name);
} else {
Path path = Paths.get(file.getPath());
try {
@ -69,24 +61,26 @@ public class Trim extends SubCommand {
long modification = file.lastModified();
long diff = Math.abs(creation - modification);
if (diff < 10000) {
try {
String[] split = name.split("\\.");
int x = Integer.parseInt(split[1]);
int z = Integer.parseInt(split[2]);
ChunkLoc loc = new ChunkLoc(x, z);
empty.add(loc);
} catch (Exception e) {
PS.debug("INVALID MCA: " + name);
}
checkMca(name);
}
} catch (IOException ignored) {
}
} catch (IOException ignored) {}
}
}
}
Trim.TASK = false;
TaskManager.runTaskAsync(whenDone);
}
private void checkMca(String name) {
try {
String[] split = name.split("\\.");
int x = Integer.parseInt(split[1]);
int z = Integer.parseInt(split[2]);
ChunkLoc loc = new ChunkLoc(x, z);
empty.add(loc);
} catch (NumberFormatException ignored) {
PS.debug("INVALID MCA: " + name);
}
}
});
Trim.TASK = true;
return true;

View File

@ -41,7 +41,7 @@ public class Update extends SubCommand {
MainUtil.sendMessage(plr, "&cTo manually specify an update URL: /plot update <url>");
return false;
}
if (PS.get().update(null, url) && (url == PS.get().update)) {
if (PS.get().update(plr, url) && (url == PS.get().update)) {
PS.get().update = null;
}
return true;

View File

@ -92,7 +92,7 @@ public class Visit extends SubCommand {
sendMessage(player, C.NOT_VALID_NUMBER, "(1, " + unsorted.size() + ")");
return false;
}
ArrayList<Plot> plots = PS.get().sortPlotsByTemp(unsorted);
List<Plot> plots = PS.get().sortPlotsByTemp(unsorted);
Plot plot = plots.get(page - 1);
if (!plot.hasOwner()) {
if (!Permissions.hasPermission(player, "plots.visit.unowned")) {

View File

@ -7,6 +7,7 @@ import com.intellectualcrafters.plot.util.StringMan;
import com.plotsquared.general.commands.CommandCaller;
import java.io.File;
import java.io.IOException;
import java.util.EnumSet;
import java.util.HashMap;
import java.util.HashSet;
@ -730,7 +731,7 @@ public enum C {
if (!split[0].equalsIgnoreCase(caption.category)) {
changed = true;
yml.set(key, null);
yml.set(caption.category + "." + caption.name().toLowerCase(), value);
yml.set(caption.category + '.' + caption.name().toLowerCase(), value);
}
captions.add(caption);
caption.s = value;
@ -747,7 +748,7 @@ public enum C {
// HashMap<String, String> replacements = new HashMap<>();
replacements.clear();
for (String style : styles) {
replacements.put("$" + style, "\u00a7" + config.getString(style));
replacements.put('$' + style, '§' + config.getString(style));
}
for (char letter : "1234567890abcdefklmnor".toCharArray()) {
replacements.put("&" + letter, "\u00a7" + letter);
@ -761,14 +762,14 @@ public enum C {
continue;
}
changed = true;
yml.set(caption.category + "." + caption.name().toLowerCase(), caption.def);
yml.set(caption.category + '.' + caption.name().toLowerCase(), caption.def);
}
caption.s = StringMan.replaceFromMap(caption.s, replacements);
}
if (changed) {
yml.save(file);
}
} catch (Exception e) {
} catch (IOException | IllegalArgumentException e) {
e.printStackTrace();
}
}

View File

@ -41,7 +41,7 @@ public class Configuration {
try {
Integer.parseInt(string);
return true;
} catch (Exception e) {
} catch (NumberFormatException ignored) {
return false;
}
}
@ -54,12 +54,8 @@ public class Configuration {
public static final SettingValue<Boolean> BOOLEAN = new SettingValue<Boolean>("BOOLEAN") {
@Override
public boolean validateValue(String string) {
try {
Boolean.parseBoolean(string);
return true;
} catch (Exception e) {
return false;
}
Boolean.parseBoolean(string);
return true;
}
@Override
@ -73,7 +69,7 @@ public class Configuration {
try {
Double.parseDouble(string);
return true;
} catch (Exception e) {
} catch (NumberFormatException ignored) {
return false;
}
}
@ -89,7 +85,7 @@ public class Configuration {
try {
int biome = WorldUtil.IMP.getBiomeFromString(string.toUpperCase());
return biome != -1;
} catch (Exception e) {
} catch (Exception ignored) {
return false;
}
}
@ -134,7 +130,7 @@ public class Configuration {
}
}
return true;
} catch (NumberFormatException e) {
} catch (NumberFormatException ignored) {
return false;
}
}
@ -166,8 +162,7 @@ public class Configuration {
if (result != null && result.match < 2) {
values[i] = result.best;
}
} catch (NumberFormatException ignored) {
}
} catch (NumberFormatException ignored) {}
}
int gcd = gcd(counts);
for (int i = 0; i < counts.length; i++) {

View File

@ -36,7 +36,7 @@ public interface AbstractDB {
* @param plots Plots for which the default table entries should be created
* @param whenDone
*/
void createPlotsAndData(ArrayList<Plot> plots, Runnable whenDone);
void createPlotsAndData(List<Plot> plots, Runnable whenDone);
/**
* Create a plot

View File

@ -81,7 +81,7 @@ public class DBFunc {
*
* @param plots List containing all plot objects
*/
public static void createPlotsAndData(ArrayList<Plot> plots, Runnable whenDone) {
public static void createPlotsAndData(List<Plot> plots, Runnable whenDone) {
DBFunc.dbManager.createPlotsAndData(plots, whenDone);
}

View File

@ -39,7 +39,7 @@ public class SQLite extends Database {
if (!file.exists()) {
try {
file.createNewFile();
} catch (IOException e) {
} catch (IOException ignored) {
PS.debug("&cUnable to create database!");
}
}

View File

@ -12,9 +12,9 @@ public abstract class StmtMod<T> {
public String getCreateMySQL(int size, String query, int params) {
StringBuilder statement = new StringBuilder(query);
for (int i = 0; i < size - 1; i++) {
statement.append("(").append(StringMan.repeat(",?", params).substring(1)).append("),");
statement.append('(').append(StringMan.repeat(",?", params).substring(1)).append("),");
}
statement.append("(").append(StringMan.repeat(",?", params).substring(1)).append(")");
statement.append('(').append(StringMan.repeat(",?", params).substring(1)).append(')');
return statement.toString();
}
@ -22,7 +22,7 @@ public abstract class StmtMod<T> {
StringBuilder statement = new StringBuilder(query);
String modParams = StringMan.repeat(",?", params).substring(1);
for (int i = 0; i < size - 1; i++) {
statement.append("UNION SELECT ").append(modParams).append(" ");
statement.append("UNION SELECT ").append(modParams).append(' ');
}
return statement.toString();
}

View File

@ -4,7 +4,7 @@ import com.intellectualcrafters.plot.object.Plot;
public class Flag<V> {
private String name;
private final String name;
/**
* Flag object used to store basic information for a Plot. Flags are a

View File

@ -94,9 +94,8 @@ public class FlagManager {
public static String toString(HashMap<Flag<?>, Object> flags) {
StringBuilder flag_string = new StringBuilder();
int i = 0;
Flag<?> flag;
for (Map.Entry<Flag<?>, Object> entry : flags.entrySet()) {
flag = entry.getKey();
Flag<?> flag = entry.getKey();
if (i != 0) {
flag_string.append(",");
}
@ -163,7 +162,7 @@ public class FlagManager {
* @param plot
* @return set of flags
*/
public static HashMap<Flag<?>, Object> getPlotFlags(Plot plot) {
public static Map<Flag<?>, Object> getPlotFlags(Plot plot) {
if (!plot.hasOwner()) {
return null;
}
@ -189,7 +188,7 @@ public class FlagManager {
return flags;
}
public static HashMap<Flag<?>, Object> getSettingFlags(PlotArea area, PlotSettings settings) {
public static Map<Flag<?>, Object> getSettingFlags(PlotArea area, PlotSettings settings) {
return getPlotFlags(area, settings, false);
}
@ -258,7 +257,7 @@ public class FlagManager {
*
* @param player with permissions
*
* @return List (AbstractFlag)
* @return List (Flag)
*/
public static List<Flag> getFlags(PlotPlayer player) {
List<Flag> returnFlags = new ArrayList<>();
@ -271,11 +270,11 @@ public class FlagManager {
}
/**
* Get an AbstractFlag by a string Returns null if flag does not exist
* Get an Flag by a String
*
* @param string Flag Key
* @param string the flag name
*
* @return AbstractFlag
* @return the flag or null if the flag the provided name does not exist
*/
public static Flag<?> getFlag(String string) {
for (Flag flag : Flags.getFlags()) {
@ -289,7 +288,22 @@ public class FlagManager {
return null;
}
public static HashMap<Flag<?>, Object> parseFlags(List<String> flagstrings) {
public static Flag<?> getFlag(String string, boolean ignoreReserved) {
for (Flag flag : Flags.getFlags()) {
if (flag.getName().equalsIgnoreCase(string)) {
if (!ignoreReserved) {
if (isReserved(flag)) {
return null;
}
}
return flag;
}
}
return null;
}
public static Map<Flag<?>, Object> parseFlags(List<String> flagstrings) {
HashMap<Flag<?>, Object> map = new HashMap<>();
for (String key : flagstrings) {

View File

@ -127,9 +127,8 @@ public class AugmentedUtils {
}
if (!has) {
continue;
} else {
toReturn = true;
}
toReturn = true;
secondaryMask = new PlotChunk<Object>(wrap) {
@Override
public Object getChunkAbs() {
@ -144,8 +143,7 @@ public class AugmentedUtils {
}
@Override
public void setBiome(int x, int z, int biome) {
}
public void setBiome(int x, int z, int biome) {}
@Override
public PlotChunk clone() {

View File

@ -158,7 +158,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
}
try {
setupSchematics();
} catch (Exception e) {
} catch (Exception ignored) {
PS.debug("&c - road schematics are disabled for this world.");
}
}

View File

@ -55,8 +55,7 @@ public abstract class IndependentPlotGenerator {
* - e.g. If setup doesn't support some standard options
* @param setup
*/
public void processSetup(SetupObject setup) {
}
public void processSetup(SetupObject setup) {}
/**
* It is preferred for the PlotArea object to do most of the initialization necessary.

View File

@ -176,7 +176,7 @@ public abstract class SquarePlotManager extends GridPlotManager {
return plot.getMerged(7) ? id : null;
}
PS.debug("invalid location: " + Arrays.toString(merged));
} catch (Exception e) {
} catch (Exception ignored) {
PS.debug("Invalid plot / road width in settings.yml for world: " + plotworld.worldname);
}
return null;

View File

@ -74,7 +74,7 @@ public class BlockLoc {
if (this.x == 0 && this.y == 0 && this.z == 0) {
return "";
}
return this.x + "," + this.y + "," + this.z + "," + this.yaw + "," + this.pitch;
return this.x + "," + this.y + ',' + this.z + ',' + this.yaw + ',' + this.pitch;
}
}

View File

@ -87,12 +87,10 @@ public class ConsolePlayer extends PlotPlayer {
}
@Override
public void setCompassTarget(Location location) {
}
public void setCompassTarget(Location location) {}
@Override
public void setAttribute(String key) {
}
public void setAttribute(String key) {}
@Override
public boolean getAttribute(String key) {
@ -100,8 +98,7 @@ public class ConsolePlayer extends PlotPlayer {
}
@Override
public void removeAttribute(String key) {
}
public void removeAttribute(String key) {}
@Override
public void setMeta(String key, Object value) {
@ -124,8 +121,7 @@ public class ConsolePlayer extends PlotPlayer {
}
@Override
public void setWeather(PlotWeather weather) {
}
public void setWeather(PlotWeather weather) {}
@Override
public PlotGameMode getGameMode() {
@ -133,24 +129,19 @@ public class ConsolePlayer extends PlotPlayer {
}
@Override
public void setGameMode(PlotGameMode gameMode) {
}
public void setGameMode(PlotGameMode gameMode) {}
@Override
public void setTime(long time) {
}
public void setTime(long time) {}
@Override
public void setFlight(boolean fly) {
}
public void setFlight(boolean fly) {}
@Override
public void playMusic(Location location, int id) {
}
public void playMusic(Location location, int id) {}
@Override
public void kick(String message) {
}
public void kick(String message) {}
@Override public void stopSpectating() {}

View File

@ -2,6 +2,7 @@ package com.intellectualcrafters.plot.object;
import com.google.common.base.Optional;
import com.google.common.collect.BiMap;
import com.google.common.collect.ImmutableSet;
import com.intellectualcrafters.jnbt.CompoundTag;
import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.config.C;
@ -212,19 +213,19 @@ public class Plot {
String[] split = string.split(";|,");
if (split.length == 2) {
if (defaultArea != null) {
PlotId id = PlotId.fromString(split[0] + ";" + split[1]);
PlotId id = PlotId.fromString(split[0] + ';' + split[1]);
return id != null ? defaultArea.getPlotAbs(id) : null;
}
} else if (split.length == 3) {
PlotArea pa = PS.get().getPlotArea(split[0], null);
if (pa != null) {
PlotId id = PlotId.fromString(split[1] + ";" + split[2]);
PlotId id = PlotId.fromString(split[1] + ';' + split[2]);
return pa.getPlotAbs(id);
}
} else if (split.length == 4) {
PlotArea pa = PS.get().getPlotArea(split[0], split[1]);
if (pa != null) {
PlotId id = PlotId.fromString(split[1] + ";" + split[2]);
PlotId id = PlotId.fromString(split[1] + ';' + split[2]);
return pa.getPlotAbs(id);
}
}
@ -334,7 +335,7 @@ public class Plot {
if (!isMerged()) {
return false;
}
HashSet<Plot> connected = getConnectedPlots();
Set<Plot> connected = getConnectedPlots();
for (Plot current : connected) {
if (uuid.equals(current.owner)) {
return true;
@ -348,17 +349,17 @@ public class Plot {
}
/**
* Get a list of owner UUIDs for a plot (supports multi-owner mega-plots).
* @return
* Get a immutable set of owner UUIDs for a plot (supports multi-owner mega-plots).
* @return the Plot owners
*/
public HashSet<UUID> getOwners() {
public Set<UUID> getOwners() {
if (this.owner == null) {
return new HashSet<>();
return Collections.emptySet();
}
if (isMerged()) {
HashSet<Plot> plots = getConnectedPlots();
Set<Plot> plots = getConnectedPlots();
Plot[] array = plots.toArray(new Plot[plots.size()]);
HashSet<UUID> owners = new HashSet<UUID>(1);
ImmutableSet.Builder<UUID> owners = ImmutableSet.builder();
UUID last = this.owner;
owners.add(this.owner);
for (Plot current : array) {
@ -367,9 +368,9 @@ public class Plot {
last = current.owner;
}
}
return owners;
return owners.build();
}
return new HashSet<>(Collections.singletonList(this.owner));
return ImmutableSet.of(this.owner);
}
/**
@ -380,10 +381,7 @@ public class Plot {
* @return true if the player is added/trusted or is the owner
*/
public boolean isAdded(UUID uuid) {
if (this.owner == null) {
return false;
}
if (getDenied().contains(uuid)) {
if (this.owner == null || getDenied().contains(uuid)) {
return false;
}
if (getTrusted().contains(uuid) || getTrusted().contains(DBFunc.everyone)) {
@ -749,14 +747,11 @@ public class Plot {
}
public boolean clear(boolean checkRunning, final boolean isDelete, final Runnable whenDone) {
if (checkRunning && this.getRunning() != 0) {
return false;
}
if (!EventUtil.manager.callClear(this)) {
if (checkRunning && this.getRunning() != 0 || !EventUtil.manager.callClear(this)) {
return false;
}
final HashSet<RegionWrapper> regions = this.getRegions();
final HashSet<Plot> plots = this.getConnectedPlots();
final Set<Plot> plots = this.getConnectedPlots();
final ArrayDeque<Plot> queue = new ArrayDeque<>(plots);
if (isDelete) {
this.removeSign();
@ -843,7 +838,7 @@ public class Plot {
}
/**
* Unlink the plot and all connected plots
* Unlink the plot and all connected plots.
* @param createSign
* @param createRoad
* @return
@ -852,7 +847,7 @@ public class Plot {
if (!this.isMerged()) {
return false;
}
HashSet<Plot> plots = this.getConnectedPlots();
Set<Plot> plots = this.getConnectedPlots();
ArrayList<PlotId> ids = new ArrayList<>(plots.size());
for (Plot current : plots) {
current.setHome(null);
@ -984,7 +979,7 @@ public class Plot {
if (!this.hasOwner()) {
return false;
}
final HashSet<Plot> plots = this.getConnectedPlots();
final Set<Plot> plots = this.getConnectedPlots();
this.clear(false, true, new Runnable() {
@Override
public void run() {
@ -1064,9 +1059,8 @@ public class Plot {
}
/**
* Unclaim the plot (does not modify terrain)<br>
* - Changes made to this plot will not be reflected in unclaimed plot objects<br>
* @return
* Unclaim the plot (does not modify terrain). Changes made to this plot will not be reflected in unclaimed plot objects.
* @return false if the Plot has no owner, otherwise true.
*/
public boolean unclaim() {
if (this.owner == null) {
@ -1266,9 +1260,7 @@ public class Plot {
});
}
/**
* Remove the plot sign if it is set
*/
/** Remove the plot sign if it is set. */
public void removeSign() {
PlotManager manager = this.area.getPlotManager();
if (!this.area.ALLOW_SIGNS) {
@ -1278,9 +1270,7 @@ public class Plot {
SetQueue.IMP.setBlock(this.area.worldname, loc.getX(), loc.getY(), loc.getZ(), 0);
}
/**
* Set the plot sign if plot signs are enabled.
*/
/** Set the plot sign if plot signs are enabled. */
public void setSign() {
if (this.owner == null) {
this.setSign("unknown");
@ -1742,7 +1732,7 @@ public class Plot {
TaskManager.runTaskAsync(new Runnable() {
@Override
public void run() {
String name = Plot.this.id + "," + Plot.this.area + "," + MainUtil.getName(Plot.this.owner);
String name = Plot.this.id + "," + Plot.this.area + ',' + MainUtil.getName(Plot.this.owner);
boolean result =
SchematicHandler.manager.save(value, Settings.SCHEMATIC_SAVE_PATH + File.separator + name + ".schematic");
if (whenDone != null) {
@ -2034,7 +2024,7 @@ public class Plot {
this.create();
}
return this.owner;
} catch (IllegalArgumentException e) {
} catch (IllegalArgumentException ignored) {
return null;
}
}
@ -2078,7 +2068,7 @@ public class Plot {
}
HashSet<Plot> visited = new HashSet<>();
HashSet<PlotId> merged = new HashSet<>();
HashSet<Plot> connected = this.getConnectedPlots();
Set<Plot> connected = this.getConnectedPlots();
for (Plot current : connected) {
merged.add(current.getId());
}
@ -2093,8 +2083,7 @@ public class Plot {
Set<Plot> plots;
if ((dir == -1 || dir == 0) && !current.getMerged(0)) {
Plot other = current.getRelative(0);
if (other != null
&& other.isOwner(uuid)
if (other != null && other.isOwner(uuid)
&& (other.getBasePlot(false).equals(current.getBasePlot(false))
|| (plots = other.getConnectedPlots()).size() <= max && frontier.addAll(plots) && (max -= plots.size()) != -1)) {
current.mergePlot(other, removeRoads);
@ -2105,12 +2094,9 @@ public class Plot {
}
if (max >= 0 && (dir == -1 || dir == 1) && !current.getMerged(1)) {
Plot other = current.getRelative(1);
if (other != null
&& other.isOwner(uuid)
if (other != null && other.isOwner(uuid)
&& (other.getBasePlot(false).equals(current.getBasePlot(false))
|| (plots = other.getConnectedPlots()).size() <= max && frontier.addAll(plots) &&
(max -= plots.size()) != -1)) {
|| (plots = other.getConnectedPlots()).size() <= max && frontier.addAll(plots) && (max -= plots.size()) != -1)) {
current.mergePlot(other, removeRoads);
merged.add(current.getId());
merged.add(other.getId());
@ -2245,14 +2231,14 @@ public class Plot {
* - This result is cached globally
* @return
*/
public HashSet<Plot> getConnectedPlots() {
public Set<Plot> getConnectedPlots() {
if (this.settings == null) {
return new HashSet<>(Collections.singletonList(this));
return Collections.singleton(this);
}
boolean[] merged = this.getMerged();
int hash = MainUtil.hash(merged);
if (hash == 0) {
return new HashSet<>(Collections.singletonList(this));
return Collections.singleton(this);
}
if (connected_cache != null && connected_cache.contains(this)) {
return connected_cache;
@ -2388,7 +2374,7 @@ public class Plot {
regions_cache.add(new RegionWrapper(pos1.getX(), pos2.getX(), pos1.getY(), pos2.getY(), pos1.getZ(), pos2.getZ()));
return regions_cache;
}
HashSet<Plot> plots = this.getConnectedPlots();
Set<Plot> plots = this.getConnectedPlots();
HashSet<RegionWrapper> regions = regions_cache = new HashSet<>();
HashSet<PlotId> visited = new HashSet<>();
for (Plot current : plots) {
@ -2576,16 +2562,15 @@ public class Plot {
return;
}
TaskManager.TELEPORT_QUEUE.remove(name);
if (!player.isOnline()) {
return;
if (player.isOnline()) {
MainUtil.sendMessage(player, C.TELEPORTED_TO_PLOT);
player.teleport(location);
}
MainUtil.sendMessage(player, C.TELEPORTED_TO_PLOT);
player.teleport(location);
}
}, Settings.TELEPORT_DELAY * 20);
return true;
}
return result;
return false;
}
public boolean isOnline() {
@ -2715,7 +2700,7 @@ public class Plot {
return false;
}
boolean occupied = false;
HashSet<Plot> plots = this.getConnectedPlots();
Set<Plot> plots = this.getConnectedPlots();
for (Plot plot : plots) {
Plot other = plot.getRelative(destination.getArea(), offset.x, offset.y);
if (other.hasOwner()) {
@ -2809,7 +2794,7 @@ public class Plot {
TaskManager.runTaskLater(whenDone, 1);
return false;
}
HashSet<Plot> plots = this.getConnectedPlots();
Set<Plot> plots = this.getConnectedPlots();
for (Plot plot : plots) {
Plot other = plot.getRelative(destination.getArea(), offset.x, offset.y);
if (other.hasOwner()) {
@ -2876,6 +2861,6 @@ public class Plot {
}
public boolean hasFlag(Flag<?> flag) {
return false;
return getFlags().containsKey(flag);
}
}

View File

@ -515,7 +515,7 @@ public class PlotAnalysis {
int SIZE = 10;
List<Integer>[] bucket = new ArrayList[SIZE];
for (int i = 0; i < bucket.length; i++) {
bucket[i] = new ArrayList<Integer>();
bucket[i] = new ArrayList<>();
}
boolean maxLength = false;
int placement = 1;

View File

@ -7,6 +7,7 @@ import com.intellectualcrafters.plot.config.ConfigurationNode;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.flag.FlagManager;
import com.intellectualcrafters.plot.flag.Flags;
import com.intellectualcrafters.plot.generator.GridPlotWorld;
import com.intellectualcrafters.plot.generator.IndependentPlotGenerator;
import com.intellectualcrafters.plot.util.EconHandler;
@ -53,9 +54,9 @@ public abstract class PlotArea {
public boolean SCHEMATIC_ON_CLAIM = false;
public String SCHEMATIC_FILE = "null";
public List<String> SCHEMATICS = null;
public HashMap<Flag<?>, Object> DEFAULT_FLAGS;
public Map<Flag<?>, Object> DEFAULT_FLAGS;
public boolean USE_ECONOMY = false;
public HashMap<String, Double> PRICES = new HashMap<>();
public Map<String, Double> PRICES = new HashMap<>();
public boolean SPAWN_EGGS = false;
public boolean SPAWN_CUSTOM = true;
public boolean SPAWN_BREEDING = false;
@ -165,10 +166,7 @@ public abstract class PlotArea {
if (this == obj) {
return true;
}
if (obj == null) {
return false;
}
if (getClass() != obj.getClass()) {
if (obj == null || getClass() != obj.getClass()) {
return false;
}
PlotArea plotarea = (PlotArea) obj;
@ -187,11 +185,8 @@ public abstract class PlotArea {
public boolean isCompatible(PlotArea plotArea) {
ConfigurationSection section = PS.get().config.getConfigurationSection("worlds");
for (ConfigurationNode setting : plotArea.getSettingNodes()) {
Object constant = section.get(plotArea.worldname + "." + setting.getConstant());
if (constant == null) {
return false;
}
if (!constant.equals(section.get(this.worldname + "." + setting.getConstant()))) {
Object constant = section.get(plotArea.worldname + '.' + setting.getConstant());
if (constant == null || !constant.equals(section.get(this.worldname + '.' + setting.getConstant()))) {
return false;
}
}
@ -269,7 +264,7 @@ public abstract class PlotArea {
try {
String[] split = homeDefault.split(",");
this.DEFAULT_HOME = new PlotLoc(Integer.parseInt(split[0]), Integer.parseInt(split[1]));
} catch (NumberFormatException e) {
} catch (NumberFormatException ignored) {
this.DEFAULT_HOME = null;
}
}
@ -283,7 +278,7 @@ public abstract class PlotArea {
Set<String> keys = section.getKeys(false);
for (String key : keys) {
if (!"default".equals(key)) {
flags.add(key + ";" + section.get(key));
flags.add(key + ';' + section.get(key));
}
}
}
@ -475,8 +470,8 @@ public abstract class PlotArea {
return myPlots;
}
public Set<Plot> getPlots(UUID uuid) {
HashSet<Plot> myplots = new HashSet<>();
public Set<Plot> getPlots(final UUID uuid) {
final HashSet<Plot> myplots = new HashSet<>();
for (Plot plot : getPlots()) {
if (plot.isBasePlot()) {
if (plot.isOwner(uuid)) {
@ -488,7 +483,7 @@ public abstract class PlotArea {
}
public Set<Plot> getPlots(PlotPlayer player) {
return player != null ? getPlots(player.getUUID()) : new HashSet<Plot>();
return getPlots(player.getUUID());
}
public Set<Plot> getPlotsAbs(PlotPlayer player) {
@ -499,7 +494,7 @@ public abstract class PlotArea {
int count = 0;
if (!Settings.DONE_COUNTS_TOWARDS_LIMIT) {
for (Plot plot : getPlotsAbs(uuid)) {
if (!plot.getFlags().containsKey("done")) {
if (!plot.hasFlag(Flags.DONE)) {
count++;
}
}
@ -617,7 +612,7 @@ public abstract class PlotArea {
}
}
public void foreachBasePlot(RunnableVal<Plot> run) {
for (Plot plot : getPlots()) {
if (plot.isBasePlot()) {

View File

@ -1,6 +1,6 @@
package com.intellectualcrafters.plot.object;
import java.util.HashSet;
import java.util.Set;
import java.util.UUID;
public class PlotHandler {
@ -8,7 +8,7 @@ public class PlotHandler {
if ((plot1.owner == null) || (plot2.owner == null)) {
return false;
}
final HashSet<UUID> owners = plot1.getOwners();
final Set<UUID> owners = plot1.getOwners();
owners.retainAll(plot2.getOwners());
return !owners.isEmpty();
}

View File

@ -42,7 +42,7 @@ public class PlotId {
try {
x = Integer.parseInt(parts[0]);
y = Integer.parseInt(parts[1]);
} catch (NumberFormatException e) {
} catch (NumberFormatException ignored) {
return null;
}
return new PlotId(x, y);

View File

@ -4,6 +4,7 @@ import com.intellectualcrafters.plot.PS;
import com.intellectualcrafters.plot.commands.RequiredType;
import com.intellectualcrafters.plot.config.Settings;
import com.intellectualcrafters.plot.database.DBFunc;
import com.intellectualcrafters.plot.flag.Flags;
import com.intellectualcrafters.plot.util.EventUtil;
import com.intellectualcrafters.plot.util.ExpireManager;
import com.intellectualcrafters.plot.util.Permissions;
@ -145,7 +146,7 @@ public abstract class PlotPlayer implements CommandCaller {
public void run(PlotArea value) {
if (!Settings.DONE_COUNTS_TOWARDS_LIMIT) {
for (Plot plot : value.getPlotsAbs(uuid)) {
if (!plot.getFlags().containsKey("done")) {
if (!plot.hasFlag(Flags.DONE)) {
count.incrementAndGet();
}
}
@ -245,19 +246,6 @@ public abstract class PlotPlayer implements CommandCaller {
*/
public abstract UUID getUUID();
/**
* Check the player's permissions<br>
* - Will be cached if permission caching is enabled
*/
@Override
public abstract boolean hasPermission(String permission);
/**
* Send the player a message
*/
@Override
public abstract void sendMessage(String message);
/**
* Teleport the player to a location
* @param location

View File

@ -254,7 +254,7 @@ public class BO3Handler {
try (FileOutputStream fos = new FileOutputStream(bo3File)) {
write(fos, plot, bo3);
}
} catch (Exception e) {
} catch (IOException e) {
e.printStackTrace();
return false;
}

View File

@ -222,8 +222,7 @@ public abstract class ChunkManager {
int z = Integer.parseInt(split[2]);
ChunkLoc loc = new ChunkLoc(x, z);
chunks.add(loc);
} catch (NumberFormatException ignored) {
}
} catch (NumberFormatException ignored) {}
}
}
return chunks;

View File

@ -208,9 +208,9 @@ public abstract class EventUtil {
if (flagValue.isPresent()) {
value = flagValue.get();
} else {
return true;
value = null;
}
if (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) {
if (value == null || !value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) {
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_BUILD_OTHER.s(), notifyPerms)) {
return true;
}
@ -255,9 +255,9 @@ public abstract class EventUtil {
if (flagValue.isPresent()) {
value = flagValue.get();
} else {
return true;
value = null;
}
if (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) {
if (value == null || !value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) {
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
return true;
}
@ -281,9 +281,9 @@ public abstract class EventUtil {
if (flag.isPresent()) {
value = flag.get();
} else {
return true;
value = null;
}
if (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) {
if (value == null || !value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) {
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
return true;
}
@ -306,9 +306,9 @@ public abstract class EventUtil {
if (flag.isPresent()) {
value = flag.get();
} else {
return true;
value = null;
}
if (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) {
if (value == null || !value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) {
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
return true;
}
@ -323,7 +323,6 @@ public abstract class EventUtil {
if (!plot.hasOwner()) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
}
if (plot.getFlag(Flags.MOB_PLACE).or(false)) {
return true;
}
@ -332,9 +331,9 @@ public abstract class EventUtil {
if (flagValue.isPresent()) {
value = flagValue.get();
} else {
return true;
value = null;
}
if (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) {
if (value == null || !value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) {
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
return true;
}
@ -351,19 +350,17 @@ public abstract class EventUtil {
if (!plot.hasOwner()) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
}
if (plot.getFlag(Flags.MISC_PLACE).or(false)) {
return true;
}
Optional<HashSet<PlotBlock>> flag = plot.getFlag(Flags.PLACE);
HashSet<PlotBlock> value;
if (flag.isPresent()) {
value = flag.get();
} else {
return true;
value = null;
}
if (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) {
if (value == null || !value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) {
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
return true;
}
@ -379,7 +376,6 @@ public abstract class EventUtil {
if (!plot.hasOwner()) {
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_UNOWNED.s(), notifyPerms);
}
if (plot.getFlag(Flags.VEHICLE_PLACE).or(false)) {
return true;
}
@ -388,9 +384,9 @@ public abstract class EventUtil {
if (flag.isPresent()) {
value = flag.get();
} else {
return true;
value = null;
}
if (!value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) {
if (value == null || !value.contains(PlotBlock.EVERYTHING) && !value.contains(block.getPlotBlock())) {
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
return true;
}

View File

@ -20,6 +20,7 @@ import com.intellectualcrafters.plot.object.RegionWrapper;
import com.intellectualcrafters.plot.object.RunnableVal;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.PrintWriter;
@ -125,7 +126,7 @@ public class MainUtil {
filename = "plot." + extension;
} else {
website = Settings.WEB_URL + "save.php?" + uuid;
filename = file + "." + extension;
filename = file + '.' + extension;
}
final URL url;
try {
@ -183,7 +184,7 @@ public class MainUtil {
whenDone.value = url;
}
TaskManager.runTask(whenDone);
} catch (Exception e) {
} catch (IOException e) {
e.printStackTrace();
TaskManager.runTask(whenDone);
}
@ -298,7 +299,8 @@ public class MainUtil {
public static String getName(UUID owner) {
if (owner == null) {
return C.NONE.s();
} else if (owner.equals(DBFunc.everyone)) {
}
if (owner.equals(DBFunc.everyone)) {
return C.EVERYONE.s();
}
String name = UUIDHandler.getName(owner);
@ -365,7 +367,7 @@ public class MainUtil {
uuid = UUID.fromString(term);
}
uuids.add(uuid);
} catch (Exception e) {
} catch (Exception ignored) {
id = PlotId.fromString(term);
if (id != null) {
continue;
@ -429,7 +431,7 @@ public class MainUtil {
if (arg == null) {
if (player == null) {
if (message) {
MainUtil.sendMessage(player, C.NOT_VALID_PLOT_WORLD);
PS.log(C.NOT_VALID_PLOT_WORLD);
}
return null;
}
@ -772,20 +774,20 @@ public class MainUtil {
}
String info;
if (full && Settings.RATING_CATEGORIES != null && Settings.RATING_CATEGORIES.size() > 1) {
String rating = "";
String prefix = "";
double[] ratings = MainUtil.getAverageRatings(plot);
for (double v : ratings) {
}
String rating = "";
String prefix = "";
for (int i = 0; i < ratings.length; i++) {
rating += prefix + Settings.RATING_CATEGORIES.get(i) + "=" + String.format("%.1f", ratings[i]);
rating += prefix + Settings.RATING_CATEGORIES.get(i) + '=' + String.format("%.1f", ratings[i]);
prefix = ",";
}
info = newInfo.replaceAll("%rating%", rating);
} else {
info = newInfo.replaceAll("%rating%", String.format("%.1f", plot.getAverageRating()) + "/" + max);
info = newInfo.replaceAll("%rating%", String.format("%.1f", plot.getAverageRating()) + '/' + max);
}
whenDone.run(info);
}

View File

@ -115,7 +115,7 @@ public class MathMan {
}
public static double sqrtApprox(double d) {
return Double.longBitsToDouble(((Double.doubleToLongBits(d) - (1l << 52)) >> 1) + (1l << 61));
return Double.longBitsToDouble(((Double.doubleToLongBits(d) - (1L << 52)) >> 1) + (1L << 61));
}
public static float invSqrt(float x) {

View File

@ -27,8 +27,8 @@ public class ReflectionUtils {
public ReflectionUtils(String version) {
if (version != null) {
preClassB += "." + version;
preClassM += "." + version;
preClassB += '.' + version;
preClassM += '.' + version;
}
}
@ -70,34 +70,32 @@ public class ReflectionUtils {
Object value = field.get(null);
try {
list.add((T) value);
} catch (ClassCastException ignored) {
}
} catch (ClassCastException ignored) {}
}
} catch (Throwable e) {
} catch (IllegalAccessException | IllegalArgumentException | SecurityException e) {
e.printStackTrace();
}
return list;
}
public static Class<?> getNmsClass(String name) {
String className = preClassM + "." + name;
String className = preClassM + '.' + name;
return getClass(className);
}
public static Class<?> getCbClass(String name) {
String className = preClassB + "." + name;
String className = preClassB + '.' + name;
return getClass(className);
}
public static Class<?> getUtilClass(String name) {
try {
return Class.forName(name); //Try before 1.8 first
} catch (ClassNotFoundException ex) {
try {
return Class.forName("net.minecraft.util." + name); //Not 1.8
} catch (ClassNotFoundException ex2) {
return null;
}
} catch (ClassNotFoundException ignored) {}
try {
return Class.forName("net.minecraft.util." + name); //Not 1.8
} catch (ClassNotFoundException ignored) {
return null;
}
}
@ -110,10 +108,8 @@ public class ReflectionUtils {
public static Method makeMethod(Class<?> clazz, String methodName, Class<?>... paramaters) {
try {
return clazz.getDeclaredMethod(methodName, paramaters);
} catch (NoSuchMethodException ex) {
} catch (NoSuchMethodException ignored) {
return null;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
@ -127,7 +123,7 @@ public class ReflectionUtils {
return (T) method.invoke(instance, paramaters);
} catch (InvocationTargetException ex) {
throw new RuntimeException(ex.getCause());
} catch (Exception ex) {
} catch (IllegalAccessException | IllegalArgumentException ex) {
throw new RuntimeException(ex);
}
}
@ -136,10 +132,8 @@ public class ReflectionUtils {
public static <T> Constructor<T> makeConstructor(Class<?> clazz, Class<?>... paramaterTypes) {
try {
return (Constructor<T>) clazz.getConstructor(paramaterTypes);
} catch (NoSuchMethodException ex) {
} catch (NoSuchMethodException ignored) {
return null;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
@ -152,7 +146,7 @@ public class ReflectionUtils {
return constructor.newInstance(paramaters);
} catch (InvocationTargetException ex) {
throw new RuntimeException(ex.getCause());
} catch (Exception ex) {
} catch (IllegalAccessException | IllegalArgumentException | InstantiationException ex) {
throw new RuntimeException(ex);
}
}
@ -160,10 +154,8 @@ public class ReflectionUtils {
public static Field makeField(Class<?> clazz, String name) {
try {
return clazz.getDeclaredField(name);
} catch (NoSuchFieldException ex) {
} catch (NoSuchFieldException ignored) {
return null;
} catch (Exception ex) {
throw new RuntimeException(ex);
}
}
@ -175,7 +167,7 @@ public class ReflectionUtils {
field.setAccessible(true);
try {
return (T) field.get(instance);
} catch (Exception ex) {
} catch (IllegalAccessException | IllegalArgumentException ex) {
throw new RuntimeException(ex);
}
}
@ -187,7 +179,7 @@ public class ReflectionUtils {
field.setAccessible(true);
try {
field.set(instance, value);
} catch (Exception ex) {
} catch (IllegalAccessException | IllegalArgumentException ex) {
throw new RuntimeException(ex);
}
}
@ -195,7 +187,7 @@ public class ReflectionUtils {
public static Class<?> getClass(String name) {
try {
return Class.forName(name);
} catch (ClassNotFoundException ex) {
} catch (ClassNotFoundException ignored) {
return null;
}
}
@ -203,7 +195,7 @@ public class ReflectionUtils {
public static <T> Class<? extends T> getClass(String name, Class<T> superClass) {
try {
return Class.forName(name).asSubclass(superClass);
} catch (ClassCastException | ClassNotFoundException ex) {
} catch (ClassCastException | ClassNotFoundException ignored) {
return null;
}
}
@ -212,21 +204,15 @@ public class ReflectionUtils {
* Get class for name. Replace {nms} to net.minecraft.server.V*. Replace {cb} to org.bukkit.craftbukkit.V*. Replace
* {nm} to net.minecraft
*
* @param classes possible class paths
* @param className possible class paths
*
* @return RefClass object
*
* @throws RuntimeException if no class found
* @throws ClassNotFoundException if no class found
*/
public static RefClass getRefClass(String... classes) throws RuntimeException {
for (String className : classes) {
try {
className = className.replace("{cb}", preClassB).replace("{nms}", preClassM).replace("{nm}", "net.minecraft");
return getRefClass(Class.forName(className));
} catch (ClassNotFoundException ignored) {
}
}
throw new RuntimeException("no class found");
public static RefClass getRefClass(String className) throws ClassNotFoundException {
className = className.replace("{cb}", preClassB).replace("{nms}", preClassM).replace("{nm}", "net.minecraft");
return getRefClass(Class.forName(className));
}
/**
@ -281,26 +267,22 @@ public class ReflectionUtils {
*
* @throws RuntimeException if method not found
*/
public RefMethod getMethod(String name, Object... types) {
public RefMethod getMethod(String name, Object... types) throws NoSuchMethodException {
Class[] classes = new Class[types.length];
int i = 0;
for (Object e : types) {
if (e instanceof Class) {
classes[i++] = (Class) e;
} else if (e instanceof RefClass) {
classes[i++] = ((RefClass) e).getRealClass();
} else {
classes[i++] = e.getClass();
}
}
try {
Class[] classes = new Class[types.length];
int i = 0;
for (Object e : types) {
if (e instanceof Class) {
classes[i++] = (Class) e;
} else if (e instanceof RefClass) {
classes[i++] = ((RefClass) e).getRealClass();
} else {
classes[i++] = e.getClass();
}
}
try {
return new RefMethod(this.clazz.getMethod(name, classes));
} catch (NoSuchMethodException ignored) {
return new RefMethod(this.clazz.getDeclaredMethod(name, classes));
}
} catch (NoSuchMethodException | SecurityException e) {
throw new RuntimeException(e);
return new RefMethod(this.clazz.getMethod(name, classes));
} catch (NoSuchMethodException ignored) {
return new RefMethod(this.clazz.getDeclaredMethod(name, classes));
}
}
@ -313,26 +295,22 @@ public class ReflectionUtils {
*
* @throws RuntimeException if constructor not found
*/
public RefConstructor getConstructor(Object... types) {
public RefConstructor getConstructor(Object... types) throws NoSuchMethodException {
Class[] classes = new Class[types.length];
int i = 0;
for (Object e : types) {
if (e instanceof Class) {
classes[i++] = (Class) e;
} else if (e instanceof RefClass) {
classes[i++] = ((RefClass) e).getRealClass();
} else {
classes[i++] = e.getClass();
}
}
try {
Class[] classes = new Class[types.length];
int i = 0;
for (Object e : types) {
if (e instanceof Class) {
classes[i++] = (Class) e;
} else if (e instanceof RefClass) {
classes[i++] = ((RefClass) e).getRealClass();
} else {
classes[i++] = e.getClass();
}
}
try {
return new RefConstructor(this.clazz.getConstructor(classes));
} catch (NoSuchMethodException ignored) {
return new RefConstructor(this.clazz.getDeclaredConstructor(classes));
}
} catch (NoSuchMethodException | SecurityException e) {
throw new RuntimeException(e);
return new RefConstructor(this.clazz.getConstructor(classes));
} catch (NoSuchMethodException ignored) {
return new RefConstructor(this.clazz.getDeclaredConstructor(classes));
}
}
@ -466,15 +444,11 @@ public class ReflectionUtils {
*
* @throws RuntimeException if field not found
*/
public RefField getField(String name) {
public RefField getField(String name) throws NoSuchFieldException {
try {
try {
return new RefField(this.clazz.getField(name));
} catch (NoSuchFieldException ignored) {
return new RefField(this.clazz.getDeclaredField(name));
}
} catch (Exception e) {
throw new RuntimeException(e);
return new RefField(this.clazz.getField(name));
} catch (NoSuchFieldException ignored) {
return new RefField(this.clazz.getDeclaredField(name));
}
}
@ -570,7 +544,7 @@ public class ReflectionUtils {
public Object call(Object... params) {
try {
return this.method.invoke(null, params);
} catch (Exception e) {
} catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) {
throw new RuntimeException(e);
}
}

View File

@ -577,6 +577,8 @@ public abstract class SchematicHandler {
try (OutputStream stream = new FileOutputStream(tmp); NBTOutputStream output = new NBTOutputStream(new GZIPOutputStream(stream))) {
output.writeTag(tag);
}
} catch (FileNotFoundException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
return false;

View File

@ -152,7 +152,7 @@ public abstract class UUIDHandlerImplementation {
}
return false;
}
} catch (Exception e) {
} catch (Exception ignored) {
BiMap<UUID, StringWrapper> inverse = this.uuidMap.inverse();
if (inverse.containsKey(uuid)) {
if (this.uuidMap.containsKey(name)) {

View File

@ -10,8 +10,7 @@ public abstract class Argument<T> {
Integer value = null;
try {
value = java.lang.Integer.parseInt(in);
} catch (Exception ignored) {
}
} catch (Exception ignored) {}
return value;
}
};

View File

@ -253,7 +253,7 @@ public abstract class Command {
return;
}
if (page == 0 && totalPages != 0) { // Next
new PlotMessage().text("<-").color("$3").text(" | ").color("$3").text("->").color("$1").command(baseCommand + " " + (page + 2))
new PlotMessage().text("<-").color("$3").text(" | ").color("$3").text("->").color("$1").command(baseCommand + " " + (0 + 2))
.text(C.CLICKABLE.s()).color("$2").send(player);
return;
}
@ -298,8 +298,7 @@ public abstract class Command {
MainCommand.getInstance().help.execute(player, args, null, null);
return;
}
} catch (IllegalArgumentException ignored) {
}
} catch (IllegalArgumentException ignored) {}
// Command recommendation
MainUtil.sendMessage(player, C.NOT_VALID_SUBCOMMAND);
List<Command> commands = getCommands(player);

View File

@ -4,8 +4,14 @@ import com.intellectualcrafters.plot.commands.RequiredType;
public interface CommandCaller {
/**
* Send the player a message.
*/
void sendMessage(String message);
/**
* Check the player's permissions. Will be cached if permission caching is enabled.
*/
boolean hasPermission(String perm);
RequiredType getSuperCaller();

View File

@ -43,7 +43,7 @@ public class PlotListener {
pp.setMeta("lastplot", plot);
EventUtil.manager.callEntry(pp, plot);
if (plot.hasOwner()) {
HashMap<Flag<?>, Object> flags = FlagManager.getPlotFlags(plot);
Map<Flag<?>, Object> flags = FlagManager.getPlotFlags(plot);
int size = flags.size();
boolean titles = Settings.TITLES;
final String greeting;
@ -122,8 +122,7 @@ public class PlotListener {
try {
pp.setMeta("music", loc);
pp.playMusic(loc, id);
} catch (Exception ignored) {
}
} catch (Exception ignored) {}
}
}
} else {

View File

@ -84,8 +84,7 @@ public class WESubscriber {
if (tool instanceof BrushTool) {
hasMask = ((BrushTool) tool).getMask() != null;
}
} catch (Exception ignored) {
}
} catch (Exception ignored) {}
}
AbstractDelegateExtent extent = (AbstractDelegateExtent) event.getExtent();
ChangeSetExtent history = null;
@ -123,11 +122,10 @@ public class WESubscriber {
if (maskextent != null) {
wrapper = new ExtentWrapper(maskextent);
field.set(maskextent, history);
event.setExtent(wrapper);
} else {
wrapper = new ExtentWrapper(history);
event.setExtent(wrapper);
}
event.setExtent(wrapper);
field.set(history, reorder);
field.set(reorder, new ProcessedWEExtent(world, mask, max, new FastModeExtent(worldObj, true), wrapper));
}