Error registering Permissions

Discussion in 'Spigot Plugin Development' started by Deitog, Jun 21, 2019.

  1. Hi.
    I am creating my plugin and when I register the permissions via "plugin.yml" and from the method:
    Code (Text):
    private static String[] perm = {"example_1","example_2"}

    public void registerPermissions(){
          PluginManager pm = Bukkit.getPluginManager();
          for(String p : perm){
             pm.addPermission(new Permission(p));
           }
        }
    And I get on the console: "The permission example_1 has already been registered"
    "The permission example_2 has already been registered"
    and in the "plugin.yml" I have it registered as well:
    upload_2019-6-21_10-12-18.png
    If I only have to have 1, which method of registering permissions do you recommend?.

    Thanks for your attention
     
  2. Your plugin.yml registers them for you, that is the point. You don't need to manually do this too
    To check for a player having it just do player.hasPermission
     
    • Agree Agree x 1
  3. Ok, Thanks for the contribution