Fix Typos and Various little things.

This commit is contained in:
Matt 2016-02-19 11:55:00 -05:00
parent c592790f68
commit 2a2c85a642
17 changed files with 172 additions and 172 deletions

View File

@ -199,7 +199,7 @@ public class JSONArray {
final Object object = get(index); final Object object = get(index);
try { try {
return object instanceof Number ? ((Number) object).doubleValue() : Double.parseDouble((String) object); return object instanceof Number ? ((Number) object).doubleValue() : Double.parseDouble((String) object);
} catch (final Exception e) { } catch (NumberFormatException e) {
throw new JSONException("JSONArray[" + index + "] is not a number."); throw new JSONException("JSONArray[" + index + "] is not a number.");
} }
} }
@ -217,7 +217,7 @@ public class JSONArray {
final Object object = get(index); final Object object = get(index);
try { try {
return object instanceof Number ? ((Number) object).intValue() : Integer.parseInt((String) object); return object instanceof Number ? ((Number) object).intValue() : Integer.parseInt((String) object);
} catch (final Exception e) { } catch (NumberFormatException e) {
throw new JSONException("JSONArray[" + index + "] is not a number."); throw new JSONException("JSONArray[" + index + "] is not a number.");
} }
} }
@ -269,7 +269,7 @@ public class JSONArray {
final Object object = get(index); final Object object = get(index);
try { try {
return object instanceof Number ? ((Number) object).longValue() : Long.parseLong((String) object); return object instanceof Number ? ((Number) object).longValue() : Long.parseLong((String) object);
} catch (final Exception e) { } catch (NumberFormatException e) {
throw new JSONException("JSONArray[" + index + "] is not a number."); throw new JSONException("JSONArray[" + index + "] is not a number.");
} }
} }
@ -368,7 +368,7 @@ public class JSONArray {
public boolean optBoolean(final int index, final boolean defaultValue) { public boolean optBoolean(final int index, final boolean defaultValue) {
try { try {
return getBoolean(index); return getBoolean(index);
} catch (final Exception e) { } catch (JSONException e) {
return defaultValue; return defaultValue;
} }
} }
@ -397,7 +397,7 @@ public class JSONArray {
public double optDouble(final int index, final double defaultValue) { public double optDouble(final int index, final double defaultValue) {
try { try {
return getDouble(index); return getDouble(index);
} catch (final Exception e) { } catch (JSONException e) {
return defaultValue; return defaultValue;
} }
} }
@ -426,7 +426,7 @@ public class JSONArray {
public int optInt(final int index, final int defaultValue) { public int optInt(final int index, final int defaultValue) {
try { try {
return getInt(index); return getInt(index);
} catch (final Exception e) { } catch (JSONException e) {
return defaultValue; return defaultValue;
} }
} }
@ -480,7 +480,7 @@ public class JSONArray {
public long optLong(final int index, final long defaultValue) { public long optLong(final int index, final long defaultValue) {
try { try {
return getLong(index); return getLong(index);
} catch (final Exception e) { } catch (JSONException e) {
return defaultValue; return defaultValue;
} }
} }
@ -798,7 +798,7 @@ public class JSONArray {
public String toString() { public String toString() {
try { try {
return this.toString(0); return this.toString(0);
} catch (final Exception e) { } catch (JSONException e) {
return null; return null;
} }
} }

View File

@ -4,6 +4,7 @@ import java.io.IOException;
import java.io.StringWriter; import java.io.StringWriter;
import java.io.Writer; import java.io.Writer;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import java.util.Collection; import java.util.Collection;
@ -87,7 +88,8 @@ public class JSONObject {
for (final String name : names) { for (final String name : names) {
try { try {
putOnce(name, jo.opt(name)); putOnce(name, jo.opt(name));
} catch (final Exception ignore) {} } catch (JSONException ignore) {
}
} }
} }
@ -192,7 +194,8 @@ public class JSONObject {
for (final String name : names) { for (final String name : names) {
try { try {
putOpt(name, c.getField(name).get(object)); putOpt(name, c.getField(name).get(object));
} catch (final Exception ignore) {} } catch (JSONException | SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException ignore) {
}
} }
} }
@ -458,7 +461,8 @@ public class JSONObject {
} }
} }
} }
} catch (final Exception ignore) {} } catch (NumberFormatException ignore) {
}
} }
return string; return string;
} }
@ -514,7 +518,7 @@ public class JSONObject {
} catch (final Exception e) { } catch (final Exception e) {
throw new JSONException(e); throw new JSONException(e);
} }
if (object instanceof String) { if (object != null) {
return (String) object; return (String) object;
} }
throw new JSONException("Bad value from toJSONString: " + object); throw new JSONException("Bad value from toJSONString: " + object);
@ -553,18 +557,18 @@ public class JSONObject {
return NULL; return NULL;
} }
if ((object instanceof JSONObject) if ((object instanceof JSONObject)
|| (object instanceof JSONArray) || (object instanceof JSONArray)
|| NULL.equals(object) || NULL.equals(object)
|| (object instanceof JSONString) || (object instanceof JSONString)
|| (object instanceof Byte) || (object instanceof Byte)
|| (object instanceof Character) || (object instanceof Character)
|| (object instanceof Short) || (object instanceof Short)
|| (object instanceof Integer) || (object instanceof Integer)
|| (object instanceof Long) || (object instanceof Long)
|| (object instanceof Boolean) || (object instanceof Boolean)
|| (object instanceof Float) || (object instanceof Float)
|| (object instanceof Double) || (object instanceof Double)
|| (object instanceof String)) { || (object instanceof String)) {
return object; return object;
} }
if (object instanceof Collection) { if (object instanceof Collection) {
@ -582,7 +586,7 @@ public class JSONObject {
return object.toString(); return object.toString();
} }
return new JSONObject(object); return new JSONObject(object);
} catch (final Exception exception) { } catch (JSONException exception) {
return null; return null;
} }
} }
@ -730,7 +734,7 @@ public class JSONObject {
final Object object = get(key); final Object object = get(key);
try { try {
return object instanceof Number ? ((Number) object).doubleValue() : Double.parseDouble((String) object); return object instanceof Number ? ((Number) object).doubleValue() : Double.parseDouble((String) object);
} catch (final Exception e) { } catch (NumberFormatException e) {
throw new JSONException("JSONObject[" + quote(key) + "] is not a number."); throw new JSONException("JSONObject[" + quote(key) + "] is not a number.");
} }
} }
@ -748,7 +752,7 @@ public class JSONObject {
final Object object = get(key); final Object object = get(key);
try { try {
return object instanceof Number ? ((Number) object).intValue() : Integer.parseInt((String) object); return object instanceof Number ? ((Number) object).intValue() : Integer.parseInt((String) object);
} catch (final Exception e) { } catch (NumberFormatException e) {
throw new JSONException("JSONObject[" + quote(key) + "] is not an int."); throw new JSONException("JSONObject[" + quote(key) + "] is not an int.");
} }
} }
@ -800,7 +804,7 @@ public class JSONObject {
final Object object = get(key); final Object object = get(key);
try { try {
return object instanceof Number ? ((Number) object).longValue() : Long.parseLong((String) object); return object instanceof Number ? ((Number) object).longValue() : Long.parseLong((String) object);
} catch (final Exception e) { } catch (NumberFormatException e) {
throw new JSONException("JSONObject[" + quote(key) + "] is not a long."); throw new JSONException("JSONObject[" + quote(key) + "] is not a long.");
} }
} }
@ -949,7 +953,7 @@ public class JSONObject {
public boolean optBoolean(final String key, final boolean defaultValue) { public boolean optBoolean(final String key, final boolean defaultValue) {
try { try {
return getBoolean(key); return getBoolean(key);
} catch (final Exception e) { } catch (JSONException e) {
return defaultValue; return defaultValue;
} }
} }
@ -978,7 +982,7 @@ public class JSONObject {
public double optDouble(final String key, final double defaultValue) { public double optDouble(final String key, final double defaultValue) {
try { try {
return getDouble(key); return getDouble(key);
} catch (final Exception e) { } catch (JSONException e) {
return defaultValue; return defaultValue;
} }
} }
@ -1007,7 +1011,7 @@ public class JSONObject {
public int optInt(final String key, final int defaultValue) { public int optInt(final String key, final int defaultValue) {
try { try {
return getInt(key); return getInt(key);
} catch (final Exception e) { } catch (JSONException e) {
return defaultValue; return defaultValue;
} }
} }
@ -1062,7 +1066,7 @@ public class JSONObject {
public long optLong(final String key, final long defaultValue) { public long optLong(final String key, final long defaultValue) {
try { try {
return getLong(key); return getLong(key);
} catch (final Exception e) { } catch (JSONException e) {
return defaultValue; return defaultValue;
} }
} }
@ -1123,7 +1127,8 @@ public class JSONObject {
} }
} }
} }
} catch (final Exception ignore) {} } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ignore) {
}
} }
} }
@ -1365,7 +1370,7 @@ public class JSONObject {
public String toString() { public String toString() {
try { try {
return this.toString(0); return this.toString(0);
} catch (final Exception e) { } catch (JSONException e) {
return null; return null;
} }
} }
@ -1471,7 +1476,7 @@ public class JSONObject {
protected final Object clone() { protected final Object clone() {
try { try {
return super.clone(); return super.clone();
} catch (final Exception e) { } catch (CloneNotSupportedException e) {
return this; return this;
} }
} }

View File

@ -235,9 +235,7 @@ public class XML {
if ("null".equalsIgnoreCase(string)) { if ("null".equalsIgnoreCase(string)) {
return JSONObject.NULL; return JSONObject.NULL;
} }
// If it might be a number, try converting it, first as a Long, and then //If it might be a number, try converting it, first as a Long, and then as a Double. If that doesn't work, return the string.
// as a
// Double. If that doesn't work, return the string.
try { try {
final char initial = string.charAt(0); final char initial = string.charAt(0);
if ((initial == '-') || ((initial >= '0') && (initial <= '9'))) { if ((initial == '-') || ((initial >= '0') && (initial <= '9'))) {
@ -246,13 +244,14 @@ public class XML {
return value; return value;
} }
} }
} catch (final Exception ignore) { } catch (NumberFormatException ignore) {
try { try {
final Double value = new Double(string); final Double value = new Double(string);
if (value.toString().equals(string)) { if (value.toString().equals(string)) {
return value; return value;
} }
} catch (final Exception ignoreAlso) {} } catch (NumberFormatException ignoreAlso) {
}
} }
return string; return string;
} }

