[Bukkit guide] Permissions

Discussion in 'Bukkit Help' started by zipron, Dec 17, 2011.

?

Did this guide help you?

  1. Yes

    18 vote(s)
    52.9%
  2. A bit

    11 vote(s)
    32.4%
  3. No

    5 vote(s)
    14.7%
Thread Status:
Not open for further replies.
  1. Offline

    zipron

    [Bukkit guide] Permissions


    IMPORTANT! if you're looking for PEX guide, check it out here: http://forums.bukkit.org/threads/bukkit-guide-permissionsex-pex.60312/
    So after three days of forum activity, i've notived that 40-50% of all issues are with permissions. That's why I decided to make this guide for all the people who want to know how groupmanager plugins work and how they can manage it thereself. First I want to point some things out:
    1) I'm not English, so I'm sorry for grammar mistakes
    2) A guide is never complete or 100% correct. I can share the things I know, give some tips but I cannot promise this will work for everyone.
    3) If you notice any mistakes, about the plugins, things I mention or even grammar, please mention it in this threath, it's very apprieciated.
    4) In this guide I will eplain everything using an example plugin called essentials. The reason I do this is because many people use this plugin, and it's impossible to cover ALL plugins.
    5) I will not fix anyone's permission configuration. So don't ask me.
    That figured out, now let's start with the guide! We'll speak about many things, and I'll try to give as much examples as possible.

    Table of content
    - Permissions? wtf??
    - Basic startup
    - YAML & permission nodes
    - Common errors
    - Different plugins
    - Endings
    - Useful links

    Permissions? wtf??
    So to start with, what are permissions? When you play Minecraft on a server, you'll probably notice some differences with the singleplayer game. Most important are the plugin features and commands. Now, there has to be a way handeling this commands. Deciding who can use them and who can't. That's why there are permission manager plugins but we'll talk about different plugins in another section. A permission plugin will allow you to decide wich player can use wich commands and make several groups of players to give permissions to. That said, let's look at the basic startup of a permission plugin.

    Basic startup
    Bukkit provides a build-in permission system. Opening the bukkit.yml file you'll be able to choose a name for your permission file, by default, this is called "permissions.yml". A .yml file is the file type we'll use for our permission configuration. This is a bit of a stubborn file extension but we'll talk about that soon. This permission system allows you to give permissions per user or per group. You can also add users to a certain group so they'll get all the permissions that group has. The configuration is pretty easy but it's not perfect. Many others made permission plugins and so come you have many possibilties about choosing the right plugin. If you choose another plugin but the default permission system, you will need to place this .jar file into your plugin folder. After that you can run your server and it wil generate all the files you need. Almost all plugins will make a default template so you can work on that one. We however will start from scratch so you really know what is going on.

    YAML & permission nodes
    As mentioned before, the permission configuration will be in a .yml file (a YAML file). To make sure everything you write in this file is correct, you need to know some things about this extension:
    - .yml is CaSeSeNsItIvE wich means "Yml" is not the same as "yml" or "YML".
    - .yml doesn't use tabs in the files. You'll need to use spaces in order for it to work correctly. One tab = four spaces in YAML.
    - If you're not sure your YAML code is correct, you can use a parser to check it for you. This parser will look if all conditions are met: http://yaml-online-parser.appspot.com/

    No on to the syntax for permission files. All permission plugins will use two basic systems:
    - groups
    - users
    most plugins will seperate them with another file, wich give you groups.yml and users.yml. Though if you choose to use the default bukkit permission system, it'll be all in the same file.

    To start your permission config, you'll have to say for what file you're writing it. Users or groups? So at the first line, this is the thing wich is needed:
    Code:
    Users:
    ...
    Groups:
    
    The ":" means the things under it with two spaces before them, will be for that "file". Now I talk about file, but as I said some system will put them into one file. I don't know a better word for it, if someone does, please tell me =).

    We're going to talk about groups first. This will be the most used feature because we'll be able to add players to a group after we've configured them. So let's start, we want to make three groups: newcomer, member and admin. We are going to give them a name, a default value, permissions, some information and an inheritance. I'll talk about all of these points seperatly. Now for the PEX plugin, things are a bit different, because hey, why not? So I'll talk about them in the last section of this guide. Now let's see what we have in our .yml file:
    Code:
    groups:
      Newcomer:
        default: true
        permissions: []
        inheritance: []
        info: []
      Member:
        default: false
        permissions: []
        inheritance: []
        info: []
      Admin:
        default: false
        permissions: []
        inheritance: []
        info: []
    
    Let's have a look at the code above: We've added three groups, each with a different name and they are alligned two spaces to the right. This means they belong to the "Groups". Beneath each group, you can see another two spaces and then the major properties per group. The two spaces again say this properties belong to a group and the square brackets [ ] means there is no data yet. It is possible you don't want a group to have permissions, so than you add the [ ] brackets. Now we can also see that the "default" property has a true or false value. This propetry will decide wich group players belong to if they join the server for the first time. So all new players will be Newcomer unless you want it to be different. Now we're going to add permissions for each group. Let's say we want Newcomers not being able to perform any command but the /rules command. We want members being able to do the same as Newcomers (/rules) AND they need some more permissions such as /sethome, /delhome, /tpa, /tpaccept, /tpdeny. Admins are allowed all permissions. Let's see what we need for that:
    Code:
    groups:
      Newcomer:
        default: true
        permissions:
        - essentials.rules
        inheritance: []
        info: []
      Member:
        default: false
        permissions:
        - essentials.sethome
        - essentials.delhome
        - essentials.tpa
        - essentials.tpaccept
        - essentials.tpdeny
        inheritance:
        - Newcomer
        info: []
      Admin:
        default: false
        permissions:
        - essentials.*
        inheritance:
        - Member
        info: []
    
    So now we can see a lot more changes to our configuration. For the Newcomer group, we've added the permission to perform the command "/rules". Now we can see this isn't writen as we would presume. For each command, we need to add the so called "permission node" for that command. A permission node basically is an indication for the server so it know wich command we mean. For most plugins this permission nodes are made like this: "plugin_name.command" or "plugin_name.command.subcommand". Now sometimes this won't be this way. For example if we want a player to do something withouth using a command. For example opening a door or not. We'll come back to that later. In the Member group we can see all the permission nodes are added for the commands we wanted. We could also help "essentials.rules" to it, but in stead of doing that, we decedid the Member group inherits from the Newcomer group. What this means is that the Members will be able to do the same things as Newcomers plus the nodes we've added for them only. This way we won't have to copy all the commands again. Alse we indicate that "Member" had a higher status than "Newcomer". The same happens for Admin, wich is the highest rang so he inherits the Member group, and through the Members, also the Newcomers. Some permission plugins will need this structure if you want to be able to promote or demote people ingame: you can only promote someone who is in the same inheritance tree as you are. But that only apply to some plugins. You can see the Admin group is allowed to use all commands of the essential plugin. It would be very stupid if you have to give the permission node for each command, that's why we can select the whole "package" of commands provided by essentials using the '*' sign. So "essentials.*" means "all commands of essentials". We can do the same for subcommands such as "/sethome" wich also includes multiple homes or not. You can say:
    Code:
    permissions:
    - essentials.sethome.others
    - essentials.sethome.multiple.unlimited
    
    So players can set multiple homes and set homes for other players, or we can say:
    Code:
    permissions:
    - essentials.sethome.*
    
    Wich allows the usage of all command in the package "sethome". Now what if we want to use almost all the commands but one? do we have to use all the nodes except that one we don't want? No, we can easily use a package and after that denying a command:
    Code:
    permissions:
    - essentials.*
    - -essentials.sethome.others
    
    Next thing to add is information about the group. In here we can say several things, we can give suffixes, prefixes and allow people to build or not. This happens:
    Code:
    groups:
      Newcomer:
        default: true
        permissions:
        - essentials.rules
        inheritance: []
        info:
          prefix: '&7[Newcomer] '
          build: false
          suffix: ''
      Member:
        default: false
        permissions:
        - essentials.sethome
        - essentials.delhome
        - essentials.tpa
        - essentials.tpaccept
        - essentials.tpdeny
        inheritance:
        - Newcomer
        info:
          prefix: '&f'
          build: true
          suffix: ''
      Admin:
        default: false
        permissions:
        - essentials.*
        inheritance:
        - Member
        info:
          prefix: '&b[&f'
          build: true
          suffix: '&b]'
    
    So we can see we add some info again two extra spaces from the info property. For the Newcomer group we say they have a tag in front of there name in a gray color wich sais "[Newcomer]". They aren't allowed to build and they don't have a suffix. Members are allowed to build, they have a white name and no other pre- or suffix. People in the Admin group are also allowed to build and there name has lightblue square brackets around it. The colors are indicated like this: "&1"-"&f". Now we know all the basics about the Group file, let's quickly check the users file:
    Code:
    users:
      Zipron:
        subgroups: []
        permissions:
        - -essentials.tpa
        group: Member
      Administrator:
        subgroups: []
        permissions: []
        group: Admin
    
    In this example we've added two players. Zipron belongs to the Members group and isn't allowed to use the "/tpa" command. Administrator belangs to the Admin group. As you can see, you can add extra nodes per player. Most of the time you will add players to a group by using ingame commands. Also notice that there are always two spaces to align the players.

    Common errors
    - tabs in stead of spaces
    - too many spaces: begin file (0), group names (2), properties (4), extra's (6)
    - wrong permission nodes, always check the nodes on the dev page/wiki of the plugins.
    - "groups" and "users" don't start with a capitol letter!

    Different plugins
    I've already mentioned that there are different permission plugins. In this guide i've used the essentials groupmanager syntax. In the future I will also add some stuff about PEX, because it's a bit different than the essentials GM. So I will cover more stuff than the basics in the future. And even if you do not want to use essentials GM, maybe this was a good guide to learn some things about YAML =)

    Endings
    So I hope this guide helped out some people with question/issues about permissions. Again, I know that there might be mistakes in this guide, don't hesitate and comment them here, that way, you help out all the people who read this =) If you feel like you want to, a like is appreciated and you can always ask help in this topic about your permissions. Be sure to copy/paste your group(s)/user(s) file into this topic and I'll try to answer them. As I said before, I won't fix them for you but I can search for errors and show them =) Also try to use the YAML parser if you're stuck =)

    Useful links
    YAML parser: http://yaml-online-parser.appspot.com/
    essentials forum page: http://forums.bukkit.org/threads/ge...1-a-collection-of-useful-commands-1597.15312/
    essentials GM wiki: http://ess.khhq.net/wiki/Group_Manager

    Have fun!
    zip
     
    ImminentFate and Amphase like this.
  2. Offline

    ZNickq

    Nice! :)
     
  3. Offline

    DeltaBoss

    Thx for this, I'll try GroupManager instead of PermissionsBukkit now.

    Just wondering: Doesn't there have to be a [] after permissions: in the user Administrator?

    I'll tell you if this will work^^
     
    zipron likes this.
  4. Offline

    mindless728

    Change that light green to something darker as it is practically unreadable
     
    zipron likes this.
  5. Offline

    zipron

    thanks for pointing that out =)

    zip

    Ok I will, thanks =)

    zip

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 22, 2016
  6. Offline

    DeltaBoss

    Jo zip,
    I set up everything again with GroupManager and I don't get any serious errors in the console, which is quite nice.
    Unfortunatelly as soon as I place a crafting table and want to use it I can't. Suddenly I cannot destroy or build (they reappear or disappear again) any more. Ideas?
     
  7. Offline

    mindless728

    oh that is much better
     
  8. Offline

    zipron

    Probably you're building in the spawn point area, wich is protected for non-OP players, or you haven't set
    Code:
    build:true
    in the info property.

    You can change the spawn radius by going into the bukkit.yml file =)
    hope that helps,
    zip
     
  9. Offline

    DeltaBoss

    No, thats not it :/
    I did some tests and it turned out that my world interaction is taken away as soon as I craft something in my inventory. But I guess you can't help me with this problem^^
     
  10. Offline

    zipron

    As long as it's not permission related, not in this topic anyways =)

    zip
     
  11. Offline

    taalasmaa

    Heyy download that text file and say if its done right :D
    i am using simpleadmin plugin.
     

    Attached Files:

    • sd.txt
      File size:
      1.7 KB
      Views:
      19
  12. Offline

    zipron

    I think it is. Remember you can use multiple nodes in a selection instruction:
    Code:
    users:
      Laitela:
        subgroups: []
        permissions:
        - -simpleadmin.*
        group: Moderator
    Zip
     
  13. Offline

    taalasmaa

    oh right! ty!

    hmh doesnt seem to work... when i speak it doesent say [admin]... :/

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 22, 2016
  14. Offline

    zipron

    Ok, is there any error message in your console? if yes, put it here =)

    zip
     
  15. Offline

    taalasmaa

    no... no errors
     
  16. Offline

    ImminentFate

    I noticed you put
    "The ":" means the things under it with a tab before them, will be for that "file"."
    This should actually be four spaces and not a tab. Tabs break .yml files unless you are using Notepad++ and have configured it to replace tabs with four spaces.
     
  17. Offline

    taalasmaa

    i didnt use tabs...
     
  18. Offline

    ImminentFate

    It was actually a suggestion to @zipron
    Sorry for the confusion
     
  19. Offline

    taalasmaa

    Server permissions files permissions.yml is not valid YAML : expected '<document start>', but found BlockMappingStart in "<reader>" , line 38 column 1
    groups:
    /\
    I

    that error message i get

    oh ok

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 22, 2016
  20. Offline

    zipron

    Yea but i've mentioned in the beginning tabs = spaces in yaml, but I'll change it thanks for the feedback =)
    zip
     
  21. Offline

    SkeloPatch

    try using the 'nChat' plugin
     
  22. Offline

    Killerdude8

    Could you update this for some of the permission plugins used nowadays please?
     
  23. Offline

    zipron

    Yes I will, but it will be somewhere this week. I know many people use PEX, so I'll try to update it for that. However, There are still some active things in this guide such as YML. that stays the same for all plugins =)

    zip
     
  24. Offline

    Killerdude8

    Alright, i guess ill be waiting. =D
     
  25. Offline

    zipron

    if you need fst help, you could search youtube for "bukkitteacher" he has a tutorial about pex =)
     
  26. Offline

    Killerdude8

    Thank you, I'll be sure to do that if I need any help.
     
  27. Offline

    zipron

  28. Offline

    esptigers

    Hello, i am a beginner with all of this and when i start my server, it says this
    "
    ---
    !!map {
    ? !!str "Users"
    : !!map {
    ? !!str "ethan711"
    : !!map {
    ? !!str "group"
    ? !!str "permissions"
    : !!seq [
    !!str "-essentials.tpa",
    ],
    ? !!str "subgroups"
    : !!seq [],
    },
    },


    it says the same thing when i use the yaml parser.
    do you know what this means? thanks
     
  29. Offline

    zipron

    never saw that =O please paste your permissions.yml file here =)
    zip
     
  30. Offline

    esptigers

    Here it is:

    Users:
    ethan711:
    subgroups: []
    permissions:
    - -essentials.tpa
    group: Admin
    groups:
    Member:
    default: true
    permissions:
    - essentials.sethome
    - essentials.delhome
    - essentials.tpa
    - essentials.tpaccept
    - essentials.tpdeny
    inheritance: []
    info:
    prefix: '&7[Member]'
    build: true
    suffix: ''
    Admin:
    default: false
    permissions:
    - permissions.*
    - sidkeick.*
    - niftywarp.*
    - essentials.*
    inheritance:
    - Member
    info:
    prefix: '&b[Admin]'
    build: true
    suffix: ''
     
Thread Status:
Not open for further replies.

Share This Page