How to despawn the egg on the EggThrowEvent

Discussion in 'Plugin Development' started by Deconta, Oct 1, 2022.

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

    Deconta

    Hey, I want to disable throwable eggs on my server, and because I cant cancel the event, I want to despawn the egg.

    I tried
    Code:
    e.getEgg().remove();
    but it didnt work

    and yes its registered and I checked if the Event is even getting called.
     
  2. Offline

    Kars

    Isn't it ProjectileLaunchEvent and not EggThrowEvent?
     
  3. Offline

    Strahan

    There is a PlayerEggThrowEvent, but yea, for this use OP you need to use ProjectileLaunchEvent instead. Do e.getEntity().remove() in that event to kill off the egg. Just be sure to check that Entity is an egg first.
     
Thread Status:
Not open for further replies.

Share This Page