Program: 178802
Project: 178802
Buggy source:
public void onPlayerInteract(PlayerInteractEvent event){
  if (event.isCancelled())   return;
  Player player=event.getPlayer();
  User user=PortalStick.players.get(player.getName());
  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 (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)) {
    if (!Config.EnabledWorlds.contains(event.getPlayer().getLocation().getWorld().getName())) {
      player.sendMessage(Config.MessageRestrictedWorld);
      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())) {
      List<Block> targetBlocks=event.getPlayer().getLastTwoTargetBlocks(tb,120);
      if (targetBlocks.size() != 2)       return;
      Block b=targetBlocks.get(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;
}
}
}

Fixed version (ground truth):
public void onPlayerInteract(PlayerInteractEvent event){
  if (event.isCancelled())   return;
  Player player=event.getPlayer();
  User user=PortalStick.players.get(player.getName());
  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 (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)) {
    if (Config.DisabledWorlds.contains(event.getPlayer().getLocation().getWorld().getName())) {
      player.sendMessage(Config.MessageRestrictedWorld);
      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())) {
      List<Block> targetBlocks=event.getPlayer().getLastTwoTargetBlocks(tb,120);
      if (targetBlocks.size() != 2)       return;
      Block b=targetBlocks.get(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;
}
}
}