Implemented getKiller in LivingEntity

This commit is contained in:
Nathan Adams 2011-12-11 16:05:27 +00:00
parent 1fc8092ea6
commit b2af70e5c7
2 changed files with 7 additions and 1 deletions

View file

@ -56,7 +56,7 @@ public abstract class EntityLiving extends Entity {
public float aC; public float aC;
public float aD; public float aD;
public float aE; public float aE;
protected EntityHuman aF = null; public EntityHuman aF = null; // CraftBukkit - prot to pub - "killer"
protected int aG = 0; protected int aG = 0;
public int aH = 0; public int aH = 0;
public int aI = 0; public int aI = 0;

View file

@ -15,6 +15,7 @@ import org.bukkit.block.Block;
import org.bukkit.entity.Arrow; import org.bukkit.entity.Arrow;
import org.bukkit.entity.Egg; import org.bukkit.entity.Egg;
import org.bukkit.entity.LivingEntity; import org.bukkit.entity.LivingEntity;
import org.bukkit.entity.Player;
import org.bukkit.entity.Snowball; import org.bukkit.entity.Snowball;
import org.bukkit.entity.Vehicle; import org.bukkit.entity.Vehicle;
import org.bukkit.util.BlockIterator; import org.bukkit.util.BlockIterator;
@ -24,6 +25,7 @@ import java.util.HashSet;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Iterator; import java.util.Iterator;
import net.minecraft.server.DamageSource; import net.minecraft.server.DamageSource;
import net.minecraft.server.EntityHuman;
import org.bukkit.entity.HumanEntity; import org.bukkit.entity.HumanEntity;
public class CraftLivingEntity extends CraftEntity implements LivingEntity { public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@ -223,4 +225,8 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
public String toString() { public String toString() {
return "CraftLivingEntity{" + "id=" + getEntityId() + '}'; return "CraftLivingEntity{" + "id=" + getEntityId() + '}';
} }
public Player getKiller() {
return getHandle().aF == null ? null : (Player)getHandle().aF.getBukkitEntity();
}
} }