From e5a25496b279d4ca71c2551735a5c05d533988c9 Mon Sep 17 00:00:00 2001 From: sk89q Date: Fri, 18 Feb 2011 15:31:09 -0800 Subject: [PATCH] Fixed warnings and deprecation warnings. --- .../worldedit/bukkit/BukkitServerInterface.java | 4 ++-- src/com/sk89q/worldedit/bukkit/BukkitWorld.java | 15 +++++++-------- .../worldedit/bukkit/WorldEditPlayerListener.java | 5 +++++ .../sk89q/worldedit/bukkit/WorldEditPlugin.java | 3 ++- 4 files changed, 16 insertions(+), 11 deletions(-) diff --git a/src/com/sk89q/worldedit/bukkit/BukkitServerInterface.java b/src/com/sk89q/worldedit/bukkit/BukkitServerInterface.java index 7827082da..05cfb918b 100644 --- a/src/com/sk89q/worldedit/bukkit/BukkitServerInterface.java +++ b/src/com/sk89q/worldedit/bukkit/BukkitServerInterface.java @@ -20,7 +20,7 @@ package com.sk89q.worldedit.bukkit; import org.bukkit.*; -import org.bukkit.entity.MobType; +import org.bukkit.entity.CreatureType; import com.sk89q.worldedit.ServerInterface; public class BukkitServerInterface extends ServerInterface { @@ -38,7 +38,7 @@ public class BukkitServerInterface extends ServerInterface { @Override public boolean isValidMobType(String type) { - return MobType.fromName(type) != null; + return CreatureType.fromName(type) != null; } } diff --git a/src/com/sk89q/worldedit/bukkit/BukkitWorld.java b/src/com/sk89q/worldedit/bukkit/BukkitWorld.java index 3672facc8..9dfa93f36 100644 --- a/src/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/src/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -22,7 +22,7 @@ package com.sk89q.worldedit.bukkit; import org.bukkit.block.Block; import org.bukkit.block.BlockState; import org.bukkit.block.Furnace; -import org.bukkit.block.MobSpawner; +import org.bukkit.block.CreatureSpawner; import org.bukkit.block.Sign; import org.bukkit.entity.Creature; import org.bukkit.entity.LivingEntity; @@ -84,7 +84,6 @@ public class BukkitWorld extends LocalWorld { * * @param pt * @param data - * @return */ @Override public void setBlockData(Vector pt, int data) { @@ -138,10 +137,10 @@ public class BukkitWorld extends LocalWorld { Block bukkitBlock = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()); if (bukkitBlock == null) return false; BlockState state = bukkitBlock.getState(); - if (!(state instanceof MobSpawner)) return false; - MobSpawner bukkit = (MobSpawner)state; + if (!(state instanceof CreatureSpawner)) return false; + CreatureSpawner bukkit = (CreatureSpawner)state; MobSpawnerBlock we = (MobSpawnerBlock)block; - bukkit.setMobTypeId(we.getMobType()); + bukkit.setCreatureTypeId(we.getMobType()); bukkit.setDelay(we.getDelay()); return true; @@ -197,10 +196,10 @@ public class BukkitWorld extends LocalWorld { Block bukkitBlock = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()); if (bukkitBlock == null) return false; BlockState state = bukkitBlock.getState(); - if (!(state instanceof MobSpawner)) return false; - MobSpawner bukkit = (MobSpawner)state; + if (!(state instanceof CreatureSpawner)) return false; + CreatureSpawner bukkit = (CreatureSpawner)state; MobSpawnerBlock we = (MobSpawnerBlock)block; - we.setMobType(bukkit.getMobTypeId()); + we.setMobType(bukkit.getCreatureTypeId()); we.setDelay((short)bukkit.getDelay()); return true; diff --git a/src/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java b/src/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java index 1a62e9bc0..5caa008ea 100644 --- a/src/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java +++ b/src/com/sk89q/worldedit/bukkit/WorldEditPlayerListener.java @@ -30,6 +30,7 @@ import org.bukkit.event.player.PlayerListener; /** * Handles all events thrown in relation to a Player */ +@SuppressWarnings("deprecation") public class WorldEditPlayerListener extends PlayerListener { /** * Plugin. @@ -41,6 +42,7 @@ public class WorldEditPlayerListener extends PlayerListener { * * @param event Relevant event details */ + @Override public void onPlayerAnimation(PlayerAnimationEvent event) { if (event.getAnimationType() == PlayerAnimationType.ARM_SWING) { plugin.controller.handleArmSwing(wrapPlayer(event.getPlayer())); @@ -61,6 +63,7 @@ public class WorldEditPlayerListener extends PlayerListener { * * @param event Relevant event details */ + @Override public void onPlayerQuit(PlayerEvent event) { plugin.controller.handleDisconnect(wrapPlayer(event.getPlayer())); } @@ -70,6 +73,7 @@ public class WorldEditPlayerListener extends PlayerListener { * * @param event Relevant event details */ + @Override public void onPlayerCommand(PlayerChatEvent event) { String[] split = event.getMessage().split(" "); @@ -83,6 +87,7 @@ public class WorldEditPlayerListener extends PlayerListener { * * @param event Relevant event details */ + @Override public void onPlayerItem(PlayerItemEvent event) { if (plugin.controller.handleRightClick(wrapPlayer(event.getPlayer()))) { event.setCancelled(true); diff --git a/src/com/sk89q/worldedit/bukkit/WorldEditPlugin.java b/src/com/sk89q/worldedit/bukkit/WorldEditPlugin.java index fce35669b..b92edb636 100644 --- a/src/com/sk89q/worldedit/bukkit/WorldEditPlugin.java +++ b/src/com/sk89q/worldedit/bukkit/WorldEditPlugin.java @@ -147,9 +147,10 @@ public class WorldEditPlugin extends JavaPlugin { perms.load(); } + @Override public boolean onCommand(CommandSender sender, Command cmd, String commandLabel, String[] args) { - if (!sender.isPlayer()) { + if (!(sender instanceof Player)) { return true; }