Blocking recipes for specific group

Discussion in 'Spigot Plugin Help' started by KindGuy, Mar 18, 2020.

  1. Hi,
    I'm trying to set up my server and writting plugins for it. I have a problem. Like i said in title i have no idea how to block recipe for specific group. For example if u have villager rank u can't craft gold/diamond set (armor + tools). If it is important i'm using Group Manager to manage premissions.
    To generally block recipe ( and add alternative ) i use :
    Code (Text):

    public void onEnable(){
        recipes =  Bukkit.recipeIterator();
        this.getServer().getPluginManager().registerEvents( new CustomRecipeListener(),this);
        while (recipes.hasNext()) {
           Recipe recipe = recipes.next();
           if ( recipe != null && recipe.getResult().getType() == Material.ENCHANTING_TABLE)
               recipes.remove();
        }
        ShapedRecipe recipe = new ShapedRecipe(new ItemStack(Material.ENCHANTING_TABLE));
        recipe.shape("121", "343", "444");
        recipe.setIngredient('1', Material.EMERALD);
        recipe.setIngredient('2', Material.BOOK);
        recipe.setIngredient('3', Material.DIAMOND);
        recipe.setIngredient('4', Material.OBSIDIAN);
        Bukkit.addRecipe(recipe);
        }
     
     
    #1 KindGuy, Mar 18, 2020
    Last edited: Mar 19, 2020