mirror of
https://github.com/IntellectualSites/PlotSquared.git
synced 2024-11-22 11:55:38 +01:00
Tidy code.
This commit is contained in:
parent
7947c3fdd7
commit
0958b57e46
@ -704,7 +704,7 @@ public class FancyMessage implements JsonRepresentedObject, Cloneable, Iterable<
|
||||
try {
|
||||
writeJson(json);
|
||||
json.close();
|
||||
} catch (IOException e) {
|
||||
} catch (IOException ignored) {
|
||||
throw new RuntimeException("invalid message");
|
||||
}
|
||||
this.jsonString = string.toString();
|
||||
|
@ -284,7 +284,7 @@ public abstract class TextualComponent implements Cloneable {
|
||||
@Override
|
||||
@SuppressWarnings("serial")
|
||||
public Map<String, Object> serialize() {
|
||||
return new java.util.HashMap<String, Object>() {
|
||||
return new HashMap<String, Object>() {
|
||||
{
|
||||
put("key", getKey());
|
||||
for (Map.Entry<String, String> valEntry : getValue().entrySet()) {
|
||||
|
@ -67,7 +67,7 @@ public class DebugUUID extends SubCommand {
|
||||
try {
|
||||
Class<?> clazz = Class.forName(args[0]);
|
||||
newWrapper = (UUIDWrapper) clazz.newInstance();
|
||||
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException e) {
|
||||
} catch (ClassNotFoundException | IllegalAccessException | InstantiationException ignored) {
|
||||
MainUtil.sendMessage(player, C.COMMAND_SYNTAX, "/plot uuidconvert <lower|offline|online>");
|
||||
return false;
|
||||
}
|
||||
|
@ -94,9 +94,7 @@ public class LikePlotMeConverter {
|
||||
content = content.replaceAll("PlotMe-DefaultGenerator", "PlotSquared");
|
||||
content = content.replaceAll("PlotMe", "PlotSquared");
|
||||
Files.write(path, content.getBytes(StandardCharsets.UTF_8));
|
||||
} catch (IOException ignored) {
|
||||
//ignored
|
||||
}
|
||||
} catch (IOException ignored) {}
|
||||
}
|
||||
|
||||
public boolean run(APlotMeConnector connector) {
|
||||
|
@ -41,9 +41,8 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
||||
}
|
||||
return new SQLite(dataFolder + File.separator + "plots.db").openConnection();
|
||||
}
|
||||
} catch (SQLException | ClassNotFoundException ignored) {
|
||||
//ignored
|
||||
ignored.printStackTrace();
|
||||
} catch (SQLException | ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -116,7 +115,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
|
||||
}
|
||||
}
|
||||
if (owner == null) {
|
||||
PS.log("&cCould not identify owner for plot: " + id + " -> '" + name + "'");
|
||||
PS.log("&cCould not identify owner for plot: " + id + " -> '" + name + '\'');
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
@ -143,9 +143,7 @@ public class BukkitPlotGenerator extends ChunkGenerator implements GeneratorWrap
|
||||
if (data != null) {
|
||||
return;
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
//ignored
|
||||
}
|
||||
} catch (Throwable ignored) {}
|
||||
// Populator spillage
|
||||
short[][] tmp = cg.generateExtBlockSections(w, r, result.getX(), result.getZ(), grid);
|
||||
if (tmp != null) {
|
||||
|
@ -49,7 +49,7 @@ public class ChunkListener implements Listener {
|
||||
RefClass classCraftChunk = getRefClass("{cb}.CraftChunk");
|
||||
this.mustSave = classChunk.getField("mustSave");
|
||||
this.methodGetHandleChunk = classCraftChunk.getMethod("getHandle");
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable ignored) {
|
||||
PS.debug("PlotSquared/Server not compatible for chunk processor trim/gc");
|
||||
Settings.CHUNK_PROCESSOR_GC = false;
|
||||
Settings.CHUNK_PROCESSOR_TRIM_ON_SAVE = false;
|
||||
|
@ -36,10 +36,10 @@ public class ForceFieldListener implements Listener {
|
||||
|
||||
private PlotPlayer hasNearbyPermitted(Player player, Plot plot) {
|
||||
for (Entity entity : player.getNearbyEntities(5d, 5d, 5d)) {
|
||||
PlotPlayer pp;
|
||||
if (!(entity instanceof Player)) {
|
||||
continue;
|
||||
}
|
||||
PlotPlayer pp;
|
||||
if ((pp = BukkitUtil.getPlayer((Player) entity)) == null) {
|
||||
continue;
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ public class DefaultTitle extends AbstractTitle {
|
||||
try {
|
||||
DefaultTitleManager title = new DefaultTitleManager(head, sub, in, delay, out);
|
||||
title.send(((BukkitPlayer) player).player);
|
||||
} catch (Throwable e) {
|
||||
} catch (Exception ignored) {
|
||||
AbstractTitle.TITLE_CLASS = new DefaultTitle_183();
|
||||
AbstractTitle.TITLE_CLASS.sendTitle(player, head, sub, in, delay, out);
|
||||
}
|
||||
|
@ -11,7 +11,7 @@ public class DefaultTitle_183 extends AbstractTitle {
|
||||
try {
|
||||
DefaultTitleManager_183 title = new DefaultTitleManager_183(head, sub, in, delay, out);
|
||||
title.send(((BukkitPlayer) player).player);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
AbstractTitle.TITLE_CLASS = new HackTitle();
|
||||
AbstractTitle.TITLE_CLASS.sendTitle(player, head, sub, in, delay, out);
|
||||
}
|
||||
|
@ -19,7 +19,7 @@ public class DefaultTitle_19 extends AbstractTitle {
|
||||
playerObj.sendTitle("", "");
|
||||
}
|
||||
}, delay * 20);
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable ignored) {
|
||||
AbstractTitle.TITLE_CLASS = new DefaultTitle();
|
||||
AbstractTitle.TITLE_CLASS.sendTitle(player, head, sub, in, delay, out);
|
||||
}
|
||||
|
@ -255,8 +255,6 @@ public class Metrics {
|
||||
|
||||
/**
|
||||
* Enables metrics for the server by setting "opt-out" to false in the config file and starting the metrics task.
|
||||
*
|
||||
* @throws java.io.IOException
|
||||
*/
|
||||
public void enable() {
|
||||
// Enable Task, if it is not running
|
||||
@ -267,7 +265,6 @@ public class Metrics {
|
||||
|
||||
/**
|
||||
* Disables metrics for the server by setting "opt-out" to true in the config file and canceling the metrics task.
|
||||
*
|
||||
*/
|
||||
public void disable() {
|
||||
// Disable Task, if it is running
|
||||
@ -499,7 +496,7 @@ public class Metrics {
|
||||
/**
|
||||
* Gets an <b>unmodifiable</b> set of the plotter objects in the graph
|
||||
*
|
||||
* @return an unmodifiable {@link java.util.Set} of the plotter objects
|
||||
* @return an unmodifiable {@link Set} of the plotter objects
|
||||
*/
|
||||
public Set<Plotter> getPlotters() {
|
||||
return Collections.unmodifiableSet(this.plotters);
|
||||
|
@ -20,6 +20,7 @@ import java.io.DataInput;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutput;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
@ -160,7 +161,7 @@ public class NbtFactory {
|
||||
/**
|
||||
* Load the content of a file from a stream.
|
||||
*
|
||||
* Use {@link Files#newInputStreamSupplier(java.io.File)} to provide a stream from a file.
|
||||
* Use {@link Files#newInputStreamSupplier(File)} to provide a stream from a file.
|
||||
* @param stream - the stream supplier.
|
||||
* @param option - whether or not to decompress the input stream.
|
||||
* @return The decoded NBT compound.
|
||||
@ -195,7 +196,7 @@ public class NbtFactory {
|
||||
/**
|
||||
* Save the content of a NBT compound to a stream.
|
||||
*
|
||||
* Use {@link Files#newOutputStreamSupplier(java.io.File)} to provide a stream supplier to a file.
|
||||
* Use {@link Files#newOutputStreamSupplier(File)} to provide a stream supplier to a file.
|
||||
* @param source - the NBT compound to save.
|
||||
* @param stream - the stream.
|
||||
* @param option - whether or not to compress the output.
|
||||
@ -284,7 +285,7 @@ public class NbtFactory {
|
||||
Constructor<?> caller = INSTANCE.CRAFT_STACK.getDeclaredConstructor(ItemStack.class);
|
||||
caller.setAccessible(true);
|
||||
return (ItemStack) caller.newInstance(stack);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
throw new IllegalStateException("Unable to convert " + stack + " + to a CraftItemStack.");
|
||||
}
|
||||
}
|
||||
@ -396,9 +397,7 @@ public class NbtFactory {
|
||||
try {
|
||||
this.STREAM_TOOLS = loader.loadClass(nmsPackage + ".NBTCompressedStreamTools");
|
||||
this.READ_LIMITER_CLASS = loader.loadClass(nmsPackage + ".NBTReadLimiter");
|
||||
} catch (ClassNotFoundException e) {
|
||||
// Ignore - we will detect this later
|
||||
}
|
||||
} catch (ClassNotFoundException ignored) {}
|
||||
}
|
||||
|
||||
private String getPackageName() {
|
||||
@ -435,12 +434,10 @@ public class NbtFactory {
|
||||
|
||||
if (value instanceof Wrapper) {
|
||||
return ((Wrapper) value).getHandle();
|
||||
|
||||
} else if (value instanceof List) {
|
||||
throw new IllegalArgumentException("Can only insert a WrappedList.");
|
||||
} else if (value instanceof Map) {
|
||||
throw new IllegalArgumentException("Can only insert a WrappedCompound.");
|
||||
|
||||
} else {
|
||||
return createNbtTag(getPrimitiveType(value), value);
|
||||
}
|
||||
@ -652,7 +649,7 @@ public class NbtFactory {
|
||||
* All changes to this map will be reflected in the underlying NBT compound. Values may only be one of the following:
|
||||
* <ul>
|
||||
* <li>Primitive types</li>
|
||||
* <li>{@link java.lang.String String}</li>
|
||||
* <li>{@link String String}</li>
|
||||
* <li>{@link NbtList}</li>
|
||||
* <li>{@link NbtCompound}</li>
|
||||
* </ul>
|
||||
@ -773,7 +770,7 @@ public class NbtFactory {
|
||||
/**
|
||||
* Save the content of a NBT compound to a stream.
|
||||
* <p>
|
||||
* Use {@link Files#newOutputStreamSupplier(java.io.File)} to provide a stream supplier to a file.
|
||||
* Use {@link Files#newOutputStreamSupplier(File)} to provide a stream supplier to a file.
|
||||
* @param stream - the output stream.
|
||||
* @param option - whether or not to compress the output.
|
||||
* @throws IOException If anything went wrong.
|
||||
|
@ -51,7 +51,6 @@ public class SendChunk {
|
||||
this.methodInitLighting = classChunk.getMethod("initLighting");
|
||||
RefClass classMapChunk = getRefClass("{nms}.PacketPlayOutMapChunk");
|
||||
//TODO in 1.7.10 this is PacketPlayOutMapChunk(Chunk chunk, boolean flag, int i, int version)
|
||||
this.mapChunk = classMapChunk.getConstructor(classChunk.getRealClass(), boolean.class, int.class);
|
||||
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), 1, 9, 4)) {
|
||||
this.mapChunk = classMapChunk.getConstructor(classChunk.getRealClass(),int.class);
|
||||
} else {
|
||||
@ -65,7 +64,7 @@ public class SendChunk {
|
||||
}
|
||||
|
||||
public void sendChunk(Collection<Chunk> input) {
|
||||
HashSet<Chunk> chunks = new HashSet<Chunk>(input);
|
||||
HashSet<Chunk> chunks = new HashSet<>(input);
|
||||
HashMap<String, ArrayList<Chunk>> map = new HashMap<>();
|
||||
int view = Bukkit.getServer().getViewDistance();
|
||||
for (Chunk chunk : chunks) {
|
||||
@ -126,9 +125,9 @@ public class SendChunk {
|
||||
public void run() {
|
||||
try {
|
||||
chunk.unload(true, false);
|
||||
} catch (Throwable e) {
|
||||
} catch (Throwable ignored) {
|
||||
String worldName = chunk.getWorld().getName();
|
||||
PS.debug("$4Could not save chunk: " + worldName + ";" + chunk.getX() + ";" + chunk.getZ());
|
||||
PS.debug("$4Could not save chunk: " + worldName + ';' + chunk.getX() + ";" + chunk.getZ());
|
||||
PS.debug("$3 - $4File may be open in another process (e.g. MCEdit)");
|
||||
PS.debug("$3 - $4" + worldName + "/level.dat or " + worldName
|
||||
+ "/level_old.dat may be corrupt (try repairing or removing these)");
|
||||
|
@ -50,7 +50,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
|
||||
try (PreparedStatement stmt = getConnection().prepareStatement(
|
||||
"CREATE TABLE IF NOT EXISTS `usercache` (uuid VARCHAR(32) NOT NULL, username VARCHAR(32) NOT NULL, PRIMARY KEY (uuid, username)"
|
||||
+ ")")) {
|
||||
+ ')')) {
|
||||
stmt.execute();
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
@ -176,7 +176,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
String id = (String) jsonProfile.get("id");
|
||||
String name = (String) jsonProfile.get("name");
|
||||
ifFetch.value = UUID.fromString(
|
||||
id.substring(0, 8) + "-" + id.substring(8, 12) + "-" + id.substring(12, 16) + "-" + id.substring(16, 20) + "-" + id
|
||||
id.substring(0, 8) + '-' + id.substring(8, 12) + '-' + id.substring(12, 16) + '-' + id.substring(16, 20) + '-' + id
|
||||
.substring(20, 32));
|
||||
} catch (IOException | ParseException e) {
|
||||
e.printStackTrace();
|
||||
@ -231,7 +231,7 @@ public class SQLUUIDHandler extends UUIDHandlerImplementation {
|
||||
statement.setString(1, name.value);
|
||||
statement.setString(2, uuid.toString());
|
||||
statement.execute();
|
||||
PS.debug(C.PREFIX + "Name change for '" + uuid + "' to '" + name.value + "'");
|
||||
PS.debug(C.PREFIX + "Name change for '" + uuid + "' to '" + name.value + '\'');
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
@ -57,9 +57,9 @@ class ConfigurationOptions {
|
||||
* If this is true, all values in the default Configuration will be
|
||||
* directly copied, making it impossible to distinguish between values
|
||||
* that were set and values that are provided by default. As a result,
|
||||
* {@link ConfigurationSection#contains(java.lang.String)} will always
|
||||
* {@link ConfigurationSection#contains(String)} will always
|
||||
* return the same value as {@link
|
||||
* ConfigurationSection#isSet(java.lang.String)}. The default value is
|
||||
* ConfigurationSection#isSet(String)}. The default value is
|
||||
* false.
|
||||
*
|
||||
* @return Whether or not defaults are directly copied
|
||||
@ -75,9 +75,9 @@ class ConfigurationOptions {
|
||||
* If this is true, all values in the default Configuration will be
|
||||
* directly copied, making it impossible to distinguish between values
|
||||
* that were set and values that are provided by default. As a result,
|
||||
* {@link ConfigurationSection#contains(java.lang.String)} will always
|
||||
* {@link ConfigurationSection#contains(String)} will always
|
||||
* return the same value as {@link
|
||||
* ConfigurationSection#isSet(java.lang.String)}. The default value is
|
||||
* ConfigurationSection#isSet(String)}. The default value is
|
||||
* false.
|
||||
*
|
||||
* @param value Whether or not defaults are directly copied
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.intellectualcrafters.configuration.file;
|
||||
|
||||
import com.intellectualcrafters.configuration.Configuration;
|
||||
import com.intellectualcrafters.configuration.MemoryConfiguration;
|
||||
import com.intellectualcrafters.configuration.MemoryConfigurationOptions;
|
||||
|
||||
@ -75,7 +76,7 @@ public class FileConfigurationOptions extends MemoryConfigurationOptions {
|
||||
* <p>
|
||||
* If this is true, if a default {@link FileConfiguration} is passed to
|
||||
* {@link
|
||||
* FileConfiguration#setDefaults(com.intellectualcrafters.configuration.Configuration)}
|
||||
* FileConfiguration#setDefaults(Configuration)}
|
||||
* then upon saving it will use the header from that config, instead of
|
||||
* the one provided here.
|
||||
* <p>
|
||||
@ -97,7 +98,7 @@ public class FileConfigurationOptions extends MemoryConfigurationOptions {
|
||||
* <p>
|
||||
* If this is true, if a default {@link FileConfiguration} is passed to
|
||||
* {@link
|
||||
* FileConfiguration#setDefaults(com.intellectualcrafters.configuration.Configuration)}
|
||||
* FileConfiguration#setDefaults(Configuration)}
|
||||
* then upon saving it will use the header from that config, instead of
|
||||
* the one provided here.
|
||||
* <p>
|
||||
|
@ -75,7 +75,7 @@ public final class ListTag extends Tag {
|
||||
public Tag getIfExists(int index) {
|
||||
try {
|
||||
return this.value.get(index);
|
||||
} catch (NoSuchElementException e) {
|
||||
} catch (NoSuchElementException ignored) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -181,7 +181,7 @@ public final class NBTInputStream implements Closeable {
|
||||
}
|
||||
return new IntArrayTag(name, data);
|
||||
default:
|
||||
throw new IOException("Invalid tag type: " + type + ".");
|
||||
throw new IOException("Invalid tag type: " + type + '.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -100,7 +100,7 @@ public final class NBTOutputStream implements Closeable {
|
||||
writeIntArrayTagPayload((IntArrayTag) tag);
|
||||
break;
|
||||
default:
|
||||
throw new IOException("Invalid tag type: " + type + ".");
|
||||
throw new IOException("Invalid tag type: " + type + '.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -179,7 +179,7 @@ public class JSONArray {
|
||||
Object object = get(index);
|
||||
try {
|
||||
return object instanceof Number ? ((Number) object).doubleValue() : Double.parseDouble((String) object);
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (NumberFormatException ignored) {
|
||||
throw new JSONException("JSONArray[" + index + "] is not a number.");
|
||||
}
|
||||
}
|
||||
@ -197,7 +197,7 @@ public class JSONArray {
|
||||
Object object = get(index);
|
||||
try {
|
||||
return object instanceof Number ? ((Number) object).intValue() : Integer.parseInt((String) object);
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (NumberFormatException ignored) {
|
||||
throw new JSONException("JSONArray[" + index + "] is not a number.");
|
||||
}
|
||||
}
|
||||
@ -249,7 +249,7 @@ public class JSONArray {
|
||||
Object object = get(index);
|
||||
try {
|
||||
return object instanceof Number ? ((Number) object).longValue() : Long.parseLong((String) object);
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (NumberFormatException ignored) {
|
||||
throw new JSONException("JSONArray[" + index + "] is not a number.");
|
||||
}
|
||||
}
|
||||
@ -348,7 +348,7 @@ public class JSONArray {
|
||||
public boolean optBoolean(int index, boolean defaultValue) {
|
||||
try {
|
||||
return getBoolean(index);
|
||||
} catch (JSONException e) {
|
||||
} catch (JSONException ignored) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@ -377,7 +377,7 @@ public class JSONArray {
|
||||
public double optDouble(int index, double defaultValue) {
|
||||
try {
|
||||
return getDouble(index);
|
||||
} catch (JSONException e) {
|
||||
} catch (JSONException ignored) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@ -406,7 +406,7 @@ public class JSONArray {
|
||||
public int optInt(int index, int defaultValue) {
|
||||
try {
|
||||
return getInt(index);
|
||||
} catch (JSONException e) {
|
||||
} catch (JSONException ignored) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@ -460,7 +460,7 @@ public class JSONArray {
|
||||
public long optLong(int index, long defaultValue) {
|
||||
try {
|
||||
return getLong(index);
|
||||
} catch (JSONException e) {
|
||||
} catch (JSONException ignored) {
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
@ -778,7 +778,7 @@ public class JSONArray {
|
||||
public String toString() {
|
||||
try {
|
||||
return this.toString(0);
|
||||
} catch (JSONException e) {
|
||||
} catch (JSONException ignored) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -61,7 +61,7 @@ class XML {
|
||||
}
|
||||
for (char c : string.toCharArray()) {
|
||||
if (Character.isWhitespace(c)) {
|
||||
throw new JSONException("'" + string + "' contains a space character.");
|
||||
throw new JSONException('\'' + string + "' contains a space character.");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -369,8 +369,8 @@ class XML {
|
||||
return sb.toString();
|
||||
} else {
|
||||
string = escape(object.toString());
|
||||
return (tagName == null) ? "\"" + string + "\"" :
|
||||
string.isEmpty() ? "<" + tagName + "/>" : "<" + tagName + ">" + string + "</" + tagName + ">";
|
||||
return (tagName == null) ? '"' + string + '"' :
|
||||
string.isEmpty() ? '<' + tagName + "/>" : '<' + tagName + '>' + string + "</" + tagName + '>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.intellectualcrafters.json;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* The XMLTokener extends the JSONTokener to provide additional methods for the parsing of XML texts.
|
||||
*
|
||||
@ -10,9 +12,9 @@ public class XMLTokener extends JSONTokener {
|
||||
/**
|
||||
* The table of entity values. It initially contains Character values for amp, apos, gt, lt, quot.
|
||||
*/
|
||||
public static final java.util.HashMap<String, Character> entity;
|
||||
public static final HashMap<String, Character> entity;
|
||||
static {
|
||||
entity = new java.util.HashMap<String, Character>(8);
|
||||
entity = new HashMap<>(8);
|
||||
entity.put("amp", XML.AMP);
|
||||
entity.put("apos", XML.APOS);
|
||||
entity.put("gt", XML.GT);
|
||||
@ -37,16 +39,14 @@ public class XMLTokener extends JSONTokener {
|
||||
* @throws JSONException If the <code>]]></code> is not found.
|
||||
*/
|
||||
public String nextCDATA() throws JSONException {
|
||||
char c;
|
||||
int i;
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
for (;;) {
|
||||
c = next();
|
||||
char c = next();
|
||||
if (end()) {
|
||||
throw syntaxError("Unclosed CDATA");
|
||||
}
|
||||
sb.append(c);
|
||||
i = sb.length() - 3;
|
||||
int i = sb.length() - 3;
|
||||
if ((i >= 0) && (sb.charAt(i) == ']') && (sb.charAt(i + 1) == ']') && (sb.charAt(i + 2) == '>')) {
|
||||
sb.setLength(i);
|
||||
return sb.toString();
|
||||
@ -64,7 +64,6 @@ public class XMLTokener extends JSONTokener {
|
||||
*/
|
||||
public Object nextContent() throws JSONException {
|
||||
char c;
|
||||
StringBuilder sb;
|
||||
do {
|
||||
c = next();
|
||||
} while (Character.isWhitespace(c));
|
||||
@ -74,14 +73,14 @@ public class XMLTokener extends JSONTokener {
|
||||
if (c == '<') {
|
||||
return XML.LT;
|
||||
}
|
||||
sb = new StringBuilder();
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (;;) {
|
||||
if ((c == '<') || (c == 0)) {
|
||||
back();
|
||||
return sb.toString().trim();
|
||||
}
|
||||
if (c == '&') {
|
||||
sb.append(nextEntity(c));
|
||||
sb.append(nextEntity('&'));
|
||||
} else {
|
||||
sb.append(c);
|
||||
}
|
||||
@ -113,7 +112,7 @@ public class XMLTokener extends JSONTokener {
|
||||
}
|
||||
final String string = sb.toString();
|
||||
final Object object = entity.get(string);
|
||||
return object != null ? object : ampersand + string + ";";
|
||||
return object != null ? object : ampersand + string + ';';
|
||||
}
|
||||
|
||||
/**
|
||||
@ -126,10 +125,10 @@ public class XMLTokener extends JSONTokener {
|
||||
*/
|
||||
public Object nextMeta() throws JSONException {
|
||||
char c;
|
||||
char q;
|
||||
do {
|
||||
c = next();
|
||||
} while (Character.isWhitespace(c));
|
||||
char q;
|
||||
switch (c) {
|
||||
case 0:
|
||||
throw syntaxError("Misshaped meta tag");
|
||||
@ -190,11 +189,11 @@ public class XMLTokener extends JSONTokener {
|
||||
*/
|
||||
public Object nextToken() throws JSONException {
|
||||
char c;
|
||||
char q;
|
||||
StringBuilder sb;
|
||||
do {
|
||||
c = next();
|
||||
} while (Character.isWhitespace(c));
|
||||
char q;
|
||||
StringBuilder sb;
|
||||
switch (c) {
|
||||
case 0:
|
||||
throw syntaxError("Misshaped element");
|
||||
@ -224,7 +223,7 @@ public class XMLTokener extends JSONTokener {
|
||||
return sb.toString();
|
||||
}
|
||||
if (c == '&') {
|
||||
sb.append(nextEntity(c));
|
||||
sb.append(nextEntity('&'));
|
||||
} else {
|
||||
sb.append(c);
|
||||
}
|
||||
@ -268,11 +267,8 @@ public class XMLTokener extends JSONTokener {
|
||||
* @throws JSONException
|
||||
*/
|
||||
public boolean skipPast(final String to) throws JSONException {
|
||||
boolean b;
|
||||
char c;
|
||||
int i;
|
||||
int j;
|
||||
int offset = 0;
|
||||
final int length = to.length();
|
||||
final char[] circle = new char[length];
|
||||
/*
|
||||
@ -287,9 +283,9 @@ public class XMLTokener extends JSONTokener {
|
||||
circle[i] = c;
|
||||
}
|
||||
/* We will loop, possibly for all of the remaining characters. */
|
||||
for (;;) {
|
||||
j = offset;
|
||||
b = true;
|
||||
for (int offset = 0; ;) {
|
||||
int j = offset;
|
||||
boolean b = true;
|
||||
/* Compare the circle buffer with the to string. */
|
||||
for (i = 0; i < length; i += 1) {
|
||||
if (circle[j] != to.charAt(i)) {
|
||||
|
@ -51,7 +51,7 @@ public class DebugClaimTest extends SubCommand {
|
||||
args[2].split(";");
|
||||
min = PlotId.fromString(args[1]);
|
||||
max = PlotId.fromString(args[2]);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
return !MainUtil.sendMessage(plr,
|
||||
"&cInvalid min/max values. &7The values are to Plot IDs in the format &cX;Y &7where X;Y are the plot coords\nThe conversion "
|
||||
+ "will only check the plots in the selected area.");
|
||||
|
@ -187,7 +187,7 @@ public class DebugExec extends SubCommand {
|
||||
double threshold;
|
||||
try {
|
||||
threshold = Integer.parseInt(args[1]) / 100d;
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (NumberFormatException ignored) {
|
||||
MainUtil.sendMessage(player, "$2Invalid threshold: " + args[1]);
|
||||
MainUtil.sendMessage(player, "$1<threshold> $2= $1The percentage of plots you want to clear as a number between 0 - 100");
|
||||
return false;
|
||||
|
@ -30,7 +30,7 @@ public class DebugPaste extends SubCommand {
|
||||
String latestLOG;
|
||||
try {
|
||||
latestLOG = HastebinUtility.upload(new File(PS.get().IMP.getDirectory(), "../../logs/latest.log"));
|
||||
} catch (IOException e) {
|
||||
} catch (IOException ignored) {
|
||||
MainUtil.sendMessage(plr, "&clatest.log is too big to be pasted, will ignore");
|
||||
latestLOG = "too big :(";
|
||||
}
|
||||
@ -38,12 +38,12 @@ public class DebugPaste extends SubCommand {
|
||||
b.append(
|
||||
"# Welcome to this paste\n# It is meant to provide us at IntellectualSites with better information about your "
|
||||
+ "problem\n\n# We will start with some informational files\n");
|
||||
b.append("links.settings_yml: ").append(settingsYML).append("\n");
|
||||
b.append("links.latest_log: ").append(latestLOG).append("\n");
|
||||
b.append("links.settings_yml: ").append(settingsYML).append('\n');
|
||||
b.append("links.latest_log: ").append(latestLOG).append('\n');
|
||||
b.append("\n# Server Information\n");
|
||||
int[] sVersion = PS.get().IMP.getServerVersion();
|
||||
b.append("version.server: ").append(sVersion[0]).append('.').append(sVersion[1]).append('.').append(sVersion[2]).append("\n");
|
||||
b.append("online_mode: ").append(UUIDHandler.getUUIDWrapper()).append(";").append(!Settings.OFFLINE_MODE).append("\n");
|
||||
b.append("version.server: ").append(sVersion[0]).append('.').append(sVersion[1]).append('.').append(sVersion[2]).append('\n');
|
||||
b.append("online_mode: ").append(UUIDHandler.getUUIDWrapper()).append(';').append(!Settings.OFFLINE_MODE).append('\n');
|
||||
b.append("plugins:");
|
||||
for (String id : PS.get().IMP.getPluginIds()) {
|
||||
String[] split = id.split(":");
|
||||
@ -51,13 +51,13 @@ public class DebugPaste extends SubCommand {
|
||||
String enabled = split.length == 2 ? split[1] : "unknown";
|
||||
String name = split2[0];
|
||||
String version = split2.length == 2 ? split2[1] : "unknown";
|
||||
b.append("\n ").append(name).append(":\n ").append("version: '").append(version).append("'").append("\n enabled: ")
|
||||
b.append("\n ").append(name).append(":\n ").append("version: '").append(version).append('\'').append("\n enabled: ")
|
||||
.append(enabled);
|
||||
}
|
||||
b.append("\n\n# YAY! Now, let's see what we can find in your JVM\n");
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
b.append("memory.free: ").append(runtime.freeMemory()).append("\n");
|
||||
b.append("memory.max: ").append(runtime.maxMemory()).append("\n");
|
||||
b.append("memory.free: ").append(runtime.freeMemory()).append('\n');
|
||||
b.append("memory.max: ").append(runtime.maxMemory()).append('\n');
|
||||
b.append("java.specification.version: '").append(System.getProperty("java.specification.version")).append("'\n");
|
||||
b.append("java.vendor: '").append(System.getProperty("java.vendor")).append("'\n");
|
||||
b.append("java.version: '").append(System.getProperty("java.version")).append("'\n");
|
||||
|
@ -37,7 +37,7 @@ public class DebugRoadRegen extends SubCommand {
|
||||
if (MathMan.isInteger(args[0])) {
|
||||
try {
|
||||
extend = Integer.parseInt(args[0]);
|
||||
} catch (Exception e) {
|
||||
} catch (NumberFormatException ignored) {
|
||||
C.NOT_VALID_NUMBER.send(player, "(0, <EXTEND HEIGHT>)");
|
||||
return false;
|
||||
}
|
||||
@ -45,7 +45,7 @@ public class DebugRoadRegen extends SubCommand {
|
||||
}
|
||||
boolean result = HybridUtils.manager.regenerateRoad(plotworld, chunk, extend);
|
||||
MainUtil.sendMessage(player,
|
||||
"&6Regenerating chunk: " + chunk.x + "," + chunk.z + "\n&6 - Result: " + (result ? "&aSuccess" : "&cFailed"));
|
||||
"&6Regenerating chunk: " + chunk.x + ',' + chunk.z + "\n&6 - Result: " + (result ? "&aSuccess" : "&cFailed"));
|
||||
MainUtil.sendMessage(player, "&cTo regenerate all roads: /plot regenallroads");
|
||||
} else {
|
||||
HybridPlotManager manager = (HybridPlotManager) plotworld.getPlotManager();
|
||||
|
@ -95,8 +95,8 @@ public class FlagCmd extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
String value = StringMan.join(Arrays.copyOfRange(args, 2, args.length), " ");
|
||||
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase() + "." + value.toLowerCase())) {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase() + "." + value.toLowerCase());
|
||||
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase() + '.' + value.toLowerCase())) {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase() + '.' + value.toLowerCase());
|
||||
return false;
|
||||
}
|
||||
Object parsed = flag.parseValue(value);
|
||||
@ -127,8 +127,8 @@ public class FlagCmd extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
for (String entry : args[2].split(",")) {
|
||||
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase() + "." + entry)) {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase() + "." + entry);
|
||||
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase() + '.' + entry)) {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase() + '.' + entry);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -167,8 +167,8 @@ public class FlagCmd extends SubCommand {
|
||||
return false;
|
||||
}
|
||||
for (String entry : args[2].split(",")) {
|
||||
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase() + "." + entry)) {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase() + "." + entry);
|
||||
if (!Permissions.hasPermission(player, "plots.set.flag." + args[1].toLowerCase() + '.' + entry)) {
|
||||
MainUtil.sendMessage(player, C.NO_PERMISSION, "plots.set.flag." + args[1].toLowerCase() + '.' + entry);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public class Inbox extends SubCommand {
|
||||
StringBuilder string = new StringBuilder();
|
||||
string.append(StringMan
|
||||
.replaceAll(C.COMMENT_LIST_HEADER_PAGED.s(), "%amount%", comments.length, "%cur", page + 1, "%max", totalPages + 1, "%word", "all")
|
||||
+ "\n");
|
||||
+ '\n');
|
||||
|
||||
// This might work xD
|
||||
for (int x = page * 12; x < max; x++) {
|
||||
@ -58,9 +58,8 @@ public class Inbox extends SubCommand {
|
||||
} else {
|
||||
color = "&7";
|
||||
}
|
||||
string.append(
|
||||
"&8[&7#" + (x + 1) + "&8][&7" + comment.world + ";" + comment.id + "&8][&6" + comment.senderName + "&8]" + color + comment.comment
|
||||
+ "\n");
|
||||
string.append("&8[&7#").append(x + 1).append("&8][&7").append(comment.world).append(';').append(comment.id).append("&8][&6")
|
||||
.append(comment.senderName).append("&8]").append(color).append(comment.comment).append('\n');
|
||||
}
|
||||
MainUtil.sendMessage(player, string.toString());
|
||||
}
|
||||
@ -71,7 +70,8 @@ public class Inbox extends SubCommand {
|
||||
if (plot == null) {
|
||||
sendMessage(player, C.NOT_IN_PLOT);
|
||||
return false;
|
||||
} else if (!plot.hasOwner()) {
|
||||
}
|
||||
if (!plot.hasOwner()) {
|
||||
sendMessage(player, C.PLOT_UNOWNED);
|
||||
return false;
|
||||
}
|
||||
@ -98,7 +98,7 @@ public class Inbox extends SubCommand {
|
||||
} else {
|
||||
color = "";
|
||||
}
|
||||
sendMessage(player, C.INBOX_ITEM, color + inbox.toString() + " (" + total + "/" + unread + ")");
|
||||
sendMessage(player, C.INBOX_ITEM, color + inbox.toString() + " (" + total + '/' + unread + ')');
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -135,7 +135,7 @@ public class Inbox extends SubCommand {
|
||||
sendMessage(player, C.NOT_VALID_INBOX_INDEX, index + "");
|
||||
return false;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (NumberFormatException ignored) {
|
||||
sendMessage(player, C.COMMAND_SYNTAX, "/plot inbox " + inbox.toString() + " delete <index>");
|
||||
return false;
|
||||
}
|
||||
@ -171,7 +171,7 @@ public class Inbox extends SubCommand {
|
||||
default:
|
||||
try {
|
||||
page = Integer.parseInt(args[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (NumberFormatException ignored) {
|
||||
sendMessage(player, C.COMMAND_SYNTAX, "/plot inbox [inbox] [delete <index>|clear|page]");
|
||||
return false;
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ public class RegenAllRoads extends SubCommand {
|
||||
if (args.length == 2) {
|
||||
try {
|
||||
height = Integer.parseInt(args[1]);
|
||||
} catch (NumberFormatException e) {
|
||||
} catch (NumberFormatException ignored) {
|
||||
MainUtil.sendMessage(plr, C.NOT_VALID_NUMBER, "(0, 256)");
|
||||
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot regenallroads <world> [height]");
|
||||
return false;
|
||||
|
@ -68,7 +68,7 @@ public class Save extends SubCommand {
|
||||
int size = (corners[1].getX() - corners[0].getX()) + 1;
|
||||
PlotId id = plot.getId();
|
||||
String world = plot.getArea().toString().replaceAll(";", "-").replaceAll("[^A-Za-z0-9]", "");
|
||||
final String file = time + "_" + world + "_" + id.x + "_" + id.y + "_" + size + "_" + name;
|
||||
final String file = time + '_' + world + '_' + id.x + '_' + id.y + '_' + size + '_' + name;
|
||||
UUID uuid = plr.getUUID();
|
||||
SchematicHandler.manager.upload(value, uuid, file, new RunnableVal<URL>() {
|
||||
@Override
|
||||
|
@ -101,7 +101,7 @@ public class Set extends SubCommand {
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e2) {
|
||||
} catch (Exception ignored) {
|
||||
MainUtil.sendMessage(plr, C.NOT_VALID_BLOCK, material);
|
||||
return false;
|
||||
}
|
||||
|
@ -9,7 +9,7 @@ import com.plotsquared.general.commands.Command;
|
||||
|
||||
/**
|
||||
* SubCommand class
|
||||
* @see com.plotsquared.general.commands.Command(com.plotsquared.general.commands.Command, boolean)
|
||||
* @see Command(Command, boolean)
|
||||
* @Deprecated In favor of normal Command class
|
||||
*/
|
||||
public abstract class SubCommand extends Command {
|
||||
|
@ -27,7 +27,7 @@ public class Update extends SubCommand {
|
||||
} else if (args.length == 1) {
|
||||
try {
|
||||
url = new URL(args[0]);
|
||||
} catch (MalformedURLException e) {
|
||||
} catch (MalformedURLException ignored) {
|
||||
MainUtil.sendMessage(plr, "&cInvalid URL: " + args[0]);
|
||||
MainUtil.sendMessage(plr, C.COMMAND_SYNTAX, "/plot update [url]");
|
||||
return false;
|
||||
|
@ -89,7 +89,7 @@ public class Visit extends SubCommand {
|
||||
}
|
||||
}
|
||||
if (page < 1 || page > unsorted.size()) {
|
||||
sendMessage(player, C.NOT_VALID_NUMBER, "(1, " + unsorted.size() + ")");
|
||||
sendMessage(player, C.NOT_VALID_NUMBER, "(1, " + unsorted.size() + ')');
|
||||
return false;
|
||||
}
|
||||
List<Plot> plots = PS.get().sortPlotsByTemp(unsorted);
|
||||
|
@ -35,7 +35,7 @@ public class ConfigurationNode {
|
||||
try {
|
||||
Object result = this.type.parseString(string);
|
||||
return result != null;
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -51,13 +51,15 @@ public class ConfigurationNode {
|
||||
public Object getValue() {
|
||||
if (this.value instanceof String[]) {
|
||||
return Arrays.asList((String[]) this.value);
|
||||
} else if (this.value instanceof Object[]) {
|
||||
List<String> values = new ArrayList<String>();
|
||||
}
|
||||
if (this.value instanceof Object[]) {
|
||||
List<String> values = new ArrayList<>();
|
||||
for (Object value : (Object[]) this.value) {
|
||||
values.add(value.toString());
|
||||
}
|
||||
return values;
|
||||
} else if (this.value instanceof PlotBlock) {
|
||||
}
|
||||
if (this.value instanceof PlotBlock) {
|
||||
return this.value.toString();
|
||||
}
|
||||
return this.value;
|
||||
|
@ -11,7 +11,6 @@ import com.intellectualcrafters.plot.object.comment.PlotComment;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.ResultSetMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
@ -58,7 +57,7 @@ public class DBFunc {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
} catch (SQLException e) {
|
||||
} catch (SQLException ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -3,6 +3,7 @@ package com.intellectualcrafters.plot.database;
|
||||
import java.sql.Connection;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
|
||||
/**
|
||||
* Abstract Database class, serves as a base for any connection method (MySQL, SQLite, etc.)
|
||||
@ -64,12 +65,12 @@ public abstract class Database {
|
||||
|
||||
/**
|
||||
* Executes an Update SQL Query.
|
||||
* See {@link java.sql.Statement#executeUpdate(String)}.
|
||||
* See {@link Statement#executeUpdate(String)}.
|
||||
* If the connection is closed, it will be opened.
|
||||
*
|
||||
* @param query Query to be run
|
||||
*
|
||||
* @return Result Code, see {@link java.sql.Statement#executeUpdate(String)}
|
||||
* @return Result Code, see {@link Statement#executeUpdate(String)}
|
||||
*
|
||||
* @throws SQLException If the query cannot be executed
|
||||
* @throws ClassNotFoundException If the driver cannot be found; see {@link #openConnection()}
|
||||
|
@ -45,7 +45,7 @@ public class MySQL extends Database {
|
||||
public Connection forceConnection() throws SQLException, ClassNotFoundException {
|
||||
Class.forName("com.mysql.jdbc.Driver");
|
||||
this.connection =
|
||||
DriverManager.getConnection("jdbc:mysql://" + this.hostname + ":" + this.port + "/" + this.database, this.user, this.password);
|
||||
DriverManager.getConnection("jdbc:mysql://" + this.hostname + ':' + this.port + '/' + this.database, this.user, this.password);
|
||||
return this.connection;
|
||||
}
|
||||
|
||||
@ -55,9 +55,9 @@ public class MySQL extends Database {
|
||||
return this.connection;
|
||||
}
|
||||
Class.forName("com.mysql.jdbc.Driver");
|
||||
PS.debug("jdbc:mysql://" + this.hostname + ":" + this.port + "/" + this.database);
|
||||
PS.debug("jdbc:mysql://" + this.hostname + ':' + this.port + '/' + this.database);
|
||||
this.connection =
|
||||
DriverManager.getConnection("jdbc:mysql://" + this.hostname + ":" + this.port + "/" + this.database, this.user, this.password);
|
||||
DriverManager.getConnection("jdbc:mysql://" + this.hostname + ':' + this.port + '/' + this.database, this.user, this.password);
|
||||
return this.connection;
|
||||
}
|
||||
|
||||
|
@ -1467,9 +1467,7 @@ public class SQLManager implements AbstractDB {
|
||||
if (this.mySQL && !PS.get().checkVersion(oldVersion, 3, 3, 2)) {
|
||||
try (Statement stmt = this.connection.createStatement()) {
|
||||
stmt.executeUpdate("ALTER TABLE `" + this.prefix + "plots` DROP INDEX `unique_alias`");
|
||||
} catch (SQLException ignore) {
|
||||
//ignored
|
||||
}
|
||||
} catch (SQLException ignored) {}
|
||||
}
|
||||
DatabaseMetaData data = this.connection.getMetaData();
|
||||
ResultSet rs = data.getColumns(null, null, this.prefix + "plot_comments", "plot_plot_id");
|
||||
|
@ -13,7 +13,7 @@ public class DoubleFlag extends Flag<Double> {
|
||||
@Override public Double parseValue(String value) {
|
||||
try {
|
||||
return Double.parseDouble(value);
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (NumberFormatException ignored) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
@ -11,6 +11,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.PlotSettings;
|
||||
import com.intellectualcrafters.plot.util.EventUtil;
|
||||
import com.intellectualcrafters.plot.util.Permissions;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
@ -32,7 +33,7 @@ public class FlagManager {
|
||||
/**
|
||||
* Some events can be called millions of times each second (e.g. physics) and reusing is a lot faster.
|
||||
*/
|
||||
private static Optional MUTABLE_OPTIONAL;
|
||||
private static final Optional MUTABLE_OPTIONAL;
|
||||
private static Field MUTABLE_OPTIONAL_FIELD;
|
||||
static {
|
||||
MUTABLE_OPTIONAL = Optional.of(new Object());
|
||||
@ -51,7 +52,9 @@ public class FlagManager {
|
||||
try {
|
||||
MUTABLE_OPTIONAL_FIELD.set(MUTABLE_OPTIONAL, value);
|
||||
return MUTABLE_OPTIONAL;
|
||||
} catch (IllegalAccessException e) {e.printStackTrace();}
|
||||
} catch (IllegalAccessException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
return Optional.of(value);
|
||||
}
|
||||
@ -97,9 +100,9 @@ public class FlagManager {
|
||||
for (Map.Entry<Flag<?>, Object> entry : flags.entrySet()) {
|
||||
Flag<?> flag = entry.getKey();
|
||||
if (i != 0) {
|
||||
flag_string.append(",");
|
||||
flag_string.append(',');
|
||||
}
|
||||
flag_string.append(flag.getName() + ":" + flag.valueToString(entry.getValue()).replaceAll(":", "¯").replaceAll(",", "´"));
|
||||
flag_string.append(flag.getName() + ':' + flag.valueToString(entry.getValue()).replaceAll(":", "¯").replaceAll(",", "´"));
|
||||
i++;
|
||||
}
|
||||
return flag_string.toString();
|
||||
|
@ -17,7 +17,7 @@ public class IntegerFlag extends Flag<Integer> {
|
||||
@Override public Integer parseValue(String value) {
|
||||
try {
|
||||
return Integer.parseInt(value);
|
||||
} catch (IllegalArgumentException e) {
|
||||
} catch (NumberFormatException ignored) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
@ -18,7 +18,7 @@ public abstract class SquarePlotWorld extends GridPlotWorld {
|
||||
@Override
|
||||
public void loadConfiguration(ConfigurationSection config) {
|
||||
if (!config.contains("plot.height")) {
|
||||
PS.debug(" - &cConfiguration is null? (" + config.getCurrentPath() + ")");
|
||||
PS.debug(" - &cConfiguration is null? (" + config.getCurrentPath() + ')');
|
||||
}
|
||||
this.PLOT_WIDTH = config.getInt("plot.size");
|
||||
this.ROAD_WIDTH = config.getInt("road.width");
|
||||
|
@ -24,8 +24,8 @@ public class BO3 {
|
||||
|
||||
public void addChild(BO3 child) {
|
||||
ChunkLoc childloc = child.getLoc();
|
||||
this.children.append("Branch(").append(childloc.x - this.chunk.x).append(",0,").append(childloc.z - this.chunk.z).append(",")
|
||||
.append(this.name).append("_").append(childloc.x).append("_").append(childloc.z).append(")\n");
|
||||
this.children.append("Branch(").append(childloc.x - this.chunk.x).append(",0,").append(childloc.z - this.chunk.z).append(',')
|
||||
.append(this.name).append('_').append(childloc.x).append('_').append(childloc.z).append(")\n");
|
||||
}
|
||||
|
||||
public ChunkLoc getLoc() {
|
||||
@ -43,9 +43,9 @@ public class BO3 {
|
||||
public void addBlock(int x, int y, int z, PlotBlock block) {
|
||||
if (block.data == 0) {
|
||||
// Block(-3,1,-2,AIR)
|
||||
this.blocks.append("Block(").append(x).append(",").append(y).append(",").append(z).append(",").append(block.id).append(")\n");
|
||||
this.blocks.append("Block(").append(x).append(',').append(y).append(',').append(z).append(',').append(block.id).append(")\n");
|
||||
} else {
|
||||
this.blocks.append("Block(").append(x).append(",").append(y).append(",").append(z).append(",").append(block.id).append(":")
|
||||
this.blocks.append("Block(").append(x).append(',').append(y).append(',').append(z).append(',').append(block.id).append(':')
|
||||
.append(block.data).append(")\n");
|
||||
}
|
||||
}
|
||||
@ -66,7 +66,7 @@ public class BO3 {
|
||||
if (this.chunk.x == 0 && this.chunk.z == 0) {
|
||||
return this.name + ".bo3";
|
||||
} else {
|
||||
return this.name + ("_" + this.chunk.x + "_" + this.chunk.z) + ".bo3";
|
||||
return this.name + ("_" + this.chunk.x + '_' + this.chunk.z) + ".bo3";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -276,7 +276,7 @@ public class BO3Handler {
|
||||
if (bo3.getLoc().x == 0 && bo3.getLoc().z == 0) {
|
||||
bo3File = MainUtil.getFile(base.getParentFile(), bo3.getName() + ".bo3");
|
||||
} else {
|
||||
bo3File = MainUtil.getFile(base.getParentFile(), bo3.getName() + "_" + bo3.getLoc().x + "_" + bo3.getLoc().z + ".bo3");
|
||||
bo3File = MainUtil.getFile(base.getParentFile(), bo3.getName() + '_' + bo3.getLoc().x + '_' + bo3.getLoc().z + ".bo3");
|
||||
}
|
||||
bo3File.createNewFile();
|
||||
Files.write(bo3File.toPath(), StringMan.join(lines, System.getProperty("line.separator")).getBytes(), StandardOpenOption.WRITE);
|
||||
|
@ -137,7 +137,7 @@ public abstract class EventUtil {
|
||||
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||
return true;
|
||||
}
|
||||
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + "/" + C.FLAG_BREAK.s()));
|
||||
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + '/' + C.FLAG_BREAK.s()));
|
||||
case BREAK_HANGING:
|
||||
if (plot == null) {
|
||||
return Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_ROAD.s(), notifyPerms);
|
||||
@ -261,7 +261,7 @@ public abstract class EventUtil {
|
||||
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||
return true;
|
||||
}
|
||||
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + "/" + C.FLAG_HANGING_INTERACT.s()));
|
||||
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + '/' + C.FLAG_HANGING_INTERACT.s()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -287,7 +287,7 @@ public abstract class EventUtil {
|
||||
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||
return true;
|
||||
}
|
||||
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + "/" + C.FLAG_MISC_INTERACT.s()));
|
||||
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + '/' + C.FLAG_MISC_INTERACT.s()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -312,7 +312,7 @@ public abstract class EventUtil {
|
||||
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||
return true;
|
||||
}
|
||||
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + "/" + C.FLAG_VEHICLE_USE.s()));
|
||||
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_USE.s() + '/' + C.FLAG_VEHICLE_USE.s()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -337,7 +337,7 @@ public abstract class EventUtil {
|
||||
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||
return true;
|
||||
}
|
||||
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_MOB_PLACE.s() + "/" + C.FLAG_PLACE.s()));
|
||||
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_MOB_PLACE.s() + '/' + C.FLAG_PLACE.s()));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@ -364,7 +364,7 @@ public abstract class EventUtil {
|
||||
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||
return true;
|
||||
}
|
||||
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_MISC_PLACE.s() + "/" + C.FLAG_PLACE.s()));
|
||||
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_MISC_PLACE.s() + '/' + C.FLAG_PLACE.s()));
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -390,7 +390,7 @@ public abstract class EventUtil {
|
||||
if (Permissions.hasPermission(pp, C.PERMISSION_ADMIN_INTERACT_OTHER.s(), notifyPerms)) {
|
||||
return true;
|
||||
}
|
||||
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_VEHICLE_PLACE.s() + "/" + C.FLAG_PLACE.s()));
|
||||
return !(!notifyPerms || MainUtil.sendMessage(pp, C.FLAG_TUTORIAL_USAGE, C.FLAG_VEHICLE_PLACE.s() + '/' + C.FLAG_PLACE.s()));
|
||||
}
|
||||
return true;
|
||||
default:
|
||||
|
@ -19,6 +19,7 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
|
||||
import com.intellectualcrafters.plot.object.PseudoRandom;
|
||||
import com.intellectualcrafters.plot.object.RegionWrapper;
|
||||
import com.intellectualcrafters.plot.object.RunnableVal;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
@ -152,7 +153,7 @@ public class MainUtil {
|
||||
String param = "value";
|
||||
writer.append(CRLF).append(param).append(CRLF).flush();
|
||||
writer.append("--" + boundary).append(CRLF);
|
||||
writer.append("Content-Disposition: form-data; name=\"schematicFile\"; filename=\"" + filename + "\"").append(CRLF);
|
||||
writer.append("Content-Disposition: form-data; name=\"schematicFile\"; filename=\"" + filename + '"').append(CRLF);
|
||||
writer.append("Content-Type: " + URLConnection.guessContentTypeFromName(filename)).append(CRLF);
|
||||
writer.append("Content-Transfer-Encoding: binary").append(CRLF);
|
||||
writer.append(CRLF).flush();
|
||||
@ -737,16 +738,14 @@ public class MainUtil {
|
||||
String description = !descriptionFlag.isPresent() ? C.NONE.s() : Flags.DESCRIPTION.valueToString(descriptionFlag.get());
|
||||
|
||||
StringBuilder flags = new StringBuilder();
|
||||
{
|
||||
HashMap<Flag<?>, Object> flagMap = FlagManager.getPlotFlags(plot.getArea(), plot.getSettings(), true);
|
||||
if (flagMap.isEmpty()) {
|
||||
flags.append(C.NONE.s());
|
||||
} else {
|
||||
String prefix = "";
|
||||
for (Entry<Flag<?>, Object> entry : flagMap.entrySet()) {
|
||||
flags.append(prefix).append(C.PLOT_FLAG_LIST.f(entry.getKey().getName(), entry.getValue()));
|
||||
prefix = ", ";
|
||||
}
|
||||
HashMap<Flag<?>, Object> flagMap = FlagManager.getPlotFlags(plot.getArea(), plot.getSettings(), true);
|
||||
if (flagMap.isEmpty()) {
|
||||
flags.append(C.NONE.s());
|
||||
} else {
|
||||
String prefix = "";
|
||||
for (Entry<Flag<?>, Object> entry : flagMap.entrySet()) {
|
||||
flags.append(prefix).append(C.PLOT_FLAG_LIST.f(entry.getKey().getName(), entry.getValue()));
|
||||
prefix = ", ";
|
||||
}
|
||||
}
|
||||
boolean build = plot.isAdded(player.getUUID());
|
||||
@ -755,7 +754,7 @@ public class MainUtil {
|
||||
|
||||
info = info.replace("%id%", plot.getId().toString());
|
||||
info = info.replace("%alias%", alias);
|
||||
info = info.replace("%num%", num + "");
|
||||
info = info.replace("%num%", String.valueOf(num));
|
||||
info = info.replace("%desc%", description);
|
||||
info = info.replace("%biome%", biome);
|
||||
info = info.replace("%owner%", owner);
|
||||
@ -766,7 +765,7 @@ public class MainUtil {
|
||||
info = info.replace("%denied%", denied);
|
||||
info = info.replace("%expires%", expires);
|
||||
info = info.replace("%flags%", flags);
|
||||
info = info.replace("%build%", build + "");
|
||||
info = info.replace("%build%", String.valueOf(build));
|
||||
info = info.replace("%desc%", "No description set.");
|
||||
if (info.contains("%rating%")) {
|
||||
final String newInfo = info;
|
||||
|
@ -80,7 +80,7 @@ public abstract class SchematicHandler {
|
||||
}
|
||||
final String name;
|
||||
if (namingScheme == null) {
|
||||
name = plot.getId().x + ";" + plot.getId().y + "," + plot.getArea() + "," + o;
|
||||
name = plot.getId().x + ";" + plot.getId().y + ',' + plot.getArea() + ',' + o;
|
||||
} else {
|
||||
name = namingScheme.replaceAll("%owner%", o).replaceAll("%id%", plot.getId().toString()).replaceAll("%idx%", plot.getId().x + "").replaceAll("%idy%", plot.getId().y + "")
|
||||
.replaceAll("%world%", plot.getArea().toString());
|
||||
@ -170,7 +170,7 @@ public abstract class SchematicHandler {
|
||||
if (((region.maxX - region.minX + xOffset + 1) < WIDTH) || ((region.maxZ - region.minZ + zOffset + 1) < LENGTH) || (HEIGHT
|
||||
> 256)) {
|
||||
PS.debug("Schematic is too large");
|
||||
PS.debug("(" + WIDTH + "," + LENGTH + "," + HEIGHT + ") is bigger than (" + (region.maxX - region.minX) + "," + (region.maxZ - region.minZ) + ",256)");
|
||||
PS.debug("(" + WIDTH + ',' + LENGTH + ',' + HEIGHT + ") is bigger than (" + (region.maxX - region.minX) + ',' + (region.maxZ - region.minZ) + ",256)");
|
||||
TaskManager.runTask(whenDone);
|
||||
return;
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ public class UUIDHandler {
|
||||
*
|
||||
* @return map with names + uuids
|
||||
*
|
||||
* @see com.google.common.collect.BiMap
|
||||
* @see BiMap
|
||||
*/
|
||||
public static BiMap<StringWrapper, UUID> getUuidMap() {
|
||||
return implementation.getUUIDMap();
|
||||
@ -39,7 +39,7 @@ public class UUIDHandler {
|
||||
*
|
||||
* @return true of the uuid is cached
|
||||
*
|
||||
* @see com.google.common.collect.BiMap#containsValue(Object)
|
||||
* @see BiMap#containsValue(Object)
|
||||
*/
|
||||
public static boolean uuidExists(UUID uuid) {
|
||||
return implementation.uuidExists(uuid);
|
||||
@ -52,7 +52,7 @@ public class UUIDHandler {
|
||||
*
|
||||
* @return true of the name is cached
|
||||
*
|
||||
* @see com.google.common.collect.BiMap#containsKey(Object)
|
||||
* @see BiMap#containsKey(Object)
|
||||
*/
|
||||
public static boolean nameExists(StringWrapper name) {
|
||||
return implementation.nameExists(name);
|
||||
|
@ -124,7 +124,7 @@ public abstract class WorldUtil {
|
||||
}
|
||||
|
||||
public File getMcr(String world, int x, int z) {
|
||||
File file = new File(PS.get().IMP.getWorldContainer(), world + File.separator + "region" + File.separator + "r." + x + "." + z + ".mca");
|
||||
File file = new File(PS.get().IMP.getWorldContainer(), world + File.separator + "region" + File.separator + "r." + x + '.' + z + ".mca");
|
||||
if (file.exists()) {
|
||||
return file;
|
||||
}
|
||||
|
@ -44,11 +44,16 @@ public class PlotListener {
|
||||
EventUtil.manager.callEntry(pp, plot);
|
||||
if (plot.hasOwner()) {
|
||||
Map<Flag<?>, Object> flags = FlagManager.getPlotFlags(plot);
|
||||
int size = flags.size();
|
||||
boolean titles = Settings.TITLES;
|
||||
final String greeting;
|
||||
|
||||
if (size != 0) {
|
||||
if (flags.isEmpty()) {
|
||||
if (titles) {
|
||||
greeting = "";
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
Optional<Boolean> titleFlag = plot.getFlag(Flags.TITLES);
|
||||
if (titleFlag.isPresent()) {
|
||||
titles = titleFlag.get();
|
||||
@ -97,7 +102,7 @@ public class PlotListener {
|
||||
try {
|
||||
long time = timeFlag.get();
|
||||
pp.setTime(time);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
FlagManager.removePlotFlag(plot, Flags.TIME);
|
||||
}
|
||||
}
|
||||
@ -133,10 +138,6 @@ public class PlotListener {
|
||||
}
|
||||
}
|
||||
CommentManager.sendTitle(pp, plot);
|
||||
} else if (titles) {
|
||||
greeting = "";
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
if (titles) {
|
||||
if (!C.TITLE_ENTERED_PLOT.s().isEmpty() || !C.TITLE_ENTERED_PLOT_SUB.s().isEmpty()) {
|
||||
@ -146,7 +147,7 @@ public class PlotListener {
|
||||
Plot lastPlot = pp.getMeta("lastplot");
|
||||
if ((lastPlot != null) && plot.getId().equals(lastPlot.getId())) {
|
||||
Map<String, String> replacements = new HashMap<>();
|
||||
replacements.put("%x%", lastPlot.getId().x + "");
|
||||
replacements.put("%x%", String.valueOf(lastPlot.getId().x));
|
||||
replacements.put("%z%", lastPlot.getId().y + "");
|
||||
replacements.put("%world%", plot.getArea().toString());
|
||||
replacements.put("%greeting%", greeting);
|
||||
|
@ -76,6 +76,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Plugin(id = "com.plotsquared", name = "PlotSquared", description = "Easy, yet powerful Plot World generation and management.", url = "https://github.com/IntellectualSites/PlotSquared", version = "3.3.3")
|
||||
public class SpongeMain implements IPlotMain {
|
||||
@ -258,7 +259,7 @@ public class SpongeMain implements IPlotMain {
|
||||
try {
|
||||
Class.forName("com.sk89q.worldedit.WorldEdit");
|
||||
return true;
|
||||
} catch (Throwable e) {
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -306,7 +307,7 @@ public class SpongeMain implements IPlotMain {
|
||||
Metrics metrics = new Metrics(this.game, this.plugin);
|
||||
metrics.start();
|
||||
log(C.PREFIX.s() + "&6Metrics enabled.");
|
||||
} catch (IOException e) {
|
||||
} catch (IOException ignored) {
|
||||
log(C.PREFIX.s() + "&cFailed to load up metrics.");
|
||||
}
|
||||
}
|
||||
@ -376,7 +377,7 @@ public class SpongeMain implements IPlotMain {
|
||||
try {
|
||||
MainUtil.canSendChunk = true;
|
||||
return new FastQueue();
|
||||
} catch (Throwable e) {
|
||||
} catch (RuntimeException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
@ -412,10 +413,7 @@ public class SpongeMain implements IPlotMain {
|
||||
|
||||
@Override
|
||||
public List<String> getPluginIds() {
|
||||
ArrayList<String> names = new ArrayList<>();
|
||||
for (PluginContainer plugin : this.game.getPluginManager().getPlugins()) {
|
||||
names.add(plugin.getName() + ";" + plugin.getVersion() + ":" + true);
|
||||
}
|
||||
return names;
|
||||
return this.game.getPluginManager().getPlugins().stream().map(plugin1 -> plugin1.getName() + ';' + plugin1.getVersion() + ':' + true)
|
||||
.collect(Collectors.toCollection(ArrayList::new));
|
||||
}
|
||||
}
|
||||
|
@ -30,7 +30,7 @@ public class SpongeCommand implements CommandCallable {
|
||||
UUID uuid = UUID.fromString(id);
|
||||
Player player = SpongeMain.THIS.getServer().getPlayer(uuid).get();
|
||||
pp = SpongeUtil.getPlayer(player);
|
||||
} catch (Exception e) {
|
||||
} catch (Exception ignored) {
|
||||
pp = ConsolePlayer.getConsole();
|
||||
}
|
||||
MainCommand.onCommand(pp, string.isEmpty() ? new String[]{} : string.split(" "));
|
||||
|
Loading…
Reference in New Issue
Block a user