Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

[FloatingTextParticle] setInvisible doesn't work ???

Comments in 'Plugin Development' started by LCraftPE, Oct 9, 2016.

  1. LCraftPE
    Offline

    LCraftPE New Member

    Joined:
    Nov 16, 2014
    Posts:
    30
    Minecraft User:
    LCraftPE
    Hello,
    I try to make invisible the FloatingTextParticles when a player changes his world but it does not work....

    The Main :

    PHP:
    public $holos = array();

    public function 
    TaskText($joueur){
       
    $particle1 = new FloatingTextParticle(new Vector3(10313129), "message""title");
       
    $this->holos[$joueur->getName()] = $particle1;

       
    $this->getServer()->getDefaultLevel()->addParticle($particle1);
    }
    public function 
    onPlayerPreLogin(PlayerPreLoginEvent $event){
       
    $player $event->getPlayer();

       
    $this->getServer()->getScheduler()->scheduleRepeatingTask(new TaskText($this$player), 200);
    }

    public function 
    onLevelChange(EntityLevelChangeEvent $event){
       
    $player $event->getEntity();
       
    $particle1 $this->holos[$player->getName()];

       if(
    $player instanceof Player){
         
    $world $event->getTarget()->getName();
         if(!
    $world == "world"){
           
    $particle1->setInvisible(true);
           
    $this->getServer()->getDefaultLevel()->addParticle($particle1);
         }else{
           
    $particle1->setInvisible(false);
           
    $this->getServer()->getDefaultLevel()->addParticle($particle1);
         }
       }
    }
    The Task :

    PHP:
      public function __construct(Main $ownerPlayer $player){
        
    parent::__construct($owner);
        
    $this->owner $owner;
        
    $this->player $player;
      }

      public function 
    onRun($currentTick){
        
    $this->owner->TaskText($this->player);
      }
    Last edited: Oct 11, 2016
  2. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    After every change of the particle you need to respawn it
  3. LCraftPE
    Offline

    LCraftPE New Member

    Joined:
    Nov 16, 2014
    Posts:
    30
    Minecraft User:
    LCraftPE
    What do you mean by that ? :)
  4. LCraftPE
    Offline

    LCraftPE New Member

    Joined:
    Nov 16, 2014
    Posts:
    30
    Minecraft User:
    LCraftPE
    I do that but it does not change anything... Look :
    PHP:
    $particle1->setInvisible(true);
    $this->getServer()->getDefaultLevel()->addParticle($particle1);
  5. LCraftPE
    Offline

    LCraftPE New Member

    Joined:
    Nov 16, 2014
    Posts:
    30
    Minecraft User:
    LCraftPE

Share This Page

Advertisement