geforkt von Mirrors/Paper
SPIGOT-911: Add hitBlock to PorjectileHitEvent
Dieser Commit ist enthalten in:
Ursprung
b6ad714e85
Commit
1d54397474
@ -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;
|
||||||
}
|
}
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren