Minecraft PlayerDeathEvent Item Name?

Pe
3

Can I print the name of the item I killed someone with?

Ma

So if somebody would kill you, and you want the item name from that, do it:

(Event.getEntity () getKiller () GetInventory () getItemInMainHand () getItemMeta) getDisplayName ()… ;

Note, however, that items that have no set name will always return zero for the function.

Pe

And how is it with mobs? Is that okay? :

else if (! (p.getKiller () instanceof Player)) {
e.setDeathMessage ("§e" + p.getName () + "§b was killed by §e" + e.getEntity (). GetKiller (). GetType (). ToString (). ToUpperCase () + "§b. ");
}

Ma

Should go like this