mirror of
https://github.com/EngineHub/WorldEdit.git
synced 2024-12-15 04:41:37 +08:00
Fixed warnings and deprecation warnings.
This commit is contained in:
parent
28941b86ba
commit
e5a25496b2
@ -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 int resolveItem(String name) {
|
||||
|
||||
@Override
|
||||
public boolean isValidMobType(String type) {
|
||||
return MobType.fromName(type) != null;
|
||||
return CreatureType.fromName(type) != null;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -22,7 +22,7 @@
|
||||
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 int getBlockType(Vector pt) {
|
||||
*
|
||||
* @param pt
|
||||
* @param data
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public void setBlockData(Vector pt, int data) {
|
||||
@ -138,10 +137,10 @@ public boolean copyToWorld(Vector pt, BaseBlock block) {
|
||||
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 boolean copyFromWorld(Vector pt, BaseBlock block) {
|
||||
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;
|
||||
|
||||
|
@ -30,6 +30,7 @@
|
||||
/**
|
||||
* 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 WorldEditPlayerListener(WorldEditPlugin plugin) {
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onPlayerQuit(PlayerEvent event) {
|
||||
plugin.controller.handleDisconnect(wrapPlayer(event.getPlayer()));
|
||||
}
|
||||
@ -70,6 +73,7 @@ public void onPlayerQuit(PlayerEvent event) {
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onPlayerCommand(PlayerChatEvent event) {
|
||||
String[] split = event.getMessage().split(" ");
|
||||
|
||||
@ -83,6 +87,7 @@ public void onPlayerCommand(PlayerChatEvent event) {
|
||||
*
|
||||
* @param event Relevant event details
|
||||
*/
|
||||
@Override
|
||||
public void onPlayerItem(PlayerItemEvent event) {
|
||||
if (plugin.controller.handleRightClick(wrapPlayer(event.getPlayer()))) {
|
||||
event.setCancelled(true);
|
||||
|
@ -147,9 +147,10 @@ public void loadConfiguration() {
|
||||
perms.load();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onCommand(CommandSender sender, Command cmd,
|
||||
String commandLabel, String[] args) {
|
||||
if (!sender.isPlayer()) {
|
||||
if (!(sender instanceof Player)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user