mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-08-19 12:56:30 +00:00
SPIGOT-3538: Add getHitBlockFace for ProjectileHitEvent
This commit is contained in:
parent
771db4aa6b
commit
d6dd2bb344
1 changed files with 17 additions and 0 deletions
|
@ -1,6 +1,7 @@
|
||||||
package org.bukkit.event.entity;
|
package org.bukkit.event.entity;
|
||||||
|
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
import org.bukkit.entity.Entity;
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.Projectile;
|
import org.bukkit.entity.Projectile;
|
||||||
import org.bukkit.event.HandlerList;
|
import org.bukkit.event.HandlerList;
|
||||||
|
@ -12,6 +13,7 @@ public class ProjectileHitEvent extends EntityEvent {
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
private final Entity hitEntity;
|
private final Entity hitEntity;
|
||||||
private final Block hitBlock;
|
private final Block hitBlock;
|
||||||
|
private final BlockFace hitFace;
|
||||||
|
|
||||||
public ProjectileHitEvent(final Projectile projectile) {
|
public ProjectileHitEvent(final Projectile projectile) {
|
||||||
this(projectile, null, null);
|
this(projectile, null, null);
|
||||||
|
@ -26,9 +28,14 @@ public class ProjectileHitEvent extends EntityEvent {
|
||||||
}
|
}
|
||||||
|
|
||||||
public ProjectileHitEvent(final Projectile projectile, Entity hitEntity, Block hitBlock) {
|
public ProjectileHitEvent(final Projectile projectile, Entity hitEntity, Block hitBlock) {
|
||||||
|
this(projectile, hitEntity, hitBlock, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectileHitEvent(final Projectile projectile, Entity hitEntity, Block hitBlock, BlockFace hitFace) {
|
||||||
super(projectile);
|
super(projectile);
|
||||||
this.hitEntity = hitEntity;
|
this.hitEntity = hitEntity;
|
||||||
this.hitBlock = hitBlock;
|
this.hitBlock = hitBlock;
|
||||||
|
this.hitFace = hitFace;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -45,6 +52,16 @@ public class ProjectileHitEvent extends EntityEvent {
|
||||||
return hitBlock;
|
return hitBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the block face that was hit, if it was a block that was hit and the
|
||||||
|
* face was provided in the vent.
|
||||||
|
*
|
||||||
|
* @return hit face or else null
|
||||||
|
*/
|
||||||
|
public BlockFace getHitBlockFace() {
|
||||||
|
return hitFace;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the entity that was hit, if it was an entity that was hit.
|
* Gets the entity that was hit, if it was an entity that was hit.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Add table
Reference in a new issue