mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-08 09:17:36 +01:00
SPIGOT-911: Add hitBlock to PorjectileHitEvent
By: md_5 <git@md-5.net>
This commit is contained in:
parent
6dda855a00
commit
8c5665d841
@ -1,5 +1,6 @@
|
||||
package org.bukkit.event.entity;
|
||||
|
||||
import org.bukkit.block.Block;
|
||||
import org.bukkit.entity.Entity;
|
||||
import org.bukkit.entity.Projectile;
|
||||
import org.bukkit.event.HandlerList;
|
||||
@ -10,14 +11,24 @@ import org.bukkit.event.HandlerList;
|
||||
public class ProjectileHitEvent extends EntityEvent {
|
||||
private static final HandlerList handlers = new HandlerList();
|
||||
private final Entity hitEntity;
|
||||
private final Block hitBlock;
|
||||
|
||||
public ProjectileHitEvent(final Projectile projectile) {
|
||||
this(projectile, null);
|
||||
this(projectile, null, null);
|
||||
}
|
||||
|
||||
public ProjectileHitEvent(final Projectile projectile, Entity hitEntity) {
|
||||
this(projectile, hitEntity, null);
|
||||
}
|
||||
|
||||
public ProjectileHitEvent(final Projectile projectile, Block hitBlock) {
|
||||
this(projectile, null, hitBlock);
|
||||
}
|
||||
|
||||
public ProjectileHitEvent(final Projectile projectile, Entity hitEntity, Block hitBlock) {
|
||||
super(projectile);
|
||||
this.hitEntity = hitEntity;
|
||||
this.hitBlock = hitBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -25,6 +36,15 @@ public class ProjectileHitEvent extends EntityEvent {
|
||||
return (Projectile) entity;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the block that was hit, if it was a block that was hit.
|
||||
*
|
||||
* @return hit block or else null
|
||||
*/
|
||||
public Block getHitBlock() {
|
||||
return hitBlock;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the entity that was hit, if it was an entity that was hit.
|
||||
*
|
||||
|
Loading…
Reference in New Issue
Block a user