Block TNT ignition by explosion

Discussion in 'Spigot Plugin Development' started by Lammendam, May 2, 2017.

  1. Hi,

    is there any way to re-write blockList() in EntityExplodeEvent ?

    I'm trying to write a small fix for TNT for my server and want allow players to explode TNT with block destruction but without TNT explosion if additional blocks of TNT will be placed around.

    I have some experience in plugin development... but.. very small :(
    WG's feature (event.blockList().clear()) is not applicable... but maybe it still can be useful in my situation ?
     
  2. Sure thing, you can get the blockList from the event

    e.getBlockList().add(someBlock)

    Or you can loop through them and remove specific ones
    Set<Block> removed = new HashSet<Block>();

    for(Block b:e.getBlockList())
    If(b.getType == Material.SAND)
    removed.add(b);

    e.getBlockList().removeAll(removed);


    Sent from my iPhone using Tapatalk
     
  3. Thnx very much, i'll try this :)

    UPD:
    Thanx u for your help, it really works! ;)
     
    #3 Lammendam, May 2, 2017
    Last edited: May 2, 2017