Solved The correct way to register permissions?

Discussion in 'Plugin Development' started by UNC00KED, Dec 23, 2015.

Thread Status:
Not open for further replies.
  1. Offline


    What is the proper way to register permissions?

    I always get the error in the console:
    Plugin PerWorldBroadcaster v1.0 tried to register permission 'PerWorldBroadcaster.use' but it's already registered

    The way I am currently doing it is:
    public Permission playerPermission = new Permission("PerWorldBroadcaster.use");
    public void onEnable() {
            plugin = this;
            new PerWorldBroadcasterListener(this);
  "PerWorldBroadcaster Enabled!");
    void permissionAdd() {
            PluginManager pm = getServer().getPluginManager();
            Set<Permission> permissions = pm.getPermissions();
            if (!permissions.contains(playerPermission)) {

    And yet I still get that error in console. Any ideas?
  2. Offline

    Mrs. bwfctower

    @UNC00KED You don't necessarily need to register any permissions. You can simply check if a CommandSender has it by using CommandSender#hasPermission(String perm) or CommandSender#hasPermission(Permissions perm).

    If you really want to register it, just put it in your plugin.yml under the 'permissions' section.

    The reason the error is coming up is because you already have the permission in your plugin.yml, so when you try to register it again that error occurs.
    UNC00KED and Zombie_Striker like this.
  3. Offline


    Got it, thanks for the clarification! :)
Thread Status:
Not open for further replies.

Share This Page