SPIGOT-911: Add hitBlock to PorjectileHitEvent

Dieser Commit ist enthalten in:
md_5 2016-12-02 09:38:50 +11:00
Ursprung b6ad714e85
Commit 1d54397474

Datei anzeigen

@ -779,7 +779,13 @@ public class CraftEventFactory {
} }
public static ProjectileHitEvent callProjectileHitEvent(Entity entity, MovingObjectPosition position) { public static ProjectileHitEvent callProjectileHitEvent(Entity entity, MovingObjectPosition position) {
ProjectileHitEvent event = new ProjectileHitEvent((Projectile) entity.getBukkitEntity(), position.entity == null ? null : position.entity.getBukkitEntity()); Block hitBlock = null;
if (position.type == MovingObjectPosition.EnumMovingObjectType.BLOCK) {
BlockPosition blockposition = position.a();
hitBlock = entity.getBukkitEntity().getWorld().getBlockAt(blockposition.getX(), blockposition.getY(), blockposition.getZ());
}
ProjectileHitEvent event = new ProjectileHitEvent((Projectile) entity.getBukkitEntity(), position.entity == null ? null : position.entity.getBukkitEntity(), hitBlock);
entity.world.getServer().getPluginManager().callEvent(event); entity.world.getServer().getPluginManager().callEvent(event);
return event; return event;
} }