View File

@ -440,7 +440,7 @@ public class Area extends SubCommand {
} }
RegionWrapper region = area.getRegion(); RegionWrapper region = area.getRegion();
Location center = new Location(area.worldname, region.minX + (region.maxX - region.minX) / 2, 0, region.minZ + (region.maxZ - region.minZ) / 2); Location center = new Location(area.worldname, region.minX + (region.maxX - region.minX) / 2, 0, region.minZ + (region.maxZ - region.minZ) / 2);
center.setY(WorldUtil.IMP.getHeighestBlock(area.worldname, center.getX(), center.getZ())); center.setY(WorldUtil.IMP.getHighestBlock(area.worldname, center.getX(), center.getZ()));
plr.teleport(center); plr.teleport(center);
return true; return true;
} }

View File

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

View File

@ -20,15 +20,6 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.database; package com.intellectualcrafters.plot.database;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
import com.intellectualcrafters.plot.flag.Flag; import com.intellectualcrafters.plot.flag.Flag;
import com.intellectualcrafters.plot.object.Plot; import com.intellectualcrafters.plot.object.Plot;
import com.intellectualcrafters.plot.object.PlotArea; import com.intellectualcrafters.plot.object.PlotArea;
@ -38,6 +29,15 @@ import com.intellectualcrafters.plot.object.PlotPlayer;
import com.intellectualcrafters.plot.object.RunnableVal; import com.intellectualcrafters.plot.object.RunnableVal;
import com.intellectualcrafters.plot.object.comment.PlotComment; import com.intellectualcrafters.plot.object.comment.PlotComment;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.UUID;
/** /**
@ -191,7 +191,7 @@ public interface AbstractDB {
void setAlias(final Plot plot, final String alias); void setAlias(final Plot plot, final String alias);
/** /**
* Purgle a plot * Purge a plot
* *
* @param uniqueIds list of plot id (db) to be purged * @param uniqueIds list of plot id (db) to be purged
*/ */

