From 50e423112542916cd6f7cd23edef778cd64b28a7 Mon Sep 17 00:00:00 2001 From: Jesse Boyd Date: Fri, 10 Jun 2016 14:08:37 +1000 Subject: [PATCH] Fix java 1.7 compatibility --- build.gradle | 3 ++ .../fawe/bukkit/wrapper/AsyncChunk.java | 2 +- .../fawe/bukkit/wrapper/AsyncWorld.java | 52 +++++++++---------- .../com/thevoxelbox/voxelsniper/Sniper.java | 12 ++--- .../fawe/bukkit/v1_10/BukkitQueue_1_10.java | 6 +-- .../fawe/bukkit/v1_8/BukkitQueue18R3.java | 4 +- .../fawe/bukkit/v1_9/BukkitQueue_1_9_R1.java | 6 +-- .../fawe/sponge/v1_8/SpongeQueue_1_8.java | 4 +- 8 files changed, 46 insertions(+), 43 deletions(-) diff --git a/build.gradle b/build.gradle index 8837bdd1..f81729b5 100644 --- a/build.gradle +++ b/build.gradle @@ -29,6 +29,9 @@ subprojects { apply plugin: 'eclipse' apply plugin: 'idea' + sourceCompatibility = 1.7 + targetCompatibility = 1.7 + dependencies { compile(group: 'com.sk89q.worldedit', name: 'worldedit-core', version:'6.1.1-SNAPSHOT') { exclude(module: 'bukkit-classloader-check') diff --git a/bukkit0/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncChunk.java b/bukkit0/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncChunk.java index 7b32cb41..490653f9 100644 --- a/bukkit0/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncChunk.java +++ b/bukkit0/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncChunk.java @@ -85,7 +85,7 @@ public class AsyncChunk implements Chunk { } @Override - public boolean load(boolean generate) { + public boolean load(final boolean generate) { return TaskManager.IMP.sync(new RunnableVal() { @Override public void run(Boolean value) { diff --git a/bukkit0/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncWorld.java b/bukkit0/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncWorld.java index 273766a5..28ea02ed 100644 --- a/bukkit0/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncWorld.java +++ b/bukkit0/src/main/java/com/boydti/fawe/bukkit/wrapper/AsyncWorld.java @@ -101,7 +101,7 @@ public class AsyncWorld implements World { } @Override - public Block getBlockAt(int x, int y, int z) { + public Block getBlockAt(final int x, final int y, final int z) { return new AsyncBlock(this, queue, x, y, z); } @@ -210,7 +210,7 @@ public class AsyncWorld implements World { } @Override - public void loadChunk(int x, int z) { + public void loadChunk(final int x, final int z) { if (!isChunkLoaded(x, z)) { TaskManager.IMP.sync(new RunnableVal() { @Override @@ -222,7 +222,7 @@ public class AsyncWorld implements World { } @Override - public boolean loadChunk(int x, int z, boolean generate) { + public boolean loadChunk(final int x, final int z, final boolean generate) { if (!isChunkLoaded(x, z)) { return TaskManager.IMP.sync(new RunnableVal() { @Override @@ -235,7 +235,7 @@ public class AsyncWorld implements World { } @Override - public boolean unloadChunk(Chunk chunk) { + public boolean unloadChunk(final Chunk chunk) { if (chunk.isLoaded()) { return TaskManager.IMP.sync(new RunnableVal() { @Override @@ -258,7 +258,7 @@ public class AsyncWorld implements World { } @Override - public boolean unloadChunk(int x, int z, boolean save, boolean safe) { + public boolean unloadChunk(final int x, final int z, final boolean save, final boolean safe) { if (isChunkLoaded(x, z)) { return TaskManager.IMP.sync(new RunnableVal() { @Override @@ -281,7 +281,7 @@ public class AsyncWorld implements World { } @Override - public boolean regenerateChunk(int x, int z) { + public boolean regenerateChunk(final int x, final int z) { return TaskManager.IMP.sync(new RunnableVal() { @Override public void run(Boolean value) { @@ -298,7 +298,7 @@ public class AsyncWorld implements World { } @Override - public Item dropItem(Location location, ItemStack item) { + public Item dropItem(final Location location, final ItemStack item) { return TaskManager.IMP.sync(new RunnableVal() { @Override public void run(Item value) { @@ -308,7 +308,7 @@ public class AsyncWorld implements World { } @Override - public Item dropItemNaturally(Location location, ItemStack item) { + public Item dropItemNaturally(final Location location, final ItemStack item) { return TaskManager.IMP.sync(new RunnableVal() { @Override public void run(Item value) { @@ -318,7 +318,7 @@ public class AsyncWorld implements World { } @Override - public Arrow spawnArrow(Location location, Vector direction, float speed, float spread) { + public Arrow spawnArrow(final Location location, final Vector direction, final float speed, final float spread) { return TaskManager.IMP.sync(new RunnableVal() { @Override public void run(Arrow value) { @@ -328,7 +328,7 @@ public class AsyncWorld implements World { } @Override - public boolean generateTree(Location location, TreeType type) { + public boolean generateTree(final Location location, final TreeType type) { return TaskManager.IMP.sync(new RunnableVal() { @Override public void run(Boolean value) { @@ -338,7 +338,7 @@ public class AsyncWorld implements World { } @Override - public boolean generateTree(Location loc, TreeType type, BlockChangeDelegate delegate) { + public boolean generateTree(final Location loc, final TreeType type, final BlockChangeDelegate delegate) { return TaskManager.IMP.sync(new RunnableVal() { @Override public void run(Boolean value) { @@ -365,7 +365,7 @@ public class AsyncWorld implements World { } @Override - public LightningStrike strikeLightning(Location loc) { + public LightningStrike strikeLightning(final Location loc) { return TaskManager.IMP.sync(new RunnableVal() { @Override public void run(LightningStrike value) { @@ -375,7 +375,7 @@ public class AsyncWorld implements World { } @Override - public LightningStrike strikeLightningEffect(Location loc) { + public LightningStrike strikeLightningEffect(final Location loc) { return TaskManager.IMP.sync(new RunnableVal() { @Override public void run(LightningStrike value) { @@ -406,7 +406,7 @@ public class AsyncWorld implements World { @Override @Deprecated - public Collection getEntitiesByClass(Class... classes) { + public Collection getEntitiesByClass(final Class... classes) { return TaskManager.IMP.sync(new RunnableVal>() { @Override public void run(Collection value) { @@ -416,7 +416,7 @@ public class AsyncWorld implements World { } @Override - public Collection getEntitiesByClass(Class cls) { + public Collection getEntitiesByClass(final Class cls) { return TaskManager.IMP.sync(new RunnableVal>() { @Override public void run(Collection value) { @@ -426,7 +426,7 @@ public class AsyncWorld implements World { } @Override - public Collection getEntitiesByClasses(Class... classes) { + public Collection getEntitiesByClasses(final Class... classes) { return TaskManager.IMP.sync(new RunnableVal>() { @Override public void run(Collection value) { @@ -446,7 +446,7 @@ public class AsyncWorld implements World { } @Override - public Collection getNearbyEntities(Location location, double x, double y, double z) { + public Collection getNearbyEntities(final Location location, final double x, final double y, final double z) { return TaskManager.IMP.sync(new RunnableVal>() { @Override public void run(Collection value) { @@ -471,7 +471,7 @@ public class AsyncWorld implements World { } @Override - public boolean setSpawnLocation(int x, int y, int z) { + public boolean setSpawnLocation(final int x, final int y, final int z) { return TaskManager.IMP.sync(new RunnableVal() { @Override public void run(Boolean value) { @@ -548,7 +548,7 @@ public class AsyncWorld implements World { return this.createExplosion(x, y, z, power, setFire, true); } - public boolean createExplosion(double x, double y, double z, float power, boolean setFire, boolean breakBlocks) { + public boolean createExplosion(final double x, final double y, final double z, final float power, final boolean setFire, final boolean breakBlocks) { return TaskManager.IMP.sync(new RunnableVal() { @Override public void run(Boolean value) { @@ -606,7 +606,7 @@ public class AsyncWorld implements World { } @Override - public T spawn(Location location, Class clazz) throws IllegalArgumentException { + public T spawn(final Location location, final Class clazz) throws IllegalArgumentException { return TaskManager.IMP.sync(new RunnableVal() { @Override public void run(T value) { @@ -623,7 +623,7 @@ public class AsyncWorld implements World { @Override @Deprecated - public FallingBlock spawnFallingBlock(Location location, int blockId, byte blockData) throws IllegalArgumentException { + public FallingBlock spawnFallingBlock(final Location location, final int blockId, final byte blockData) throws IllegalArgumentException { return TaskManager.IMP.sync(new RunnableVal() { @Override public void run(FallingBlock value) { @@ -638,7 +638,7 @@ public class AsyncWorld implements World { } @Override - public void playEffect(Location location, Effect effect, int data, int radius) { + public void playEffect(final Location location, final Effect effect, final int data, final int radius) { TaskManager.IMP.sync(new RunnableVal() { @Override public void run(Object value) { @@ -653,7 +653,7 @@ public class AsyncWorld implements World { } @Override - public void playEffect(Location location, Effect effect, T data, int radius) { + public void playEffect(final Location location, final Effect effect, final T data, final int radius) { TaskManager.IMP.sync(new RunnableVal() { @Override public void run(Object value) { @@ -663,7 +663,7 @@ public class AsyncWorld implements World { } @Override - public ChunkSnapshot getEmptyChunkSnapshot(int x, int z, boolean includeBiome, boolean includeBiomeTempRain) { + public ChunkSnapshot getEmptyChunkSnapshot(final int x, final int z, final boolean includeBiome, final boolean includeBiomeTempRain) { return TaskManager.IMP.sync(new RunnableVal() { @Override public void run(ChunkSnapshot value) { @@ -724,7 +724,7 @@ public class AsyncWorld implements World { } @Override - public void setKeepSpawnInMemory(boolean keepLoaded) { + public void setKeepSpawnInMemory(final boolean keepLoaded) { TaskManager.IMP.sync(new RunnableVal() { @Override public void run(Object value) { @@ -829,7 +829,7 @@ public class AsyncWorld implements World { } @Override - public void playSound(Location location, Sound sound, float volume, float pitch) { + public void playSound(final Location location, final Sound sound, final float volume, final float pitch) { TaskManager.IMP.sync(new RunnableVal() { @Override public void run(Object value) { diff --git a/bukkit0/src/main/java/com/thevoxelbox/voxelsniper/Sniper.java b/bukkit0/src/main/java/com/thevoxelbox/voxelsniper/Sniper.java index f4e34234..95343d3d 100644 --- a/bukkit0/src/main/java/com/thevoxelbox/voxelsniper/Sniper.java +++ b/bukkit0/src/main/java/com/thevoxelbox/voxelsniper/Sniper.java @@ -135,7 +135,7 @@ public class Sniper { } // Old method (plus world arg) - public boolean snipe(Action action, Material itemInHand, AsyncWorld world, Block clickedBlock, BlockFace clickedFace) { + public boolean snipe(final Action action, final Material itemInHand, final AsyncWorld world, final Block clickedBlock, final BlockFace clickedFace) { String toolId = getToolId(itemInHand); SniperTool sniperTool = tools.get(toolId); @@ -160,7 +160,7 @@ public class Sniper { return true; } - SnipeData snipeData = sniperTool.getSnipeData(); + final SnipeData snipeData = sniperTool.getSnipeData(); if (getPlayer().isSneaking()) { Block targetBlock; SnipeAction snipeAction = sniperTool.getActionAssigned(itemInHand); @@ -262,9 +262,9 @@ public class Sniper { return false; } } else { - Block targetBlock; - Block lastBlock; - SnipeAction snipeAction = sniperTool.getActionAssigned(itemInHand); + final Block targetBlock; + final Block lastBlock; + final SnipeAction snipeAction = sniperTool.getActionAssigned(itemInHand); switch (action) { case RIGHT_CLICK_AIR: @@ -302,7 +302,7 @@ public class Sniper { // MetricsManager.increaseBrushUsage(sniperTool.getCurrentBrush().getName()); // } // return result; - IBrush brush = sniperTool.getCurrentBrush(); + final IBrush brush = sniperTool.getCurrentBrush(); if (sniperTool.getCurrentBrush() instanceof PerformBrush) { PerformBrush performerBrush = (PerformBrush) sniperTool.getCurrentBrush(); performerBrush.initP(snipeData); diff --git a/bukkit110/src/main/java/com/boydti/fawe/bukkit/v1_10/BukkitQueue_1_10.java b/bukkit110/src/main/java/com/boydti/fawe/bukkit/v1_10/BukkitQueue_1_10.java index 6d93b595..9641373c 100644 --- a/bukkit110/src/main/java/com/boydti/fawe/bukkit/v1_10/BukkitQueue_1_10.java +++ b/bukkit110/src/main/java/com/boydti/fawe/bukkit/v1_10/BukkitQueue_1_10.java @@ -121,7 +121,7 @@ public class BukkitQueue_1_10 extends BukkitQueue_0 set = new HashSet(playerChunk.c); EntityTracker tracker = w.getTracker(); // Get players - HashSet players = new HashSet<>(); + final HashSet players = new HashSet<>(); for (EntityHuman human : w.players) { if (set.contains(human)) { players.add((EntityPlayer) human); @@ -161,8 +161,8 @@ public class BukkitQueue_1_10 extends BukkitQueue_0 players = new HashSet<>((Collection)fieldPlayers.get(playerChunk)); + final HashSet players = new HashSet<>((Collection)fieldPlayers.get(playerChunk)); if (players.size() == 0) { return; } @@ -441,7 +441,7 @@ public class BukkitQueue18R3 extends BukkitQueue_0 set = new HashSet(playerChunk.c); EntityTracker tracker = w.getTracker(); // Get players - HashSet players = new HashSet<>(); + final HashSet players = new HashSet<>(); for (EntityHuman human : w.players) { if (set.contains(human)) { players.add((EntityPlayer) human); @@ -161,8 +161,8 @@ public class BukkitQueue_1_9_R1 extends BukkitQueue_0 players = new HashSet<>(); + final HashSet players = new HashSet<>(); for (EntityPlayer player : w.playerEntities) { if (player instanceof EntityPlayerMP) { if (chunkMap.isPlayerWatchingChunk((EntityPlayerMP) player, x, z)) { @@ -156,7 +156,7 @@ public class SpongeQueue_1_8 extends NMSMappedFaweQueue