Solved Explosions

Discussion in 'Plugin Development' started by SeniorCluckers, Apr 9, 2017.

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

    SeniorCluckers

    After lots of testing and looking I just cant seem how to make an explosion only destroy blocks placed by a player.

    I have created a block array-list where I add blocks that players have placed and this is because I only want blocks that a player has placed to be destroyed by any explosion, but when I add the blocks to EntityExplodeEvent using event.blocklist(); it removes all the blocks not just from the explosion but from others locations far from it because they're obviously in the list. This is just one of the many things that I tried that actually did what I wanted just not right of course.

    Code:
        @EventHandler
        public void onEntityExplode(EntityExplodeEvent event) {
            event.blockList().clear();
            event.blockList().add(blocks);
    
        }
    So, I am not sure if I am supposed to be using the ExplosionPrimeEvent for what I am trying to accomplish. Any suggestions?
     
  2. Offline

    martian3333

    @SeniorCluckers
    Seems like you'll need to create a new block list that only contains the blocks that are in both the event block list and your player block list.
     
  3. Offline

    SeniorCluckers

Thread Status:
Not open for further replies.

Share This Page