mirror of
https://github.com/PaperMC/Paper.git
synced 2024-11-05 10:20:53 +01:00
Add hitEntity to ProjectileHitEvent
This commit is contained in:
parent
2ba48b4965
commit
1c07d5c78f
@ -27,7 +27,7 @@
|
||||
protected void a(MovingObjectPosition movingobjectposition) {
|
||||
Entity entity = movingobjectposition.entity;
|
||||
-
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // CraftBukkit - Call event
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this, movingobjectposition); // CraftBukkit - Call event
|
||||
if (entity != null) {
|
||||
float f = MathHelper.sqrt(this.motX * this.motX + this.motY * this.motY + this.motZ * this.motZ);
|
||||
int i = MathHelper.f((double) f * this.damage);
|
||||
|
@ -44,7 +44,7 @@
|
||||
+
|
||||
+ // CraftBukkit start - Fire ProjectileHitEvent
|
||||
+ if (this.dead) {
|
||||
+ CraftEventFactory.callProjectileHitEvent(this);
|
||||
+ CraftEventFactory.callProjectileHitEvent(this, movingobjectposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
@ -16,7 +16,7 @@
|
||||
}
|
||||
|
||||
if (movingobjectposition != null && movingobjectposition.type != MovingObjectPosition.EnumMovingObjectType.MISS) {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this); // Craftbukkit - Call event
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this, movingobjectposition); // Craftbukkit - Call event
|
||||
if (movingobjectposition.type == MovingObjectPosition.EnumMovingObjectType.ENTITY) {
|
||||
this.hooked = movingobjectposition.entity;
|
||||
this.s();
|
||||
|
@ -14,7 +14,7 @@
|
||||
this.a(movingobjectposition);
|
||||
+ // CraftBukkit start
|
||||
+ if (this.dead) {
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this);
|
||||
+ org.bukkit.craftbukkit.event.CraftEventFactory.callProjectileHitEvent(this, movingobjectposition);
|
||||
+ }
|
||||
+ // CraftBukkit end
|
||||
}
|
||||
|
@ -778,8 +778,8 @@ public class CraftEventFactory {
|
||||
return event;
|
||||
}
|
||||
|
||||
public static ProjectileHitEvent callProjectileHitEvent(Entity entity) {
|
||||
ProjectileHitEvent event = new ProjectileHitEvent((Projectile) entity.getBukkitEntity());
|
||||
public static ProjectileHitEvent callProjectileHitEvent(Entity entity, MovingObjectPosition position) {
|
||||
ProjectileHitEvent event = new ProjectileHitEvent((Projectile) entity.getBukkitEntity(), position.entity == null ? null : position.entity.getBukkitEntity());
|
||||
entity.world.getServer().getPluginManager().callEvent(event);
|
||||
return event;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user