SPIGOT-4882: EntityExplodeEvent appears to fire every tick because of enderdragon

This commit is contained in:
md_5 2019-05-07 09:45:13 +10:00
parent 524facd24e
commit d20328368c

View File

@ -70,11 +70,16 @@
} else { } else {
flag = true; flag = true;
} }
@@ -407,6 +428,43 @@ @@ -407,6 +428,48 @@
} }
} }
+ // CraftBukkit start - Set off an EntityExplodeEvent for the dragon exploding all these blocks + // CraftBukkit start - Set off an EntityExplodeEvent for the dragon exploding all these blocks
+ // SPIGOT-4882: don't fire event if nothing hit
+ if (!flag1) {
+ return flag;
+ }
+
+ org.bukkit.entity.Entity bukkitEntity = this.getBukkitEntity(); + org.bukkit.entity.Entity bukkitEntity = this.getBukkitEntity();
+ EntityExplodeEvent event = new EntityExplodeEvent(bukkitEntity, bukkitEntity.getLocation(), destroyedBlocks, 0F); + EntityExplodeEvent event = new EntityExplodeEvent(bukkitEntity, bukkitEntity.getLocation(), destroyedBlocks, 0F);
+ bukkitEntity.getServer().getPluginManager().callEvent(event); + bukkitEntity.getServer().getPluginManager().callEvent(event);