Permissions help

Discussion in 'Plugin Development' started by zJanny, Oct 20, 2019.

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


    How can i give a player the "Community.King" permission
    when i executed a command like /king ?
    And remove it when i do for example /removeking
  2. Offline


    Correct me if I'm wrong, but I believe you can grant permissions like this:

    PermissionAttachment attachment = new PermissionAttachment(mainPluginClass,PlayerInstance);
    MainPluginClass means an instance of the main class, PlayerInstance being the Player instance you want to give the permission to, and true/false being whether the permission is granted.

    You can also pass a org.bukkit.permission.Permission instance instead of a String for the permission.

    Do yourself a favor and familiarize yourself with the Bukkit JavaDoc. I have no problem answering your questions, but the official JavaDoc documentation is an incredible resource for Bukkit, and rather than spending the time typing up a forum post, a quick search through the JavaDoc can usually answer your questions pretty quickly.
  3. Offline


    If your using a permission plugin you can do
    If (player.hasPermission("permission.permission")) {
         //Your Code
    Edit: do you want to make your plugin give a permission to a player, or do you want to do a command that can be executed only if the player has a certain permission?

    Edit2: Sorry just understand your question now. You have to do what Panda said. I recommend read this before doing it
    Last edited: Nov 1, 2019
Thread Status:
Not open for further replies.

Share This Page