Bypassing Permissions #237


Open
  • yeldnil0 created this issue Nov 3, 2020

    I'm not sure if this is a "working as intended" issue and I'm misunderstanding something, but is there a way to give a player permission to use a mycommand that uses a minecraft command if the player doesn't have access to the minecraft command?

  • yeldnil0 posted a comment Nov 3, 2020

    For contextual purposes, I thought that I might need to give an example:

    I don't want players to have access to the /tp command, but I want them to be able to use /worldspawn, which is a mycommand custom command and will /tp them to a specific part of the world.

     

    Currently, I have a workaround, using RUN_CONSOLE and using $player to run the command, but I need to be able to bypass the permission in order to perform some of the functions that I'd like to use on my server.

     

    In the most specific context that I'm currently working with, this is my code:

    hearthstone:
    command: /hearthstone
    type: RUN_COMMAND
    runcmd:
    - $Script$%if%$world==CentralHub
    - /home CentralHub
    - $Script$%else%
    - $Script$%if%$world==EasyWorld
    - /home EasyWorld
    - $Script$%else%
    - $Script$%if%$world==NormalWorld
    - /home NormalWorld
    - $Script$%else%
    - $Script$%if%$world==HardWorld
    - /home HardWorld
    - $Script$%else%
    - $text$You are not on a world that allows this command. $world
    register: true

    This works fine if the player has the /home permission, but I don't want the player to blanketly have that command or they'd be able to set either multiple homes in one world or be able to set homes in worlds that they shouldn't be allowed to set homes in.


    Edited Nov 3, 2020
  • Sxxshingekinokyojinxxs posted a comment Nov 6, 2020

    I may have a work around in mind where you add perms in the beginning and remove them at the end using $player (I doubt anyone will figure there's a small window of opportunity to sethome, or even be able to physically time it), with one tick delays if needed. But also, shouldn't there be a separate permission node for "sethome" and just "home"? I'm not sure why a /home permission would let people /sethome (name) 

  • yeldnil0 posted a comment Nov 6, 2020

    Oh, I guess that you're right. The /home command should be free to use, but the /sethome should be regulated. I guess I should've posted the code for that one instead, ha ha. And so you're saying that I could just run a RUN_CONSOLE and use that to grant them the permission node, have them run the command, and then remove the permission?

  • Sxxshingekinokyojinxxs posted a comment Nov 6, 2020

    ye like have the add command at the top and have it remove it at the end. If things aren't working right, try adding $delay$<1> before the command. for example '$delay$<1>/perm user add node' which will add a 1 tick delay. You probably won't need to use that. For some reason I gotta for almost all my commands. So try it without first. Then at the end, have a command to remove the node. I very much doubt any player will be able to fit in a command between a twentieth or fifteenth of a second or that they'd know how the thing works and try it. If they do, then they will just have to end up removing a sethome if they want to use that command you got there. Very unlikely. I'm not sure if there's a better way to do it, but you'll probably have to use this work around in the meantime


To post a comment, please login or register a new account.