Permissions

Discussion in 'Spigot Plugin Development' started by MrHardyCZ, Apr 14, 2016.

  1. Hi. How i can add permissions to craft to this code? :)

    Code (Text):
      private void Elytra() {
            if (getConfig().getString("Elytra").equals("true")) {
      ItemStack item = new ItemStack(Material.ELYTRA, (short)1);
      ShapedRecipe r = new ShapedRecipe(item);
      r.shape(new String[] { "***", "*%*", "*%*" });
      r.setIngredient('*', Material.IRON_INGOT);
      r.setIngredient('%', Material.LEATHER);
      getServer().addRecipe(r);
        }
      }
     
  2. Serializator

    Supporter

    Use the CraftItemEvent and check if the player who's trying to craft the item has the permission that's necessary.
    I also have a tip, use YamlConfiguration#getBoolean() instead of comparing a string value with "true" or "false".
    And the last thing, use proper Java naming convention, method names should use camelCase.
     
  3. Emmm.. :D Do you please write it in code? :D I'm Noob Dev. :D
     
    • Optimistic Optimistic x 1
  4. Serializator

    Supporter

    I'm not gonna spoon feed you...
    The information I gave should be more than enough.
     
    • Like Like x 1