mirror of
https://github.com/PaperMC/Paper.git
synced 2025-09-02 05:13:51 -07:00
Add method to get the source of a TNTPrimed. Adds BUKKIT-3815
This commit is contained in:
committed by
Nate Mortensen
parent
816a7f1559
commit
2c5b2a8f6f
@@ -1,8 +1,10 @@
|
|||||||
package org.bukkit.craftbukkit.entity;
|
package org.bukkit.craftbukkit.entity;
|
||||||
|
|
||||||
|
import net.minecraft.server.EntityLiving;
|
||||||
import net.minecraft.server.EntityTNTPrimed;
|
import net.minecraft.server.EntityTNTPrimed;
|
||||||
|
|
||||||
import org.bukkit.craftbukkit.CraftServer;
|
import org.bukkit.craftbukkit.CraftServer;
|
||||||
|
import org.bukkit.entity.Entity;
|
||||||
import org.bukkit.entity.EntityType;
|
import org.bukkit.entity.EntityType;
|
||||||
import org.bukkit.entity.TNTPrimed;
|
import org.bukkit.entity.TNTPrimed;
|
||||||
|
|
||||||
@@ -50,4 +52,17 @@ public class CraftTNTPrimed extends CraftEntity implements TNTPrimed {
|
|||||||
return EntityType.PRIMED_TNT;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user