Permission Node Max

Discussion in 'Plugin Development' started by Dai_Kunai, Mar 24, 2022.

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

    Dai_Kunai

    So I have need of a permission node that is something like friends.max.30, or whatever the maximum is. I need it to be easily reactable so that if the permission node is changed the plugin realizes this and changes some info pretty fast after, but it doesn't have to be the instant after. I was considering having a timer going through every player's permission nodes every second or so and grabbing it. I'm pretty sure this would work but is there any better way?

    Thanks,
    DaiKunai
     
  2. Offline

    CraftCreeper6

    @Dai_Kunai
    No need to grab it every few seconds, just check it whenever they try to add a new friend.
     
  3. Offline

    Dai_Kunai

    Wow, fast response...

    The problem is that I need to show the correct value in the list in chat if the value is changed. That makes sense for general functionality but not for this one little special case.

    Also, do I need to cancel the task on the onDisable later, or is it okay to just leave it running and it will cancel on it's own?
     
  4. Offline

    CraftCreeper6

    @Dai_Kunai
    Good practice to cancel it.

    How do you add these new permissions?
     
  5. Offline

    Dai_Kunai

    These are permissions each server admin should be adding to a role or player, giving it to the player. To be honest it's not that big a deal if it doesn't update, but my own pride is making me want to make it update even for players who are offline, which seems to be a problem. You can't check permissions of an OfflinePlayer, as I just noticed.

    Perhaps I would have to hook into Vault then...
     
  6. Offline

    CraftCreeper6

    @Dai_Kunai
    If they add the permissions with a command then you could catch the command and update it like that.
     
  7. Offline

    Dai_Kunai

    do I have to use the player getEffectivePermissions to see all of a player's permissions?
     
  8. Offline

    CraftCreeper6

    @Dai_Kunai
    If you use another plugin to handle permissions then use the Vault API to interface with it (provided that it's supported by Vault).
    Otherwise use player#getEffectivePermissions().
     
Thread Status:
Not open for further replies.

Share This Page