Archiviert
13
0

Moved getVehicle, leaveVehicle and isInsideVehicle from CraftLivingEntity to CraftEntity. Addresses BUKKIT-811

Dieser Commit ist enthalten in:
TomyLobo 2011-10-25 15:53:43 +02:00 committet von EvilSeph
Ursprung 1394926e53
Commit 53e4a034f4
2 geänderte Dateien mit 22 neuen und 26 gelöschten Zeilen

Datei anzeigen

@ -9,6 +9,7 @@ import org.bukkit.Server;
import org.bukkit.World;
import org.bukkit.craftbukkit.CraftServer;
import org.bukkit.craftbukkit.CraftWorld;
import org.bukkit.entity.Vehicle;
import org.bukkit.event.entity.EntityDamageEvent;
import org.bukkit.metadata.MetadataValue;
import org.bukkit.plugin.Plugin;
@ -342,4 +343,25 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
public void removeMetadata(String metadataKey, Plugin owningPlugin) {
server.getEntityMetadata().removeMetadata(this, metadataKey, owningPlugin);
}
public boolean isInsideVehicle() {
return getHandle().vehicle != null;
}
public boolean leaveVehicle() {
if (getHandle().vehicle == null) {
return false;
}
getHandle().setPassengerOf(null);
return true;
}
public org.bukkit.entity.Entity getVehicle() {
if (getHandle().vehicle == null) {
return null;
}
return getHandle().vehicle.getBukkitEntity();
}
}

Datei anzeigen

@ -128,32 +128,6 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
return launchProjectile(Arrow.class);
}
public boolean isInsideVehicle() {
return getHandle().vehicle != null;
}
public boolean leaveVehicle() {
if (getHandle().vehicle == null) {
return false;
}
getHandle().setPassengerOf(null);
return true;
}
public Vehicle getVehicle() {
if (getHandle().vehicle == null) {
return null;
}
org.bukkit.entity.Entity vehicle = (getHandle().vehicle.getBukkitEntity());
if (vehicle instanceof Vehicle) {
return (Vehicle) vehicle;
}
return null;
}
public int getRemainingAir() {
return getHandle().getAirTicks();
}