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

Command

Discussion in 'Development' started by KevTastisch, Apr 7, 2018.

  1. KevTastisch

    KevTastisch Creeper

    Messages:
    4
    Hey Guys!
    I have a question, i want to code a command and i dont know how i did it if a player usw the command second he disable the Commando...

    Also if i make command if the Sender use the command, he can build and break Blocks but when he use the Command again he dont can build and break Blocks but how can i say if the player use the Command again, than ... You know what i mean? XD
    Thanks for answers
    Bye
     
  2. Daniktheboss

    Daniktheboss Baby Zombie

    Messages:
    144
    GitHub:
    daniktheboss
    Speak English please
     
    Angel, PixelzChris and Muqsit like this.
  3. QuiverlyRivalry

    QuiverlyRivalry Zombie Pigman

    Messages:
    491
    GitHub:
    quiverlyrivalry
    wut
     
  4. @KevTastisch Meep, want to cmmd an get it 2nwurk withd mord Dan on persun.. lol
     
  5. BalAnce

    BalAnce Silverfish

    Messages:
    22
    GitHub:
    YaBoiBalAnce
    I think he wants a command that allow him to disable or enable block breaking? Very complicated way he explained it but thats the just of it.
     
  6. Palente

    Palente Slime

    Messages:
    75
    GitHub:
    palente
    he can create a config to store if the player is able to build and break
    And to check if he can in event
    PHP:
    public function onPlace(BlockPlaceEvent $event){
    $player $event->getPlayer();
    $config = new Config($this->getDataFolder()."buildandbreak.yml",Config::YAML);
    #Name the config on what you want
    if($config->get($player->getName()) =="true"){
    return;
    }else{
    $player->sendPopup("You can't build Here");
    $event->setCancelled(true);
    return;
    }
    }
    public function 
    onBreak(BlockBreakEvent $event){
    $player $event->getPlayer();
    $config = new Config($this->getDataFolder()."buildandbreak.yml",Config::YAML);
    #Name the config on what you want
    if($config->get($player->getName()) =="true"){
    return;
    }else{
    $player->sendPopup("You can't break block Here");
    $event->setCancelled(true);
    return;
    }
    }
    I think this could work
     
  7. Daniktheboss

    Daniktheboss Baby Zombie

    Messages:
    144
    GitHub:
    daniktheboss
    Thats not what the OP asked for
     
  8. RUISMINE

    RUISMINE Silverfish

    Messages:
    17
    GitHub:
    thecgaming
    He means that say a player does /b it enables the player to break blocks, then when the player does /b the second time, it enables the player to place blocks again. Sort of like a T flip flop redstone circuit, but in php. (The best example I could give)
     
  9. RUISMINE

    RUISMINE Silverfish

    Messages:
    17
    GitHub:
    thecgaming
    '/b' can be any command
     
  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.