Is it possible to multiple events in 1 function?

Discussion in 'Plugin Development' started by JavaNaza, Feb 18, 2018.

Thread Status:
Not open for further replies.
  1. Offline

    JavaNaza

    Hey guys, I m trying to multiple events in 1 function, but it gives me error. I wrote my multiple line like this:
    Code:
    public void onExplosion(EntityDamageByBlockEvent eventB, EntityDamageByEntityEvent eventP) {
    //do something
    }
    The error is:
    attempted to register an invalid EventHandler method signature "public void me.grantis.antiexplosion.ExplosiveEnchant.onExplosion(org.bukkit.event.entity.EntityDamageByBlockEvent,org.bukkit.event.entity.EntityDamageByEntityEvent)" in class me.grantis.antiexplosion.ExplosiveEnchant

    Is this even possible to do this?
    If yes can you show me how to?

    Thank you very much !
     
  2. Online

    timtower Administrator Administrator Moderator

    @JavaNaza You can't have multiple types in the same listener.
    It is 1 event for 1 function.
     
  3. Offline

    AdamDev

    @JavaNaza There are also other ways to use 2 events in 1 function such as calling the event when needed in a function.
     
Thread Status:
Not open for further replies.

Share This Page