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

How to remove all floatingtextparticles in the world

Comments in 'Plugin Development' started by Valeron, Mar 11, 2016.

  1. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    I used search.... But it is not for me
  2. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    Without FloatingTextParticle.php i use timer task
  3. XxD7omGamer
    Offline

    XxD7omGamer New Member

    Joined:
    Jun 28, 2015
    Posts:
    38
    Minecraft User:
    XxD7omGamer
    Restart server :/
  4. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    PHP:
    public function addParticle($text){
               foreach(
    $this->getServer()->getLevelByName("world")->getPlayers() as $p){
               
    $x = -797;
               
    $y 6;
               
    $z = -1093;
               if(
    $this->== 0){
               
    $this->i++;
               
    $this->particle = new FloatingTextParticle(new Vector3($x$y$z), $text"HungryGames");
               
    $p->getLevel()->addParticle($this->particle);
               } else {
               
    $this->particle->setInvisible(true);
                
    $p->getLevel()->addParticle($this->particle);
                
    $this->0;
                }
               }
             }
    It works for one player. I try to delete all particles.
    When join second player. Result:

    Attached Files:

  5. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    When i try:
    PHP:
    public function addParticle($text){
               foreach(
    $this->getServer()->getLevelByName("world")->getPlayers() as $p){
               
    $x = -797;
               
    $y 6;
               
    $z = -1093;
               if(
    $this->== 0){
               
    $this->i++;
               
    $this->particle = new FloatingTextParticle(new Vector3($x$y$z), $text"HungryGames");
               
    $p->getLevel()->addParticle($this->particle,array($p));
               } else {
               
    $this->particle->setInvisible(true);
                
    $p->getLevel()->addParticle($this->particle,array($p));
                
    $this->0;
                }
               }
             }
    When join second player(result):

    Attached Files:

  6. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    It is timer task function
  7. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    If you're experiencing overlapping issues, use
    PHP:
    Level::addParticle($particle, [$player]);
    So when a player joins, add the particle and use the player from that event in the second parameter of the addParticle method.
    Last edited: Mar 12, 2016
  8. ImagicalGamer
    Offline

    ImagicalGamer Active Member

    Joined:
    Feb 25, 2016
    Posts:
    141
    Minecraft User:
    ImagicalGamer
    One question. Why is it called "HungryGames"? Shouldn't it be "HungerGames"?
  9. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    You shouldn't go off topic, the answer of that question will not be useful for future readers.
  10. ImagicalGamer
    Offline

    ImagicalGamer Active Member

    Joined:
    Feb 25, 2016
    Posts:
    141
    Minecraft User:
    ImagicalGamer
    I apologize.
  11. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    Error: second parametr must be an array
  12. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    Remove particle as created?
  13. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    Errors
    Deprecated: Non-static method pocketmine\level\Level::addParticle() should not be called statically in /root/Genisys/plugins/sg/src/load/mclass.php on line 106 [05:02:08] [Server thread/CRITICAL]: Could not execute task load\Task: Argument 2 passed to pocketmine\level\Level::addParticle() must be of the type array, object given, called in /root/Genisys/plugins/sg/src/load/mclass.php on line 106 [05:02:08] [Server thread/CRITICAL]: TypeError: "Argument 2 passed to pocketmine\level\Level::addParticle() must be of the type array, object given, called in /root/Genisys/plugins/sg/src/load/mclass.php on line 106" (EXCEPTION) in "/src/pocketmine/level/Level" at line 516 p
  14. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    Cool.... Too errors)
  15. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    Level::addParticle() is a nonstatic method. Lambo just told you the function. You should use it upon a level object.
    PocketKiller and Lambo like this.
  16. Lambo
    Offline

    Lambo Notable Member Plugin Developer

    Joined:
    Sep 14, 2013
    Posts:
    431
    Plugins:
    4
    Minecraft User:
    Lambo
    I updated my code to support the array type. Weird that they use that, because in the code of the method they even check if it's an array or just a player.
    Also, it's a non-static method. Meaning that you have to call it on a Level object.
  17. PocketKiller
    Offline

    PocketKiller Notable Member

    Joined:
    Jul 20, 2015
    Posts:
    741
    ... You should do it when a player joins, would be better of course.
  18. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    I wanna create particle as hypixel. It is not for me events...
  19. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    Nobody wont create this plugin.
  20. Valeron
    Offline

    Valeron New Member

    Joined:
    Aug 26, 2015
    Posts:
    111
    Minecraft User:
    DarkSpive
    I tried to create this plugin in my hungryGames plugin :)

Share This Page

Advertisement