Program: 79924
Project: 79924
Buggy source:
@SuppressWarnings("String_Node_Str") public static void displayItem(Player p,final ItemStack item,boolean addToHistory,final boolean book,final int page){
  if (item == null || item.getType() == Material.AIR)   return;
  final SlimefunItem sfItem=SlimefunItem.getByItem(item);
  if (sfItem == null) {
    if (!all_recipes)     return;
  }
  ItemStack[] recipe=new ItemStack[9];
  ItemStack recipeType=null;
  ItemStack recipeOutput=item;
  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);
    }
  }
);
  if (sfItem != null) {
    recipe=sfItem.getRecipe();
    recipeType=sfItem.getRecipeType().toItem();
    recipeOutput=sfItem.getCustomOutput() != null ? sfItem.getCustomOutput() : sfItem.getItem();
  }
 else {
    List<Recipe> recipes=new ArrayList<Recipe>();
    Iterator<Recipe> iterator=Bukkit.recipeIterator();
    while (iterator.hasNext()) {
      Recipe r=iterator.next();
      if (SlimefunManager.isItemSimiliar(new CustomItem(r.getResult(),1),item,true) && r.getResult().getData().getData() == item.getData().getData())       recipes.add(r);
    }
    if (recipes.isEmpty())     return;
    Recipe r=recipes.get(page);
    if (recipes.size() > page + 1) {
      menu.addItem(1,new CustomItem(new MaterialData(Material.ENCHANTED_BOOK),"String_Node_Str","String_Node_Str","String_Node_Str"));
      menu.addMenuClickHandler(1,new MenuClickHandler(){
        @Override public boolean onClick(        Player p,        int slot,        ItemStack stack,        ClickAction action){
          displayItem(p,item,false,book,page + 1);
          return false;
        }
      }
);
    }
    if (r instanceof ShapedRecipe) {
      String[] shape=((ShapedRecipe)r).getShape();
      for (int i=0; i < shape.length; i++) {
        for (int j=0; j < shape[i].length(); j++) {
          ItemStack ingredient=((ShapedRecipe)r).getIngredientMap().get(shape[i].charAt(j));
          if (ingredient != null) {
            MaterialData data=ingredient.getData();
            if (ingredient.getData().getData() < 0)             data.setData((byte)0);
            ingredient=data.toItemStack(ingredient.getAmount());
          }
          recipe[i * 3 + j]=ingredient;
        }
      }
      recipeType=RecipeType.SHAPED_RECIPE.toItem();
      recipeOutput=r.getResult();
    }
 else     if (r instanceof ShapelessRecipe) {
      List<ItemStack> ingredients=((ShapelessRecipe)r).getIngredientList();
      for (int i=0; i < ingredients.size(); i++) {
        ItemStack ingredient=ingredients.get(i);
        if (ingredient != null) {
          MaterialData data=ingredient.getData();
          if (ingredient.getData().getData() < 0)           data.setData((byte)0);
          ingredient=data.toItemStack(ingredient.getAmount());
        }
        recipe[i]=ingredient;
      }
      recipeType=RecipeType.SHAPELESS_RECIPE.toItem();
      recipeOutput=r.getResult();
    }
 else     if (r instanceof FurnaceRecipe) {
      ItemStack ingredient=((FurnaceRecipe)r).getInput();
      if (ingredient != null) {
        MaterialData data=ingredient.getData();
        if (ingredient.getData().getData() < 0)         data.setData((byte)0);
        ingredient=data.toItemStack(ingredient.getAmount());
      }
      recipe[4]=ingredient;
      recipeType=RecipeType.FURNACE.toItem();
      recipeOutput=r.getResult();
    }
  }
  if (addToHistory)   addToHistory(p,sfItem != null ? sfItem.getURID() : URID.nextURID(item,true));
  if (history.containsKey(p.getUniqueId()) && history.get(p.getUniqueId()).size() > 1) {
    menu.addItem(0,new CustomItem(new MaterialData(Material.ENCHANTED_BOOK),"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
    menu.addMenuClickHandler(0,new MenuClickHandler(){
      @Override public boolean onClick(      Player p,      int slot,      ItemStack item,      ClickAction action){
        if (action.isShiftClicked())         openMainMenu(p,true,book,1);
 else {
          URID last=getLastEntry(p,true);
          if (URID.decode(last) instanceof Category)           openCategory(p,(Category)URID.decode(last),true,1,book);
 else           if (URID.decode(last) instanceof SlimefunItem)           displayItem(p,((SlimefunItem)URID.decode(last)).getItem(),false,book,0);
 else           if (URID.decode(last) instanceof GuideHandler)           ((GuideHandler)URID.decode(last)).run(p,true,book);
 else           displayItem(p,(ItemStack)URID.decode(last),false,book,0);
        }
        return false;
      }
    }
);
  }
 else {
    menu.addItem(0,new CustomItem(new MaterialData(Material.ENCHANTED_BOOK),"String_Node_Str","String_Node_Str","String_Node_Str"));
    menu.addMenuClickHandler(0,new MenuClickHandler(){
      @Override public boolean onClick(      Player p,      int slot,      ItemStack item,      ClickAction action){
        openMainMenu(p,true,book,1);
        return false;
      }
    }
);
  }
  menu.addItem(3,Slimefun.hasUnlocked(p,recipe[0],false) ? recipe[0] : new CustomItem(Material.BARRIER,StringUtils.formatItemName(recipe[0],false),0,new String[]{"String_Node_Str","String_Node_Str",Slimefun.hasPermission(p,SlimefunItem.getByItem(recipe[0]),false) ? "String_Node_Str" : "String_Node_Str"}));
  menu.addMenuClickHandler(3,new MenuClickHandler(){
    @Override public boolean onClick(    Player p,    int slot,    ItemStack item,    ClickAction action){
      displayItem(p,item,true,book,0);
      return false;
    }
  }
);
  menu.addItem(4,Slimefun.hasUnlocked(p,recipe[1],false) ? recipe[1] : new CustomItem(Material.BARRIER,StringUtils.formatItemName(recipe[1],false),0,new String[]{"String_Node_Str","String_Node_Str",Slimefun.hasPermission(p,SlimefunItem.getByItem(recipe[1]),false) ? "String_Node_Str" : "String_Node_Str"}));
  menu.addMenuClickHandler(4,new MenuClickHandler(){
    @Override public boolean onClick(    Player p,    int slot,    ItemStack item,    ClickAction action){
      displayItem(p,item,true,book,0);
      return false;
    }
  }
);
  menu.addItem(5,Slimefun.hasUnlocked(p,recipe[2],false) ? recipe[2] : new CustomItem(Material.BARRIER,StringUtils.formatItemName(recipe[2],false),0,new String[]{"String_Node_Str","String_Node_Str",Slimefun.hasPermission(p,SlimefunItem.getByItem(recipe[2]),false) ? "String_Node_Str" : "String_Node_Str"}));
  menu.addMenuClickHandler(5,new MenuClickHandler(){
    @Override public boolean onClick(    Player p,    int slot,    ItemStack item,    ClickAction action){
      displayItem(p,item,true,book,0);
      return false;
    }
  }
);
  if (sfItem != null) {
    if (Slimefun.getItemConfig().contains(sfItem.getName() + "String_Node_Str")) {
      try {
        menu.addItem(8,new CustomItem(CustomSkull.getItem("String_Node_Str"),"String_Node_Str","String_Node_Str","String_Node_Str"));
        menu.addMenuClickHandler(8,new MenuClickHandler(){
          @Override public boolean onClick(          Player p,          int slot,          ItemStack item,          ClickAction action){
            p.closeInventory();
            p.sendMessage("String_Node_Str");
            p.sendMessage(ChatColor.translateAlternateColorCodes('&',"String_Node_Str" + Slimefun.getItemConfig().getString(sfItem.getName() + "String_Node_Str")));
            p.sendMessage("String_Node_Str");
            return false;
          }
        }
);
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
    if (Slimefun.getItemConfig().contains(sfItem.getName() + "String_Node_Str")) {
      try {
        menu.addItem(7,new CustomItem(CustomSkull.getItem("String_Node_Str"),"String_Node_Str","String_Node_Str","String_Node_Str"));
        menu.addMenuClickHandler(7,new MenuClickHandler(){
          @Override public boolean onClick(          Player p,          int slot,          ItemStack item,          ClickAction action){
            p.closeInventory();
            p.sendMessage("String_Node_Str");
            p.sendMessage(ChatColor.translateAlternateColorCodes('&',"String_Node_Str" + Slimefun.getItemConfig().getString(sfItem.getName() + "String_Node_Str")));
            p.sendMessage("String_Node_Str");
            return false;
          }
        }
);
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
  }
  menu.addItem(10,recipeType);
  menu.addMenuClickHandler(10,new MenuClickHandler(){
    @Override public boolean onClick(    Player p,    int slot,    ItemStack item,    ClickAction action){
      return false;
    }
  }
);
  menu.addItem(12,Slimefun.hasUnlocked(p,recipe[3],false) ? recipe[3] : new CustomItem(Material.BARRIER,StringUtils.formatItemName(recipe[3],false),0,new String[]{"String_Node_Str","String_Node_Str",Slimefun.hasPermission(p,SlimefunItem.getByItem(recipe[3]),false) ? "String_Node_Str" : "String_Node_Str"}));
  menu.addMenuClickHandler(12,new MenuClickHandler(){
    @Override public boolean onClick(    Player p,    int slot,    ItemStack item,    ClickAction action){
      displayItem(p,item,true,book,0);
      return false;
    }
  }
);
  menu.addItem(13,Slimefun.hasUnlocked(p,recipe[4],false) ? recipe[4] : new CustomItem(Material.BARRIER,StringUtils.formatItemName(recipe[4],false),0,new String[]{"String_Node_Str","String_Node_Str",Slimefun.hasPermission(p,SlimefunItem.getByItem(recipe[4]),false) ? "String_Node_Str" : "String_Node_Str"}));
  menu.addMenuClickHandler(13,new MenuClickHandler(){
    @Override public boolean onClick(    Player p,    int slot,    ItemStack item,    ClickAction action){
      displayItem(p,item,true,book,0);
      return false;
    }
  }
);
  menu.addItem(14,Slimefun.hasUnlocked(p,recipe[5],false) ? recipe[5] : new CustomItem(Material.BARRIER,StringUtils.formatItemName(recipe[5],false),0,new String[]{"String_Node_Str","String_Node_Str",Slimefun.hasPermission(p,SlimefunItem.getByItem(recipe[5]),false) ? "String_Node_Str" : "String_Node_Str"}));
  menu.addMenuClickHandler(14,new MenuClickHandler(){
    @Override public boolean onClick(    Player p,    int slot,    ItemStack item,    ClickAction action){
      displayItem(p,item,true,book,0);
      return false;
    }
  }
);
  menu.addItem(16,recipeOutput);
  menu.addMenuClickHandler(16,new MenuClickHandler(){
    @Override public boolean onClick(    Player p,    int slot,    ItemStack item,    ClickAction action){
      return false;
    }
  }
);
  menu.addItem(21,Slimefun.hasUnlocked(p,recipe[6],false) ? recipe[6] : new CustomItem(Material.BARRIER,StringUtils.formatItemName(recipe[6],false),0,new String[]{"String_Node_Str","String_Node_Str",Slimefun.hasPermission(p,SlimefunItem.getByItem(recipe[6]),false) ? "String_Node_Str" : "String_Node_Str"}));
  menu.addMenuClickHandler(21,new MenuClickHandler(){
    @Override public boolean onClick(    Player p,    int slot,    ItemStack item,    ClickAction action){
      displayItem(p,item,true,book,0);
      return false;
    }
  }
);
  menu.addItem(22,Slimefun.hasUnlocked(p,recipe[7],false) ? recipe[7] : new CustomItem(Material.BARRIER,StringUtils.formatItemName(recipe[7],false),0,new String[]{"String_Node_Str","String_Node_Str",Slimefun.hasPermission(p,SlimefunItem.getByItem(recipe[7]),false) ? "String_Node_Str" : "String_Node_Str"}));
  menu.addMenuClickHandler(22,new MenuClickHandler(){
    @Override public boolean onClick(    Player p,    int slot,    ItemStack item,    ClickAction action){
      displayItem(p,item,true,book,0);
      return false;
    }
  }
);
  menu.addItem(23,Slimefun.hasUnlocked(p,recipe[8],false) ? recipe[8] : new CustomItem(Material.BARRIER,StringUtils.formatItemName(recipe[8],false),0,new String[]{"String_Node_Str","String_Node_Str",Slimefun.hasPermission(p,SlimefunItem.getByItem(recipe[8]),false) ? "String_Node_Str" : "String_Node_Str"}));
  menu.addMenuClickHandler(23,new MenuClickHandler(){
    @Override public boolean onClick(    Player p,    int slot,    ItemStack item,    ClickAction action){
      displayItem(p,item,true,book,0);
      return false;
    }
  }
);
  if (sfItem != null) {
    if ((sfItem instanceof SlimefunMachine && ((SlimefunMachine)sfItem).getDisplayRecipes().size() > 0) || (sfItem instanceof SlimefunGadget && ((SlimefunGadget)sfItem).getRecipes().size() > 0)) {
      for (int i=27; i < 36; i++) {
        menu.addItem(i,new CustomItem(Material.STAINED_GLASS_PANE,SlimefunItem.getByItem(item) instanceof SlimefunMachine ? "String_Node_Str" : "String_Node_Str",7));
        menu.addMenuClickHandler(i,new MenuClickHandler(){
          @Override public boolean onClick(          Player arg0,          int arg1,          ItemStack arg2,          ClickAction arg3){
            return false;
          }
        }
);
      }
      List<ItemStack> recipes=SlimefunItem.getByItem(item) instanceof SlimefunMachine ? ((SlimefunMachine)SlimefunItem.getByItem(item)).getDisplayRecipes() : ((SlimefunGadget)SlimefunItem.getByItem(item)).getDisplayRecipes();
      int recipe_size=recipes.size();
      if (recipe_size > 18)       recipe_size=18;
      int inputs=-1, outputs=-1;
      for (int i=0; i < recipe_size; i++) {
        int slot=36;
        if (i % 2 == 1) {
          slot=slot + 9;
          outputs++;
        }
 else         inputs++;
        int addition=(i % 2 == 0 ? inputs : outputs);
        menu.addItem(slot + addition,recipes.get(i));
        menu.addMenuClickHandler(slot + addition,new MenuClickHandler(){
          @Override public boolean onClick(          Player p,          int slot,          ItemStack item,          ClickAction action){
            displayItem(p,item,true,book,0);
            return false;
          }
        }
);
      }
    }
 else     if (sfItem instanceof AGenerator) {
      int slot=27;
      for (      MachineFuel fuel : ((AGenerator)sfItem).getFuelTypes()) {
        if (slot > 54)         break;
        ItemStack fItem=fuel.getInput().clone();
        ItemMeta im=fItem.getItemMeta();
        List<String> lore=new ArrayList<String>();
        lore.add(ChatColor.translateAlternateColorCodes('&',"String_Node_Str" + getTimeLeft(fuel.getTicks() / 2)));
        lore.add(ChatColor.translateAlternateColorCodes('&',"String_Node_Str" + (((AGenerator)sfItem).getEnergyProduction() * 2) + "String_Node_Str"));
        lore.add(ChatColor.translateAlternateColorCodes('&',"String_Node_Str" + DoubleHandler.getFancyDouble(fuel.getTicks() * ((AGenerator)sfItem).getEnergyProduction()) + "String_Node_Str"));
        im.setLore(lore);
        fItem.setItemMeta(im);
        menu.addItem(slot,fItem);
        menu.addMenuClickHandler(slot,new MenuClickHandler(){
          @Override public boolean onClick(          Player p,          int slot,          ItemStack item,          ClickAction action){
            return false;
          }
        }
);
        slot++;
      }
    }
 else     if (sfItem instanceof AReactor) {
      int slot=27;
      for (      MachineFuel fuel : ((AReactor)sfItem).getFuelTypes()) {
        if (slot > 54)         break;
        ItemStack fItem=fuel.getInput().clone();
        ItemMeta im=fItem.getItemMeta();
        List<String> lore=new ArrayList<String>();
        lore.add(ChatColor.translateAlternateColorCodes('&',"String_Node_Str" + getTimeLeft(fuel.getTicks() / 2)));
        lore.add(ChatColor.translateAlternateColorCodes('&',"String_Node_Str" + (((AReactor)sfItem).getEnergyProduction() * 2) + "String_Node_Str"));
        lore.add(ChatColor.translateAlternateColorCodes('&',"String_Node_Str" + DoubleHandler.getFancyDouble(fuel.getTicks() * ((AReactor)sfItem).getEnergyProduction()) + "String_Node_Str"));
        im.setLore(lore);
        fItem.setItemMeta(im);
        menu.addItem(slot,fItem);
        menu.addMenuClickHandler(slot,new MenuClickHandler(){
          @Override public boolean onClick(          Player p,          int slot,          ItemStack item,          ClickAction action){
            return false;
          }
        }
);
        slot++;
      }
    }
  }
  menu.build().open(p);
}

Fixed version (ground truth):
@SuppressWarnings("String_Node_Str") public static void displayItem(Player p,final ItemStack item,boolean addToHistory,final boolean book,final int page){
  if (item == null || item.getType() == Material.AIR)   return;
  final SlimefunItem sfItem=SlimefunItem.getByItem(item);
  if (sfItem == null) {
    if (!all_recipes)     return;
  }
  ItemStack[] recipe=new ItemStack[9];
  ItemStack recipeType=null;
  ItemStack recipeOutput=item;
  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);
    }
  }
);
  if (sfItem != null) {
    recipe=sfItem.getRecipe();
    recipeType=sfItem.getRecipeType().toItem();
    recipeOutput=sfItem.getCustomOutput() != null ? sfItem.getCustomOutput() : sfItem.getItem();
  }
 else {
    List<Recipe> recipes=new ArrayList<Recipe>();
    Iterator<Recipe> iterator=Bukkit.recipeIterator();
    while (iterator.hasNext()) {
      Recipe r=iterator.next();
      if (SlimefunManager.isItemSimiliar(new CustomItem(r.getResult(),1),item,true) && r.getResult().getData().getData() == item.getData().getData())       recipes.add(r);
    }
    if (recipes.isEmpty())     return;
    Recipe r=recipes.get(page);
    if (recipes.size() > page + 1) {
      menu.addItem(1,new CustomItem(new MaterialData(Material.ENCHANTED_BOOK),"String_Node_Str","String_Node_Str","String_Node_Str"));
      menu.addMenuClickHandler(1,new MenuClickHandler(){
        @Override public boolean onClick(        Player p,        int slot,        ItemStack stack,        ClickAction action){
          displayItem(p,item,false,book,page + 1);
          return false;
        }
      }
);
    }
    if (r instanceof ShapedRecipe) {
      String[] shape=((ShapedRecipe)r).getShape();
      for (int i=0; i < shape.length; i++) {
        for (int j=0; j < shape[i].length(); j++) {
          ItemStack ingredient=((ShapedRecipe)r).getIngredientMap().get(shape[i].charAt(j));
          if (ingredient != null) {
            MaterialData data=ingredient.getData();
            if (ingredient.getData().getData() < 0)             data.setData((byte)0);
            ingredient=data.toItemStack(ingredient.getAmount());
          }
          recipe[i * 3 + j]=ingredient;
        }
      }
      recipeType=RecipeType.SHAPED_RECIPE.toItem();
      recipeOutput=r.getResult();
    }
 else     if (r instanceof ShapelessRecipe) {
      List<ItemStack> ingredients=((ShapelessRecipe)r).getIngredientList();
      for (int i=0; i < ingredients.size(); i++) {
        ItemStack ingredient=ingredients.get(i);
        if (ingredient != null) {
          MaterialData data=ingredient.getData();
          if (ingredient.getData().getData() < 0)           data.setData((byte)0);
          ingredient=data.toItemStack(ingredient.getAmount());
        }
        recipe[i]=ingredient;
      }
      recipeType=RecipeType.SHAPELESS_RECIPE.toItem();
      recipeOutput=r.getResult();
    }
 else     if (r instanceof FurnaceRecipe) {
      ItemStack ingredient=((FurnaceRecipe)r).getInput();
      if (ingredient != null) {
        MaterialData data=ingredient.getData();
        if (ingredient.getData().getData() < 0)         data.setData((byte)0);
        ingredient=data.toItemStack(ingredient.getAmount());
      }
      recipe[4]=ingredient;
      recipeType=RecipeType.FURNACE.toItem();
      recipeOutput=r.getResult();
    }
  }
  if (addToHistory)   addToHistory(p,sfItem != null ? sfItem.getURID() : URID.nextURID(item,true));
  if (history.containsKey(p.getUniqueId()) && history.get(p.getUniqueId()).size() > 1) {
    menu.addItem(0,new CustomItem(new MaterialData(Material.ENCHANTED_BOOK),"String_Node_Str","String_Node_Str","String_Node_Str","String_Node_Str"));
    menu.addMenuClickHandler(0,new MenuClickHandler(){
      @Override public boolean onClick(      Player p,      int slot,      ItemStack item,      ClickAction action){
        if (action.isShiftClicked())         openMainMenu(p,true,book,1);
 else {
          URID last=getLastEntry(p,true);
          if (URID.decode(last) instanceof Category)           openCategory(p,(Category)URID.decode(last),true,1,book);
 else           if (URID.decode(last) instanceof SlimefunItem)           displayItem(p,((SlimefunItem)URID.decode(last)).getItem(),false,book,0);
 else           if (URID.decode(last) instanceof GuideHandler)           ((GuideHandler)URID.decode(last)).run(p,true,book);
 else           displayItem(p,(ItemStack)URID.decode(last),false,book,0);
        }
        return false;
      }
    }
);
  }
 else {
    menu.addItem(0,new CustomItem(new MaterialData(Material.ENCHANTED_BOOK),"String_Node_Str","String_Node_Str","String_Node_Str"));
    menu.addMenuClickHandler(0,new MenuClickHandler(){
      @Override public boolean onClick(      Player p,      int slot,      ItemStack item,      ClickAction action){
        openMainMenu(p,true,book,1);
        return false;
      }
    }
);
  }
  menu.addItem(3,Slimefun.hasUnlocked(p,recipe[0],false) ? recipe[0] : new CustomItem(Material.BARRIER,StringUtils.formatItemName(recipe[0],false),0,new String[]{"String_Node_Str","String_Node_Str",Slimefun.hasPermission(p,SlimefunItem.getByItem(recipe[0]),false) ? "String_Node_Str" : "String_Node_Str"}));
  menu.addMenuClickHandler(3,new MenuClickHandler(){
    @Override public boolean onClick(    Player p,    int slot,    ItemStack item,    ClickAction action){
      displayItem(p,item,true,book,0);
      return false;
    }
  }
);
  menu.addItem(4,Slimefun.hasUnlocked(p,recipe[1],false) ? recipe[1] : new CustomItem(Material.BARRIER,StringUtils.formatItemName(recipe[1],false),0,new String[]{"String_Node_Str","String_Node_Str",Slimefun.hasPermission(p,SlimefunItem.getByItem(recipe[1]),false) ? "String_Node_Str" : "String_Node_Str"}));
  menu.addMenuClickHandler(4,new MenuClickHandler(){
    @Override public boolean onClick(    Player p,    int slot,    ItemStack item,    ClickAction action){
      displayItem(p,item,true,book,0);
      return false;
    }
  }
);
  menu.addItem(5,Slimefun.hasUnlocked(p,recipe[2],false) ? recipe[2] : new CustomItem(Material.BARRIER,StringUtils.formatItemName(recipe[2],false),0,new String[]{"String_Node_Str","String_Node_Str",Slimefun.hasPermission(p,SlimefunItem.getByItem(recipe[2]),false) ? "String_Node_Str" : "String_Node_Str"}));
  menu.addMenuClickHandler(5,new MenuClickHandler(){
    @Override public boolean onClick(    Player p,    int slot,    ItemStack item,    ClickAction action){
      displayItem(p,item,true,book,0);
      return false;
    }
  }
);
  if (sfItem != null) {
    if (Slimefun.getItemConfig().contains(sfItem.getName() + "String_Node_Str")) {
      try {
        menu.addItem(8,new CustomItem(CustomSkull.getItem("String_Node_Str"),"String_Node_Str","String_Node_Str","String_Node_Str"));
        menu.addMenuClickHandler(8,new MenuClickHandler(){
          @Override public boolean onClick(          Player p,          int slot,          ItemStack item,          ClickAction action){
            p.closeInventory();
            p.sendMessage("String_Node_Str");
            p.sendMessage(ChatColor.translateAlternateColorCodes('&',"String_Node_Str" + Slimefun.getItemConfig().getString(sfItem.getName() + "String_Node_Str")));
            p.sendMessage("String_Node_Str");
            return false;
          }
        }
);
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
    if (Slimefun.getItemConfig().contains(sfItem.getName() + "String_Node_Str")) {
      try {
        menu.addItem(7,new CustomItem(CustomSkull.getItem("String_Node_Str"),"String_Node_Str","String_Node_Str","String_Node_Str"));
        menu.addMenuClickHandler(7,new MenuClickHandler(){
          @Override public boolean onClick(          Player p,          int slot,          ItemStack item,          ClickAction action){
            p.closeInventory();
            p.sendMessage("String_Node_Str");
            p.sendMessage(ChatColor.translateAlternateColorCodes('&',"String_Node_Str" + Slimefun.getItemConfig().getString(sfItem.getName() + "String_Node_Str")));
            p.sendMessage("String_Node_Str");
            return false;
          }
        }
);
      }
 catch (      Exception e) {
        e.printStackTrace();
      }
    }
  }
  menu.addItem(10,recipeType);
  menu.addMenuClickHandler(10,new MenuClickHandler(){
    @Override public boolean onClick(    Player p,    int slot,    ItemStack item,    ClickAction action){
      return false;
    }
  }
);
  menu.addItem(12,Slimefun.hasUnlocked(p,recipe[3],false) ? recipe[3] : new CustomItem(Material.BARRIER,StringUtils.formatItemName(recipe[3],false),0,new String[]{"String_Node_Str","String_Node_Str",Slimefun.hasPermission(p,SlimefunItem.getByItem(recipe[3]),false) ? "String_Node_Str" : "String_Node_Str"}));
  menu.addMenuClickHandler(12,new MenuClickHandler(){
    @Override public boolean onClick(    Player p,    int slot,    ItemStack item,    ClickAction action){
      displayItem(p,item,true,book,0);
      return false;
    }
  }
);
  menu.addItem(13,Slimefun.hasUnlocked(p,recipe[4],false) ? recipe[4] : new CustomItem(Material.BARRIER,StringUtils.formatItemName(recipe[4],false),0,new String[]{"String_Node_Str","String_Node_Str",Slimefun.hasPermission(p,SlimefunItem.getByItem(recipe[4]),false) ? "String_Node_Str" : "String_Node_Str"}));
  menu.addMenuClickHandler(13,new MenuClickHandler(){
    @Override public boolean onClick(    Player p,    int slot,    ItemStack item,    ClickAction action){
      displayItem(p,item,true,book,0);
      return false;
    }
  }
);
  menu.addItem(14,Slimefun.hasUnlocked(p,recipe[5],false) ? recipe[5] : new CustomItem(Material.BARRIER,StringUtils.formatItemName(recipe[5],false),0,new String[]{"String_Node_Str","String_Node_Str",Slimefun.hasPermission(p,SlimefunItem.getByItem(recipe[5]),false) ? "String_Node_Str" : "String_Node_Str"}));
  menu.addMenuClickHandler(14,new MenuClickHandler(){
    @Override public boolean onClick(    Player p,    int slot,    ItemStack item,    ClickAction action){
      displayItem(p,item,true,book,0);
      return false;
    }
  }
);
  menu.addItem(16,recipeOutput);
  menu.addMenuClickHandler(16,new MenuClickHandler(){
    @Override public boolean onClick(    Player p,    int slot,    ItemStack item,    ClickAction action){
      return false;
    }
  }
);
  menu.addItem(21,Slimefun.hasUnlocked(p,recipe[6],false) ? recipe[6] : new CustomItem(Material.BARRIER,StringUtils.formatItemName(recipe[6],false),0,new String[]{"String_Node_Str","String_Node_Str",Slimefun.hasPermission(p,SlimefunItem.getByItem(recipe[6]),false) ? "String_Node_Str" : "String_Node_Str"}));
  menu.addMenuClickHandler(21,new MenuClickHandler(){
    @Override public boolean onClick(    Player p,    int slot,    ItemStack item,    ClickAction action){
      displayItem(p,item,true,book,0);
      return false;
    }
  }
);
  menu.addItem(22,Slimefun.hasUnlocked(p,recipe[7],false) ? recipe[7] : new CustomItem(Material.BARRIER,StringUtils.formatItemName(recipe[7],false),0,new String[]{"String_Node_Str","String_Node_Str",Slimefun.hasPermission(p,SlimefunItem.getByItem(recipe[7]),false) ? "String_Node_Str" : "String_Node_Str"}));
  menu.addMenuClickHandler(22,new MenuClickHandler(){
    @Override public boolean onClick(    Player p,    int slot,    ItemStack item,    ClickAction action){
      displayItem(p,item,true,book,0);
      return false;
    }
  }
);
  menu.addItem(23,Slimefun.hasUnlocked(p,recipe[8],false) ? recipe[8] : new CustomItem(Material.BARRIER,StringUtils.formatItemName(recipe[8],false),0,new String[]{"String_Node_Str","String_Node_Str",Slimefun.hasPermission(p,SlimefunItem.getByItem(recipe[8]),false) ? "String_Node_Str" : "String_Node_Str"}));
  menu.addMenuClickHandler(23,new MenuClickHandler(){
    @Override public boolean onClick(    Player p,    int slot,    ItemStack item,    ClickAction action){
      displayItem(p,item,true,book,0);
      return false;
    }
  }
);
  if (sfItem != null) {
    if ((sfItem instanceof SlimefunMachine && ((SlimefunMachine)sfItem).getDisplayRecipes().size() > 0) || (sfItem instanceof SlimefunGadget && ((SlimefunGadget)sfItem).getRecipes().size() > 0)) {
      for (int i=27; i < 36; i++) {
        menu.addItem(i,new CustomItem(Material.STAINED_GLASS_PANE,SlimefunItem.getByItem(item) instanceof SlimefunMachine ? "String_Node_Str" : "String_Node_Str",7));
        menu.addMenuClickHandler(i,new MenuClickHandler(){
          @Override public boolean onClick(          Player arg0,          int arg1,          ItemStack arg2,          ClickAction arg3){
            return false;
          }
        }
);
      }
      List<ItemStack> recipes=SlimefunItem.getByItem(item) instanceof SlimefunMachine ? ((SlimefunMachine)SlimefunItem.getByItem(item)).getDisplayRecipes() : ((SlimefunGadget)SlimefunItem.getByItem(item)).getDisplayRecipes();
      int recipe_size=recipes.size();
      if (recipe_size > 18)       recipe_size=18;
      int inputs=-1, outputs=-1;
      for (int i=0; i < recipe_size; i++) {
        int slot=36;
        if (i % 2 == 1) {
          slot=slot + 9;
          outputs++;
        }
 else         inputs++;
        int addition=(i % 2 == 0 ? inputs : outputs);
        menu.addItem(slot + addition,recipes.get(i));
        menu.addMenuClickHandler(slot + addition,new MenuClickHandler(){
          @Override public boolean onClick(          Player p,          int slot,          ItemStack item,          ClickAction action){
            displayItem(p,item,true,book,0);
            return false;
          }
        }
);
      }
    }
 else     if (sfItem instanceof AGenerator) {
      int slot=27;
      for (      MachineFuel fuel : ((AGenerator)sfItem).getFuelTypes()) {
        if (slot > 54)         break;
        ItemStack fItem=fuel.getInput().clone();
        ItemMeta im=fItem.getItemMeta();
        List<String> lore=new ArrayList<String>();
        lore.add(ChatColor.translateAlternateColorCodes('&',"String_Node_Str" + getTimeLeft(fuel.getTicks() / 2)));
        lore.add(ChatColor.translateAlternateColorCodes('&',"String_Node_Str" + (((AGenerator)sfItem).getEnergyProduction() * 2) + "String_Node_Str"));
        lore.add(ChatColor.translateAlternateColorCodes('&',"String_Node_Str" + DoubleHandler.getFancyDouble(fuel.getTicks() * ((AGenerator)sfItem).getEnergyProduction()) + "String_Node_Str"));
        im.setLore(lore);
        fItem.setItemMeta(im);
        menu.addItem(slot,fItem);
        menu.addMenuClickHandler(slot,new MenuClickHandler(){
          @Override public boolean onClick(          Player p,          int slot,          ItemStack item,          ClickAction action){
            return false;
          }
        }
);
        slot++;
      }
    }
 else     if (sfItem instanceof AReactor) {
      int slot=27;
      for (      MachineFuel fuel : ((AReactor)sfItem).getFuelTypes()) {
        if (slot > 54)         break;
        ItemStack fItem=fuel.getInput().clone();
        ItemMeta im=fItem.getItemMeta();
        List<String> lore=new ArrayList<String>();
        lore.add(ChatColor.translateAlternateColorCodes('&',"String_Node_Str" + getTimeLeft(fuel.getTicks() / 2)));
        lore.add(ChatColor.translateAlternateColorCodes('&',"String_Node_Str" + (((AReactor)sfItem).getEnergyProduction() * 2) + "String_Node_Str"));
        lore.add(ChatColor.translateAlternateColorCodes('&',"String_Node_Str" + DoubleHandler.getFancyDouble(fuel.getTicks() * ((AReactor)sfItem).getEnergyProduction()) + "String_Node_Str"));
        im.setLore(lore);
        fItem.setItemMeta(im);
        menu.addItem(slot,fItem);
        menu.addMenuClickHandler(slot,new MenuClickHandler(){
          @Override public boolean onClick(          Player p,          int slot,          ItemStack item,          ClickAction action){
            return false;
          }
        }
);
        slot++;
      }
    }
  }
  menu.build().open(p);
}