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 FloatingTextParticle after few seconds

Comments in 'Plugin Development' started by MikkiMCPE, May 29, 2016.

  1. MikkiMCPE
    Offline

    MikkiMCPE Active Member

    Joined:
    May 16, 2015
    Posts:
    125
    Minecraft User:
    MikkiMC
    hello!

    i make new plugin about FloatingTextParticle.
    my question is, how to remove FloatingTextParticle after few second appear?

    thanks
  2. andre_the_gamer
    Offline

    andre_the_gamer Active Member

    Joined:
    Feb 5, 2015
    Posts:
    112
    Minecraft User:
    Andre_The_Gamer
    Here
  3. MyNameIsTriXz
    Offline

    MyNameIsTriXz Notable Member

    Joined:
    Aug 17, 2015
    Posts:
    538
    Minecraft User:
    MyNameIsTriXz
    PHP:
    <?php

    namespace ServerCore;

    use 
    pocketmine\event\Listener;

    use 
    pocketmine\plugin\PluginBase;

    use 
    pocketmine\event\player\PlayerChatEvent;
    use 
    pocketmine\event\player\PlayerMoveEvent;
    use 
    pocketmine\event\player\PlayerDeathEvent;
    use 
    pocketmine\event\player\PlayerJoinEvent;
    use 
    pocketmine\event\player\PlayerCommandPreprocessEvent;
    use 
    pocketmine\event\player\PlayerInteractEvent;

    use 
    pocketmine\level\particle\FloatingTextParticle;

    use 
    pocketmine\network\protocol\ExplodePacket


    use 
    pocketmine\nbt\tag\IntTag;
    use 
    pocketmine\nbt\tag\CompoundTag;
    use 
    pocketmine\nbt\NBT;

    use 
    pocketmine\item\Item;

    use 
    pocketmine\math\Vector3;

    class 
    Main3 extends PluginBase implements Listener{



    public 
    $holos = [];
    public 
    $animation = [];
    public 
    $pack = [=> [0x000000000x00ffffff0x00ffffff0x00ffffff], => [0x00ffffff0x000000000x00ffffff0x00ffffff], => [0x00ffffff0x00ffffff0x000000000x00ffffff], => [0x00ffffff0x0fffffff0x00ffffff0x00000000]];


    public function 
    onEnable(){
    $this->getServer()->getPluginManager()->registerEvents($this$this);
    }




    public function 
    onChat(PlayerChatEvent $event){

    if(
    $event->getMessage() == "c"){




    }}











    public function 
    onJoin(PlayerJoinEvent $event){
    $this->spawnParticle($player $event->getPlayer());
    }



    public function 
    onMove(PlayerInteractEvent $event){
    $player $event->getPlayer();

    /* $player->teleport($player->getLocation(), rad2deg(atan2(136 - $player->z, 136 - $player->x)) - 90, 0); */


    }



    public function 
    onDeath(PlayerDeathEvent $event){
    if(isset(
    $this->holos[$event->getEntity()->getName()])){
    $this->despawnParticle($p $event->getEntity());
    }}



    public function 
    spawnParticle($player){


    $holo = new FloatingTextParticle(new Vector3(1406140), "§fBomb§cLobber\n§eOne§6In§eThe§6Chamber\n§9Turf§dWars\n§cBed§fWars""§aHere you find:");
    $player->getLevel()->addParticle($holo, [$player]);

    $this->holos[$player->getName()] = $holo;


    }




    public function 
    despawnParticle($player){

    $particle $this->holos[$player->getName()];

    unset(
    $this->holos[$player->getName()]);

    $particle->setInvisible(true);

    foreach(
    $particle->encode() as $pk){
    }}






    }

Share This Page

Advertisement