Solved How to change permissions for specify plugin?

Discussion in 'Spigot Plugin Development' started by Interestinng, May 16, 2016.

  1. Now, I developed a plugin and setting some default permissions:
    Code (Text):
    #plugin.yml
    ...

    commands:
      feature:
        permission: myplugin.feature

    permissions:
      myplugin.feature:
        default: op
        description: Allow use feature command
    If other user of my plugin want to change the permission of "feature" command to allow all user use it.

    How can they do this ?
    Should I provide any other things for user ?

    In other words, if I download a plugin.jar that developed by other man. How can I change the default permissions ?
     
  2. Honestly, I never use the plugin.yml for permissions. I always just use a boolean statement in the CommandExecutor.
    Example:

    Code (Text):
    if(player.hasPermission("my.permission"){
      // do something
    }
    What's the purpose of changing the permission String? Any player can be given any permission and permission managers tend to have an option to give to all players.
     
    • Agree Agree x 1
  3. Some plugin's command do not allow all player execute, but server admin want to change this, he want all player can use some command.
    So he want to change permission for plugin.
     
  4. I think you may be confused. If the plugin has a specific permission requirement, the solution is to give the player that permission. Changing the String value of the permission won't help, unless it's changed to a permission that all players already have... in which case, just give the players the original permission value.

    If this server doesn't have some sort of permission management plugin, it probably should get one. Of course, you could always use the PlayerJoinEvent to give the permission to the joining player, within any plugin.
     
  5. yes, I'm new developer for spigot. So, I'm not understand the permission system how to work.
     
  6. OK, well the basics are that every player on a server can have a permission (which is basically just a String stored in the appropriate place) added onto their data. So, for example, in my plugin RecipesGUI, I have several permissions that are considered when a player executes a command. If the command "/recipes" is used by a player, the command is only executed if the player has been given the permission (String) "recipesgui.list" prior to entering the command .. my plugin does not handle giving the permission to the player, it only verifies whether they have it or not and acts appropriately. So, the permission is never changed for the plugin, it is changed for the player. A player can have an endless amount of permissions.

    There are several permission manager plugins out there for server admins, in which they can specify which players receive which permissions, and some allow sorting by groups. A commonly used plugin is PermissionsEX, often referred to as PEX. See http://dev.bukkit.org/bukkit-plugins/permissionsex/
     
  7. Is there any ways to give some permissions to a player without anyother plugin?
    Can I modify permissions.yml in root dir of server.jar to do this?
     
  8. I'm not too certain about that but a quick look at http://wiki.bukkit.org/Permissions.yml suggests this probably isn't the case. I've never really worked with giving permissions to people but more googling gives me https://bukkit.org/threads/can-someone-explain-permissions-and-how-to-set-them.83768/ .. which suggests that using your original method of the plugin.yml, where you have "default: op" .. use "default: true"
     
    • Like Like x 1
  9. No problem, sorry I didn't know the answer straight off the hop. Google can be friendly, though.