mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-24 03:25:15 +01:00
Moved getVehicle, leaveVehicle and isInsideVehicle from CraftLivingEntity to CraftEntity. Addresses BUKKIT-811
This commit is contained in:
parent
1394926e53
commit
53e4a034f4
@ -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();
|
||||
}
|
||||
}
|
||||
|
@ -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();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user