Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-11-17 05:20:05 +01:00
Avoid some avoidable calls, clean PluginManager accessors
Dieser Commit ist enthalten in:
Ursprung
a7744ac751
Commit
b0ab686964
@ -1200,15 +1200,17 @@ public abstract class Entity {
|
|||||||
// b(null) doesn't really fly for overloaded methods,
|
// b(null) doesn't really fly for overloaded methods,
|
||||||
// so this method is needed
|
// so this method is needed
|
||||||
|
|
||||||
|
PluginManager pluginManager = Bukkit.getPluginManager();
|
||||||
|
this.getBukkitEntity(); // make sure bukkitEntity is initialised
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
this.e = 0.0D;
|
this.e = 0.0D;
|
||||||
this.f = 0.0D;
|
this.f = 0.0D;
|
||||||
if (entity == null) {
|
if (entity == null) {
|
||||||
if (this.vehicle != null) {
|
if (this.vehicle != null) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if ((this.getBukkitEntity() instanceof LivingEntity) && (this.vehicle.getBukkitEntity() instanceof Vehicle)) {
|
if ((this.bukkitEntity instanceof LivingEntity) && (this.vehicle.getBukkitEntity() instanceof Vehicle)) {
|
||||||
VehicleExitEvent event = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.getBukkitEntity());
|
VehicleExitEvent event = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
|
||||||
this.world.getServer().getPluginManager().callEvent(event);
|
pluginManager.callEvent(event);
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -1219,9 +1221,9 @@ public abstract class Entity {
|
|||||||
this.vehicle = null;
|
this.vehicle = null;
|
||||||
} else if (this.vehicle == entity) {
|
} else if (this.vehicle == entity) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if ((this.getBukkitEntity() instanceof LivingEntity) && (this.vehicle.getBukkitEntity() instanceof Vehicle)) {
|
if ((this.bukkitEntity instanceof LivingEntity) && (this.vehicle.getBukkitEntity() instanceof Vehicle)) {
|
||||||
VehicleExitEvent event = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.getBukkitEntity());
|
VehicleExitEvent event = new VehicleExitEvent((Vehicle) this.vehicle.getBukkitEntity(), (LivingEntity) this.bukkitEntity);
|
||||||
this.world.getServer().getPluginManager().callEvent(event);
|
pluginManager.callEvent(event);
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
|
||||||
@ -1230,9 +1232,9 @@ public abstract class Entity {
|
|||||||
this.setPositionRotation(entity.locX, entity.boundingBox.b + (double) entity.length, entity.locZ, this.yaw, this.pitch);
|
this.setPositionRotation(entity.locX, entity.boundingBox.b + (double) entity.length, entity.locZ, this.yaw, this.pitch);
|
||||||
} else {
|
} else {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
if ((this.getBukkitEntity() instanceof LivingEntity) && (entity != null) && (entity.getBukkitEntity() instanceof Vehicle)) {
|
if ((this.bukkitEntity instanceof LivingEntity) && (entity.getBukkitEntity() instanceof Vehicle)) {
|
||||||
VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) entity.getBukkitEntity(), (LivingEntity) this.getBukkitEntity());
|
VehicleEnterEvent event = new VehicleEnterEvent((Vehicle) entity.getBukkitEntity(), this.bukkitEntity);
|
||||||
this.world.getServer().getPluginManager().callEvent(event);
|
pluginManager.callEvent(event);
|
||||||
|
|
||||||
if (event.isCancelled()) {
|
if (event.isCancelled()) {
|
||||||
return;
|
return;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren