removed all instances of new CraftEntity* where appropriate.

Entity.getBukkitEntity() is now used instead.

By: Andrew Ardill <andrew.ardill@gmail.com>
This commit is contained in:
CraftBukkit/Spigot 2011-01-23 23:23:13 +11:00
parent b49ed260f6
commit d85ad792fb
4 changed files with 11 additions and 5 deletions

View File

@ -8,6 +8,7 @@ import org.bukkit.craftbukkit.entity.CraftEntity;
*
* @author sk89q
*/
/**@deprecated*/
public interface CraftMappable {
/**
* Gets the CraftEntity version.

View File

@ -151,7 +151,7 @@ public class CraftWorld implements World {
CraftMinecart.Type.Minecart.getId()
);
world.a(minecart);
return new CraftMinecart(world.getServer(), minecart);
return (Minecart) minecart.getBukkitEntity();
}
public StorageMinecart spawnStorageMinecart(Location loc) {
@ -163,7 +163,7 @@ public class CraftWorld implements World {
CraftMinecart.Type.StorageMinecart.getId()
);
world.a(minecart);
return new CraftStorageMinecart(world.getServer(), minecart);
return (StorageMinecart) minecart.getBukkitEntity();
}
public PoweredMinecart spawnPoweredMinecart(Location loc) {

View File

@ -52,6 +52,8 @@ public class CraftMinecart extends CraftVehicle implements Minecart {
* @param server
* @param minecart
* @return
*
* @deprecated
*/
public static CraftMinecart getCraftMinecart(CraftServer server,
EntityMinecart minecart) {

View File

@ -1,7 +1,6 @@
package org.bukkit.craftbukkit.entity;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.entity.Entity;
import org.bukkit.entity.Vehicle;
@ -20,8 +19,12 @@ public abstract class CraftVehicle extends CraftEntity implements Vehicle {
}
public boolean setPassenger(Entity passenger) {
((CraftEntity)passenger).getHandle().setPassengerOf(getHandle());
return true;
if(passenger instanceof CraftEntity){
((CraftEntity)passenger).getHandle().setPassengerOf(getHandle());
return true;
} else {
return false;
}
}
public boolean isEmpty() {