mirror of
https://github.com/PaperMC/Paper.git
synced 2024-09-07 20:38:22 +02:00
65 lines
1.8 KiB
Diff
65 lines
1.8 KiB
Diff
From 820409d462306180ec3d416d93a8dba43bb3874f Mon Sep 17 00:00:00 2001
|
|
From: AlphaBlend <whizkid3000@hotmail.com>
|
|
Date: Wed, 21 Sep 2016 20:40:21 -0700
|
|
Subject: [PATCH] Add hit entity to ProjectileHitEvent
|
|
|
|
|
|
diff --git a/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java b/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java
|
|
index 25ae832..250bddf 100644
|
|
--- a/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java
|
|
+++ b/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java
|
|
@@ -1,23 +1,50 @@
|
|
package org.bukkit.event.entity;
|
|
|
|
+import org.bukkit.entity.Entity; // Paper
|
|
import org.bukkit.entity.Projectile;
|
|
import org.bukkit.event.HandlerList;
|
|
|
|
+import javax.annotation.Nullable;
|
|
+
|
|
/**
|
|
* Called when a projectile hits an object
|
|
*/
|
|
public class ProjectileHitEvent extends EntityEvent {
|
|
private static final HandlerList handlers = new HandlerList();
|
|
+ // Paper start
|
|
+ @Nullable
|
|
+ private final Entity hitEntity;
|
|
|
|
public ProjectileHitEvent(final Projectile projectile) {
|
|
+ this(projectile, null);
|
|
+ }
|
|
+
|
|
+ public ProjectileHitEvent(final Projectile projectile, @Nullable final Entity hitEntity) {
|
|
super(projectile);
|
|
+ this.hitEntity = hitEntity;
|
|
}
|
|
+ // Paper end
|
|
|
|
@Override
|
|
public Projectile getEntity() {
|
|
return (Projectile) entity;
|
|
}
|
|
|
|
+ // Paper start
|
|
+ /**
|
|
+ * Gets the entity that was hit by the projectile.
|
|
+ *
|
|
+ * This may be null, depending on if the projectile
|
|
+ * actually hit an entity.
|
|
+ *
|
|
+ * @return The entity that was hit, or null otherwise
|
|
+ */
|
|
+ @Nullable
|
|
+ public Entity getHitEntity() {
|
|
+ return hitEntity;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
@Override
|
|
public HandlerList getHandlers() {
|
|
return handlers;
|
|
--
|
|
2.10.0
|
|
|