Program: 178727
Project: 178727
Buggy source:
@EventHandler(ignoreCancelled=true) public void onPlayerInteract(PlayerInteractEvent event){
  Player player=event.getPlayer();
  User user=plugin.userManager.getUser(player);
  if (player.getItemInHand().getTypeId() == plugin.config.PortalTool && player.getItemInHand().getDurability() == plugin.config.portalToolData && (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)) {
    event.setCancelled(true);
    Region region=plugin.regionManager.getRegion(new V10Location(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) && plugin.worldGuard != null && !plugin.worldGuard.canBuild(player,player.getLocation().getBlock()))     return;
    if (!region.getBoolean(RegionSetting.ENABLE_PORTALS) || !plugin.hasPermission(player,plugin.PERM_PLACE_PORTAL))     return;
    List<Block> targetBlocks=event.getPlayer().getLineOfSight(tb,120);
    if (targetBlocks.size() < 1 || plugin.config.DisabledWorlds.contains(event.getPlayer().getLocation().getWorld().getName()) || !region.getBoolean(RegionSetting.ENABLE_PORTALS))     return;
    if (region.getBoolean(RegionSetting.PREVENT_PORTAL_THROUGH_PORTAL)) {
      for (      Block b : targetBlocks) {
        for (        Portal p : plugin.portalManager.portals) {
          if (p.inside.contains(b)) {
            plugin.util.sendMessage(player,plugin.config.MessageCannotPlacePortal);
            plugin.util.PlaySound(Sound.PORTAL_CANNOT_CREATE,player,new V10Location(b.getLocation()));
            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)) {
          plugin.util.sendMessage(player,plugin.config.MessageCannotPlacePortal);
          plugin.util.PlaySound(Sound.PORTAL_CANNOT_CREATE,player,new V10Location(b.getLocation()));
          return;
        }
 else         if (b.getType() == Material.TRAP_DOOR && (b.getData() & 4) == 0) {
          plugin.util.sendMessage(player,plugin.config.MessageCannotPlacePortal);
          plugin.util.PlaySound(Sound.PORTAL_CANNOT_CREATE,player,new V10Location(b.getLocation()));
          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);
      V10Location loc=new V10Location(b);
      if (targetBlocks.size() < 2)       plugin.portalManager.placePortal(loc,event.getPlayer(),orange);
 else       plugin.portalManager.placePortal(loc,b.getFace(targetBlocks.get(targetBlocks.size() - 2)),event.getPlayer(),orange,true);
    }
 else     plugin.portalManager.placePortal(new V10Location(event.getClickedBlock()),event.getBlockFace(),event.getPlayer(),orange,true);
  }
 else   if (user.usingTool && player.getItemInHand().getTypeId() == plugin.config.RegionTool) {
switch (event.getAction()) {
case RIGHT_CLICK_BLOCK:
      user.pointTwo=new V10Location(event.getClickedBlock());
    break;
case LEFT_CLICK_BLOCK:
  user.pointOne=new V10Location(event.getClickedBlock());
plugin.util.sendMessage(player,"String_Node_Str");
break;
}
}
 else if (event.getAction() == Action.RIGHT_CLICK_BLOCK && player.getItemInHand().getType() == Material.FLINT_AND_STEEL) {
{
V10Location loc=new V10Location(event.getClickedBlock());
if (plugin.grillManager.createGrill(player,loc) || plugin.funnelBridgeManager.placeGlassBridge(player,loc)) event.setCancelled(true);
}
}
 else if (event.getAction() == Action.RIGHT_CLICK_BLOCK && player.getItemInHand().getTypeId() == 0 && event.getClickedBlock().getType() == Material.WOOL) {
Portal portal=plugin.portalManager.borderBlocks.get(event.getClickedBlock().getLocation());
if (portal == null) portal=plugin.portalManager.insideBlocks.get(event.getClickedBlock().getLocation());
if (portal == null && plugin.config.CompactPortal) portal=plugin.portalManager.behindBlocks.get(event.getClickedBlock().getLocation());
if (portal == null) return;
if (portal.owner.name != player.getName()) return;
int preset=user.colorPreset;
if (preset == plugin.config.ColorPresets.size() - 1) preset=0;
 else preset++;
user.colorPreset=preset;
user.recreatePortals();
String color1=DyeColor.values()[plugin.util.getLeftPortalColor(preset)].toString().replace("String_Node_Str","String_Node_Str");
String color2=DyeColor.values()[plugin.util.getRightPortalColor(preset)].toString().replace("String_Node_Str","String_Node_Str");
plugin.util.sendMessage(player,"String_Node_Str" + color1 + "String_Node_Str"+ color2);
}
}

Fixed version (ground truth):
@EventHandler(ignoreCancelled=false) public void onPlayerInteract(PlayerInteractEvent event){
  Player player=event.getPlayer();
  User user=plugin.userManager.getUser(player);
  if (player.getItemInHand().getTypeId() == plugin.config.PortalTool && player.getItemInHand().getDurability() == plugin.config.portalToolData && (event.getAction() == Action.RIGHT_CLICK_BLOCK || event.getAction() == Action.RIGHT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_AIR || event.getAction() == Action.LEFT_CLICK_BLOCK)) {
    event.setCancelled(true);
    Region region=plugin.regionManager.getRegion(new V10Location(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) && plugin.worldGuard != null && !plugin.worldGuard.canBuild(player,player.getLocation().getBlock()))     return;
    if (!region.getBoolean(RegionSetting.ENABLE_PORTALS) || !plugin.hasPermission(player,plugin.PERM_PLACE_PORTAL))     return;
    List<Block> targetBlocks=event.getPlayer().getLineOfSight(tb,120);
    if (targetBlocks.size() < 1 || plugin.config.DisabledWorlds.contains(event.getPlayer().getLocation().getWorld().getName()) || !region.getBoolean(RegionSetting.ENABLE_PORTALS))     return;
    if (region.getBoolean(RegionSetting.PREVENT_PORTAL_THROUGH_PORTAL)) {
      for (      Block b : targetBlocks) {
        for (        Portal p : plugin.portalManager.portals) {
          if (p.inside.contains(b)) {
            plugin.util.sendMessage(player,plugin.config.MessageCannotPlacePortal);
            plugin.util.PlaySound(Sound.PORTAL_CANNOT_CREATE,player,new V10Location(b.getLocation()));
            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)) {
          plugin.util.sendMessage(player,plugin.config.MessageCannotPlacePortal);
          plugin.util.PlaySound(Sound.PORTAL_CANNOT_CREATE,player,new V10Location(b.getLocation()));
          return;
        }
 else         if (b.getType() == Material.TRAP_DOOR && (b.getData() & 4) == 0) {
          plugin.util.sendMessage(player,plugin.config.MessageCannotPlacePortal);
          plugin.util.PlaySound(Sound.PORTAL_CANNOT_CREATE,player,new V10Location(b.getLocation()));
          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);
      V10Location loc=new V10Location(b);
      if (targetBlocks.size() < 2)       plugin.portalManager.placePortal(loc,event.getPlayer(),orange);
 else       plugin.portalManager.placePortal(loc,b.getFace(targetBlocks.get(targetBlocks.size() - 2)),event.getPlayer(),orange,true);
    }
 else     plugin.portalManager.placePortal(new V10Location(event.getClickedBlock()),event.getBlockFace(),event.getPlayer(),orange,true);
  }
 else   if (user.usingTool && player.getItemInHand().getTypeId() == plugin.config.RegionTool) {
switch (event.getAction()) {
case RIGHT_CLICK_BLOCK:
      user.pointTwo=new V10Location(event.getClickedBlock());
    break;
case LEFT_CLICK_BLOCK:
  user.pointOne=new V10Location(event.getClickedBlock());
plugin.util.sendMessage(player,"String_Node_Str");
break;
}
}
 else if (event.getAction() == Action.RIGHT_CLICK_BLOCK && player.getItemInHand().getType() == Material.FLINT_AND_STEEL) {
{
V10Location loc=new V10Location(event.getClickedBlock());
if (plugin.grillManager.createGrill(player,loc) || plugin.funnelBridgeManager.placeGlassBridge(player,loc)) event.setCancelled(true);
}
}
 else if (event.getAction() == Action.RIGHT_CLICK_BLOCK && player.getItemInHand().getTypeId() == 0 && event.getClickedBlock().getType() == Material.WOOL) {
Portal portal=plugin.portalManager.borderBlocks.get(event.getClickedBlock().getLocation());
if (portal == null) portal=plugin.portalManager.insideBlocks.get(event.getClickedBlock().getLocation());
if (portal == null && plugin.config.CompactPortal) portal=plugin.portalManager.behindBlocks.get(event.getClickedBlock().getLocation());
if (portal == null) return;
if (portal.owner.name != player.getName()) return;
int preset=user.colorPreset;
if (preset == plugin.config.ColorPresets.size() - 1) preset=0;
 else preset++;
user.colorPreset=preset;
user.recreatePortals();
String color1=DyeColor.values()[plugin.util.getLeftPortalColor(preset)].toString().replace("String_Node_Str","String_Node_Str");
String color2=DyeColor.values()[plugin.util.getRightPortalColor(preset)].toString().replace("String_Node_Str","String_Node_Str");
plugin.util.sendMessage(player,"String_Node_Str" + color1 + "String_Node_Str"+ color2);
}
}