Add hitEntity to ProjectileHitEvent

This commit is contained in:
md_5 2016-11-28 12:47:01 +11:00
parent 2ba48b4965
commit 1c07d5c78f
5 changed files with 6 additions and 6 deletions

View File

@ -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);

View File

@ -44,7 +44,7 @@
+
+ // CraftBukkit start - Fire ProjectileHitEvent
+ if (this.dead) {
+ CraftEventFactory.callProjectileHitEvent(this);
+ CraftEventFactory.callProjectileHitEvent(this, movingobjectposition);
+ }
+ // CraftBukkit end
}

View File

@ -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();

View File

@ -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
}

View File

@ -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;
}