Non entity explosion event

Discussion in 'Plugin Development' started by Quantum64, Jun 20, 2014.

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

    Quantum64

    What event is called when you use world.createExplosion? It can't be EntityExplodeEvent since there is no entity. Thanks!
     
  2. Offline

    ElliottOlson

    Hi Quantum,

    It actually is EntityExplodeEvent!

    To check to see if it is a TNT Block for example you would include the following:

    Code:java
    1. @EventHandler
    2. public void onBoom(EntityExplodeEvent e){
    3. Entity entity = e.getEntity();
    4. if (entity != null){
    5. if ((entity instanceof TNTPrimed)){
    6. //Do what you want here after
    7. }
    8. }
    9. }


    It checks to make sure that entity is a TNT Block that is primed for explosion. And it also checks to make sure it isn't null.

    I hope this helps you finish the plugin you have started! :D
     
  3. Offline

    fireblast709

    Quantum64 EntityExplodeEvent with the entity null iirc
     
Thread Status:
Not open for further replies.

Share This Page