Using PermissionsEx with EZRanksPro

Jul 4, 2017
Using PermissionsEx with EZRanksPro
  • Hello there,

    So, it's been brought to my attention that a lot of people are struggling to use PermissionsEx (PEX) along side EZRanksPro. It's actually pretty simple once you've gotten the hang of it, and I assume that it is because a lot of people don't understand the weight system within PermissionsEx. I'm not doing to be going into heavy detail about the weight system. If, at the end of this guide, you're still a bit confused on how the weight system works, you can visit this thread, which explains it very well.

    So, let's begin.

    To start off, you want to make sure you have these plugins installed (along side your other ones)
    Vault is an API that handles chat, permissions and economy, and it is what EZRanksPro hooks into for handling permissions (ranking up), and for handling economy (checking the costs, player balance, etc).

    We're going to be creating 5 Permissions groups: A, B, C, D, and VIP. A-D will be our Prison ranking up ranks, and VIP will be our donator rank to show how we can do multiple groups and still play fair.

    To begin, setup your ranks within PermissionsEx, like so:

    Code (Text):
    groups:
      A:
        options:
          default: true
          prefix: "&f[&aA&f] "
        inheritance:
        - null
        permissions:
        - modifyworld.*
      B:
        options:
          default: false
          prefix: "&f[&bB&f] "
        inheritance:
        - A
        permissions:
        - modifyworld.*
      C:
        options:
          default: false
          prefix: "&f[&cC&f] "
        inheritance:
        - B
        permissions:
        - modifyworld.*
      D:
        options:
          default: false
          prefix: "&f[&dD&f] "
        inheritance:
        - C
        permissions:
        - modifyworld.*
      VIP:
        options:
          default: false
          suffix: "&f[&eVIP&f] "
        inheritance:
        - A
        permissions:
        - modifyworld.*

    Now that we have our groups setup, let's go ahead and add weights to them. Remember, the way PermissionsEx determines your Primary group (if you are in multiple groups), is through weights. The lower the number, the higher the priority. Below is a basic example of how the groups should look with weights added to them.

    Code (Text):
    groups:
      A:
        options:
          default: true
          prefix: "&f[&aA&f] "
          weight: "4"
        inheritance:
        - null
        permissions:
        - modifyworld.*
      B:
        options:
          default: false
          prefix: "&f[&bB&f] "
          weight: "3"
        inheritance:
        - A
        permissions:
        - modifyworld.*
      C:
        options:
          default: false
          prefix: "&f[&cC&f] "
          weight: "2"
        inheritance:
        - B
        permissions:
        - modifyworld.*
      D:
        options:
          default: false
          prefix: "&f[&dD&f] "
          weight: "1"
        inheritance:
        - C
        permissions:
        - modifyworld.*
      VIP:
        options:
          default: false
          suffix: "&f[&eVIP&f] "
          weight: "100"
        inheritance:
        - A
        permissions:
        - modifyworld.*

    Okay, we've now got our permission groups setup, the next thing to do is to add the required EZRanksPro permission node to them, so the plugin knows what rank to rank you up to. The permission node is "ezranks.rank.<rank>", and it can be found on the EZRanksPro plugin page. The <rank> placeholder should be replaced by the section name in your EZRanksPro rankups.yml file (we'll get to that later). I also just added a random permission node to the VIP group, this is where you'd put your donator perks.

    Code (Text):
    groups:
      A:
        options:
          default: true
          prefix: "&f[&aA&f] "
          weight: "4"
        inheritance:
        - null
        permissions:
        - modifyworld.*
        - ezranks.rank.A
      B:
        options:
          default: false
          prefix: "&f[&bB&f] "
          weight: "3"
        inheritance:
        - A
        permissions:
        - ezranks.rank.B
      C:
        options:
          default: false
          prefix: "&f[&cC&f] "
          weight: "2"
        inheritance:
        - B
        permissions:
        - ezranks.rank.C
      D:
        options:
          default: false
          prefix: "&f[&dD&f] "
          weight: "1"
        inheritance:
        - C
        permissions:
        - ezranks.rank.D
      VIP:
        options:
          default: false
          suffix: "&f[&eVIP&f] "
          weight: "100"
        inheritance:
        - A
        permissions:
        - essentials.fly

    Okay, we're essentially done with the permissions.yml file, now, we can move over to EZRanksPro.

    If you are going to have multiple groups (for donors, staff, etc) you'll need to change this to true in the EZRanksPro configuration file. This tells the plugin to ONLY look inside of your primary permission group for the rankup information (the ezranks.rank.<rank> permission node).

    Code (Text):
    check_primary_group_for_available_rankup: true

    Alright, so, now you're ready to create (well, edit) your rankups.yml file.

    Code (Text):
    # EZRanksPro rankups.yml file
    # Create your rankups in this file.
    # If you need a default template, delete the rankups: section and
    # let it regenerate an example rankup.
    #
    # rankup_actions are a list of
    # actions which will be executed
    # when a player successfully ranks up
    #
    # You must include required arguments
    # <required>, (optional)
    # rankup_action list:
    # [consolecommand] <command> - perform a console command
    # [playercommand] <command> - make the player perform a command
    # [message] <message> - send the player a message
    # [broadcast] <message> - send the server a message
    # [jsonmessage] <json>- send the player a json message
    # [jsonbroadcast] <json> - send the server a json message
    # [actionbarmessage] <message> - send the player an actionbar message
    # [actionbarbroadcast] <message> - send the server an actionbar message
    # [addgroup] <group> (world) - add the player to a permissions group
    # [removegroup] <group> (world) - remove the player from a permissions group
    # [addpermission] <permission> (world) - add a permission node to the player
    # [removepermission] <permission> (world) - remove a permission node from a player
    # [setprefix] <prefix> - set the players prefix
    # [setsuffix] <suffix> - set the players suffix
    # [effect] <effect> - play an effect at the players location
    # [sound] <sound> <volume> <pitch> - play a sound at the players location
    #
    # You can delay any of the rankup actions being performed by ending the action with
    # <delay=(time in seconds)>
    # example:
    # [consolecommand] eco give %player% 100 <delay=10>
    #
    # Placeholders can be used in your rankup actions and messages:
    #
    # %player% - players name
    # %displayname% - players displayname
    # %world% - players current world
    # %rank% - players current rank
    # %rankup% - players next rank (if they have one)
    # %cost% - cost to rankup
    # %cost_formatted% - formatted cost to rankup
    # %balance% - players balance
    # %balance_formatted% - players formatted balance
    # %difference% - amount still needed
    # %difference_formatted% - formatted amount still needede
    # %progress% - rounded progress % based on cost - balance
    # %progressexact% - exact progress % based on cost - balance
    # %progressbar% - custom progressbar based on cost - balance
    # %rankprefix% - players current rank prefix defined in this file
    # %rankupprefix% - players next rank prefix defined in this file
    # %lastrank% - last rank available
    # %lastrankprefix% - last rank available prefix
    # %rankup_cost_<rankname>% - show the cost for a specific rank
    # %rankup_cost_formatted_<rankname>% - show the formatted cost for a specific rank
    # %rankup_is_completed_<rankname>% - show if a player has completed the specified rank

    last_rank:
      rank: Z
      prefix: '&8[&bZ&8]'
    requirement_message:
    - '&8&m------------'
    - '&cYou need &a$&f%cost% &cto rankup to %rankupprefix%'
    - '&8&m------------'
    rankups:
      A:
        order: 1
        prefix: '[A]'
        rankup_to: B
        cost: 1000.0
        rankup_actions:
        - '[broadcast] &6&l>&b&l> &6%player% &eranked up to &7[&e&l%rankup%&7]'
        - '[addgroup] %rankup%'
        - '[removegroup] %rank%'
     

    Okay, so, in this tutorial, I'm only going to be creating a rankup from A to B. You should be able to get it from there. If not, I've included a video tutorial at the end of this wiki/tutorial.

    We're going to analyse the rankups section bit by bit.

    Code (Text):
    rankups:
      A:
        order: 1
        prefix: '[A]'
        rankup_to: B
        cost: 1000.0
        rankup_actions:
        - '[broadcast] &6&l>&b&l> &6%player% &eranked up to &7[&e&l%rankup%&7]'
        - '[addgroup] %rankup%'
        - '[removegroup] %rank%'

    The first thing, the section name.
    • A: - This is the name of the section and will hold any rankup information for the A group. This is where the ezranks.rank.A gets the rank information from.
    • order: 1 - This is the order of the rankup, it goes it counting order, so, from 1 to 2 to 3 and so on. You want to make sure that your rank order follows this pattern.
    • rankup_to: B - This is the name of the PermissionsEx group that you will be ranked up into once you meet all of the selected requirements.
    • cost: 1000.0 - This is the cost of the rank. This is how much the player will need to have in his balance in order to rankup. The plugin uses Vault here, so, this is why you need a Vault supported economy plugin.
    • rankup_actions: - This tells the plugin what to do when the player SUCCESSFULLY ranks up from this group. You can add anything from the supported list here, but, it is very important that you add [addgroup] and [removegroup].
    • [addgroup] - Adds, not sets the player into another PermissionsEx group. The %rankup% placeholder will be replaced with the groups name as defined in rankup_to.
    • [removegroup] - This removes the player from the defined group within PermissionsEx. The %rank% placeholder will be replaced with the group name that they are currently in. It's recommended that you do it this way, and not with console commands.
    So, repeating these steps to create our other groups should look like this. Remember, I'm only creating 1 more, you should be able to do the rest.

    Code (Text):
    rankups:
      A:
        order: 1
        prefix: '[A]'
        rankup_to: B
        cost: 1000.0
        rankup_actions:
        - '[broadcast] &6&l>&b&l> &6%player% &eranked up to &7[&e&l%rankup%&7]'
        - '[addgroup] %rankup%'
        - '[removegroup] %rank%'
      B:
        order: 2
        prefix: '[B]'
        rankup_to: C
        cost: 5000.0
        rankup_actions:
        - '[broadcast] &6&l>&b&l> &6%player% &eranked up to &7[&e&l%rankup%&7]'
        - '[addgroup] %rankup%'
        - '[removegroup] %rank%'
     

    Alright, we're almost done, just a few things left inside of this file. We're going to analyse it one by one, again.

    Code (Text):
    last_rank:
      rank: Z
      prefix: '&8[&bZ&8]'
    requirement_message:
    - '&8&m------------'
    - '&cYou need &a$&f%cost% &cto rankup to %rankupprefix%'
    - '&8&m------------'
    • last_rank - The section which defines all the settings for the last rank.
    • rank: Z - This is the name of the PermissionsEx group that the player will need to be in for the plugin to recognise it as the last rank.
    • prefix: '&8[&bZ&8]' - What the chat prefix of the rank will be (if you enable it in the EZRanksPro config)
    • requirement_message: - The message that will be sent to the player when they try and rankup, but cannot afford it. The %cost% placeholder will be replaced with the amount of money it costs to actually rankup. The %rankupprefix% placeholder will be replaced with the prefix of the rank (defined in EZRanksPro) that the player is trying to rankup to.
    Okay, we're done. Now, here is an important note to remember when dealing with PermissionsEx group commands.

    You want to use the add command to add them to a group, rather than the set command, which sets their group.

    • /pex user <player> group add <group> - This is the command that you want to use. Replace <player> with the players name and <group> with the groups name.
    Still confused? Here is a semi in-depth video tutorial!



    I use PermissionsEx here, too

    If I'm not mistaken, THIS file should work. It's not been tested, so, please report back with any issues.

    Hope I was able to help!
  • Loading...
  • Loading...