From d85ad792fb6301698725e5b9f5d7aca79afe393e Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Sun, 23 Jan 2011 23:23:13 +1100 Subject: [PATCH] removed all instances of new CraftEntity* where appropriate. Entity.getBukkitEntity() is now used instead. By: Andrew Ardill --- .../main/java/org/bukkit/craftbukkit/CraftMappable.java | 1 + .../src/main/java/org/bukkit/craftbukkit/CraftWorld.java | 4 ++-- .../org/bukkit/craftbukkit/entity/CraftMinecart.java | 2 ++ .../java/org/bukkit/craftbukkit/entity/CraftVehicle.java | 9 ++++++--- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftMappable.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftMappable.java index 8a0de5e21b..da0c2bcea3 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftMappable.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftMappable.java @@ -8,6 +8,7 @@ import org.bukkit.craftbukkit.entity.CraftEntity; * * @author sk89q */ +/**@deprecated*/ public interface CraftMappable { /** * Gets the CraftEntity version. diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java index ea89b7b1b2..a03d26db97 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/CraftWorld.java @@ -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) { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java index 0463bfd8e9..b0912c3128 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftMinecart.java @@ -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) { diff --git a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftVehicle.java b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftVehicle.java index 3fbd7c0087..e1cca61387 100644 --- a/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftVehicle.java +++ b/paper-server/src/main/java/org/bukkit/craftbukkit/entity/CraftVehicle.java @@ -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() {