Stop IronDoors from exploding

Discussion in 'Spigot Plugin Development' started by CookieFreak, Apr 29, 2017.

  1. In this plugin IronDoors should not explode if they're built on Obsidian.
    https://pastebin.com/jKKg6U0T
    Why does the IronDoor still explode?
     
  2. You forgot to replace the door in your loop.
     
  3. I don't think so, where?
     
  4. Code (Text):


    if (b.getType() == Material.IRON_DOOR) {
         if(blo.getType() == Material.OBSIDIAN) {

       it.remove();
        }

     
    There is no code placing an iron door after it is destoryed. Remember editing the list won't do anything. You must place a new iron door at the location it exploded at.
     
  5. You do not need to replace the door. Let me tell you a simple way to perform what you are doing.
    Loop through all the destroyed blocks. Check if it contains a 1 block part of a iron door, if yes, check if there is a obsidian below it. If yes, remove the iron door from both y levels since a iron door has 2 parts from the blocklist not the iterator.
     
  6. #6 CookieFreak, May 1, 2017
    Last edited: May 1, 2017
  7. As i said, iron doors are in 2 parts. Try after removing the top portion, remove block below the block b from the list too.