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

Help code plugin random Chest

Discussion in 'Plugin Help' started by girlx189, Aug 15, 2018.

?

Hi

Poll closed Aug 18, 2018.
  1. Sorry

    1 vote(s)
    100.0%
  2. Srr

    0 vote(s)
    0.0%
Multiple votes are allowed.
  1. girlx189

    girlx189 Spider

    Messages:
    10
    How to generate a chest on random coordinates?
    PHP:
    <?php

    namespace chest;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\command\CommandSender;

    class 
    Main extends PluginBase{
        
        public function 
    onEnable(){
            
    $this->getLogger()->info("[Chest]");
        }
        public function 
    onCommand(CommandSender $senderCommand $command$label, array $args){
            if(
    $cmd->getName() == "chest"){
             
    $x rand(1,100);
              
    $y rand(80,100);
                
    $z rand(1,100);
           
    $sender->getServer()->broadcastMessage("[Chest] create random chest cordinants : ( X -> $x ) ( Y -> $y ) ( Z -> $z ) ")
               
       }

    }
    }
     
  2. corytortoise

    corytortoise Skeleton

    Messages:
    825
    GitHub:
    corytortoise
    Look at PMMP's method of doing this.
     
  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.