diff --git a/src/main/java/com/intellectualcrafters/json/JSONArray.java b/src/main/java/com/intellectualcrafters/json/JSONArray.java index 2b8587aad..103049a5f 100644 --- a/src/main/java/com/intellectualcrafters/json/JSONArray.java +++ b/src/main/java/com/intellectualcrafters/json/JSONArray.java @@ -199,7 +199,7 @@ public class JSONArray { final Object object = get(index); try { 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."); } } @@ -217,7 +217,7 @@ public class JSONArray { final Object object = get(index); try { 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."); } } @@ -269,7 +269,7 @@ public class JSONArray { final Object object = get(index); try { 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."); } } @@ -368,7 +368,7 @@ public class JSONArray { public boolean optBoolean(final int index, final boolean defaultValue) { try { return getBoolean(index); - } catch (final Exception e) { + } catch (JSONException e) { return defaultValue; } } @@ -397,7 +397,7 @@ public class JSONArray { public double optDouble(final int index, final double defaultValue) { try { return getDouble(index); - } catch (final Exception e) { + } catch (JSONException e) { return defaultValue; } } @@ -426,7 +426,7 @@ public class JSONArray { public int optInt(final int index, final int defaultValue) { try { return getInt(index); - } catch (final Exception e) { + } catch (JSONException e) { return defaultValue; } } @@ -480,7 +480,7 @@ public class JSONArray { public long optLong(final int index, final long defaultValue) { try { return getLong(index); - } catch (final Exception e) { + } catch (JSONException e) { return defaultValue; } } @@ -798,7 +798,7 @@ public class JSONArray { public String toString() { try { return this.toString(0); - } catch (final Exception e) { + } catch (JSONException e) { return null; } } diff --git a/src/main/java/com/intellectualcrafters/json/JSONObject.java b/src/main/java/com/intellectualcrafters/json/JSONObject.java index c413e8510..d8b53c523 100644 --- a/src/main/java/com/intellectualcrafters/json/JSONObject.java +++ b/src/main/java/com/intellectualcrafters/json/JSONObject.java @@ -4,6 +4,7 @@ import java.io.IOException; import java.io.StringWriter; import java.io.Writer; import java.lang.reflect.Field; +import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; import java.lang.reflect.Modifier; import java.util.Collection; @@ -87,7 +88,8 @@ public class JSONObject { for (final String name : names) { try { putOnce(name, jo.opt(name)); - } catch (final Exception ignore) {} + } catch (JSONException ignore) { + } } } @@ -192,7 +194,8 @@ public class JSONObject { for (final String name : names) { try { 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; } @@ -514,7 +518,7 @@ public class JSONObject { } catch (final Exception e) { throw new JSONException(e); } - if (object instanceof String) { + if (object != null) { return (String) object; } throw new JSONException("Bad value from toJSONString: " + object); @@ -553,18 +557,18 @@ public class JSONObject { return NULL; } if ((object instanceof JSONObject) - || (object instanceof JSONArray) - || NULL.equals(object) - || (object instanceof JSONString) - || (object instanceof Byte) - || (object instanceof Character) - || (object instanceof Short) - || (object instanceof Integer) - || (object instanceof Long) - || (object instanceof Boolean) - || (object instanceof Float) - || (object instanceof Double) - || (object instanceof String)) { + || (object instanceof JSONArray) + || NULL.equals(object) + || (object instanceof JSONString) + || (object instanceof Byte) + || (object instanceof Character) + || (object instanceof Short) + || (object instanceof Integer) + || (object instanceof Long) + || (object instanceof Boolean) + || (object instanceof Float) + || (object instanceof Double) + || (object instanceof String)) { return object; } if (object instanceof Collection) { @@ -582,7 +586,7 @@ public class JSONObject { return object.toString(); } return new JSONObject(object); - } catch (final Exception exception) { + } catch (JSONException exception) { return null; } } @@ -730,7 +734,7 @@ public class JSONObject { final Object object = get(key); try { 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."); } } @@ -748,7 +752,7 @@ public class JSONObject { final Object object = get(key); try { 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."); } } @@ -800,7 +804,7 @@ public class JSONObject { final Object object = get(key); try { 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."); } } @@ -949,7 +953,7 @@ public class JSONObject { public boolean optBoolean(final String key, final boolean defaultValue) { try { return getBoolean(key); - } catch (final Exception e) { + } catch (JSONException e) { return defaultValue; } } @@ -978,7 +982,7 @@ public class JSONObject { public double optDouble(final String key, final double defaultValue) { try { return getDouble(key); - } catch (final Exception e) { + } catch (JSONException e) { return defaultValue; } } @@ -1007,7 +1011,7 @@ public class JSONObject { public int optInt(final String key, final int defaultValue) { try { return getInt(key); - } catch (final Exception e) { + } catch (JSONException e) { return defaultValue; } } @@ -1062,7 +1066,7 @@ public class JSONObject { public long optLong(final String key, final long defaultValue) { try { return getLong(key); - } catch (final Exception e) { + } catch (JSONException e) { 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() { try { return this.toString(0); - } catch (final Exception e) { + } catch (JSONException e) { return null; } } @@ -1471,7 +1476,7 @@ public class JSONObject { protected final Object clone() { try { return super.clone(); - } catch (final Exception e) { + } catch (CloneNotSupportedException e) { return this; } } diff --git a/src/main/java/com/intellectualcrafters/json/XML.java b/src/main/java/com/intellectualcrafters/json/XML.java index 40f063fbb..2190b6311 100644 --- a/src/main/java/com/intellectualcrafters/json/XML.java +++ b/src/main/java/com/intellectualcrafters/json/XML.java @@ -235,9 +235,7 @@ public class XML { if ("null".equalsIgnoreCase(string)) { return JSONObject.NULL; } - // 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. + //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. try { final char initial = string.charAt(0); if ((initial == '-') || ((initial >= '0') && (initial <= '9'))) { @@ -246,13 +244,14 @@ public class XML { return value; } } - } catch (final Exception ignore) { + } catch (NumberFormatException ignore) { try { final Double value = new Double(string); if (value.toString().equals(string)) { return value; } - } catch (final Exception ignoreAlso) {} + } catch (NumberFormatException ignoreAlso) { + } } return string; } diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Area.java b/src/main/java/com/intellectualcrafters/plot/commands/Area.java index 6a47420da..f3c9f01a4 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Area.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Area.java @@ -440,7 +440,7 @@ public class Area extends SubCommand { } 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); - 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); return true; } diff --git a/src/main/java/com/intellectualcrafters/plot/commands/Auto.java b/src/main/java/com/intellectualcrafters/plot/commands/Auto.java index 4a274ced4..a96f7cebe 100644 --- a/src/main/java/com/intellectualcrafters/plot/commands/Auto.java +++ b/src/main/java/com/intellectualcrafters/plot/commands/Auto.java @@ -93,7 +93,7 @@ public class Auto extends SubCommand { if (args.length > 1) { schematic = args[1]; } - } catch (final Exception e) { + } catch (NumberFormatException e) { size_x = 1; size_z = 1; schematic = args[0]; diff --git a/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java b/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java index 0b9bf3551..ac8d11519 100644 --- a/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java +++ b/src/main/java/com/intellectualcrafters/plot/database/AbstractDB.java @@ -20,15 +20,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// 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.object.Plot; 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.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); /** - * Purgle a plot + * Purge a plot * * @param uniqueIds list of plot id (db) to be purged */ diff --git a/src/main/java/com/intellectualcrafters/plot/object/Plot.java b/src/main/java/com/intellectualcrafters/plot/object/Plot.java index fee67be64..0747d797b 100644 --- a/src/main/java/com/intellectualcrafters/plot/object/Plot.java +++ b/src/main/java/com/intellectualcrafters/plot/object/Plot.java @@ -20,25 +20,6 @@ //////////////////////////////////////////////////////////////////////////////////////////////////// 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.intellectualcrafters.jnbt.CompoundTag; import com.intellectualcrafters.plot.PS; @@ -60,6 +41,25 @@ import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.WorldUtil; 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 */ @@ -1089,7 +1089,7 @@ public class Plot { 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); 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; } @@ -1134,7 +1134,7 @@ public class Plot { x = bot.getX() + this.area.DEFAULT_HOME.x; 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); } // Side @@ -1142,7 +1142,7 @@ public class Plot { final int x = ((largest.maxX - largest.minX) / 2) + largest.minX; final int z = largest.minZ - 1; 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); } @@ -1933,7 +1933,7 @@ public class Plot { * 3 = west
* @param max The max number of merges to do * @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 */ 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)
+ * Get all the corners of the plot (supports non-rectangular shapes)
* @return */ public List getAllCorners() { diff --git a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java index 74f5d806d..e5ec725c9 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java +++ b/src/main/java/com/intellectualcrafters/plot/util/MainUtil.java @@ -452,7 +452,7 @@ public class MainUtil { * @return */ 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) { return 64; } diff --git a/src/main/java/com/intellectualcrafters/plot/util/WorldUtil.java b/src/main/java/com/intellectualcrafters/plot/util/WorldUtil.java index f8c8ecf89..75704efd6 100644 --- a/src/main/java/com/intellectualcrafters/plot/util/WorldUtil.java +++ b/src/main/java/com/intellectualcrafters/plot/util/WorldUtil.java @@ -30,7 +30,7 @@ public abstract class WorldUtil { 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); diff --git a/src/main/java/com/plotsquared/bukkit/chat/FancyMessage.java b/src/main/java/com/plotsquared/bukkit/chat/FancyMessage.java index ede5ea4e7..e4a985d83 100644 --- a/src/main/java/com/plotsquared/bukkit/chat/FancyMessage.java +++ b/src/main/java/com/plotsquared/bukkit/chat/FancyMessage.java @@ -2,6 +2,24 @@ package com.plotsquared.bukkit.chat; 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.StringWriter; import java.lang.reflect.Constructor; @@ -18,25 +36,6 @@ import java.util.List; import java.util.Map; import java.util.logging.Level; -import org.bukkit.Achievement; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.Material; -import org.bukkit.Statistic; -import org.bukkit.Statistic.Type; -import org.bukkit.command.CommandSender; -import org.bukkit.entity.EntityType; -import org.bukkit.entity.Player; -import org.bukkit.inventory.ItemStack; - -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -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 JSON message formatter. * This class allows plugins to emulate the functionality of the vanilla Minecraft tellraw command. @@ -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")); 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): *
    *
  1. The color of each message part.
  2. - *
  3. The applicable stylizations for each message part.
  4. + *
  5. The applicable stylization for each message part.
  6. *
  7. The core text of the message part.
  8. *
* 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. * It is not intended for direct public API consumption. * @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(); /** - * 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. * @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) { final JsonObject serialized = _stringParser.parse(json).getAsJsonObject(); diff --git a/src/main/java/com/plotsquared/bukkit/database/plotme/PlotMeConnector_017.java b/src/main/java/com/plotsquared/bukkit/database/plotme/PlotMeConnector_017.java index af0187f8b..22091f0ca 100644 --- a/src/main/java/com/plotsquared/bukkit/database/plotme/PlotMeConnector_017.java +++ b/src/main/java/com/plotsquared/bukkit/database/plotme/PlotMeConnector_017.java @@ -58,7 +58,7 @@ public class PlotMeConnector_017 extends APlotMeConnector { try { stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "core_plots`"); r = stmt.executeQuery(); - } catch (Exception e) { + } catch (SQLException e) { PS.debug("========= Table does not exist ========="); e.printStackTrace(); PS.debug("======================================="); @@ -114,9 +114,7 @@ public class PlotMeConnector_017 extends APlotMeConnector { final byte[] bytes = r.getBytes("ownerid"); if (bytes != null) { owner = UUID.nameUUIDFromBytes(bytes); - if (owner != null) { - UUIDHandler.add(new StringWrapper(name), owner); - } + UUIDHandler.add(new StringWrapper(name), owner); } } catch (final Exception e) { e.printStackTrace(); @@ -148,7 +146,7 @@ public class PlotMeConnector_017 extends APlotMeConnector { PS.log(" - " + plugin + "core_denied"); stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "core_denied`"); r = stmt.executeQuery(); - + while (r.next()) { final int key = r.getInt("plot_id"); final Plot plot = plots.get(key); @@ -159,11 +157,11 @@ public class PlotMeConnector_017 extends APlotMeConnector { final UUID denied = UUID.fromString(r.getString("player")); plot.getDenied().add(denied); } - + PS.log(" - " + plugin + "core_allowed"); stmt = connection.prepareStatement("SELECT * FROM `" + plugin + "core_allowed`"); r = stmt.executeQuery(); - + while (r.next()) { final int key = r.getInt("plot_id"); final Plot plot = plots.get(key); @@ -176,8 +174,8 @@ public class PlotMeConnector_017 extends APlotMeConnector { } r.close(); stmt.close(); - - } catch (final Exception e) { + + } catch (SQLException e) { e.printStackTrace(); } final HashMap> processed = new HashMap<>(); diff --git a/src/main/java/com/plotsquared/bukkit/generator/BukkitAugmentedGenerator.java b/src/main/java/com/plotsquared/bukkit/generator/BukkitAugmentedGenerator.java index b94ed2261..e69c4c66c 100644 --- a/src/main/java/com/plotsquared/bukkit/generator/BukkitAugmentedGenerator.java +++ b/src/main/java/com/plotsquared/bukkit/generator/BukkitAugmentedGenerator.java @@ -1,23 +1,22 @@ package com.plotsquared.bukkit.generator; -import java.util.Random; - +import com.intellectualcrafters.plot.generator.AugmentedUtils; import org.bukkit.Chunk; import org.bukkit.World; import org.bukkit.generator.BlockPopulator; -import com.intellectualcrafters.plot.generator.AugmentedUtils; +import java.util.Random; public class BukkitAugmentedGenerator extends BlockPopulator { private static BukkitAugmentedGenerator generator; - private BukkitAugmentedGenerator() {}; - + private BukkitAugmentedGenerator() {} + public static BukkitAugmentedGenerator get(World world) { - for (BlockPopulator poplator : world.getPopulators()) { - if (poplator instanceof BukkitAugmentedGenerator) { - return (BukkitAugmentedGenerator) poplator; + for (BlockPopulator populator : world.getPopulators()) { + if (populator instanceof BukkitAugmentedGenerator) { + return (BukkitAugmentedGenerator) populator; } } if (generator == null) { diff --git a/src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java b/src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java index 010ccbbbe..03b7b73a1 100644 --- a/src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java +++ b/src/main/java/com/plotsquared/bukkit/util/BukkitChunkManager.java @@ -664,11 +664,11 @@ public class BukkitChunkManager extends ChunkManager { SetQueue.IMP.queue.sendChunk(world, Collections.singletonList(loc)); for (Entry entry : UUIDHandler.getPlayers().entrySet()) { PlotPlayer pp = entry.getValue(); - Location ploc = pp.getLocation(); - if (!ploc.getChunkLoc().equals(loc)) { + Location pLoc = pp.getLocation(); + if (!pLoc.getChunkLoc().equals(loc)) { continue; } - PlotBlock plotblock = WorldUtil.IMP.getBlock(ploc); + PlotBlock plotblock = WorldUtil.IMP.getBlock(pLoc); if (plotblock.id != 0) { Plot plot = pp.getCurrentPlot(); pp.teleport(plot.getDefaultHome()); diff --git a/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java b/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java index a83e963af..47f95df22 100644 --- a/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java +++ b/src/main/java/com/plotsquared/bukkit/util/BukkitUtil.java @@ -163,7 +163,7 @@ public class BukkitUtil extends WorldUtil { } @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(); } diff --git a/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_7.java b/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_7.java index 17b7b15a2..69e84301c 100644 --- a/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_7.java +++ b/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_7.java @@ -2,16 +2,6 @@ package com.plotsquared.bukkit.util.block; 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.PlotBlock; 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.plotsquared.bukkit.util.BukkitUtil; 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 { @@ -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 */ @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 */ @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 locs */ diff --git a/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_8.java b/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_8.java index 65349ff63..78ae31f71 100644 --- a/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_8.java +++ b/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_8.java @@ -2,17 +2,6 @@ package com.plotsquared.bukkit.util.block; 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.PlotBlock; 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.plotsquared.bukkit.util.BukkitUtil; 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 { @@ -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 */ @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 */ @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 */ @Override diff --git a/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_8_3.java b/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_8_3.java index fa76f9d95..a1021c83d 100644 --- a/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_8_3.java +++ b/src/main/java/com/plotsquared/bukkit/util/block/FastQueue_1_8_3.java @@ -2,23 +2,6 @@ package com.plotsquared.bukkit.util.block; 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.PseudoRandom; 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.plotsquared.bukkit.util.BukkitUtil; 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 { @@ -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 */ @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 */ @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 */ @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 locs */