Hello, I'm currently trying to use the PrepareItemCraftEvent and ItemCraftEvent to make it so if players have a certain permissions rank. Currently I've ruled out using the ItemCraftEvent and I think I still need to use the PrepareItemCraftEvent. This is what I currently have. Code (Text): @EventHandler public void craftItem(PrepareItemCraftEvent event) { Material itemType = event.getRecipe().getResult().getType(); if(!(itemType == Material.DIAMOND_PICKAXE || itemType == Material.DIAMOND_AXE || itemType == Material.DIAMOND_HOE || itemType == Material.DIAMOND_SPADE || itemType == Material.DIAMOND_SWORD || itemType == Material.DIAMOND_HELMET || itemType == Material.DIAMOND_CHESTPLATE || itemType == Material.DIAMOND_LEGGINGS || itemType == Material.DIAMOND_BOOTS || itemType == Material.WOOD)) return; for(HumanEntity he : event.getViewers()) { if(he instanceof Player) { if((itemType == Material.DIAMOND_PICKAXE || itemType == Material.DIAMOND_AXE) && !(PyxisCore.perms.playerInGroup((Player) he, "Craftsman"))) { event.getInventory().setResult(new ItemStack(Material.AIR)); he.sendMessage(ChatColor.RED + "You must unlock the Craftsman path before crafting this item."); return; } else if((itemType == Material.DIAMOND_HOE || itemType == Material.DIAMOND_SPADE) && !(PyxisCore.perms.playerInGroup((Player) he, "Harvester"))) { event.getInventory().setResult(new ItemStack(Material.AIR)); he.sendMessage(ChatColor.RED + "You must unlock the Harvester path before crafting this item."); return; } else if(itemType == Material.DIAMOND_SWORD && !(PyxisCore.perms.playerInGroup((Player) he, "Ninja"))) { event.getInventory().setResult(new ItemStack(Material.AIR)); he.sendMessage(ChatColor.RED + "You must unlock the Ninja path before crafting this item."); return; } else if(itemType == Material.WOOD && PyxisCore.perms.playerInGroup((Player) he, "Craftsman")) { event.getInventory().getResult().setAmount(6); } } } } Any idea on how I could change this to make it work? Thanks.
Wouldn't that add a recipe for everyone instead of just for people with a certain permission though? I'm trying to make it so if you're in a certain group you can craft more planks.