Program: 79922
Project: 79922
Buggy source:
@SuppressWarnings("String_Node_Str") public static void openMainMenu(final Player p,final boolean survival,final boolean book,final int selected_page){
  clearHistory(p.getUniqueId());
  if (book) {
    List<TellRawMessage> pages=new ArrayList<TellRawMessage>();
    List<String> texts=new ArrayList<String>();
    List<String> tooltips=new ArrayList<String>();
    List<PlayerRunnable> actions=new ArrayList<PlayerRunnable>();
    int tier=0;
    for (    final Category category : Category.list()) {
      boolean locked=true;
      for (      SlimefunItem item : category.getItems()) {
        if (Slimefun.isEnabled(p,item,false)) {
          locked=false;
          break;
        }
      }
      if (locked) {
      }
 else {
        if (tier < category.getTier()) {
          if (survival) {
            for (            final GuideHandler handler : Slimefun.getGuideHandlers(tier)) {
              handler.addEntry(texts,tooltips);
              actions.add(new PlayerRunnable(2){
                @Override public void run(                Player p){
                  handler.run(p,survival,book);
                }
              }
);
            }
          }
          tier=category.getTier();
          if (tier > 1) {
            for (int i=0; i < 10; i++) {
              if (texts.size() % 10 == 0)               break;
              texts.add("String_Node_Str");
              tooltips.add(null);
              actions.add(null);
            }
          }
          texts.add("String_Node_Str" + tier);
          tooltips.add(null);
          actions.add(null);
        }
        if (category instanceof LockedCategory && !((LockedCategory)category).hasUnlocked(p)) {
          StringBuilder parents=new StringBuilder("String_Node_Str");
          for (          Category parent : ((LockedCategory)category).getParents()) {
            parents.append("String_Node_Str" + StringUtils.formatItemName(parent.getItem(),false));
          }
          texts.add(shorten("String_Node_Str",StringUtils.formatItemName(category.getItem(),false)));
          tooltips.add(parents.toString());
          actions.add(null);
        }
 else         if (category instanceof SeasonCategory) {
          if (((SeasonCategory)category).isUnlocked()) {
            texts.add(shorten("String_Node_Str",StringUtils.formatItemName(category.getItem(),false)));
            tooltips.add("String_Node_Str" + StringUtils.formatItemName(category.getItem(),false));
            actions.add(new PlayerRunnable(1){
              @Override public void run(              final Player p){
                Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance,new Runnable(){
                  @Override public void run(){
                    openCategory(p,category,survival,1,book);
                  }
                }
,1L);
              }
            }
);
          }
        }
 else {
          texts.add(shorten("String_Node_Str",StringUtils.formatItemName(category.getItem(),false)));
          tooltips.add("String_Node_Str" + StringUtils.formatItemName(category.getItem(),false));
          actions.add(new PlayerRunnable(1){
            @Override public void run(            final Player p){
              Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance,new Runnable(){
                @Override public void run(){
                  openCategory(p,category,survival,1,book);
                }
              }
,1L);
            }
          }
);
        }
      }
    }
    if (survival) {
      for (      final GuideHandler handler : Slimefun.getGuideHandlers(tier)) {
        handler.addEntry(texts,tooltips);
        actions.add(new PlayerRunnable(2){
          @Override public void run(          Player p){
            handler.run(p,survival,book);
          }
        }
);
      }
    }
    for (int i=0; i < texts.size(); i=i + 10) {
      TellRawMessage page=new TellRawMessage();
      page.addText("String_Node_Str");
      for (int j=i; j < texts.size() && j < i + 10; j++) {
        page.addText(texts.get(j) + "String_Node_Str");
        if (tooltips.get(j) != null)         page.addHoverEvent(HoverAction.SHOW_TEXT,tooltips.get(j));
        if (actions.get(j) != null)         page.addClickEvent(actions.get(j));
      }
      pages.add(page);
    }
    new CustomBookOverlay("String_Node_Str","String_Node_Str",pages.toArray(new TellRawMessage[pages.size()])).open(p);
  }
 else {
    final ChestMenu menu=new ChestMenu("String_Node_Str");
    menu.addMenuOpeningHandler(new MenuOpeningHandler(){
      @Override public void onOpen(      Player p){
        p.playSound(p.getLocation(),Sound.ENTITY_BAT_TAKEOFF,0.7F,0.7F);
      }
    }
);
    List<Category> categories=Slimefun.current_categories;
    List<GuideHandler> handlers=Slimefun.guide_handlers2;
    int index=9;
    int pages=1;
    for (int i=0; i < 9; i++) {
      menu.addItem(i,new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE,(byte)7),"String_Node_Str"));
      menu.addMenuClickHandler(i,new MenuClickHandler(){
        @Override public boolean onClick(        Player arg0,        int arg1,        ItemStack arg2,        ClickAction arg3){
          return false;
        }
      }
);
    }
    for (int i=45; i < 54; i++) {
      menu.addItem(i,new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE,(byte)7),"String_Node_Str"));
      menu.addMenuClickHandler(i,new MenuClickHandler(){
        @Override public boolean onClick(        Player arg0,        int arg1,        ItemStack arg2,        ClickAction arg3){
          return false;
        }
      }
);
    }
    int target=(category_size * (selected_page - 1)) - 1;
    while (target < (categories.size() + handlers.size() - 1)) {
      if (index >= category_size + 9) {
        pages++;
        break;
      }
      target++;
      if (target >= categories.size()) {
        if (!survival)         break;
        index=handlers.get(target - categories.size()).next(p,index,menu);
      }
 else {
        final Category category=categories.get(target);
        boolean locked=true;
        for (        SlimefunItem item : category.getItems()) {
          if (Slimefun.isEnabled(p,item,false)) {
            locked=false;
            break;
          }
        }
        if (locked) {
        }
 else         if (!(category instanceof LockedCategory)) {
          if (!(category instanceof SeasonCategory)) {
            menu.addItem(index,category.getItem());
            menu.addMenuClickHandler(index,new MenuClickHandler(){
              @Override public boolean onClick(              Player p,              int slot,              ItemStack item,              ClickAction action){
                openCategory(p,category,survival,1,book);
                return false;
              }
            }
);
            index++;
          }
 else {
            if (((SeasonCategory)category).isUnlocked()) {
              menu.addItem(index,category.getItem());
              menu.addMenuClickHandler(index,new MenuClickHandler(){
                @Override public boolean onClick(                Player p,                int slot,                ItemStack item,                ClickAction action){
                  openCategory(p,category,survival,1,book);
                  return false;
                }
              }
);
              index++;
            }
          }
        }
 else         if (((LockedCategory)category).hasUnlocked(p)) {
          menu.addItem(index,category.getItem());
          menu.addMenuClickHandler(index,new MenuClickHandler(){
            @Override public boolean onClick(            Player p,            int slot,            ItemStack item,            ClickAction action){
              openCategory(p,category,survival,1,book);
              return false;
            }
          }
);
          index++;
        }
 else {
          List<String> parents=new ArrayList<String>();
          parents.add("String_Node_Str");
          parents.add("String_Node_Str");
          parents.add("String_Node_Str");
          parents.add("String_Node_Str");
          for (          Category parent : ((LockedCategory)category).getParents()) {
            parents.add(parent.getItem().getItemMeta().getDisplayName());
          }
          menu.addItem(index,new CustomItem(Material.BARRIER,"String_Node_Str" + category.getItem().getItemMeta().getDisplayName(),0,parents.toArray(new String[parents.size()])));
          menu.addMenuClickHandler(index,new MenuClickHandler(){
            @Override public boolean onClick(            Player arg0,            int arg1,            ItemStack arg2,            ClickAction arg3){
              return false;
            }
          }
);
          index++;
        }
      }
    }
    final int finalPages=pages;
    menu.addItem(46,new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE,(byte)5),"String_Node_Str","String_Node_Str","String_Node_Str" + selected_page + "String_Node_Str"+ pages+ "String_Node_Str"));
    menu.addMenuClickHandler(46,new MenuClickHandler(){
      @Override public boolean onClick(      Player arg0,      int arg1,      ItemStack arg2,      ClickAction arg3){
        int next=selected_page - 1;
        if (next < 1)         next=finalPages;
        if (next != selected_page)         openMainMenu(p,survival,book,next);
        return false;
      }
    }
);
    menu.addItem(52,new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE,(byte)5),"String_Node_Str","String_Node_Str","String_Node_Str" + selected_page + "String_Node_Str"+ pages+ "String_Node_Str"));
    menu.addMenuClickHandler(52,new MenuClickHandler(){
      @Override public boolean onClick(      Player arg0,      int arg1,      ItemStack arg2,      ClickAction arg3){
        int next=selected_page + 1;
        if (next > finalPages)         next=1;
        if (next != selected_page)         openMainMenu(p,survival,book,next);
        return false;
      }
    }
);
    menu.open(p);
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static void openMainMenu(final Player p,final boolean survival,final boolean book,final int selected_page){
  clearHistory(p.getUniqueId());
  if (book) {
    List<TellRawMessage> pages=new ArrayList<TellRawMessage>();
    List<String> texts=new ArrayList<String>();
    List<String> tooltips=new ArrayList<String>();
    List<PlayerRunnable> actions=new ArrayList<PlayerRunnable>();
    int tier=0;
    for (    final Category category : Category.list()) {
      boolean locked=true;
      for (      SlimefunItem item : category.getItems()) {
        if (Slimefun.isEnabled(p,item,false)) {
          locked=false;
          break;
        }
      }
      if (locked) {
      }
 else {
        if (tier < category.getTier()) {
          if (survival) {
            for (            final GuideHandler handler : Slimefun.getGuideHandlers(tier)) {
              handler.addEntry(texts,tooltips);
              actions.add(new PlayerRunnable(2){
                @Override public void run(                Player p){
                  handler.run(p,survival,book);
                }
              }
);
            }
          }
          tier=category.getTier();
          if (tier > 1) {
            for (int i=0; i < 10; i++) {
              if (texts.size() % 10 == 0)               break;
              texts.add("String_Node_Str");
              tooltips.add(null);
              actions.add(null);
            }
          }
          texts.add("String_Node_Str" + tier);
          tooltips.add(null);
          actions.add(null);
        }
        if (category instanceof LockedCategory && !((LockedCategory)category).hasUnlocked(p)) {
          StringBuilder parents=new StringBuilder("String_Node_Str");
          for (          Category parent : ((LockedCategory)category).getParents()) {
            parents.append("String_Node_Str" + StringUtils.formatItemName(parent.getItem(),false));
          }
          texts.add(shorten("String_Node_Str",StringUtils.formatItemName(category.getItem(),false)));
          tooltips.add(parents.toString());
          actions.add(null);
        }
 else         if (category instanceof SeasonCategory) {
          if (((SeasonCategory)category).isUnlocked()) {
            texts.add(shorten("String_Node_Str",StringUtils.formatItemName(category.getItem(),false)));
            tooltips.add("String_Node_Str" + StringUtils.formatItemName(category.getItem(),false));
            actions.add(new PlayerRunnable(1){
              @Override public void run(              final Player p){
                Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance,new Runnable(){
                  @Override public void run(){
                    openCategory(p,category,survival,1,book);
                  }
                }
,1L);
              }
            }
);
          }
        }
 else {
          texts.add(shorten("String_Node_Str",StringUtils.formatItemName(category.getItem(),false)));
          tooltips.add("String_Node_Str" + StringUtils.formatItemName(category.getItem(),false));
          actions.add(new PlayerRunnable(1){
            @Override public void run(            final Player p){
              Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance,new Runnable(){
                @Override public void run(){
                  openCategory(p,category,survival,1,book);
                }
              }
,1L);
            }
          }
);
        }
      }
    }
    if (survival) {
      for (      final GuideHandler handler : Slimefun.getGuideHandlers(tier)) {
        handler.addEntry(texts,tooltips);
        actions.add(new PlayerRunnable(2){
          @Override public void run(          Player p){
            handler.run(p,survival,book);
          }
        }
);
      }
    }
    for (int i=0; i < texts.size(); i=i + 10) {
      TellRawMessage page=new TellRawMessage();
      page.addText("String_Node_Str");
      for (int j=i; j < texts.size() && j < i + 10; j++) {
        page.addText(texts.get(j) + "String_Node_Str");
        if (tooltips.get(j) != null)         page.addHoverEvent(HoverAction.SHOW_TEXT,tooltips.get(j));
        if (actions.get(j) != null)         page.addClickEvent(actions.get(j));
      }
      pages.add(page);
    }
    new CustomBookOverlay("String_Node_Str","String_Node_Str",pages.toArray(new TellRawMessage[pages.size()])).open(p);
  }
 else {
    final ChestMenu menu=new ChestMenu("String_Node_Str");
    menu.setEmptySlotsClickable(false);
    menu.addMenuOpeningHandler(new MenuOpeningHandler(){
      @Override public void onOpen(      Player p){
        p.playSound(p.getLocation(),Sound.ENTITY_BAT_TAKEOFF,0.7F,0.7F);
      }
    }
);
    List<Category> categories=Slimefun.current_categories;
    List<GuideHandler> handlers=Slimefun.guide_handlers2;
    int index=9;
    int pages=1;
    for (int i=0; i < 9; i++) {
      menu.addItem(i,new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE,(byte)7),"String_Node_Str"));
      menu.addMenuClickHandler(i,new MenuClickHandler(){
        @Override public boolean onClick(        Player arg0,        int arg1,        ItemStack arg2,        ClickAction arg3){
          return false;
        }
      }
);
    }
    for (int i=45; i < 54; i++) {
      menu.addItem(i,new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE,(byte)7),"String_Node_Str"));
      menu.addMenuClickHandler(i,new MenuClickHandler(){
        @Override public boolean onClick(        Player arg0,        int arg1,        ItemStack arg2,        ClickAction arg3){
          return false;
        }
      }
);
    }
    int target=(category_size * (selected_page - 1)) - 1;
    while (target < (categories.size() + handlers.size() - 1)) {
      if (index >= category_size + 9) {
        pages++;
        break;
      }
      target++;
      if (target >= categories.size()) {
        if (!survival)         break;
        index=handlers.get(target - categories.size()).next(p,index,menu);
      }
 else {
        final Category category=categories.get(target);
        boolean locked=true;
        for (        SlimefunItem item : category.getItems()) {
          if (Slimefun.isEnabled(p,item,false)) {
            locked=false;
            break;
          }
        }
        if (locked) {
        }
 else         if (!(category instanceof LockedCategory)) {
          if (!(category instanceof SeasonCategory)) {
            menu.addItem(index,category.getItem());
            menu.addMenuClickHandler(index,new MenuClickHandler(){
              @Override public boolean onClick(              Player p,              int slot,              ItemStack item,              ClickAction action){
                openCategory(p,category,survival,1,book);
                return false;
              }
            }
);
            index++;
          }
 else {
            if (((SeasonCategory)category).isUnlocked()) {
              menu.addItem(index,category.getItem());
              menu.addMenuClickHandler(index,new MenuClickHandler(){
                @Override public boolean onClick(                Player p,                int slot,                ItemStack item,                ClickAction action){
                  openCategory(p,category,survival,1,book);
                  return false;
                }
              }
);
              index++;
            }
          }
        }
 else         if (((LockedCategory)category).hasUnlocked(p)) {
          menu.addItem(index,category.getItem());
          menu.addMenuClickHandler(index,new MenuClickHandler(){
            @Override public boolean onClick(            Player p,            int slot,            ItemStack item,            ClickAction action){
              openCategory(p,category,survival,1,book);
              return false;
            }
          }
);
          index++;
        }
 else {
          List<String> parents=new ArrayList<String>();
          parents.add("String_Node_Str");
          parents.add("String_Node_Str");
          parents.add("String_Node_Str");
          parents.add("String_Node_Str");
          for (          Category parent : ((LockedCategory)category).getParents()) {
            parents.add(parent.getItem().getItemMeta().getDisplayName());
          }
          menu.addItem(index,new CustomItem(Material.BARRIER,"String_Node_Str" + category.getItem().getItemMeta().getDisplayName(),0,parents.toArray(new String[parents.size()])));
          menu.addMenuClickHandler(index,new MenuClickHandler(){
            @Override public boolean onClick(            Player arg0,            int arg1,            ItemStack arg2,            ClickAction arg3){
              return false;
            }
          }
);
          index++;
        }
      }
    }
    final int finalPages=pages;
    menu.addItem(46,new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE,(byte)5),"String_Node_Str","String_Node_Str","String_Node_Str" + selected_page + "String_Node_Str"+ pages+ "String_Node_Str"));
    menu.addMenuClickHandler(46,new MenuClickHandler(){
      @Override public boolean onClick(      Player arg0,      int arg1,      ItemStack arg2,      ClickAction arg3){
        int next=selected_page - 1;
        if (next < 1)         next=finalPages;
        if (next != selected_page)         openMainMenu(p,survival,book,next);
        return false;
      }
    }
);
    menu.addItem(52,new CustomItem(new MaterialData(Material.STAINED_GLASS_PANE,(byte)5),"String_Node_Str","String_Node_Str","String_Node_Str" + selected_page + "String_Node_Str"+ pages+ "String_Node_Str"));
    menu.addMenuClickHandler(52,new MenuClickHandler(){
      @Override public boolean onClick(      Player arg0,      int arg1,      ItemStack arg2,      ClickAction arg3){
        int next=selected_page + 1;
        if (next > finalPages)         next=1;
        if (next != selected_page)         openMainMenu(p,survival,book,next);
        return false;
      }
    }
);
    menu.open(p);
  }
}