Fixed warnings and deprecation warnings.

Dieser Commit ist enthalten in:
sk89q 2011-02-18 15:31:09 -08:00
Ursprung 28941b86ba
Commit e5a25496b2
4 geänderte Dateien mit 16 neuen und 11 gelöschten Zeilen

Datei anzeigen

@ -20,7 +20,7 @@
package com.sk89q.worldedit.bukkit; package com.sk89q.worldedit.bukkit;
import org.bukkit.*; import org.bukkit.*;
import org.bukkit.entity.MobType; import org.bukkit.entity.CreatureType;
import com.sk89q.worldedit.ServerInterface; import com.sk89q.worldedit.ServerInterface;
public class BukkitServerInterface extends ServerInterface { public class BukkitServerInterface extends ServerInterface {
@ -38,7 +38,7 @@ public class BukkitServerInterface extends ServerInterface {
@Override @Override
public boolean isValidMobType(String type) { public boolean isValidMobType(String type) {
return MobType.fromName(type) != null; return CreatureType.fromName(type) != null;
} }
} }

Datei anzeigen

@ -22,7 +22,7 @@ package com.sk89q.worldedit.bukkit;
import org.bukkit.block.Block; import org.bukkit.block.Block;
import org.bukkit.block.BlockState; import org.bukkit.block.BlockState;
import org.bukkit.block.Furnace; import org.bukkit.block.Furnace;
import org.bukkit.block.MobSpawner; import org.bukkit.block.CreatureSpawner;
import org.bukkit.block.Sign; import org.bukkit.block.Sign;
import org.bukkit.entity.Creature; import org.bukkit.entity.Creature;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
@ -84,7 +84,6 @@ public class BukkitWorld extends LocalWorld {
* *
* @param pt * @param pt
* @param data * @param data
* @return
*/ */
@Override @Override
public void setBlockData(Vector pt, int data) { 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()); Block bukkitBlock = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
if (bukkitBlock == null) return false; if (bukkitBlock == null) return false;
BlockState state = bukkitBlock.getState(); BlockState state = bukkitBlock.getState();
if (!(state instanceof MobSpawner)) return false; if (!(state instanceof CreatureSpawner)) return false;
MobSpawner bukkit = (MobSpawner)state; CreatureSpawner bukkit = (CreatureSpawner)state;
MobSpawnerBlock we = (MobSpawnerBlock)block; MobSpawnerBlock we = (MobSpawnerBlock)block;
bukkit.setMobTypeId(we.getMobType()); bukkit.setCreatureTypeId(we.getMobType());
bukkit.setDelay(we.getDelay()); bukkit.setDelay(we.getDelay());
return true; return true;
@ -197,10 +196,10 @@ public class BukkitWorld extends LocalWorld {
Block bukkitBlock = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ()); Block bukkitBlock = world.getBlockAt(pt.getBlockX(), pt.getBlockY(), pt.getBlockZ());
if (bukkitBlock == null) return false; if (bukkitBlock == null) return false;
BlockState state = bukkitBlock.getState(); BlockState state = bukkitBlock.getState();
if (!(state instanceof MobSpawner)) return false; if (!(state instanceof CreatureSpawner)) return false;
MobSpawner bukkit = (MobSpawner)state; CreatureSpawner bukkit = (CreatureSpawner)state;
MobSpawnerBlock we = (MobSpawnerBlock)block; MobSpawnerBlock we = (MobSpawnerBlock)block;
we.setMobType(bukkit.getMobTypeId()); we.setMobType(bukkit.getCreatureTypeId());
we.setDelay((short)bukkit.getDelay()); we.setDelay((short)bukkit.getDelay());
return true; return true;

Datei anzeigen

@ -30,6 +30,7 @@ import org.bukkit.event.player.PlayerListener;
/** /**
* Handles all events thrown in relation to a Player * Handles all events thrown in relation to a Player
*/ */
@SuppressWarnings("deprecation")
public class WorldEditPlayerListener extends PlayerListener { public class WorldEditPlayerListener extends PlayerListener {
/** /**
* Plugin. * Plugin.
@ -41,6 +42,7 @@ public class WorldEditPlayerListener extends PlayerListener {
* *
* @param event Relevant event details * @param event Relevant event details
*/ */
@Override
public void onPlayerAnimation(PlayerAnimationEvent event) { public void onPlayerAnimation(PlayerAnimationEvent event) {
if (event.getAnimationType() == PlayerAnimationType.ARM_SWING) { if (event.getAnimationType() == PlayerAnimationType.ARM_SWING) {
plugin.controller.handleArmSwing(wrapPlayer(event.getPlayer())); plugin.controller.handleArmSwing(wrapPlayer(event.getPlayer()));
@ -61,6 +63,7 @@ public class WorldEditPlayerListener extends PlayerListener {
* *
* @param event Relevant event details * @param event Relevant event details
*/ */
@Override
public void onPlayerQuit(PlayerEvent event) { public void onPlayerQuit(PlayerEvent event) {
plugin.controller.handleDisconnect(wrapPlayer(event.getPlayer())); plugin.controller.handleDisconnect(wrapPlayer(event.getPlayer()));
} }
@ -70,6 +73,7 @@ public class WorldEditPlayerListener extends PlayerListener {
* *
* @param event Relevant event details * @param event Relevant event details
*/ */
@Override
public void onPlayerCommand(PlayerChatEvent event) { public void onPlayerCommand(PlayerChatEvent event) {
String[] split = event.getMessage().split(" "); String[] split = event.getMessage().split(" ");
@ -83,6 +87,7 @@ public class WorldEditPlayerListener extends PlayerListener {
* *
* @param event Relevant event details * @param event Relevant event details
*/ */
@Override
public void onPlayerItem(PlayerItemEvent event) { public void onPlayerItem(PlayerItemEvent event) {
if (plugin.controller.handleRightClick(wrapPlayer(event.getPlayer()))) { if (plugin.controller.handleRightClick(wrapPlayer(event.getPlayer()))) {
event.setCancelled(true); event.setCancelled(true);

Datei anzeigen

@ -147,9 +147,10 @@ public class WorldEditPlugin extends JavaPlugin {
perms.load(); perms.load();
} }
@Override
public boolean onCommand(CommandSender sender, Command cmd, public boolean onCommand(CommandSender sender, Command cmd,
String commandLabel, String[] args) { String commandLabel, String[] args) {
if (!sender.isPlayer()) { if (!(sender instanceof Player)) {
return true; return true;
} }