#776: Add ability to cancel ProjectileHitEvent

By: Martoph <sager1018@gmail.com>
This commit is contained in:
CraftBukkit/Spigot
2021-05-09 16:51:44 +10:00
parent 9d5bc88891
commit 3df6aee27f
9 changed files with 101 additions and 9 deletions

View File

@@ -1167,9 +1167,9 @@ public class CraftEventFactory {
return event;
}
public static void callProjectileHitEvent(Entity entity, MovingObjectPosition position) {
public static ProjectileHitEvent callProjectileHitEvent(Entity entity, MovingObjectPosition position) {
if (position.getType() == MovingObjectPosition.EnumMovingObjectType.MISS) {
return;
return null;
}
Block hitBlock = null;
@@ -1187,6 +1187,7 @@ public class CraftEventFactory {
ProjectileHitEvent event = new ProjectileHitEvent((Projectile) entity.getBukkitEntity(), hitEntity, hitBlock, hitFace);
entity.world.getServer().getPluginManager().callEvent(event);
return event;
}
public static ExpBottleEvent callExpBottleEvent(Entity entity, int exp) {