View File

@ -20,25 +20,6 @@
//////////////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////////////////
package com.intellectualcrafters.plot.object; package com.intellectualcrafters.plot.object;
import java.awt.Rectangle;
import java.awt.geom.Area;
import java.awt.geom.PathIterator;
import java.io.File;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
import com.google.common.collect.BiMap; import com.google.common.collect.BiMap;
import com.intellectualcrafters.jnbt.CompoundTag; import com.intellectualcrafters.jnbt.CompoundTag;
import com.intellectualcrafters.plot.PS; import com.intellectualcrafters.plot.PS;
@ -60,6 +41,25 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.util.WorldUtil; import com.intellectualcrafters.plot.util.WorldUtil;
import com.plotsquared.listener.PlotListener; import com.plotsquared.listener.PlotListener;
import java.awt.Rectangle;
import java.awt.geom.Area;
import java.awt.geom.PathIterator;
import java.io.File;
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayDeque;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import java.util.UUID;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicInteger;
/** /**
* The plot class * The plot class
*/ */
@ -1089,7 +1089,7 @@ public class Plot {
final Location bot = this.getBottomAbs(); final Location bot = this.getBottomAbs();
final Location loc = new Location(bot.getWorld(), bot.getX() + home.x, bot.getY() + home.y, bot.getZ() + home.z, home.yaw, home.pitch); final Location loc = new Location(bot.getWorld(), bot.getX() + home.x, bot.getY() + home.y, bot.getZ() + home.z, home.yaw, home.pitch);
if (WorldUtil.IMP.getBlock(loc).id != 0) { if (WorldUtil.IMP.getBlock(loc).id != 0) {
loc.setY(Math.max(WorldUtil.IMP.getHeighestBlock(this.area.worldname, loc.getX(), loc.getZ()), bot.getY())); loc.setY(Math.max(WorldUtil.IMP.getHighestBlock(this.area.worldname, loc.getX(), loc.getZ()), bot.getY()));
} }
return loc; return loc;
} }
@ -1134,7 +1134,7 @@ public class Plot {
x = bot.getX() + this.area.DEFAULT_HOME.x; x = bot.getX() + this.area.DEFAULT_HOME.x;
z = bot.getZ() + this.area.DEFAULT_HOME.z; z = bot.getZ() + this.area.DEFAULT_HOME.z;
} }
final int y = WorldUtil.IMP.getHeighestBlock(plot.area.worldname, x, z); final int y = WorldUtil.IMP.getHighestBlock(plot.area.worldname, x, z);
return new Location(plot.area.worldname, x, y + 1, z); return new Location(plot.area.worldname, x, y + 1, z);
} }
// Side // Side
@ -1142,7 +1142,7 @@ public class Plot {
final int x = ((largest.maxX - largest.minX) / 2) + largest.minX; final int x = ((largest.maxX - largest.minX) / 2) + largest.minX;
final int z = largest.minZ - 1; final int z = largest.minZ - 1;
final PlotManager manager = plot.getManager(); final PlotManager manager = plot.getManager();
final int y = Math.max(WorldUtil.IMP.getHeighestBlock(plot.area.worldname, x, z), manager.getSignLoc(plot.area, plot).getY()); final int y = Math.max(WorldUtil.IMP.getHighestBlock(plot.area.worldname, x, z), manager.getSignLoc(plot.area, plot).getY());
return new Location(plot.area.worldname, x, y + 1, z); return new Location(plot.area.worldname, x, y + 1, z);
} }
@ -1933,7 +1933,7 @@ public class Plot {
* 3 = west<br> * 3 = west<br>
* @param max The max number of merges to do * @param max The max number of merges to do
* @param uuid The UUID it is allowed to merge with * @param uuid The UUID it is allowed to merge with
* @param removeRoads Wether to remove roads * @param removeRoads Whether to remove roads
* @return true if a merge takes place * @return true if a merge takes place
*/ */
public boolean autoMerge(final int dir, int max, final UUID uuid, final boolean removeRoads) { public boolean autoMerge(final int dir, int max, final UUID uuid, final boolean removeRoads) {
@ -2355,7 +2355,7 @@ public class Plot {
} }
/** /**
* Get all the corners of the plot (supports non-recangular shapes)<br> * Get all the corners of the plot (supports non-rectangular shapes)<br>
* @return * @return
*/ */
public List<Location> getAllCorners() { public List<Location> getAllCorners() {

View File

@ -452,7 +452,7 @@ public class MainUtil {
* @return * @return
*/ */
public static int getHeighestBlock(final String world, final int x, final int z) { public static int getHeighestBlock(final String world, final int x, final int z) {
final int result = WorldUtil.IMP.getHeighestBlock(world, x, z); final int result = WorldUtil.IMP.getHighestBlock(world, x, z);
if (result == 0) { if (result == 0) {
return 64; return 64;
} }

View File

@ -30,7 +30,7 @@ public abstract class WorldUtil {
public abstract PlotBlock getBlock(Location location); public abstract PlotBlock getBlock(Location location);
public abstract int getHeighestBlock(String world, int x, int z); public abstract int getHighestBlock(String world, int x, int z);
public abstract boolean addItems(String world, PlotItem item); public abstract boolean addItems(String world, PlotItem item);

View File

@ -2,6 +2,24 @@ package com.plotsquared.bukkit.chat;
import static com.plotsquared.bukkit.chat.TextualComponent.rawText; import static com.plotsquared.bukkit.chat.TextualComponent.rawText;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.stream.JsonWriter;
import com.intellectualcrafters.configuration.serialization.ConfigurationSerializable;
import com.intellectualcrafters.configuration.serialization.ConfigurationSerialization;
import org.bukkit.Achievement;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Statistic;
import org.bukkit.Statistic.Type;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import java.io.IOException; import java.io.IOException;
import java.io.StringWriter; import java.io.StringWriter;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
@ -18,25 +36,6 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.logging.Level; import java.util.logging.Level;
import org.bukkit.Achievement;
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.Material;
import org.bukkit.Statistic;
import org.bukkit.Statistic.Type;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.EntityType;
import org.bukkit.entity.Player;
import org.bukkit.inventory.ItemStack;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.google.gson.stream.JsonWriter;
import com.intellectualcrafters.configuration.serialization.ConfigurationSerializable;
import com.intellectualcrafters.configuration.serialization.ConfigurationSerialization;
/** /**
* Represents a formattable message. Such messages can use elements such as colors, formatting codes, hover and click data, and other features provided by the vanilla Minecraft <a href="http://minecraft.gamepedia.com/Tellraw#Raw_JSON_Text">JSON message formatter</a>. * Represents a formattable message. Such messages can use elements such as colors, formatting codes, hover and click data, and other features provided by the vanilla Minecraft <a href="http://minecraft.gamepedia.com/Tellraw#Raw_JSON_Text">JSON message formatter</a>.
* This class allows plugins to emulate the functionality of the vanilla Minecraft <a href="http://minecraft.gamepedia.com/Commands#tellraw">tellraw command</a>. * This class allows plugins to emulate the functionality of the vanilla Minecraft <a href="http://minecraft.gamepedia.com/Commands#tellraw">tellraw command</a>.
@ -662,8 +661,11 @@ public class FancyMessage implements JsonRepresentedObject, Cloneable, Iterable<
} }
} }
// Since the method is so simple, and all the obfuscated methods have the same name, it's easier to reimplement 'IChatBaseComponent a(String)' than to reflectively call it /*
// Of course, the implementation may change, but fuzzy matches might break with signature changes Since the method is so simple, and all the obfuscated methods have the same name, it's easier to reimplement 'IChatBaseComponent a(String)'
than to reflectively call it
Of course, the implementation may change, but fuzzy matches might break with signature changes
*/
final Object serializedChatComponent = fromJsonMethod.invoke(nmsChatSerializerGsonInstance, json, Reflection.getNMSClass("IChatBaseComponent")); final Object serializedChatComponent = fromJsonMethod.invoke(nmsChatSerializerGsonInstance, json, Reflection.getNMSClass("IChatBaseComponent"));
return nmsPacketPlayOutChatConstructor.newInstance(serializedChatComponent); return nmsPacketPlayOutChatConstructor.newInstance(serializedChatComponent);
@ -699,7 +701,7 @@ public class FancyMessage implements JsonRepresentedObject, Cloneable, Iterable<
* Serialization of this message by using this message will include (in this order for each message part): * Serialization of this message by using this message will include (in this order for each message part):
* <ol> * <ol>
* <li>The color of each message part.</li> * <li>The color of each message part.</li>
* <li>The applicable stylizations for each message part.</li> * <li>The applicable stylization for each message part.</li>
* <li>The core text of the message part.</li> * <li>The core text of the message part.</li>
* </ol> * </ol>
* The primary omissions are tooltips and clickable actions. Consequently, this method should be used only as a last resort. * The primary omissions are tooltips and clickable actions. Consequently, this method should be used only as a last resort.
@ -748,7 +750,7 @@ public class FancyMessage implements JsonRepresentedObject, Cloneable, Iterable<
} }
/** /**
* Deserializes a JSON-represented message from a mapping of key-value pairs. * Deserialize a JSON-represented message from a mapping of key-value pairs.
* This is called by the Bukkit serialization API. * This is called by the Bukkit serialization API.
* It is not intended for direct public API consumption. * It is not intended for direct public API consumption.
* @param serialized The key-value mapping which represents a fancy message. * @param serialized The key-value mapping which represents a fancy message.
@ -773,10 +775,10 @@ public class FancyMessage implements JsonRepresentedObject, Cloneable, Iterable<
private static JsonParser _stringParser = new JsonParser(); private static JsonParser _stringParser = new JsonParser();
/** /**
* Deserializes a fancy message from its JSON representation. This JSON representation is of the format of * Deserialize a fancy message from its JSON representation. This JSON representation is of the format of
* that returned by {@link #toJSONString()}, and is compatible with vanilla inputs. * that returned by {@link #toJSONString()}, and is compatible with vanilla inputs.
* @param json The JSON string which represents a fancy message. * @param json The JSON string which represents a fancy message.
* @return A {@code FancyMessage} representing the parameterized JSON message. * @return A {@code FancyMessage} representing the parametrized JSON message.
*/ */
public static FancyMessage deserialize(final String json) { public static FancyMessage deserialize(final String json) {
final JsonObject serialized = _stringParser.parse(json).getAsJsonObject(); final JsonObject serialized = _stringParser.parse(json).getAsJsonObject();

View File

@ -58,7 +58,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
try { try {
stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "core_plots`"); stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "core_plots`");
r = stmt.executeQuery(); r = stmt.executeQuery();
} catch (Exception e) { } catch (SQLException e) {
PS.debug("========= Table does not exist ========="); PS.debug("========= Table does not exist =========");
e.printStackTrace(); e.printStackTrace();
PS.debug("======================================="); PS.debug("=======================================");
@ -114,9 +114,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
final byte[] bytes = r.getBytes("ownerid"); final byte[] bytes = r.getBytes("ownerid");
if (bytes != null) { if (bytes != null) {
owner = UUID.nameUUIDFromBytes(bytes); owner = UUID.nameUUIDFromBytes(bytes);
if (owner != null) { UUIDHandler.add(new StringWrapper(name), owner);
UUIDHandler.add(new StringWrapper(name), owner);
}
} }
} catch (final Exception e) { } catch (final Exception e) {
e.printStackTrace(); e.printStackTrace();
@ -177,7 +175,7 @@ public class PlotMeConnector_017 extends APlotMeConnector {
r.close(); r.close();
stmt.close(); stmt.close();
} catch (final Exception e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
} }
final HashMap<String, HashMap<PlotId, Plot>> processed = new HashMap<>(); final HashMap<String, HashMap<PlotId, Plot>> processed = new HashMap<>();

View File

@ -1,23 +1,22 @@
package com.plotsquared.bukkit.generator; package com.plotsquared.bukkit.generator;
import java.util.Random; import com.intellectualcrafters.plot.generator.AugmentedUtils;
import org.bukkit.Chunk; import org.bukkit.Chunk;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.generator.BlockPopulator; import org.bukkit.generator.BlockPopulator;
import com.intellectualcrafters.plot.generator.AugmentedUtils; import java.util.Random;
public class BukkitAugmentedGenerator extends BlockPopulator { public class BukkitAugmentedGenerator extends BlockPopulator {
private static BukkitAugmentedGenerator generator; private static BukkitAugmentedGenerator generator;
private BukkitAugmentedGenerator() {}; private BukkitAugmentedGenerator() {}
public static BukkitAugmentedGenerator get(World world) { public static BukkitAugmentedGenerator get(World world) {
for (BlockPopulator poplator : world.getPopulators()) { for (BlockPopulator populator : world.getPopulators()) {
if (poplator instanceof BukkitAugmentedGenerator) { if (populator instanceof BukkitAugmentedGenerator) {
return (BukkitAugmentedGenerator) poplator; return (BukkitAugmentedGenerator) populator;
} }
} }
if (generator == null) { if (generator == null) {

View File

@ -664,11 +664,11 @@ public class BukkitChunkManager extends ChunkManager {
SetQueue.IMP.queue.sendChunk(world, Collections.singletonList(loc)); SetQueue.IMP.queue.sendChunk(world, Collections.singletonList(loc));
for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) { for (Entry<String, PlotPlayer> entry : UUIDHandler.getPlayers().entrySet()) {
PlotPlayer pp = entry.getValue(); PlotPlayer pp = entry.getValue();
Location ploc = pp.getLocation(); Location pLoc = pp.getLocation();
if (!ploc.getChunkLoc().equals(loc)) { if (!pLoc.getChunkLoc().equals(loc)) {
continue; continue;
} }
PlotBlock plotblock = WorldUtil.IMP.getBlock(ploc); PlotBlock plotblock = WorldUtil.IMP.getBlock(pLoc);
if (plotblock.id != 0) { if (plotblock.id != 0) {
Plot plot = pp.getCurrentPlot(); Plot plot = pp.getCurrentPlot();
pp.teleport(plot.getDefaultHome()); pp.teleport(plot.getDefaultHome());

View File

@ -163,7 +163,7 @@ public class BukkitUtil extends WorldUtil {
} }
@Override @Override
public int getHeighestBlock(final String world, final int x, final int z) { public int getHighestBlock(final String world, final int x, final int z) {
return getWorld(world).getHighestBlockAt(x, z).getY(); return getWorld(world).getHighestBlockAt(x, z).getY();
} }

View File

@ -2,16 +2,6 @@ package com.plotsquared.bukkit.util.block;
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass; import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.block.Biome;
import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
@ -23,6 +13,15 @@ import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.bukkit.util.SendChunk; import com.plotsquared.bukkit.util.SendChunk;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.block.Biome;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
public class FastQueue_1_7 extends SlowQueue { public class FastQueue_1_7 extends SlowQueue {
@ -91,7 +90,7 @@ public class FastQueue_1_7 extends SlowQueue {
} }
/** /**
* This should be overriden by any specialized queues * This should be overridden by any specialized queues
* @param pc * @param pc
*/ */
@Override @Override
@ -144,7 +143,7 @@ public class FastQueue_1_7 extends SlowQueue {
} }
/** /**
* This should be overriden by any specialized queues * This should be overridden by any specialized queues
* @param wrap * @param wrap
*/ */
@Override @Override
@ -165,7 +164,7 @@ public class FastQueue_1_7 extends SlowQueue {
} }
/** /**
* This should be overriden by any specialized queues * This should be overridden by any specialized queues
* @param world * @param world
* @param locs * @param locs
*/ */

View File

@ -2,17 +2,6 @@ package com.plotsquared.bukkit.util.block;
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass; import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.PlotBlock; import com.intellectualcrafters.plot.object.PlotBlock;
import com.intellectualcrafters.plot.util.MainUtil; import com.intellectualcrafters.plot.util.MainUtil;
@ -25,6 +14,16 @@ import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.bukkit.util.SendChunk; import com.plotsquared.bukkit.util.SendChunk;
import org.bukkit.Chunk;
import org.bukkit.World;
import org.bukkit.block.Biome;
import org.bukkit.block.Block;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map.Entry;
public class FastQueue_1_8 extends SlowQueue { public class FastQueue_1_8 extends SlowQueue {
@ -349,7 +348,7 @@ public class FastQueue_1_8 extends SlowQueue {
} }
/** /**
* This should be overriden by any specialized queues * This should be overridden by any specialized queues
* @param wrap * @param wrap
*/ */
@Override @Override
@ -358,7 +357,7 @@ public class FastQueue_1_8 extends SlowQueue {
} }
/** /**
* This should be overriden by any specialized queues * This should be overridden by any specialized queues
* @param fixAll * @param fixAll
*/ */
@Override @Override
@ -369,7 +368,7 @@ public class FastQueue_1_8 extends SlowQueue {
} }
/** /**
* This should be overriden by any specialized queues * This should be overridden by any specialized queues
* @param locs * @param locs
*/ */
@Override @Override

View File

@ -2,23 +2,6 @@ package com.plotsquared.bukkit.util.block;
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass; import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import org.bukkit.Chunk;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.block.Biome;
import com.intellectualcrafters.plot.object.ChunkLoc; import com.intellectualcrafters.plot.object.ChunkLoc;
import com.intellectualcrafters.plot.object.PseudoRandom; import com.intellectualcrafters.plot.object.PseudoRandom;
import com.intellectualcrafters.plot.util.ChunkManager; import com.intellectualcrafters.plot.util.ChunkManager;
@ -34,6 +17,22 @@ import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper;
import com.intellectualcrafters.plot.util.TaskManager; import com.intellectualcrafters.plot.util.TaskManager;
import com.plotsquared.bukkit.util.BukkitUtil; import com.plotsquared.bukkit.util.BukkitUtil;
import com.plotsquared.bukkit.util.SendChunk; import com.plotsquared.bukkit.util.SendChunk;
import org.bukkit.Chunk;
import org.bukkit.Material;
import org.bukkit.World;
import org.bukkit.World.Environment;
import org.bukkit.block.Biome;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
public class FastQueue_1_8_3 extends SlowQueue { public class FastQueue_1_8_3 extends SlowQueue {
@ -123,7 +122,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
} }
/** /**
* This should be overriden by any specialized queues * This should be overridden by any specialized queues
* @param pc * @param pc
*/ */
@Override @Override
@ -257,7 +256,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
} }
/** /**
* This should be overriden by any specialized queues * This should be overridden by any specialized queues
* @param wrap * @param wrap
*/ */
@Override @Override
@ -266,7 +265,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
} }
/** /**
* This should be overriden by any specialized queues * This should be overridden by any specialized queues
* @param pc * @param pc
*/ */
@Override @Override
@ -405,7 +404,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
} }
/** /**
* This should be overriden by any specialized queues * This should be overridden by any specialized queues
* @param world * @param world
* @param locs * @param locs
*/ */