Setting Max'es via Permissions (Read for better expl.)

Discussion in 'Plugin Development' started by hskrasek, Aug 1, 2012.

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

    hskrasek

    So I am wondering what is the best native way to do maximums or limits via permissions, for example if I want to have someone have a limit of 5 plots I could give them the permission node:

    plots.max.5

    How would I read that and get the 5 from permission node via code? Also how would i register the plots.max.# permission node in my plugin.yml so that any number would be a valid permission that the server recognized.
     
  2. Offline

    ELCHILEN0

    I would do something such as this. First get how many plots the current user already has. Then add one to that and add that number to a string or your permission node. Here is a quick example of how I would do it.
    Code:
    if(player.hasPermission("plots.max." + customPlayerData.getTotalPlots()))
      // If True
    else
      // If False
    Hope this helps!
     
Thread Status:
Not open for further replies.

Share This Page