From e810113ea0a5ea7d4a6e4e56d4979964670e7d79 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Fri, 6 Jan 2012 18:07:27 +0100 Subject: [PATCH] Fixed some warnings and removed Bukkit/SpoutWorld.toLocation(pt) (replaced it by a call to the according Bukkit/SpoutUtil method) --- .../sk89q/worldedit/bukkit/BukkitWorld.java | 7 +-- .../worldedit/spout/SpoutCommandSender.java | 4 +- .../sk89q/worldedit/spout/SpoutPlayer.java | 1 + .../com/sk89q/worldedit/spout/SpoutWorld.java | 55 ++++++++----------- 4 files changed, 26 insertions(+), 41 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java b/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java index 361aae7db..3feb740ae 100644 --- a/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -458,8 +458,7 @@ public class BukkitWorld extends LocalWorld { public void dropItem(Vector pt, BaseItemStack item) { ItemStack bukkitItem = new ItemStack(item.getType(), item.getAmount(), (byte) item.getDamage()); - world.dropItemNaturally(toLocation(pt), bukkitItem); - + world.dropItemNaturally(BukkitUtil.toLocation(world, pt), bukkitItem); } /** @@ -573,10 +572,6 @@ public class BukkitWorld extends LocalWorld { return num; } - private Location toLocation(Vector pt) { - return new Location(world, pt.getX(), pt.getY(), pt.getZ()); - } - /** * Set a sign's text. * diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutCommandSender.java b/src/main/java/com/sk89q/worldedit/spout/SpoutCommandSender.java index 02d4032ad..b6ec96e6a 100644 --- a/src/main/java/com/sk89q/worldedit/spout/SpoutCommandSender.java +++ b/src/main/java/com/sk89q/worldedit/spout/SpoutCommandSender.java @@ -8,14 +8,12 @@ import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldVector; import com.sk89q.worldedit.bags.BlockBag; import org.getspout.api.ChatColor; -import org.getspout.api.Spout; import org.getspout.api.command.CommandSource; import org.getspout.api.player.Player; -import java.util.logging.Level; - public class SpoutCommandSender extends LocalPlayer { private CommandSource sender; + @SuppressWarnings("unused") private WorldEditPlugin plugin; public SpoutCommandSender(WorldEditPlugin plugin, ServerInterface server, CommandSource sender) { diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutPlayer.java b/src/main/java/com/sk89q/worldedit/spout/SpoutPlayer.java index 062d0bfa0..65435a36e 100644 --- a/src/main/java/com/sk89q/worldedit/spout/SpoutPlayer.java +++ b/src/main/java/com/sk89q/worldedit/spout/SpoutPlayer.java @@ -37,6 +37,7 @@ import org.getspout.api.player.Player; public class SpoutPlayer extends LocalPlayer { private Player player; + @SuppressWarnings("unused") private WorldEditPlugin plugin; public SpoutPlayer(WorldEditPlugin plugin, ServerInterface server, Player player) { diff --git a/src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java b/src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java index 89a7e202b..ac77e8e54 100644 --- a/src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java +++ b/src/main/java/com/sk89q/worldedit/spout/SpoutWorld.java @@ -29,7 +29,6 @@ import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.regions.Region; import org.getspout.api.geo.World; -import org.getspout.api.geo.discrete.Point; import org.getspout.api.material.MaterialData; public class SpoutWorld extends LocalWorld { @@ -443,7 +442,7 @@ public class SpoutWorld extends LocalWorld { public void dropItem(Vector pt, BaseItemStack item) { /*ItemStack bukkitItem = new ItemStack(item.getType(), item.getAmount(), (byte) item.getDamage()); - world.dropItemNaturally(toLocation(pt), bukkitItem);*/ + world.dropItemNaturally(SpoutUtil.toLocation(world, pt), bukkitItem);*/ } @@ -457,16 +456,16 @@ public class SpoutWorld extends LocalWorld { */ @Override public int killMobs(Vector origin, double radius, int flags) { - boolean killPets = (flags & KillFlags.PETS) != 0; + /*boolean killPets = (flags & KillFlags.PETS) != 0; boolean killNPCs = (flags & KillFlags.NPCS) != 0; - boolean killAnimals = (flags & KillFlags.ANIMALS) != 0; + boolean killAnimals = (flags & KillFlags.ANIMALS) != 0;*/ int num = 0; - double radiusSq = radius * radius; + /*double radiusSq = radius * radius; Point bukkitOrigin = SpoutUtil.toPoint(world, origin); - /* + for (LivingEntity ent : world.getLivingEntities()) { if (ent instanceof HumanEntity) { continue; @@ -506,9 +505,9 @@ public class SpoutWorld extends LocalWorld { @Override public int removeEntities(EntityType type, Vector origin, int radius) { int num = 0; - double radiusSq = radius * radius; + /*double radiusSq = radius * radius; - /*for (Entity ent : world.getEntities()) { + for (Entity ent : world.getEntities()) { if (radius != -1 && origin.distanceSq(SpoutUtil.toVector(ent.getTransform().getPosition())) > radiusSq) { continue; @@ -555,10 +554,6 @@ public class SpoutWorld extends LocalWorld { return num; } - private Point toLocation(Vector pt) { - return new Point(world, (float)pt.getX(), (float)pt.getY(), (float)pt.getZ()); - } - /** * Set a sign's text. * @@ -566,8 +561,8 @@ public class SpoutWorld extends LocalWorld { * @param text * @return */ - private boolean setSignText(Vector pt, String[] text) { - /*Block block = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()); + /*private boolean setSignText(Vector pt, String[] text) { + Block block = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()); if (block == null) return false; BlockState state = block.getState(); if (state == null || !(state instanceof Sign)) return false; @@ -577,9 +572,8 @@ public class SpoutWorld extends LocalWorld { sign.setLine(2, text[2]); sign.setLine(3, text[3]); sign.update(); - return true;*/ - return false; - } + return true; + }*/ /** * Get a sign's text. @@ -587,8 +581,8 @@ public class SpoutWorld extends LocalWorld { * @param pt * @return */ - private String[] getSignText(Vector pt) { - /*Block block = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()); + /*private String[] getSignText(Vector pt) { + Block block = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()); if (block == null) return new String[] { "", "", "", "" }; BlockState state = block.getState(); if (state == null || !(state instanceof Sign)) return new String[] { "", "", "", "" }; @@ -603,9 +597,7 @@ public class SpoutWorld extends LocalWorld { line2 != null ? line2 : "", line3 != null ? line3 : "", }; - */ - return new String[] {"", "", "", ""}; - } + }*/ /** * Get a container block's contents. @@ -613,8 +605,8 @@ public class SpoutWorld extends LocalWorld { * @param pt * @return */ - private BaseItemStack[] getContainerBlockContents(Vector pt) { - /*Block block = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()); + /*private BaseItemStack[] getContainerBlockContents(Vector pt) { + Block block = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()); if (block == null) { return new BaseItemStack[0]; } @@ -641,10 +633,10 @@ public class SpoutWorld extends LocalWorld { } } catch (Throwable ignore) {} } - }*/ + } - return new BaseItemStack[0]; - } + return contents; + }*/ /** * Set a container block's contents. @@ -653,8 +645,8 @@ public class SpoutWorld extends LocalWorld { * @param contents * @return */ - private boolean setContainerBlockContents(Vector pt, BaseItemStack[] contents) { - /*Block block = world.getBlock(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()); + /*private boolean setContainerBlockContents(Vector pt, BaseItemStack[] contents) { + Block block = world.getBlock(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()); if (block == null) { return false; } @@ -687,9 +679,8 @@ public class SpoutWorld extends LocalWorld { } } - return true;*/ - return false; - } + return true; + }*/ /** * Returns whether a block has a valid ID.