Program: 178746
Project: 178746
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,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;
        }
 else         if (b.getType() == Material.TRAP_DOOR && (b.getData() & 4) == 0) {
          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);
      Block b2=targetBlocks.get(targetBlocks.size() - 2);
      BlockFace face=b.getFace(b2);
      if (face == null)       PortalManager.placePortal(b,event.getPlayer(),orange);
 else       PortalManager.placePortal(b,face,event.getPlayer(),orange,true);
    }
 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());
}
 else if (event.getAction() == Action.RIGHT_CLICK_BLOCK && player.getItemInHand().getTypeId() == 0 && event.getClickedBlock().getType() == Material.WOOL) {
Portal portal=PortalManager.borderBlocks.get(event.getClickedBlock().getLocation());
if (portal == null) portal=PortalManager.insideBlocks.get(event.getClickedBlock().getLocation());
if (portal == null && Config.CompactPortal) portal=PortalManager.behindBlocks.get(event.getClickedBlock().getLocation());
if (portal == null) return;
if (portal.getOwner().name != player.getName()) return;
int preset=user.getColorPreset();
if (preset == Config.ColorPresets.size() - 1) preset=0;
 else preset++;
user.setColorPreset(preset);
user.recreatePortals();
String color1=DyeColor.values()[Util.getLeftPortalColor(preset)].toString().replace("String_Node_Str","String_Node_Str");
String color2=DyeColor.values()[Util.getRightPortalColor(preset)].toString().replace("String_Node_Str","String_Node_Str");
Util.sendMessage(player,"String_Node_Str" + color1 + "String_Node_Str"+ color2);
}
}

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;
        }
 else         if (b.getType() == Material.TRAP_DOOR && (b.getData() & 4) == 0) {
          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);
      Block b2=targetBlocks.size() >= 2 ? targetBlocks.get(targetBlocks.size() - 2) : null;
      if (targetBlocks.size() < 2 || b.getFace(b2) == null)       PortalManager.placePortal(b,event.getPlayer(),orange);
 else       PortalManager.placePortal(b,b.getFace(b2),event.getPlayer(),orange,true);
    }
 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());
}
 else if (event.getAction() == Action.RIGHT_CLICK_BLOCK && player.getItemInHand().getTypeId() == 0 && event.getClickedBlock().getType() == Material.WOOL) {
Portal portal=PortalManager.borderBlocks.get(event.getClickedBlock().getLocation());
if (portal == null) portal=PortalManager.insideBlocks.get(event.getClickedBlock().getLocation());
if (portal == null && Config.CompactPortal) portal=PortalManager.behindBlocks.get(event.getClickedBlock().getLocation());
if (portal == null) return;
if (portal.getOwner().name != player.getName()) return;
int preset=user.getColorPreset();
if (preset == Config.ColorPresets.size() - 1) preset=0;
 else preset++;
user.setColorPreset(preset);
user.recreatePortals();
String color1=DyeColor.values()[Util.getLeftPortalColor(preset)].toString().replace("String_Node_Str","String_Node_Str");
String color2=DyeColor.values()[Util.getRightPortalColor(preset)].toString().replace("String_Node_Str","String_Node_Str");
Util.sendMessage(player,"String_Node_Str" + color1 + "String_Node_Str"+ color2);
}
}