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

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

Thread Status:
Not open for further replies.
  1. that does not support player instances, like im using the EntityDeathEvent right now, but there is no "getPlayer()"
     
  2. Offline

    timtower Administrator Administrator Moderator

  3. Offline

    KarimAKL

    @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.

    https://hastebin.com/ekiqekuxuj.cs

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

    timtower Administrator Administrator Moderator

  6. Offline

    timtower Administrator Administrator Moderator

    No, because it is a method on LivingEntity.
     
  7. Works like a charm! thank you so much!
     
Thread Status:
Not open for further replies.

Share This Page