From 3e875b79365d81734651a87fdbc2517c7ffc7d64 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Sat, 22 Jun 2013 05:54:28 +0200 Subject: [PATCH] Fixed some warnings. --- .../java/com/sk89q/worldedit/bukkit/BukkitWorld.java | 5 +++-- .../com/sk89q/worldedit/bukkit/WorldEditPlugin.java | 11 +++-------- .../sk89q/worldedit/commands/SchematicCommands.java | 2 -- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java b/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java index 2278ce427..108dfc58a 100644 --- a/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -130,6 +130,7 @@ public class BukkitWorld extends LocalWorld { * Construct the object. * @param world */ + @SuppressWarnings("unchecked") public BukkitWorld(World world) { this.world = world; @@ -170,7 +171,7 @@ public class BukkitWorld extends LocalWorld { Class nmsClass = (Class) testBlock; boolean canUse = false; try { - canUse = (Boolean) nmsClass.getMethod("verify", null).invoke(null, null); + canUse = (Boolean) nmsClass.getMethod("verify").invoke(null); } catch (Throwable e) { continue; } @@ -191,7 +192,7 @@ public class BukkitWorld extends LocalWorld { // try our default try { nmsBlockType = (Class) Class.forName("com.sk89q.worldedit.bukkit.DefaultNmsBlock"); - boolean canUse = (Boolean) nmsBlockType.getMethod("verify", null).invoke(null, null); + boolean canUse = (Boolean) nmsBlockType.getMethod("verify").invoke(null); if (canUse) { nmsSetMethod = nmsBlockType.getMethod("set", World.class, Vector.class, BaseBlock.class); nmsValidBlockMethod = nmsBlockType.getMethod("isValidBlockType", int.class); diff --git a/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java b/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java index d19de40d7..eaba0e2af 100644 --- a/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java +++ b/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java @@ -116,20 +116,21 @@ public class WorldEditPlugin extends JavaPlugin { // Setup interfaces server = new BukkitServerInterface(this, getServer()); controller = new WorldEdit(server, config); - WorldEdit.getInstance().logger.setParent(Bukkit.getLogger()); + WorldEdit.logger.setParent(Bukkit.getLogger()); api = new WorldEditAPI(this); getServer().getMessenger().registerIncomingPluginChannel(this, CUI_PLUGIN_CHANNEL, new CUIChannelListener(this)); getServer().getMessenger().registerOutgoingPluginChannel(this, CUI_PLUGIN_CHANNEL); // Now we can register events! getServer().getPluginManager().registerEvents(new WorldEditListener(this), this); - getServer().getScheduler().scheduleAsyncRepeatingTask(this, + getServer().getScheduler().runTaskTimerAsynchronously(this, new SessionTimer(controller, getServer()), 120, 120); } private void copyNmsBlockClasses(File target) { try { JarFile jar = new JarFile(getFile()); + @SuppressWarnings("rawtypes") Enumeration entries = jar.entries(); while (entries.hasMoreElements()) { JarEntry jarEntry = (JarEntry) entries.nextElement(); @@ -158,12 +159,6 @@ public class WorldEditPlugin extends JavaPlugin { */ @Override public void onDisable() { - for (Player player : getServer().getOnlinePlayers()) { - LocalPlayer lPlayer = wrapPlayer(player); - if (controller.getSession(lPlayer).hasCUISupport()) { - lPlayer.dispatchCUIHandshake(); - } - } controller.clearSessions(); for (Handler h : controller.commandLogger.getHandlers()) { h.close(); diff --git a/src/main/java/com/sk89q/worldedit/commands/SchematicCommands.java b/src/main/java/com/sk89q/worldedit/commands/SchematicCommands.java index e8880d5ac..8c5114273 100644 --- a/src/main/java/com/sk89q/worldedit/commands/SchematicCommands.java +++ b/src/main/java/com/sk89q/worldedit/commands/SchematicCommands.java @@ -225,7 +225,6 @@ public class SchematicCommands { throw new FilenameResolutionException(dir.getPath(), "Schematics directory invalid or not found."); } StringBuilder build = new StringBuilder("Available schematics (Filename (Format)): "); - boolean first = true; final int sortType = args.hasFlag('d') ? -1 : args.hasFlag('n') ? 1 : 0; // cleanup file list @@ -248,7 +247,6 @@ public class SchematicCommands { build.append("\n\u00a79"); SchematicFormat format = SchematicFormat.getFormat(file); build.append(file.getName()).append(": ").append(format == null ? "Unknown" : format.getName()); - first = false; } player.print(build.toString()); }