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