ExplosionPrimeEvent bug/issue

Discussion in 'Plugin Development' started by bennie3211, Sep 5, 2022.

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

    bennie3211

    Hi all,

    I'm trying to prevent entities like creepers (not sure if any other mob is also triggering this?) to blow themself up in a certain game state (lobby). I'm using the ExplosionPrimeEvent for this and found something strange during testing.

    When I prima a creeper with a flint and steel and canceling the ExplosionPrimeEvent the creeper stays in its 'blowing up state' where the model stretches and keeps repeating the detonate sound but nothing else happens. It won't get out of this state until I stop canceling the event. Another testing that I did was testing if this happens when the creeper targets a player, but there it just stops and get back into targeting the player again.

    Is this normal behavior or is this a bug? The code I'm using is

    Code:
    @EventHandler
    public void onPrime(ExplosionPrimeEvent e) {
        if (getPlugin().getGameManager().gameInProcess()) {
            return;
        }
        e.setCancelled(true);
    }
    
     
  2. Offline

    Kars

    It's normal creeper behavior to try to blow you up.
    You cancelling the event stops the explosion but not the creeper from trying. That's probably why the loop happens.
    Yes it's normal behavior.
     
    bennie3211 likes this.
Thread Status:
Not open for further replies.

Share This Page