mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-23 19:15:32 +01:00
[Bleeding] Call EntityTargetEvent for EnderDragons. Fixes BUKKIT-5160
EnderDragons did not call an EntityTargetEvent when they were targeting random players in the End. This commit adds that event call into the targeting code.
This commit is contained in:
parent
1154484815
commit
ae9cd0729e
@ -10,6 +10,7 @@ import org.bukkit.event.entity.EntityCreatePortalEvent;
|
||||
import org.bukkit.event.entity.EntityDamageEvent;
|
||||
import org.bukkit.event.entity.EntityExplodeEvent;
|
||||
import org.bukkit.event.entity.EntityRegainHealthEvent;
|
||||
import org.bukkit.event.entity.EntityTargetEvent;
|
||||
import org.bukkit.Bukkit;
|
||||
// CraftBukkit end
|
||||
|
||||
@ -377,7 +378,19 @@ public class EntityEnderDragon extends EntityInsentient implements IComplex, IMo
|
||||
private void bO() {
|
||||
this.bz = false;
|
||||
if (this.random.nextInt(2) == 0 && !this.world.players.isEmpty()) {
|
||||
this.bD = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size()));
|
||||
// CraftBukkit start
|
||||
Entity target = (Entity) this.world.players.get(this.random.nextInt(this.world.players.size()));
|
||||
EntityTargetEvent event = new EntityTargetEvent(this.getBukkitEntity(), target.getBukkitEntity(), EntityTargetEvent.TargetReason.RANDOM_TARGET);
|
||||
this.world.getServer().getPluginManager().callEvent(event);
|
||||
|
||||
if (!event.isCancelled()) {
|
||||
if (event.getTarget() == null) {
|
||||
this.bD = null;
|
||||
} else {
|
||||
this.bD = ((org.bukkit.craftbukkit.entity.CraftEntity) event.getTarget()).getHandle();
|
||||
}
|
||||
}
|
||||
// CraftBukkit end
|
||||
} else {
|
||||
boolean flag = false;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user