Program: 79923
Project: 79923
Buggy source:
@SuppressWarnings("String_Node_Str") public static void openCategory(final Player p,final Category category,final boolean survival,final int selected_page,final boolean book){
  if (category == null)   return;
  if (book && category.getItems().size() < 250) {
    List<TellRawMessage> pages=new ArrayList<TellRawMessage>();
    List<String> texts=new ArrayList<String>();
    List<String> tooltips=new ArrayList<String>();
    List<PlayerRunnable> actions=new ArrayList<PlayerRunnable>();
    for (    final SlimefunItem item : category.getItems()) {
      if (Slimefun.hasPermission(p,item,false)) {
        if (Slimefun.isEnabled(p,item,false)) {
          if (survival && !Slimefun.hasUnlocked(p,item,false) && item.getResearch() != null) {
            final Research research=item.getResearch();
            texts.add(shorten("String_Node_Str",StringUtils.formatItemName(item.getItem(),false)));
            tooltips.add(StringUtils.formatItemName(item.getItem(),false) + "String_Node_Str" + (p.getLevel() >= research.getCost() ? "String_Node_Str" : "String_Node_Str")+ research.getCost()+ "String_Node_Str");
            actions.add(new PlayerRunnable(2){
              @Override public void run(              final Player p){
                if (!Research.isResearching(p)) {
                  if (research.canUnlock(p)) {
                    if (research.hasUnlocked(p))                     openCategory(p,category,true,selected_page,book);
 else {
                      if (!(p.getGameMode() == GameMode.CREATIVE && Research.creative_research)) {
                        p.setLevel(p.getLevel() - research.getCost());
                      }
                      if (p.getGameMode() == GameMode.CREATIVE) {
                        research.unlock(p,true);
                        Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance,new Runnable(){
                          @Override public void run(){
                            openCategory(p,category,survival,selected_page,book);
                          }
                        }
,1L);
                      }
 else {
                        research.unlock(p,false);
                        Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance,new Runnable(){
                          @Override public void run(){
                            openCategory(p,category,survival,selected_page,book);
                          }
                        }
,103L);
                      }
                    }
                  }
 else                   Messages.local.sendTranslation(p,"String_Node_Str",true);
                }
              }
            }
);
          }
 else {
            texts.add(shorten("String_Node_Str",StringUtils.formatItemName(item.getItem(),false)));
            StringBuilder tooltip=new StringBuilder();
            tooltip.append(StringUtils.formatItemName(item.getItem(),false));
            if (item.getItem().hasItemMeta() && item.getItem().getItemMeta().hasLore()) {
              for (              String line : item.getItem().getItemMeta().getLore()) {
                tooltip.append("String_Node_Str" + line);
              }
            }
            tooltip.append("String_Node_Str");
            tooltips.add(tooltip.toString());
            actions.add(new PlayerRunnable(2){
              @Override public void run(              Player p){
                displayItem(p,item.getItem(),true,book,0);
              }
            }
);
          }
        }
      }
 else {
        texts.add(shorten("String_Node_Str",StringUtils.formatItemName(item.getItem(),false)));
        tooltips.add("String_Node_Str");
        actions.add(null);
      }
    }
    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));
      }
      page.addText("String_Node_Str");
      page.addText("String_Node_Str");
      page.addHoverEvent(HoverAction.SHOW_TEXT,"String_Node_Str");
      page.addClickEvent(new PlayerRunnable(2){
        @Override public void run(        final Player p){
          Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance,new Runnable(){
            @Override public void run(){
              openMainMenu(p,survival,true,1);
            }
          }
,1L);
        }
      }
);
      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);
      }
    }
);
    int index=9;
    final int pages=category.getItems().size() / category_size + 1;
    for (int i=0; i < 4; 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;
        }
      }
);
    }
    menu.addItem(4,new CustomItem(new MaterialData(Material.ENCHANTED_BOOK),"String_Node_Str"));
    menu.addMenuClickHandler(4,new MenuClickHandler(){
      @Override public boolean onClick(      Player arg0,      int arg1,      ItemStack arg2,      ClickAction arg3){
        openMainMenu(p,survival,book,1);
        return false;
      }
    }
);
    for (int i=5; 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;
        }
      }
);
    }
    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=pages;
        if (next != selected_page)         openCategory(p,category,survival,next,book);
        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 > pages)         next=1;
        if (next != selected_page)         openCategory(p,category,survival,next,book);
        return false;
      }
    }
);
    int category_index=category_size * (selected_page - 1);
    for (int i=0; i < category_size; i++) {
      int target=category_index + i;
      if (target >= category.getItems().size())       break;
      final SlimefunItem sfitem=category.getItems().get(target);
      if (Slimefun.isEnabled(p,sfitem,false)) {
        if (survival && !Slimefun.hasUnlocked(p,sfitem.getItem(),false) && sfitem.getResearch() != null) {
          if (Slimefun.hasPermission(p,sfitem,false)) {
            final Research research=sfitem.getResearch();
            menu.addItem(index,new CustomItem(Material.BARRIER,"String_Node_Str" + StringUtils.formatItemName(sfitem.getItem(),false),0,new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str" + research.getCost() + "String_Node_Str"}));
            menu.addMenuClickHandler(index,new MenuClickHandler(){
              @Override public boolean onClick(              final Player p,              int slot,              ItemStack item,              ClickAction action){
                if (!Research.isResearching(p)) {
                  if (research.canUnlock(p)) {
                    if (research.hasUnlocked(p))                     openCategory(p,category,true,selected_page,book);
 else {
                      if (!(p.getGameMode() == GameMode.CREATIVE && Research.creative_research)) {
                        p.setLevel(p.getLevel() - research.getCost());
                      }
                      if (p.getGameMode() == GameMode.CREATIVE) {
                        research.unlock(p,Research.creative_research);
                        openCategory(p,category,survival,selected_page,book);
                      }
 else {
                        research.unlock(p,false);
                        Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance,new Runnable(){
                          @Override public void run(){
                            openCategory(p,category,survival,selected_page,book);
                          }
                        }
,103L);
                      }
                    }
                  }
 else                   Messages.local.sendTranslation(p,"String_Node_Str",true);
                }
                return false;
              }
            }
);
            index++;
          }
 else {
            menu.addItem(index,new CustomItem(Material.BARRIER,StringUtils.formatItemName(sfitem.getItem(),false),0,new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"}));
            menu.addMenuClickHandler(index,new MenuClickHandler(){
              @Override public boolean onClick(              Player arg0,              int arg1,              ItemStack arg2,              ClickAction arg3){
                return false;
              }
            }
);
            index++;
          }
        }
 else {
          menu.addItem(index,sfitem.getItem());
          menu.addMenuClickHandler(index,new MenuClickHandler(){
            @Override public boolean onClick(            Player p,            int slot,            ItemStack item,            ClickAction action){
              if (survival)               displayItem(p,item,true,book,0);
 else               p.getInventory().addItem(item);
              return false;
            }
          }
);
          index++;
        }
      }
    }
    menu.open(p);
  }
  if (survival) {
    addToHistory(p,category.getURID());
  }
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static void openCategory(final Player p,final Category category,final boolean survival,final int selected_page,final boolean book){
  if (category == null)   return;
  if (book && category.getItems().size() < 250) {
    List<TellRawMessage> pages=new ArrayList<TellRawMessage>();
    List<String> texts=new ArrayList<String>();
    List<String> tooltips=new ArrayList<String>();
    List<PlayerRunnable> actions=new ArrayList<PlayerRunnable>();
    for (    final SlimefunItem item : category.getItems()) {
      if (Slimefun.hasPermission(p,item,false)) {
        if (Slimefun.isEnabled(p,item,false)) {
          if (survival && !Slimefun.hasUnlocked(p,item,false) && item.getResearch() != null) {
            final Research research=item.getResearch();
            texts.add(shorten("String_Node_Str",StringUtils.formatItemName(item.getItem(),false)));
            tooltips.add(StringUtils.formatItemName(item.getItem(),false) + "String_Node_Str" + (p.getLevel() >= research.getCost() ? "String_Node_Str" : "String_Node_Str")+ research.getCost()+ "String_Node_Str");
            actions.add(new PlayerRunnable(2){
              @Override public void run(              final Player p){
                if (!Research.isResearching(p)) {
                  if (research.canUnlock(p)) {
                    if (research.hasUnlocked(p))                     openCategory(p,category,true,selected_page,book);
 else {
                      if (!(p.getGameMode() == GameMode.CREATIVE && Research.creative_research)) {
                        p.setLevel(p.getLevel() - research.getCost());
                      }
                      if (p.getGameMode() == GameMode.CREATIVE) {
                        research.unlock(p,true);
                        Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance,new Runnable(){
                          @Override public void run(){
                            openCategory(p,category,survival,selected_page,book);
                          }
                        }
,1L);
                      }
 else {
                        research.unlock(p,false);
                        Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance,new Runnable(){
                          @Override public void run(){
                            openCategory(p,category,survival,selected_page,book);
                          }
                        }
,103L);
                      }
                    }
                  }
 else                   Messages.local.sendTranslation(p,"String_Node_Str",true);
                }
              }
            }
);
          }
 else {
            texts.add(shorten("String_Node_Str",StringUtils.formatItemName(item.getItem(),false)));
            StringBuilder tooltip=new StringBuilder();
            tooltip.append(StringUtils.formatItemName(item.getItem(),false));
            if (item.getItem().hasItemMeta() && item.getItem().getItemMeta().hasLore()) {
              for (              String line : item.getItem().getItemMeta().getLore()) {
                tooltip.append("String_Node_Str" + line);
              }
            }
            tooltip.append("String_Node_Str");
            tooltips.add(tooltip.toString());
            actions.add(new PlayerRunnable(2){
              @Override public void run(              Player p){
                displayItem(p,item.getItem(),true,book,0);
              }
            }
);
          }
        }
      }
 else {
        texts.add(shorten("String_Node_Str",StringUtils.formatItemName(item.getItem(),false)));
        tooltips.add("String_Node_Str");
        actions.add(null);
      }
    }
    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));
      }
      page.addText("String_Node_Str");
      page.addText("String_Node_Str");
      page.addHoverEvent(HoverAction.SHOW_TEXT,"String_Node_Str");
      page.addClickEvent(new PlayerRunnable(2){
        @Override public void run(        final Player p){
          Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance,new Runnable(){
            @Override public void run(){
              openMainMenu(p,survival,true,1);
            }
          }
,1L);
        }
      }
);
      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);
      }
    }
);
    int index=9;
    final int pages=category.getItems().size() / category_size + 1;
    for (int i=0; i < 4; 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;
        }
      }
);
    }
    menu.addItem(4,new CustomItem(new MaterialData(Material.ENCHANTED_BOOK),"String_Node_Str"));
    menu.addMenuClickHandler(4,new MenuClickHandler(){
      @Override public boolean onClick(      Player arg0,      int arg1,      ItemStack arg2,      ClickAction arg3){
        openMainMenu(p,survival,book,1);
        return false;
      }
    }
);
    for (int i=5; 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;
        }
      }
);
    }
    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=pages;
        if (next != selected_page)         openCategory(p,category,survival,next,book);
        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 > pages)         next=1;
        if (next != selected_page)         openCategory(p,category,survival,next,book);
        return false;
      }
    }
);
    int category_index=category_size * (selected_page - 1);
    for (int i=0; i < category_size; i++) {
      int target=category_index + i;
      if (target >= category.getItems().size())       break;
      final SlimefunItem sfitem=category.getItems().get(target);
      if (Slimefun.isEnabled(p,sfitem,false)) {
        if (survival && !Slimefun.hasUnlocked(p,sfitem.getItem(),false) && sfitem.getResearch() != null) {
          if (Slimefun.hasPermission(p,sfitem,false)) {
            final Research research=sfitem.getResearch();
            menu.addItem(index,new CustomItem(Material.BARRIER,"String_Node_Str" + StringUtils.formatItemName(sfitem.getItem(),false),0,new String[]{"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str" + research.getCost() + "String_Node_Str"}));
            menu.addMenuClickHandler(index,new MenuClickHandler(){
              @Override public boolean onClick(              final Player p,              int slot,              ItemStack item,              ClickAction action){
                if (!Research.isResearching(p)) {
                  if (research.canUnlock(p)) {
                    if (research.hasUnlocked(p))                     openCategory(p,category,true,selected_page,book);
 else {
                      if (!(p.getGameMode() == GameMode.CREATIVE && Research.creative_research)) {
                        p.setLevel(p.getLevel() - research.getCost());
                      }
                      if (p.getGameMode() == GameMode.CREATIVE) {
                        research.unlock(p,Research.creative_research);
                        openCategory(p,category,survival,selected_page,book);
                      }
 else {
                        research.unlock(p,false);
                        Bukkit.getScheduler().scheduleSyncDelayedTask(SlimefunStartup.instance,new Runnable(){
                          @Override public void run(){
                            openCategory(p,category,survival,selected_page,book);
                          }
                        }
,103L);
                      }
                    }
                  }
 else                   Messages.local.sendTranslation(p,"String_Node_Str",true);
                }
                return false;
              }
            }
);
            index++;
          }
 else {
            menu.addItem(index,new CustomItem(Material.BARRIER,StringUtils.formatItemName(sfitem.getItem(),false),0,new String[]{"String_Node_Str","String_Node_Str","String_Node_Str"}));
            menu.addMenuClickHandler(index,new MenuClickHandler(){
              @Override public boolean onClick(              Player arg0,              int arg1,              ItemStack arg2,              ClickAction arg3){
                return false;
              }
            }
);
            index++;
          }
        }
 else {
          menu.addItem(index,sfitem.getItem());
          menu.addMenuClickHandler(index,new MenuClickHandler(){
            @Override public boolean onClick(            Player p,            int slot,            ItemStack item,            ClickAction action){
              if (survival)               displayItem(p,item,true,book,0);
 else               p.getInventory().addItem(item);
              return false;
            }
          }
);
          index++;
        }
      }
    }
    menu.open(p);
  }
  if (survival) {
    addToHistory(p,category.getURID());
  }
}