Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-24 07:10:10 +01:00
Throw event when EnderCrystals harm EnderDragon. Fixes BUKKIT-4052
The EntityLiving dealDamage method will not call an event for the entity damage caused by an explosion without an associated entity cause, therefore, the explosion caused by EnderCrystals needs to be explicitely handled within the EnderDragon class.
Dieser Commit ist enthalten in:
Ursprung
e6bccf6bfd
Commit
c2a0396af2
@ -7,6 +7,7 @@ import java.util.List;
|
|||||||
import org.bukkit.block.BlockState;
|
import org.bukkit.block.BlockState;
|
||||||
import org.bukkit.craftbukkit.util.BlockStateListPopulator;
|
import org.bukkit.craftbukkit.util.BlockStateListPopulator;
|
||||||
import org.bukkit.event.entity.EntityCreatePortalEvent;
|
import org.bukkit.event.entity.EntityCreatePortalEvent;
|
||||||
|
import org.bukkit.event.entity.EntityDamageEvent;
|
||||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
@ -300,7 +301,15 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
|
|||||||
if (this.bC != null) {
|
if (this.bC != null) {
|
||||||
if (this.bC.dead) {
|
if (this.bC.dead) {
|
||||||
if (!this.world.isStatic) {
|
if (!this.world.isStatic) {
|
||||||
this.a(this.bq, DamageSource.explosion((Explosion) null), 10.0F);
|
// CraftBukkit start
|
||||||
|
EntityDamageEvent event = new EntityDamageEvent(this.getBukkitEntity(), org.bukkit.event.entity.EntityDamageEvent.DamageCause.ENTITY_EXPLOSION, 10.0F);
|
||||||
|
Bukkit.getPluginManager().callEvent(event);
|
||||||
|
|
||||||
|
if (!event.isCancelled()) {
|
||||||
|
getBukkitEntity().setLastDamageCause(event);
|
||||||
|
this.a(this.bq, DamageSource.explosion((Explosion) null), (float) event.getDamage());
|
||||||
|
}
|
||||||
|
// CraftBukkit end
|
||||||
}
|
}
|
||||||
|
|
||||||
this.bC = null;
|
this.bC = null;
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren