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

Solved Task make players unable to type in chat.

Discussion in 'Development' started by Kyd, Dec 9, 2017.

  1. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    When I Schedule task to spawn particles for players it make players no able to type in chat..

    Task:
    PHP:
    <?php
    namespace Core\Particle\task;
    use 
    Core\Particle\ParticleManager;
    use 
    pocketmine\scheduler\Task;
    class 
    ParticleTickTask extends Task{
     public 
    $plugin;
     public function 
    __construct(ParticleManager $plugin){
           
    $this->plugin $plugin;
     }
     public function 
    onRun($currentTick){
            foreach(
    $this->plugin->particles as $particle){
             
    $particle->tick();
            }
     }
    }
    ParticleManager:
    PHP:
    <?php
    namespace Core\Particle;
    use 
    Core\Loader;
    use 
    Core\Particle\task\ParticleTickTask;
    use 
    Core\Particle\particles\CloudRainParticle;
    use 
    Core\Particle\particles\FireWingsParticle;
    use 
    Core\Particle\particles\DragonHeadParticle;
    use 
    pocketmine\Server;
    class 
    ParticleManager{

     public 
    $particles = [];

     public function 
    __construct(){
      
    $this->registerParticles();
     
    Server::getInstance()->getScheduler()->scheduleRepeatingTask(new ParticleTickTask($this), Loader::getInstance(), 60);
     }
     public function 
    registerParticles(){
              
    $this->particles['cloudrain'] = new CloudRainParticle();
              
    $this->particles['firewings'] = new FireWingsParticle();
              
    $this->particles['dragonhead'] = new DragonHeadParticle();
     }
    }
    CloudRainParticle: (Posted on pastebin because it's really long)
    https://pastebin.com/sSr59BsC
     
  2. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    Player just get freezed.. But particle is spawned
     
  3. Kyd

    Kyd Zombie Pigman

    Messages:
    678
    GitHub:
    boi1216
    Wtf I set Main class instance to scheduleRepeatingTask instead of just time :facepalm: :facepalm: :facepalm: :facepalm: :facepalm:
     
  4. YiPluss

    YiPluss Creeper

    Messages:
    1
    hello
    give me full pls
     
  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.