Need help with InventoryClicks

Discussion in 'Spigot Plugin Development' started by HockeyFreak062, Apr 15, 2017.

  1. Hey! im makeing a custom crafting plugin but it doenst seem to work the code will speak for itsself i think
    Code (Java):

        public void onCraft(InventoryClickEvent event) {
            Player player = (Player) event.getWhoClicked();

            if (player.getOpenInventory().getTitle().equals(ChatColor.GREEN + "" + ChatColor.BOLD + "Crafting Table")) {
                if (event.getSlot() == 12) {
                    if (player.getOpenInventory().getItem(12).equals(Material.STONE)) {

                        ItemStack glass = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) 5);
                        ItemMeta meta = glass.getItemMeta();
                        meta.setDisplayName(ChatColor.GOLD + "Yes");

                        ItemStack glass1 = new ItemStack(Material.STAINED_GLASS_PANE, 1, (byte) 14);
                        ItemMeta meta1 = glass1.getItemMeta();
                        meta1.setDisplayName(ChatColor.GOLD + "No");

                        Inventory crafting2 = Bukkit.createInventory(null, 27,
                                ChatColor.GREEN + "" + ChatColor.BOLD + "Want to craft Slabs?");
                        crafting2.setItem(12, glass1);
                        crafting2.setItem(14, glass1);
    the problem is when you put a stone in the 12th slot of the inventory you dont open the new created inventory. can someone help me out? (no errors shown in the console)
  2. what did you change about the code? and i have registered the Listener
  3. ahh oke ill try tomorrow when i wake up :D