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

Predicated Commands

Discussion in 'Development' started by Bluzzi, Dec 18, 2016.

  1. Bluzzi

    Bluzzi Spider Jockey

    Messages:
    46
    Hi guys, I was thinking about something...
    Can we remove the predicated commands on server?
    If we can, how can I do this? Have a nice day, bye

    Image Exemple: http://hpics.li/b6db63f
     
    Last edited: Dec 18, 2016
  2. Dog2puppy

    Dog2puppy Slime

    Messages:
    94
    GitHub:
    colesquared
    applqpak and Magicode like this.
  3. Magicode

    Magicode Baby Zombie

    Messages:
    183
    GitHub:
    magicode1
    I don't think there is a way to do this as of now, but you can change the permissions so that fewer people can use them :)
     
    Bluzzi likes this.
  4. Bluzzi

    Bluzzi Spider Jockey

    Messages:
    46
    Corriger
     
  5. SalmonDE

    SalmonDE Zombie Pigman

    Messages:
    739
    GitHub:
    SalmonDE
    You could try to send an AvailableCommandsPacket to the players which contains only the commands you want the players to see.
     
    applqpak and Bluzzi like this.
  6. Bluzzi

    Bluzzi Spider Jockey

    Messages:
    46
    Possible to have a demonstration of the code please?
     
  7. SalmonDE

    SalmonDE Zombie Pigman

    Messages:
    739
    GitHub:
    SalmonDE
    HimbeersaftLP and applqpak like this.
  8. Bluzzi

    Bluzzi Spider Jockey

    Messages:
    46
  9. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    You mean predicted not predicated?
     
    Last edited: Dec 19, 2016
    Legoboy0215 likes this.
  10. Magicode

    Magicode Baby Zombie

    Messages:
    183
    GitHub:
    magicode1
    No, he meant Predicated. If you look at the definitions, Predicated means to "be the base of" or "affirmed or asserted" commands. He is basically saying the commands that are the base commands for Pocketmine.
     
    Palente likes this.
  11. Legoboy0215

    Legoboy0215 Witch

    Messages:
    64
    GitHub:
    legoboy0215
    I am pretty sure he mean "predicted" :p

    He wants to change the commands that the MCPE client (or in this case the server) "predicted".
     
    Dog2puppy likes this.
  12. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    Oh man, I remember my kindergarten life, when we were taught the difference between subject and predicate.

    Back to the topic..
    Send an empty array of json encoded commands packet to the player (AvailableCommandsPacket).

    But that'll let you not use "/" commands anymore I guess.

    PHP:
       public static function unsendCommandData($player){
            
    $pk = new AvailableCommandsPacket();
            
    $data = new \stdClass();
            
    $pk->commands '';
            
    $commands = [];
            
    //$commands = ['help' => 0]; help command will be in the list of predicted cmds.
            
    foreach(Server::getInstance()->getCommandMap()->getCommands() as $command){
                if (isset(
    $commands[$command->getName()])) {
                    
    $data->{$command->getName()}->versions[0] = $command->generateCustomCommandData($player);
                }
            }
            
    $pk->commands json_encode($data);
            
    $player->dataPacket($pk);
        }
     
    Last edited: Dec 19, 2016
    Dog2puppy and Magicode like this.
  13. SOFe

    SOFe Administrator Staff Member PMMP Team Poggit Admin

    Messages:
    1,968
    GitHub:
    sof3
    Wow I didn't know the word Predicate until I saw it in Java :D
     
    Muqsit and Magicode like this.
  14. Legoboy0215

    Legoboy0215 Witch

    Messages:
    64
    GitHub:
    legoboy0215
    I had no idea until just now.
     
    Magicode likes this.
  15. Dog2puppy

    Dog2puppy Slime

    Messages:
    94
    GitHub:
    colesquared
    We never learned that. But if I remember right, predicate is like a verb right? It's when your doing something? And subject is a noun.
     
    Magicode likes this.
  16. Bluzzi

    Bluzzi Spider Jockey

    Messages:
    46
    I does not understand how used this :/
     
  17. kaliiks

    kaliiks Zombie

    Messages:
    250
    copy it to your plugin and use
    PHP:
    public function onJoin(PlayerJoinEvent $e)
    {
          
    $player $e->getPlayer();
          
    $this->unsetCommandData($player);
    }
     
    Bluzzi likes this.
  18. Muqsit

    Muqsit Chicken

    Messages:
    1,548
    GitHub:
    muqsit
    For real!?
    sx.PNG

    Better use
    PHP:
    self::unsetCommandData($player); //if the function is within the class
    It's static for a reason, give it a static look ;)
     
    Bluzzi and Magicode like this.
  19. Bluzzi

    Bluzzi Spider Jockey

    Messages:
    46
    This code does not work:/
     
  20. kaliiks

    kaliiks Zombie

    Messages:
    250
    ok, you can not do it :D
     
  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.