PaperMC/Spigot-API-Patches/Add-hit-entity-to-ProjectileHitEvent.patch
2016-10-05 16:07:29 -05:00

62 lines
No EOL
1.8 KiB
Diff

From 0000000000000000000000000000000000000000 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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java
+++ b/src/main/java/org/bukkit/event/entity/ProjectileHitEvent.java
@@ -0,0 +0,0 @@
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;
--