Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 20:40:08 +01:00
Moved getVehicle, leaveVehicle and isInsideVehicle from CraftLivingEntity to CraftEntity. Addresses BUKKIT-811
Dieser Commit ist enthalten in:
Ursprung
1394926e53
Commit
53e4a034f4
@ -9,6 +9,7 @@ import org.bukkit.Server;
|
|||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
import org.bukkit.craftbukkit.CraftWorld;
|
import org.bukkit.craftbukkit.CraftWorld;
|
||||||
|
import org.bukkit.entity.Vehicle;
|
||||||
import org.bukkit.event.entity.EntityDamageEvent;
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.metadata.MetadataValue;
|
import org.bukkit.metadata.MetadataValue;
|
||||||
import org.bukkit.plugin.Plugin;
|
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) {
|
public void removeMetadata(String metadataKey, Plugin owningPlugin) {
|
||||||
server.getEntityMetadata().removeMetadata(this, metadataKey, 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);
|
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() {
|
public int getRemainingAir() {
|
||||||
return getHandle().getAirTicks();
|
return getHandle().getAirTicks();
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren