mirror of
https://hub.spigotmc.org/stash/scm/spigot/bukkit.git
synced 2025-08-30 05:05:22 +00:00
Add hitEntity to ProjectileHitEvent
This commit is contained in:
parent
daec93fe81
commit
51d92a748d
1 changed files with 16 additions and 0 deletions
|
@ -1,5 +1,6 @@
|
||||||
package org.bukkit.event.entity;
|
package org.bukkit.event.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;
|
||||||
|
|
||||||
|
@ -8,9 +9,15 @@ import org.bukkit.event.HandlerList;
|
||||||
*/
|
*/
|
||||||
public class ProjectileHitEvent extends EntityEvent {
|
public class ProjectileHitEvent extends EntityEvent {
|
||||||
private static final HandlerList handlers = new HandlerList();
|
private static final HandlerList handlers = new HandlerList();
|
||||||
|
private final Entity hitEntity;
|
||||||
|
|
||||||
public ProjectileHitEvent(final Projectile projectile) {
|
public ProjectileHitEvent(final Projectile projectile) {
|
||||||
|
this(projectile, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public ProjectileHitEvent(final Projectile projectile, Entity hitEntity) {
|
||||||
super(projectile);
|
super(projectile);
|
||||||
|
this.hitEntity = hitEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -18,6 +25,15 @@ public class ProjectileHitEvent extends EntityEvent {
|
||||||
return (Projectile) entity;
|
return (Projectile) entity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Gets the entity that was hit, if it was an entity that was hit.
|
||||||
|
*
|
||||||
|
* @return hit entity or else null
|
||||||
|
*/
|
||||||
|
public Entity getHitEntity() {
|
||||||
|
return hitEntity;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HandlerList getHandlers() {
|
public HandlerList getHandlers() {
|
||||||
return handlers;
|
return handlers;
|
||||||
|
|
Loading…
Add table
Reference in a new issue