Add permission to a player when typing a command

Discussion in 'Plugin Development' started by BagduFagdu, Jan 24, 2015.

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

    BagduFagdu

    So this is my code, when typing for example "/perm add Notch" it would give player Notch a certain permission, in this case "essentials.helpop". What's the expression I should use to do this? something similar to the this?:


    Code:
    getServer().getPluginManager().addPermission(new Permission("essentials.helpop"));

    Code:
    if(args.length == 2 && args[0].equalsIgnoreCase("add")) {
           Player tp = (Player) Bukkit.getServer().getPlayer(args[1]);
           if(tp != null) {
                 //command to add permission to a "tp"
           }
    return false;
    }
     
  2. Offline

    WinX64

    Konato_K and BagduFagdu like this.
  3. Offline

    Skionz

  4. Offline

    Funergy

    BagduFagdu likes this.
  5. Offline

    TehHypnoz

    You can also try using the Vault API.
     
  6. Offline

    Treeline1

    Bukkit.dispatchCommand(Bukkit.getConsoleSender(), "permission command here");

    "Permission command here" is where you put pex + player + "permission"
     
  7. Offline

    Skionz

    @Treeline1 He wants to do it programmatically.
     
  8. Offline

    PreFiXAUT

    @Treeline1 And when you do it like this, it would screw up all Commands which require a Player as Executor (such as the /tp Command, because how do you wanna teleport a Console?) so that's a very bad Idea.
     
  9. Offline

    Treeline1

    If he was using a permissions plugin like Permissionsex or whatever, then this command gives them the permission to be able to teleport. Which is what I thought he was asking for
     
Thread Status:
Not open for further replies.

Share This Page