No longer using deprecated stuff.

This commit is contained in:
TomyLobo 2012-03-02 19:57:32 +01:00
parent f265a93913
commit 4e91f4e988
2 changed files with 12 additions and 10 deletions

View File

@ -29,7 +29,8 @@ import org.bukkit.Bukkit;
import org.bukkit.Material;
import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.entity.CreatureType;
import org.bukkit.entity.EntityType;
import com.sk89q.worldedit.LocalWorld;
import com.sk89q.worldedit.ServerInterface;
@ -52,7 +53,8 @@ public class BukkitServerInterface extends ServerInterface {
@Override
public boolean isValidMobType(String type) {
return CreatureType.fromName(type) != null;
final EntityType entityType = EntityType.fromName(type);
return entityType != null && entityType.isAlive();
}
@Override

View File

@ -284,7 +284,7 @@ public class BukkitWorld extends LocalWorld {
if (!(state instanceof CreatureSpawner)) return false;
CreatureSpawner bukkit = (CreatureSpawner) state;
MobSpawnerBlock we = (MobSpawnerBlock) block;
bukkit.setCreatureTypeId(we.getMobType());
bukkit.setCreatureTypeByName(we.getMobType());
bukkit.setDelay(we.getDelay());
return true;
}
@ -347,7 +347,7 @@ public class BukkitWorld extends LocalWorld {
if (!(state instanceof CreatureSpawner)) return false;
CreatureSpawner bukkit = (CreatureSpawner) state;
MobSpawnerBlock we = (MobSpawnerBlock) block;
we.setMobType(bukkit.getCreatureTypeId());
we.setMobType(bukkit.getCreatureTypeName());
we.setDelay((short) bukkit.getDelay());
return true;
}
@ -378,11 +378,11 @@ public class BukkitWorld extends LocalWorld {
return false;
}
BlockState state = block.getState();
if (!(state instanceof org.bukkit.block.ContainerBlock)) {
if (!(state instanceof org.bukkit.inventory.InventoryHolder)) {
return false;
}
org.bukkit.block.ContainerBlock chest = (org.bukkit.block.ContainerBlock) state;
org.bukkit.inventory.InventoryHolder chest = (org.bukkit.inventory.InventoryHolder) state;
Inventory inven = chest.getInventory();
inven.clear();
return true;
@ -629,11 +629,11 @@ public class BukkitWorld extends LocalWorld {
return new BaseItemStack[0];
}
BlockState state = block.getState();
if (!(state instanceof org.bukkit.block.ContainerBlock)) {
if (!(state instanceof org.bukkit.inventory.InventoryHolder)) {
return new BaseItemStack[0];
}
org.bukkit.block.ContainerBlock container = (org.bukkit.block.ContainerBlock) state;
org.bukkit.inventory.InventoryHolder container = (org.bukkit.inventory.InventoryHolder) state;
Inventory inven = container.getInventory();
int size = inven.getSize();
BaseItemStack[] contents = new BaseItemStack[size];
@ -669,11 +669,11 @@ public class BukkitWorld extends LocalWorld {
return false;
}
BlockState state = block.getState();
if (!(state instanceof org.bukkit.block.ContainerBlock)) {
if (!(state instanceof org.bukkit.inventory.InventoryHolder)) {
return false;
}
org.bukkit.block.ContainerBlock chest = (org.bukkit.block.ContainerBlock) state;
org.bukkit.inventory.InventoryHolder chest = (org.bukkit.inventory.InventoryHolder) state;
Inventory inven = chest.getInventory();
int size = inven.getSize();