Solved Where do I add my permissions?

Discussion in 'Plugin Development' started by keaton64, May 27, 2014.

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


    So basically I have two listener classes that use permissions to determine what user can do what etc.
    It calls on hasPermission but when I throw any of my current permissions into PEX it throws about 70 errors and calls me an idiot. I think I have to use the addPermission function but where do I put it? I've tried putting it in my main class but it throws tons of errors. I'm really new to bukkit and am looking for some helpful advice.
    snipit of code
    1. if(!player.hasPermission("")) {
    2. event.setCancelled(false);
    3. player.setFoodLevel(20);

    and the other snipit
    1. private boolean hasPermission(Player p){
    2. return p.hasPermission("sleep.sleep");

    getPluginManager().addPermission(new Permission(.....)) is the code but it throws me errors.
    Not sure if the code is outdated or if I'm challenged. I wrote the code, I'm 100% sure I didn't put any addPermissions in anywhere else.

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


    You dont need to do anything to have hasPermission work.
    Paste the error you are getting please.
  3. Offline


    if (bukkitPlayer.hasPermission("my.permission") {
    bukkitPlayer.sendMessage("You have the permission.");
    else {
    bukkitPlayer.sendMEssage("Nu uh!");
    If you have that and you don't do anything else, don't add it to plugin.yml, your on enable method etc. it will work.
  4. Offline


    As he said, post stacktrace
  5. Offline


  6. Offline


    keaton64 you dont need permissions.yml.
    I just check if the player has a perm, and it works...
  7. Offline


    FabeGabeMC You have a tab somewhere in your "permissions.yml", YAML files can't contain any tab stops.
    Paste your YAML file into this and fix that little tab;
  8. Offline


    How do I check if a player has a perm?
    And how do I know if my code works if I don't test it?
  9. Offline


    You already check permission properly. However, you broke your PEX permissions.yml, so do what Azubuso said,
  10. Offline


    I've fixed it all.
    I feel like I've accomplished so much so quickly. I want to thank all of you guys.
    I was yet again just being an idiot.
Thread Status:
Not open for further replies.

Share This Page