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

My plugin dosn't work

Comments in 'Plugin Development' started by Kiosek, Jun 19, 2015.

  1. Kiosek
    Offline

    Kiosek New Member

    Joined:
    Jun 17, 2014
    Posts:
    34
    Minecraft User:
    Cecil107
    PHP:
    <?php

    namespace HText;

    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\Command;
    use 
    pocketmine\commander;
    use 
    pocketmine\event\Listener;\CommandSender;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\Player;
    use 
    pocketmine\level\position;

    class 
    Main extends PluginBase implements Listener{
       
        public function 
    onDisable() {
          
    $this->getLogger()->info("Offline!"); 
        }

    private 
    $particles = [];

    public function 
    onEnable(){
      
    $this->getServer()->getPluginManager()->registerEvents($this$this);
      
    $this->particles[] = new FloatingTextParticle(new Vector3($player->getX(), $player->getY(), $player->getZ()), ""TextFormat::GREEN "Welcome back!");
    }

    public function 
    onPlayerJoin(PlayerJoinEvent $event){
      foreach(
    $this->particles as $particle){
       
    $event->getPlayer()->getLevel()->addParticle($particle, [$event->getPlayer()]);
      }
    }

    }
    name: H-Text
    main: Cecil107\Main
    version: 0.1
    api: [1.0.0]
    author: Cecil107
  2. Anton Magsino
    Offline

    Anton Magsino Active Member

    Joined:
    Jan 17, 2014
    Posts:
    58
    Minecraft User:
    MinecrafterPH
    1. Your main in plugin.yml is different from the namespace.
    2. Add
    PHP:
    use pocketmine\math\Vector3;
    use 
    pocketmine\level\particle\FloatingTextParticle;
    use 
    pocketmine\level\particle\Particle;
    3. You doubled your Listener.
    4. There's no such thing as
    PHP:
    use pocketmine\commander;
    Last edited: Jun 19, 2015
    PEMapModder and Kiosek like this.
  3. Creeperface
    Offline

    Creeperface Notable Member Plugin Developer

    Joined:
    Nov 8, 2014
    Posts:
    1,346
    Plugins:
    4
    Minecraft User:
    CreeperFace
    nevypadá že by ses PHP věnoval rok :D

Share This Page

Advertisement