Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-18 20:40:08 +01:00
Fire HangingBreakEvent when explosions remove hanging entities. Fixes BUKKIT-2764
Dieser Commit ist enthalten in:
Ursprung
87a1cd3d43
Commit
1623bf0f9b
@ -206,7 +206,7 @@ public abstract class EntityHanging extends Entity {
|
|||||||
public boolean damageEntity(DamageSource damagesource, int i) {
|
public boolean damageEntity(DamageSource damagesource, int i) {
|
||||||
if (!this.dead && !this.world.isStatic) {
|
if (!this.dead && !this.world.isStatic) {
|
||||||
// CraftBukkit start
|
// CraftBukkit start
|
||||||
HangingBreakEvent event = null;
|
HangingBreakEvent event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.DEFAULT);
|
||||||
PaintingBreakEvent paintingEvent = null;
|
PaintingBreakEvent paintingEvent = null;
|
||||||
if (damagesource.getEntity() != null) {
|
if (damagesource.getEntity() != null) {
|
||||||
event = new HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damagesource.getEntity() == null ? null : damagesource.getEntity().getBukkitEntity());
|
event = new HangingBreakByEntityEvent((Hanging) this.getBukkitEntity(), damagesource.getEntity() == null ? null : damagesource.getEntity().getBukkitEntity());
|
||||||
@ -215,18 +215,18 @@ public abstract class EntityHanging extends Entity {
|
|||||||
// Fire old painting event until it can be removed
|
// Fire old painting event until it can be removed
|
||||||
paintingEvent = new org.bukkit.event.painting.PaintingBreakByEntityEvent((Painting) this.getBukkitEntity(), damagesource.getEntity() == null ? null : damagesource.getEntity().getBukkitEntity());
|
paintingEvent = new org.bukkit.event.painting.PaintingBreakByEntityEvent((Painting) this.getBukkitEntity(), damagesource.getEntity() == null ? null : damagesource.getEntity().getBukkitEntity());
|
||||||
}
|
}
|
||||||
|
} else if (damagesource == DamageSource.EXPLOSION || damagesource == DamageSource.EXPLOSION2) {
|
||||||
|
event = new HangingBreakEvent((Hanging) this.getBukkitEntity(), HangingBreakEvent.RemoveCause.EXPLOSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (event != null) {
|
this.world.getServer().getPluginManager().callEvent(event);
|
||||||
this.world.getServer().getPluginManager().callEvent(event);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (paintingEvent != null) {
|
if (paintingEvent != null) {
|
||||||
paintingEvent.setCancelled(event != null && event.isCancelled());
|
paintingEvent.setCancelled(event.isCancelled());
|
||||||
this.world.getServer().getPluginManager().callEvent(paintingEvent);
|
this.world.getServer().getPluginManager().callEvent(paintingEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dead || (event != null && event.isCancelled()) || (paintingEvent != null && paintingEvent.isCancelled())) {
|
if (dead || event.isCancelled() || (paintingEvent != null && paintingEvent.isCancelled())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
// CraftBukkit end
|
// CraftBukkit end
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren