General changes

This commit is contained in:
MattBDev 2016-04-26 10:14:22 -04:00
parent 2c16c767e7
commit 669359cd37
27 changed files with 96 additions and 106 deletions

View file

@ -2,7 +2,7 @@ dependencies {
compile project(':Core') compile project(':Core')
compile 'org.bukkit:bukkit:1.9-R0.1-SNAPSHOT' compile 'org.bukkit:bukkit:1.9-R0.1-SNAPSHOT'
compile 'org.mcstats.bukkit:metrics:R7' compile 'org.mcstats.bukkit:metrics:R7'
compile 'net.milkbowl.vault:VaultAPI:1.5' compile 'net.milkbowl.vault:VaultAPI:1.6'
} }
sourceCompatibility = 1.7 sourceCompatibility = 1.7

View file

@ -111,11 +111,11 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
if (split.length == 3) { if (split.length == 3) {
this.version[2] = Integer.parseInt(split[2]); this.version[2] = Integer.parseInt(split[2]);
} }
} catch (Exception e) { } catch (NumberFormatException e) {
e.printStackTrace(); e.printStackTrace();
PS.debug(StringMan.getString(Bukkit.getBukkitVersion())); PS.debug(StringMan.getString(Bukkit.getBukkitVersion()));
PS.debug(StringMan.getString(Bukkit.getBukkitVersion().split("-")[0].split("\\."))); PS.debug(StringMan.getString(Bukkit.getBukkitVersion().split("-")[0].split("\\.")));
return new int[]{1,9,2}; return new int[]{1, 9, 2};
} }
} }
return this.version; return this.version;
@ -202,10 +202,6 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
} }
List<Entity> entities = world.getEntities(); List<Entity> entities = world.getEntities();
Iterator<Entity> iterator = entities.iterator(); Iterator<Entity> iterator = entities.iterator();
for (Entity entity : entities) {
}
while (iterator.hasNext()) { while (iterator.hasNext()) {
Entity entity = iterator.next(); Entity entity = iterator.next();
switch (entity.getType()) { switch (entity.getType()) {
@ -593,7 +589,7 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain
if (!PS.get().hasPlotArea(worldName)) { if (!PS.get().hasPlotArea(worldName)) {
SetGenCB.setGenerator(BukkitUtil.getWorld(worldName)); SetGenCB.setGenerator(BukkitUtil.getWorld(worldName));
} }
} catch (Exception e) { } catch (Exception ignored) {
log("Failed to reload world: " + world); log("Failed to reload world: " + world);
Bukkit.getServer().unloadWorld(world, false); Bukkit.getServer().unloadWorld(world, false);
} }

View file

@ -464,7 +464,7 @@ public class FancyMessage implements JsonRepresentedObject, Cloneable, Iterable<
Reflection.getMethod(Reflection.getOBCClass("inventory.CraftItemStack"), "asNMSCopy", ItemStack.class).invoke(null, itemStack); Reflection.getMethod(Reflection.getOBCClass("inventory.CraftItemStack"), "asNMSCopy", ItemStack.class).invoke(null, itemStack);
return itemTooltip(Reflection.getMethod(Reflection.getNMSClass("ItemStack"), "save", Reflection.getNMSClass("NBTTagCompound")) return itemTooltip(Reflection.getMethod(Reflection.getNMSClass("ItemStack"), "save", Reflection.getNMSClass("NBTTagCompound"))
.invoke(nmsItem, Reflection.getNMSClass("NBTTagCompound").newInstance()).toString()); .invoke(nmsItem, Reflection.getNMSClass("NBTTagCompound").newInstance()).toString());
} catch (Exception e) { } catch (IllegalAccessException | IllegalArgumentException | InstantiationException | InvocationTargetException e) {
e.printStackTrace(); e.printStackTrace();
return this; return this;
} }

View file

@ -121,7 +121,7 @@ public class DebugUUID extends SubCommand {
try { try {
UUID uuid = UUID.fromString(s); UUID uuid = UUID.fromString(s);
uuids.add(uuid); uuids.add(uuid);
} catch (Exception e) { } catch (Exception ignored) {
MainUtil.sendMessage(player, C.PREFIX + "Invalid playerdata: " + current); MainUtil.sendMessage(player, C.PREFIX + "Invalid playerdata: " + current);
} }
} }
@ -152,7 +152,7 @@ public class DebugUUID extends SubCommand {
uCMap.put(uuid, uuid2); uCMap.put(uuid, uuid2);
uCReverse.put(uuid2, uuid); uCReverse.put(uuid2, uuid);
} }
} catch (Throwable e) { } catch (Throwable ignored) {
MainUtil.sendMessage(player, C.PREFIX + "&6Invalid playerdata: " + uuid.toString() + ".dat"); MainUtil.sendMessage(player, C.PREFIX + "&6Invalid playerdata: " + uuid.toString() + ".dat");
} }
} }

View file

@ -5,11 +5,13 @@ import org.bukkit.Art;
import org.bukkit.DyeColor; import org.bukkit.DyeColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Rotation; import org.bukkit.Rotation;
import org.bukkit.TreeSpecies;
import org.bukkit.World; import org.bukkit.World;
import org.bukkit.block.BlockFace; import org.bukkit.block.BlockFace;
import org.bukkit.entity.Ageable; import org.bukkit.entity.Ageable;
import org.bukkit.entity.ArmorStand; import org.bukkit.entity.ArmorStand;
import org.bukkit.entity.Bat; import org.bukkit.entity.Bat;
import org.bukkit.entity.Boat;
import org.bukkit.entity.EnderDragon; import org.bukkit.entity.EnderDragon;
import org.bukkit.entity.Entity; import org.bukkit.entity.Entity;
import org.bukkit.entity.EntityType; import org.bukkit.entity.EntityType;
@ -35,25 +37,25 @@ import org.bukkit.util.Vector;
public class EntityWrapper { public class EntityWrapper {
public final EntityType type; private final EntityType type;
public final float yaw; private final float yaw;
public final float pitch; private final float pitch;
public final short depth; private final short depth;
private final int hash; private final int hash;
private final EntityBaseStats base = new EntityBaseStats(); private final EntityBaseStats base = new EntityBaseStats();
public double x; public double x;
public double y; public double y;
public double z; public double z;
// Extended
public ItemStack stack;
public ItemStack[] inventory; public ItemStack[] inventory;
public byte dataByte; // Extended
public byte dataByte2; private ItemStack stack;
public String dataString; private byte dataByte;
public LivingEntityStats lived; private byte dataByte2;
public AgeableStats aged; private String dataString;
public TameableStats tamed; private LivingEntityStats lived;
ArmorStandStats stand; private AgeableStats aged;
private TameableStats tamed;
private ArmorStandStats stand;
private HorseStats horse; private HorseStats horse;
public EntityWrapper(Entity entity, short depth) { public EntityWrapper(Entity entity, short depth) {
@ -86,6 +88,10 @@ public class EntityWrapper {
switch (entity.getType()) { switch (entity.getType()) {
case ARROW: case ARROW:
case BOAT: case BOAT:
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), 1, 9, 0)) {
Boat boat = (Boat) entity;
this.dataByte = getOrdinal(TreeSpecies.values(), boat.getWoodType());
}
case COMPLEX_PART: case COMPLEX_PART:
case EGG: case EGG:
case ENDER_CRYSTAL: case ENDER_CRYSTAL:
@ -459,7 +465,7 @@ public class EntityWrapper {
if (this.base.passenger != null) { if (this.base.passenger != null) {
try { try {
entity.setPassenger(this.base.passenger.spawn(world, x_offset, z_offset)); entity.setPassenger(this.base.passenger.spawn(world, x_offset, z_offset));
} catch (Exception e) { } catch (Exception ignored) {
} }
} }
if (this.base.fall != 0) { if (this.base.fall != 0) {
@ -478,6 +484,11 @@ public class EntityWrapper {
switch (entity.getType()) { switch (entity.getType()) {
case ARROW: case ARROW:
case BOAT: case BOAT:
if (PS.get().checkVersion(PS.get().IMP.getServerVersion(), 1, 9, 0)) {
Boat boat = (Boat) entity;
boat.setWoodType(TreeSpecies.values()[dataByte]);
}
case COMPLEX_PART: case COMPLEX_PART:
case EGG: case EGG:
case ENDER_CRYSTAL: case ENDER_CRYSTAL:
@ -706,4 +717,10 @@ public class EntityWrapper {
} }
return 0; return 0;
} }
@SuppressWarnings("deprecation")
@Override
public String toString() {
return String.format("[%s, x=%s, y=%s, z=%s]", type.getName(), x, y, z);
}
} }

View file

@ -388,10 +388,12 @@ public class BukkitChunkManager extends ChunkManager {
return BukkitUtil.getWorld(world).getChunkAt(loc.x, loc.z).load(force); return BukkitUtil.getWorld(world).getChunkAt(loc.x, loc.z).load(force);
} }
@SuppressWarnings("deprecation")
@Override @Override
public void unloadChunk(final String world, final ChunkLoc loc, final boolean save, final boolean safe) { public void unloadChunk(final String world, final ChunkLoc loc, final boolean save, final boolean safe) {
if (!PS.get().isMainThread(Thread.currentThread())) { if (!PS.get().isMainThread(Thread.currentThread())) {
TaskManager.runTask(new Runnable() { TaskManager.runTask(new Runnable() {
@SuppressWarnings("deprecation")
@Override @Override
public void run() { public void run() {
BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save, safe); BukkitUtil.getWorld(world).unloadChunk(loc.x, loc.z, save, safe);
@ -722,7 +724,7 @@ public class BukkitChunkManager extends ChunkManager {
try { try {
entity.spawn(world, xOffset, zOffset); entity.spawn(world, xOffset, zOffset);
} catch (Exception e) { } catch (Exception e) {
PS.debug("Failed to restore entity (e): " + entity.x + "," + entity.y + "," + entity.z + " : " + entity.type); PS.debug("Failed to restore entity (e): " + e.toString());
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -743,7 +745,7 @@ public class BukkitChunkManager extends ChunkManager {
PS.debug("&c[WARN] Plot clear failed to regenerate chest: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry PS.debug("&c[WARN] Plot clear failed to regenerate chest: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset)); .getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
} }
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException ignored) {
PS.debug("&c[WARN] Plot clear failed to regenerate chest (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry PS.debug("&c[WARN] Plot clear failed to regenerate chest (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset)); .getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
} }
@ -786,7 +788,7 @@ public class BukkitChunkManager extends ChunkManager {
PS.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry PS.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset)); .getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
} }
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException ignored) {
PS.debug("&c[WARN] Plot clear failed to regenerate dispenser (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry PS.debug("&c[WARN] Plot clear failed to regenerate dispenser (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset)); .getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
} }
@ -803,7 +805,7 @@ public class BukkitChunkManager extends ChunkManager {
PS.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry PS.debug("&c[WARN] Plot clear failed to regenerate dispenser: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset)); .getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
} }
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException ignored) {
PS.debug("&c[WARN] Plot clear failed to regenerate dispenser (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry PS.debug("&c[WARN] Plot clear failed to regenerate dispenser (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset)); .getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
} }
@ -820,7 +822,7 @@ public class BukkitChunkManager extends ChunkManager {
PS.debug("&c[WARN] Plot clear failed to regenerate beacon: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry PS.debug("&c[WARN] Plot clear failed to regenerate beacon: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset)); .getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
} }
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException ignored) {
PS.debug("&c[WARN] Plot clear failed to regenerate beacon (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry PS.debug("&c[WARN] Plot clear failed to regenerate beacon (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset)); .getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
} }
@ -840,7 +842,7 @@ public class BukkitChunkManager extends ChunkManager {
.getKey().y + "," + ( .getKey().y + "," + (
blockLocMaterialEntry.getKey().z + zOffset)); blockLocMaterialEntry.getKey().z + zOffset));
} }
} catch (Exception e) { } catch (Exception ignored) {
PS.debug("&c[WARN] Plot clear failed to regenerate jukebox (e): " + (blockLocMaterialEntry.getKey().x + xOffset) + "," PS.debug("&c[WARN] Plot clear failed to regenerate jukebox (e): " + (blockLocMaterialEntry.getKey().x + xOffset) + ","
+ blockLocMaterialEntry + blockLocMaterialEntry
.getKey().y + "," + ( .getKey().y + "," + (
@ -882,7 +884,7 @@ public class BukkitChunkManager extends ChunkManager {
PS.debug("&c[WARN] Plot clear failed to regenerate hopper: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry PS.debug("&c[WARN] Plot clear failed to regenerate hopper: " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset)); .getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
} }
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException ignored) {
PS.debug("&c[WARN] Plot clear failed to regenerate hopper (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry PS.debug("&c[WARN] Plot clear failed to regenerate hopper (e): " + (blockLocEntry.getKey().x + xOffset) + "," + blockLocEntry
.getKey().y + "," + (blockLocEntry.getKey().z + zOffset)); .getKey().y + "," + (blockLocEntry.getKey().z + zOffset));
} }
@ -901,7 +903,7 @@ public class BukkitChunkManager extends ChunkManager {
.getKey().y + "," + ( .getKey().y + "," + (
blockLocNoteEntry.getKey().z + zOffset)); blockLocNoteEntry.getKey().z + zOffset));
} }
} catch (Exception e) { } catch (Exception ignored) {
PS.debug("&c[WARN] Plot clear failed to regenerate note block (e): " + (blockLocNoteEntry.getKey().x + xOffset) + "," PS.debug("&c[WARN] Plot clear failed to regenerate note block (e): " + (blockLocNoteEntry.getKey().x + xOffset) + ","
+ blockLocNoteEntry + blockLocNoteEntry
.getKey().y + "," + ( .getKey().y + "," + (
@ -921,7 +923,7 @@ public class BukkitChunkManager extends ChunkManager {
.getKey().y + "," + ( .getKey().y + "," + (
blockLocShortEntry.getKey().z + zOffset)); blockLocShortEntry.getKey().z + zOffset));
} }
} catch (Exception e) { } catch (Exception ignored) {
PS.debug("&c[WARN] Plot clear failed to restore brewing stand cooking (e): " + (blockLocShortEntry.getKey().x + xOffset) + "," PS.debug("&c[WARN] Plot clear failed to restore brewing stand cooking (e): " + (blockLocShortEntry.getKey().x + xOffset) + ","
+ blockLocShortEntry.getKey().y + "," + (blockLocShortEntry.getKey().z + zOffset)); + blockLocShortEntry.getKey().y + "," + (blockLocShortEntry.getKey().z + zOffset));
} }
@ -1060,7 +1062,11 @@ public class BukkitChunkManager extends ChunkManager {
Material id = block.getType(); Material id = block.getType();
if (storeNormal) { if (storeNormal) {
int typeId = id.getId(); int typeId = id.getId();
ids[y] = new PlotBlock((short) typeId, typeId == 0 ? 0 : block.getData()); if (typeId == 0) {
ids[y] = PlotBlock.EVERYTHING;
} else {
ids[y] = new PlotBlock((short) typeId, block.getData());
}
} }
if (!id.equals(Material.AIR)) { if (!id.equals(Material.AIR)) {
try { try {

View file

@ -12,8 +12,6 @@ import com.intellectualcrafters.plot.util.TaskManager;
import com.intellectualcrafters.plot.util.UUIDHandler; import com.intellectualcrafters.plot.util.UUIDHandler;
import com.intellectualcrafters.plot.util.WorldUtil; import com.intellectualcrafters.plot.util.WorldUtil;
import com.plotsquared.bukkit.object.BukkitPlayer; import com.plotsquared.bukkit.object.BukkitPlayer;
import java.util.Arrays;
import java.util.List;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.OfflinePlayer; import org.bukkit.OfflinePlayer;
@ -34,6 +32,9 @@ import org.bukkit.material.Tree;
import org.bukkit.material.WoodenStep; import org.bukkit.material.WoodenStep;
import org.bukkit.material.Wool; import org.bukkit.material.Wool;
import java.util.Arrays;
import java.util.List;
public class BukkitUtil extends WorldUtil { public class BukkitUtil extends WorldUtil {
private static String lastString = null; private static String lastString = null;
@ -260,7 +261,7 @@ public class BukkitUtil extends WorldUtil {
public String getClosestMatchingName(PlotBlock block) { public String getClosestMatchingName(PlotBlock block) {
try { try {
return Material.getMaterial(block.id).name(); return Material.getMaterial(block.id).name();
} catch (Exception e) { } catch (Exception ignored) {
return null; return null;
} }
} }

View file

@ -25,6 +25,7 @@ import java.io.InputStream;
import java.io.OutputStream; import java.io.OutputStream;
import java.lang.reflect.Constructor; import java.lang.reflect.Constructor;
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.AbstractList; import java.util.AbstractList;
@ -314,7 +315,7 @@ public class NbtFactory {
private static Object invokeMethod(Method method, Object target, Object... params) { private static Object invokeMethod(Method method, Object target, Object... params) {
try { try {
return method.invoke(target, params); return method.invoke(target, params);
} catch (Exception e) { } catch (IllegalAccessException | InvocationTargetException | IllegalArgumentException e) {
throw new RuntimeException("Unable to invoke method " + method + " for " + target, e); throw new RuntimeException("Unable to invoke method " + method + " for " + target, e);
} }
} }
@ -322,7 +323,7 @@ public class NbtFactory {
private static void setFieldValue(Field field, Object target, Object value) { private static void setFieldValue(Field field, Object target, Object value) {
try { try {
field.set(target, value); field.set(target, value);
} catch (Exception e) { } catch (IllegalAccessException | IllegalArgumentException e) {
throw new RuntimeException("Unable to set " + field + " for " + target, e); throw new RuntimeException("Unable to set " + field + " for " + target, e);
} }
} }
@ -330,7 +331,7 @@ public class NbtFactory {
private static Object getFieldValue(Field field, Object target) { private static Object getFieldValue(Field field, Object target) {
try { try {
return field.get(target); return field.get(target);
} catch (Exception e) { } catch (IllegalAccessException | IllegalArgumentException e) {
throw new RuntimeException("Unable to retrieve " + field + " for " + target, e); throw new RuntimeException("Unable to retrieve " + field + " for " + target, e);
} }
} }

View file

@ -133,7 +133,7 @@ public class FastQueue_1_8_3 extends SlowQueue {
Method getHandle = chunk.getClass().getDeclaredMethod("getHandle"); Method getHandle = chunk.getClass().getDeclaredMethod("getHandle");
Object c = getHandle.invoke(chunk); Object c = getHandle.invoke(chunk);
Object w = this.methodGetWorld.of(c).call(); Object w = this.methodGetWorld.of(c).call();
Class<? extends Object> clazz = c.getClass(); Class<?> clazz = c.getClass();
Field sections1 = clazz.getDeclaredField("sections"); Field sections1 = clazz.getDeclaredField("sections");
sections1.setAccessible(true); sections1.setAccessible(true);
Field tileEntities = clazz.getDeclaredField("tileEntities"); Field tileEntities = clazz.getDeclaredField("tileEntities");

View file

@ -1,5 +1,7 @@
package com.plotsquared.bukkit.util.block; package com.plotsquared.bukkit.util.block;
import static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
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;
@ -13,6 +15,12 @@ import com.intellectualcrafters.plot.util.ReflectionUtils.RefMethod.RefExecutor;
import com.intellectualcrafters.plot.util.SetQueue.ChunkWrapper; 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 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.Field;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
@ -22,14 +30,6 @@ import java.util.HashMap;
import java.util.Iterator; import java.util.Iterator;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set; 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 static com.intellectualcrafters.plot.util.ReflectionUtils.getRefClass;
public class FastQueue_1_9 extends SlowQueue { public class FastQueue_1_9 extends SlowQueue {
@ -118,7 +118,7 @@ public class FastQueue_1_9 extends SlowQueue {
Entry<?, ?> tile = iterator.next(); Entry<?, ?> tile = iterator.next();
Object pos = tile.getKey(); Object pos = tile.getKey();
if (xm == null) { if (xm == null) {
Class<? extends Object> clazz2 = pos.getClass().getSuperclass(); Class<?> clazz2 = pos.getClass().getSuperclass();
xm = clazz2.getDeclaredMethod("getX"); xm = clazz2.getDeclaredMethod("getX");
ym = clazz2.getDeclaredMethod("getY"); ym = clazz2.getDeclaredMethod("getY");
zm = clazz2.getDeclaredMethod("getZ"); zm = clazz2.getDeclaredMethod("getZ");

View file

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

View file

@ -80,7 +80,7 @@ public class DebugExec extends SubCommand {
this.engine.eval(script, this.scope); this.engine.eval(script, this.scope);
} }
} }
} catch (IOException | ScriptException e) { } catch (IOException | ScriptException ignored) {
} }
} }
@ -214,7 +214,7 @@ public class DebugExec extends SubCommand {
for (Plot plot : PS.get().getBasePlots()) { for (Plot plot : PS.get().getBasePlots()) {
Flag<?> flag1 = FlagManager.getFlag(flag); Flag<?> flag1 = FlagManager.getFlag(flag);
if (plot.getFlag(flag1).isPresent()) { if (plot.getFlag(flag1).isPresent()) {
FlagManager.removePlotFlag(plot, flag1); plot.removeFlag(flag1);
} }
} }
return MainUtil.sendMessage(player, "Cleared flag: " + flag); return MainUtil.sendMessage(player, "Cleared flag: " + flag);

View file

@ -42,12 +42,10 @@ public class DebugFixFlags extends SubCommand {
Iterator<Entry<Flag<?>, Object>> i = flags.entrySet().iterator(); Iterator<Entry<Flag<?>, Object>> i = flags.entrySet().iterator();
boolean changed = false; boolean changed = false;
while (i.hasNext()) { while (i.hasNext()) {
/* if (i.next().getKey() == null) {
if (FlagManager.getFlag(i.next().getKey()) == null) {
changed = true; changed = true;
i.remove(); i.remove();
} }
*/
} }
if (changed) { if (changed) {
DBFunc.setFlags(plot, plot.getFlags()); DBFunc.setFlags(plot, plot.getFlags());

View file

@ -315,7 +315,7 @@ public class ListCmd extends SubCommand {
if (uuid == null) { if (uuid == null) {
try { try {
uuid = UUID.fromString(args[0]); uuid = UUID.fromString(args[0]);
} catch (Exception e) { } catch (Exception ignored) {
} }
} }
if (uuid != null) { if (uuid != null) {

View file

@ -127,16 +127,16 @@ public class Load extends SubCommand {
return; return;
} }
plr.setMeta("plot_schematics", schematics); plr.setMeta("plot_schematics", schematics);
displaySaves(plr, 0); displaySaves(plr);
} }
}); });
} else { } else {
displaySaves(plr, 0); displaySaves(plr);
} }
return true; return true;
} }
public void displaySaves(PlotPlayer player, int page) { public void displaySaves(PlotPlayer player) {
List<String> schematics = player.getMeta("plot_schematics"); List<String> schematics = player.getMeta("plot_schematics");
for (int i = 0; i < Math.min(schematics.size(), 32); i++) { for (int i = 0; i < Math.min(schematics.size(), 32); i++) {
try { try {

View file

@ -34,7 +34,7 @@ public class Owner extends SetCommand {
try { try {
uuid = UUID.fromString(value); uuid = UUID.fromString(value);
name = MainUtil.getName(uuid); name = MainUtil.getName(uuid);
} catch (Exception e) { } catch (Exception ignored) {
} }
} else { } else {
uuid = UUIDHandler.getUUID(value, null); uuid = UUIDHandler.getUUID(value, null);

View file

@ -166,7 +166,7 @@ public class Configuration {
if (result != null && result.match < 2) { if (result != null && result.match < 2) {
values[i] = result.best; values[i] = result.best;
} }
} catch (NumberFormatException e) { } catch (NumberFormatException ignored) {
} }
} }
int gcd = gcd(counts); int gcd = gcd(counts);

View file

@ -951,8 +951,7 @@ public class Plot {
* @param flag * @param flag
*/ */
public boolean removeFlag(Flag<?> flag) { public boolean removeFlag(Flag<?> flag) {
FlagManager.removePlotFlag(this, flag); return FlagManager.removePlotFlag(this, flag);
return false;
} }
/** /**

View file

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

View file

@ -1,7 +1,8 @@
package com.intellectualcrafters.plot.object; package com.intellectualcrafters.plot.object;
public class PseudoRandom { public class PseudoRandom {
public static PseudoRandom random = new PseudoRandom();
public static final PseudoRandom random = new PseudoRandom();
public long state = System.nanoTime(); public long state = System.nanoTime();

View file

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

View file

@ -298,7 +298,7 @@ public abstract class Command {
MainCommand.getInstance().help.execute(player, args, null, null); MainCommand.getInstance().help.execute(player, args, null, null);
return; return;
} }
} catch (IllegalArgumentException e) { } catch (IllegalArgumentException ignored) {
} }
// Command recommendation // Command recommendation
MainUtil.sendMessage(player, C.NOT_VALID_SUBCOMMAND); MainUtil.sendMessage(player, C.NOT_VALID_SUBCOMMAND);

View file

@ -1,31 +0,0 @@
package com.plotsquared.general.commands;
import java.lang.reflect.Field;
public class CommandHandlingOutput {
public static int CALLER_OF_WRONG_TYPE = -6;
public static int NOT_COMMAND = -5;
public static int NOT_FOUND = -4;
public static int NOT_PERMITTED = -3;
public static int ERROR = -2;
public static int WRONG_USAGE = -1;
public static int SUCCESS = 1;
public static String nameField(int code) {
Field[] fields = CommandHandlingOutput.class.getDeclaredFields();
for (Field field : fields) {
if (field.getGenericType() == Integer.TYPE) {
try {
if ((Integer) field.get(CommandHandlingOutput.class) == code) {
return field.getName();
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
return "null??";
}
}

View file

@ -84,7 +84,7 @@ public class WESubscriber {
if (tool instanceof BrushTool) { if (tool instanceof BrushTool) {
hasMask = ((BrushTool) tool).getMask() != null; hasMask = ((BrushTool) tool).getMask() != null;
} }
} catch (Exception e) { } catch (Exception ignored) {
} }
} }
AbstractDelegateExtent extent = (AbstractDelegateExtent) event.getExtent(); AbstractDelegateExtent extent = (AbstractDelegateExtent) event.getExtent();

View file

@ -43,6 +43,7 @@ import org.spongepowered.api.world.biome.BiomeTypes;
import org.spongepowered.api.world.extent.Extent; import org.spongepowered.api.world.extent.Extent;
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.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -154,7 +155,8 @@ public class SpongeUtil extends WorldUtil {
PlotBlock plotBlock = new PlotBlock((short) (i & 0xFFF), (byte) (i >> 12 & 0xF)); PlotBlock plotBlock = new PlotBlock((short) (i & 0xFFF), (byte) (i >> 12 & 0xF));
stateArray[i] = state; stateArray[i] = state;
stateMap.put(state, plotBlock); stateMap.put(state, plotBlock);
} catch (Throwable e) {} } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException ignored) {
}
} }
PS.debug("Done!"); PS.debug("Done!");
} catch (Throwable e) { } catch (Throwable e) {

View file

@ -28,7 +28,7 @@ import java.util.Set;
public class FastQueue extends SlowQueue { public class FastQueue extends SlowQueue {
public final SendChunk chunkSender; public final SendChunk chunkSender;
public HashMap<ChunkWrapper, Chunk> toUpdate = new HashMap<>(); public final HashMap<ChunkWrapper, Chunk> toUpdate = new HashMap<>();
public FastQueue() throws RuntimeException { public FastQueue() throws RuntimeException {
TaskManager.runTaskRepeat(new Runnable() { TaskManager.runTaskRepeat(new Runnable() {
@ -38,7 +38,7 @@ public class FastQueue extends SlowQueue {
return; return;
} }
int count = 0; int count = 0;
ArrayList<Chunk> chunks = new ArrayList<Chunk>(); ArrayList<Chunk> chunks = new ArrayList<>();
Iterator<Entry<ChunkWrapper, Chunk>> i = FastQueue.this.toUpdate.entrySet().iterator(); Iterator<Entry<ChunkWrapper, Chunk>> i = FastQueue.this.toUpdate.entrySet().iterator();
while (i.hasNext() && (count < 128)) { while (i.hasNext() && (count < 128)) {
chunks.add(i.next().getValue()); chunks.add(i.next().getValue());

View file

@ -1,6 +1,6 @@
#Wed Apr 20 16:28:49 EDT 2016 #Tue Apr 26 09:51:19 EDT 2016
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-bin.zip distributionUrl=https\://services.gradle.org/distributions/gradle-2.12-all.zip