From 2c5b2a8f6f8f1a9a49cfa546191fadad7da929a5 Mon Sep 17 00:00:00 2001 From: AlphaBlend Date: Thu, 21 Mar 2013 12:47:46 -0600 Subject: [PATCH] Add method to get the source of a TNTPrimed. Adds BUKKIT-3815 --- .../bukkit/craftbukkit/entity/CraftTNTPrimed.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java index d9ac266ba1..e08ad471e0 100644 --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftTNTPrimed.java @@ -1,8 +1,10 @@ package org.bukkit.craftbukkit.entity; +import net.minecraft.server.EntityLiving; import net.minecraft.server.EntityTNTPrimed; import org.bukkit.craftbukkit.CraftServer; +import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.TNTPrimed; @@ -50,4 +52,17 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed { return EntityType.PRIMED_TNT; } + public Entity getSource() { + EntityLiving source = getHandle().getSource(); + + if (source != null) { + Entity bukkitEntity = source.getBukkitEntity(); + + if (bukkitEntity.isValid()) { + return bukkitEntity; + } + } + + return null; + } }