Program: 178766
Project: 178766
Buggy source:
public void onPlayerInteract(PlayerInteractEvent event){
  Player player=event.getPlayer();
  User user=UserManager.getUser(player);
  if (player.getItemInHand().getTypeId() == Config.PortalTool && (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)) {
    Region region=RegionManager.getRegion(player.getLocation());
    HashSet<Byte> tb=new HashSet<Byte>();
    for (    int i : region.getList(RegionSetting.TRANSPARENT_BLOCKS).toArray(new Integer[0]))     tb.add((byte)i);
    if (region.getBoolean(RegionSetting.CHECK_WORLDGUARD) && PortalStick.worldGuard != null && !PortalStick.worldGuard.canBuild(player,player.getLocation().getBlock()))     return;
    if (!region.getBoolean(RegionSetting.ENABLE_PORTALS))     return;
    if (!Permission.placePortal(player))     return;
    List<Block> targetBlocks=event.getPlayer().getLineOfSight(tb,20);
    if (targetBlocks.size() < 1)     return;
    if (Config.DisabledWorlds.contains(event.getPlayer().getLocation().getWorld().getName())) {
      player.sendMessage(Config.MessageRestrictedWorld);
      return;
    }
    if (!region.getBoolean(RegionSetting.ENABLE_PORTALS))     return;
    if (region.getBoolean(RegionSetting.PREVENT_PORTAL_THROUGH_PORTAL)) {
      for (      Block b : targetBlocks) {
        for (        Portal p : PortalManager.portals) {
          if (p.getInside().contains(b)) {
            Util.sendMessage(player,Config.MessageCannotPlacePortal);
            return;
          }
        }
      }
    }
    if (region.getBoolean(RegionSetting.PREVENT_PORTAL_CLOSED_DOOR)) {
      for (      Block b : targetBlocks) {
        if ((b.getType() == Material.IRON_DOOR_BLOCK || b.getType() == Material.WOODEN_DOOR) && ((b.getData() & 4) != 4)) {
          Util.sendMessage(player,Config.MessageCannotPlacePortal);
          return;
        }
      }
    }
    Boolean orange=false;
    if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)     orange=true;
    if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_AIR || tb.contains((byte)event.getClickedBlock().getTypeId())) {
      Block b=targetBlocks.get(targetBlocks.size() - 1);
      PortalManager.placePortal(b,event.getPlayer(),orange);
    }
 else {
      PortalManager.placePortal(event.getClickedBlock(),event.getBlockFace(),event.getPlayer(),orange,true);
    }
  }
 else   if (user.getUsingTool() && player.getItemInHand().getTypeId() == Config.RegionTool) {
switch (event.getAction()) {
case RIGHT_CLICK_BLOCK:
      user.setPointTwo(event.getClickedBlock().getLocation());
    Util.sendMessage(player,"String_Node_Str");
  break;
case LEFT_CLICK_BLOCK:
user.setPointOne(event.getClickedBlock().getLocation());
Util.sendMessage(player,"String_Node_Str");
break;
}
}
 else if (event.getAction() == Action.RIGHT_CLICK_BLOCK && player.getItemInHand().getType() == Material.FLINT_AND_STEEL) {
GrillManager.createGrill(player,event.getClickedBlock());
}
}

Fixed version (ground truth):
public void onPlayerInteract(PlayerInteractEvent event){
  Player player=event.getPlayer();
  User user=UserManager.getUser(player);
  if (player.getItemInHand().getTypeId() == Config.PortalTool && (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)) {
    Region region=RegionManager.getRegion(player.getLocation());
    HashSet<Byte> tb=new HashSet<Byte>();
    for (    int i : region.getList(RegionSetting.TRANSPARENT_BLOCKS).toArray(new Integer[0]))     tb.add((byte)i);
    if (region.getBoolean(RegionSetting.CHECK_WORLDGUARD) && PortalStick.worldGuard != null && !PortalStick.worldGuard.canBuild(player,player.getLocation().getBlock()))     return;
    if (!region.getBoolean(RegionSetting.ENABLE_PORTALS))     return;
    if (!Permission.placePortal(player))     return;
    List<Block> targetBlocks=event.getPlayer().getLineOfSight(tb,120);
    if (targetBlocks.size() < 1)     return;
    if (Config.DisabledWorlds.contains(event.getPlayer().getLocation().getWorld().getName())) {
      player.sendMessage(Config.MessageRestrictedWorld);
      return;
    }
    if (!region.getBoolean(RegionSetting.ENABLE_PORTALS))     return;
    if (region.getBoolean(RegionSetting.PREVENT_PORTAL_THROUGH_PORTAL)) {
      for (      Block b : targetBlocks) {
        for (        Portal p : PortalManager.portals) {
          if (p.getInside().contains(b)) {
            Util.sendMessage(player,Config.MessageCannotPlacePortal);
            return;
          }
        }
      }
    }
    if (region.getBoolean(RegionSetting.PREVENT_PORTAL_CLOSED_DOOR)) {
      for (      Block b : targetBlocks) {
        if ((b.getType() == Material.IRON_DOOR_BLOCK || b.getType() == Material.WOODEN_DOOR) && ((b.getData() & 4) != 4)) {
          Util.sendMessage(player,Config.MessageCannotPlacePortal);
          return;
        }
      }
    }
    Boolean orange=false;
    if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.RIGHT_CLICK_BLOCK)     orange=true;
    if (event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_AIR || tb.contains((byte)event.getClickedBlock().getTypeId())) {
      Block b=targetBlocks.get(targetBlocks.size() - 1);
      PortalManager.placePortal(b,event.getPlayer(),orange);
    }
 else {
      PortalManager.placePortal(event.getClickedBlock(),event.getBlockFace(),event.getPlayer(),orange,true);
    }
  }
 else   if (user.getUsingTool() && player.getItemInHand().getTypeId() == Config.RegionTool) {
switch (event.getAction()) {
case RIGHT_CLICK_BLOCK:
      user.setPointTwo(event.getClickedBlock().getLocation());
    Util.sendMessage(player,"String_Node_Str");
  break;
case LEFT_CLICK_BLOCK:
user.setPointOne(event.getClickedBlock().getLocation());
Util.sendMessage(player,"String_Node_Str");
break;
}
}
 else if (event.getAction() == Action.RIGHT_CLICK_BLOCK && player.getItemInHand().getType() == Material.FLINT_AND_STEEL) {
GrillManager.createGrill(player,event.getClickedBlock());
}
}