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

Hide noPerm Commands

Discussion in 'Development' started by BLOCKSTORM, Mar 29, 2018.

  1. BLOCKSTORM

    BLOCKSTORM Witch

    Messages:
    67
    Hello,
    i found an old plugin on Github what do exactly what stands in the title. But how i said, its very old. I fixed it as far as i can, but here i need help.
    PHP:
    public function onSendPacket(DataPacketSendEvent $event){
            
    $packet $event->getPacket();
            
    $player $event->getPlayer();
            if(
    $packet instanceof AvailableCommandsPacket){
                
    $data = [];
                foreach(
    $this->plugin->getServer()->getCommandMap()->getCommands() as $command){
                    if(
    $player->hasPermission($command->getPermission())){
                        if(
    count($cmdData $command->generateCustomCommandData($player)) > 0){
                            
    $data[$command->getName()]["versions"][0] = $cmdData;
                        }
                    }
                }
                if(
    count($data) > 0){
                    
    $packet->commands json_encode($data);
                }
            }
        }

    This is the code to hide the commands
    And here is the error:
    Code:
    [17:02:35] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\server\DataPacketSendEvent' to 'BefehleVersteckenxD v1': Call to undefined method pocketmine\command\defaults\HelpCommand::generateCustomCommandData() on MrDoni98\HideExcess                                                           [17:02:35] [Server thread/CRITICAL]: Error: "Call to undefined method pocketmine\command\defaults\HelpCommand::generateCustomCommandData()" (EXCEPTION) in "HideExcess-master/src/MrDoni98/HideExcess" at line 25 
    Please write here if you have any idea how to fix :p
     
  2. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    generateCustomCommandData Isn’t define
     
  3. Teamblocket

    Teamblocket Zombie

    Messages:
    301
    GitHub:
    teamblocket
    It's not a method therefore you have to create that method
     
  4. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    Ik that what I said
     
  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.