What event for what action?

Hello guys,

I’m having a hard time trying to set up my listeners. I don’t really get what event I should listen for a given action in the game. I don’t like to have to ask it like that since I think it’s a bit rude, but would you know what event I should listen to for these “in-game actions” :

  • PvP
  • Fire spreading
  • Mob looting

Also I tried to listen to ExplosionEvent.Pre but I got a warn that says (in short) The method public static void onExplosion(...) on ... has Listener but has the wrong signature
I saw this post but that doesn’t seem to be the solution I am looking for is it ?

I believe it should be just public void onExplosion(...)

1 Like

Agreed, it musn’t be static

  • PVP
    Use the DamageEntityEvent. You can get the damaged entity with DamageEntityEvent#getTargetEntity().
    The source is found by putting onPVP(DamageEntityEvent event, @First EntityDamageSource source) (or using the Cause) and then checking if the entity is a player.

  • Fire spread
    See here: Listening to Fire

  • Mob Looting: HarvestEntityEvent

1 Like

Actually it looks like HarvestEntityEvent doesn’t have any methods to get the items dropped, um

Probably have to use Causes in ConstructEntityEvent to get the items dropped maybe?

Oh yeah, I don’t know why I set it static, thanks !

So do you think there is a way to modify the items dropped by a mob when it dies ?

You may need to wait for DropData and DropTables to be implemented for that.

1 Like

Ok thanks. I’ll wait then :wink: