1. The forums will be archived and moved to a read only mode in about 2 weeks (mid march).

How can i remove a command on /help list?

Discussion in 'Help' started by LewBr, Jan 28, 2018.

  1. LewBr

    LewBr Zombie

    Messages:
    385
    GitHub:
    lewbr
    Hello i have recently created commands for staff members on my server but even if the player is not a staff member by my plugin they can show the list of commands on /help that i don't want that they see, so how can i remove of the list if the player don't have a permission or a group on database?
    My code for creating commands looks like this:

    Main.php
    PHP:
    $this->getServer()->getCommandMap()->register('cmdtest', new cmdtestfile('cmdtest'$this));
    cmdtestfile.php
    PHP:
    <?php
    namespace server\commands;

    use 
    pocketmine\command\defaults\VanillaCommand;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\Player;

    class 
    cmdtestfile extends VanillaCommand {
        public function 
    __construct($name$plugin) {
            
    parent::__construct($name"cmdtest""cmdtest <bla bla>");
            
    $this->plugin $plugin;
        }

        public function 
    execute(CommandSender $senderstring $currentAlias, array $args) : bool  {      
          
        }

    }
     
  2. Kenn Fatt

    Kenn Fatt Slime

    Messages:
    82
    GitHub:
    kennfatt
    I think we can't.
    But with older PocketMine-MP its working fine. If they don't have permission, they would'nt see a command that they can't execute on help list.

    Im not sure if it possible to handle '/' when player type it, because its like client's side function right now.
     
  3. Sardilla

    Sardilla Creeper

    Messages:
    2
    Use a custom help plugin but you have to modify it one by one and you can remove anything from /help
    :)
     
  4. kenygamer

    kenygamer Banned Banned

    Messages:
    106
    GitHub:
    kenygamer
    You are not showing us the full code.

    Try
    PHP:
    ...

      if(!
    $sender->hasPermission("permission.node")){
        
    $sender->sendMessage("You do not have permission to use this command");
        return 
    true;
      }
     
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.