#Player gets killed event
1 messages · Page 1 of 1 (latest)
PlayerDeathEvent and check getEntity().getKiller() is not null
LivingEntity object has getKiller method so you can use that
@lost lagoon
if (event.getEntity().getKiller() == null) return;
How do I make so that player heads are named and look like the person who died?
wdym
you want to drop head at victim?
yea
ItemStack playerHead;
try {
playerHead = new ItemStack(Material.getMaterial("PLAYER_HEAD"), 1);
} catch (IllegalArgumentException | NullPointerException exception) {
playerHead = new ItemStack(Material.getMaterial("SKULL_ITEM"), 1, (short) 3);
}
SkullMeta meta = (SkullMeta) playerHead.getItemMeta();
meta.setOwner(player.getName());
playerHead.setItemMeta(meta);
event.getDrops().add(playerHead);