Question How to give permissions when a command is entered?

Discussion in 'Bukkit Help' started by WishMachine, Apr 22, 2015.

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

    WishMachine

    I am trying to give someone a permissions if they put in the correct command. i.e. if they enter "/give permission", they will be given the permission associated with that command, I just don't know how to do that. I know how to give someone a command if they are opped or admin with the permissions addin in the plugins.yml file, but I can't find anything like "player.givePermission(permission)" or anything along those lines. I feel like I'm missing something obvious but none of the permission tutorials I've found include anything like this.

    Thanks in advance
     
  2. Offline

    Koobaczech

    Your permission manager can add permissions if you know the permission and do a command to add it. For example "/manuaddp WishMachine somePermission" is the GroupManager way of giving a player a permission. But if this makes sense, the game doesn't know what permission is needed to run a command until you run it. So for example, to run a command /kill , the code might look like this
    Code:
    if (cmd.getName().equalsIgnoreCase("kill")&&p.hasPermission("somePerm"))
    The permission to run /kill is "somePerm. And doing /kill Permission or /give Kill or whatever will not give a player the appropriate permission. Only knowing that the permission is "somePerm" and adding it with a plugin command like GroupManager should work. I could be wrong though, someone correct me
     
  3. Offline

    lecraeman

    Might help if you give us what instance you're actually using this. Like, What you're going to do if you figure it out.
     
  4. Offline

    WishMachine

    Alright, I get what you're saying, but I don't get what you mean when you say "adding it to a group manager should work". I know how to manage them in a yml file, I just don't get how to give a specific player a permission without adding that specific player to the yml file. Is that even possible? I feel like it should be something simple, you know?

    Im working on an RPG server where when people log on, they have the option of joining a district, d1, d2, and d3 for example. I want them to be able to type something like /joind1 and for them to have the permissions of that district, and I figured using permissions would be easiest because I can just detect which permission they have and if they have that permission, certain abilities will be available to them. Stuff like that. I think I could use hashmaps too but those are complicated I'd much rather just use permissions but this is turning out to be more complicated than I expected.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 12, 2016
  5. Offline

    lecraeman

    Use this plugin: http://dev.bukkit.org/bukkit-plugins/commander/

    Been using it for ages (I'm on a 1.8 server now), and it still works perfectly with no errors that i've found. Should be able to do the job. You'd need to have them select a button of something though.
     
Thread Status:
Not open for further replies.

Share This Page