Solved How do i get a player instance into an event that...

Discussion in 'Plugin Development' started by EssentialsPissesMeOff, Nov 10, 2019.

  1. that does not support player instances, like im using the EntityDeathEvent right now, but there is no "getPlayer()"
  2. Online

    timtower Moderator Moderator

  3. Online


    @EssentialsPissesMeOff As timtower already said, there's a PlayerDeathEvent but, if you still want to use the EntityDeathEvent for some reason, you can check if the entity is a player.
  4. The reason im using the EntityDeathEvent is because im doing custom mob drops. and i need the player so i can see if the player has a weapon that holds a certain level of looting enchantment so looting works on the custom drops.

    if would do if e.getentity isinstanceof player but i dont know if i can do that in my situation
  5. Online

    timtower Moderator Moderator

  6. Online

    timtower Moderator Moderator

    No, because it is a method on LivingEntity.
  7. Works like a charm! thank you so much!

Share This Page