Find command by permission

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the community!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

Status
Not open for further replies.

Inferno

Member
Feb 2, 2017
20
0
0
Skript Version: Skript 2.2 (dev20)
Skript Author: None, this is another question
Minecraft Version: 1.10
---

Is it at all possible to find a command based on a permission node? For example, the command /help has the permission essentials.help. When a player types /help, it sends the player the permission node essentials.help.

Addons using (including versions):
SkQuery 3.5.1 (Gatt version), MundoSk 1.7.2, SkUtilities 0.8.8, ExertSk 0.1.3b, SharpSk 1.5.8, SkRayFall 1.9.5

Have you tried searching the docs? Yes
Have you tried searching the forums? Yes
What other methods have you tried to fix it? None
 
If you want to see the permission for a command you can use TuSKe:
code_language.skript:
[the] permission of command %string%
command %string%'[s] permission
Example:
code_language.skript:
command "essentials:help"'s permission #should return: essentials.help
 
If you want to see the permission for a command you can use TuSKe:
code_language.skript:
[the] permission of command %string%
command %string%'[s] permission
Example:
code_language.skript:
command "essentials:help"'s permission #should return: essentials.help
Thank you, but what about the other way around? To find a command by a permission I mean.
 
Thank you, but what about the other way around? To find a command by a permission I mean.
Ah, here is a workaround for that:
code_language.skript:
function cmdByPerm(perm: string) :: string:
    set {_commands::*} to all registered commands
    loop {_commands::*}:
        if command loop-value's permission is {_perm}:
            return loop-value
Example:
code_language.skript:
set {_command} to cmdByPerm("essentials.help") #should return the "essentials:help" command
 
Ah, here is a workaround for that:
code_language.skript:
function cmdByPerm(perm: string) :: string:
    set {_commands::*} to all registered commands
    loop {_commands::*}:
        if command loop-value's permission is {_perm}:
            return loop-value
Example:
code_language.skript:
set {_command} to cmdByPerm("essentials.help") #should return the "essentials:help" command
Alright, one last question. How would I go about finding the description of a command?

And I am getting "{_commands::*} can't be set to 'all registered' commands' because the latter is not an object line 2 "
 
Last edited by a moderator:
Status
Not open for further replies.