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

Help me my error

Discussion in 'Plugin Help' started by NutXzG, Apr 8, 2020.

  1. NutXzG

    NutXzG Baby Zombie

    Messages:
    132
    GitHub:
    NutXzG
    Hi, Who some one Help me
    Code:
    2020-04-08 [08:50:21] [Server thread/CRITICAL]: ParseError: "syntax error, unexpected '}'" (EXCEPTION) in "plugins/Stats/src/Nurtzatvchkung/Stat/Task" at line 27
    2020-04-08 [08:50:21] [Server thread/DEBUG]: #0 vendor/pocketmine/classloader/src/BaseClassLoader(124): BaseClassLoader->loadClass(string[24] Nurtzatvchkung\Stat\Task)
    2020-04-08 [08:50:21] [Server thread/DEBUG]: #1 (): BaseClassLoader->{closure}(string[24] Nurtzatvchkung\Stat\Task)
    2020-04-08 [08:50:21] [Server thread/DEBUG]: #2 plugins/Stats/src/Nurtzatvchkung/Stat/Loader(33): spl_autoload_call(string[24] Nurtzatvchkung\Stat\Task)
    2020-04-08 [08:50:21] [Server thread/DEBUG]: #3 src/pocketmine/plugin/PluginBase(115): Nurtzatvchkung\Stat\Loader->onEnable()
    2020-04-08 [08:50:21] [Server thread/DEBUG]: #4 src/pocketmine/plugin/PluginManager(541): pocketmine\plugin\PluginBase->setEnabled(boolean 1)
    2020-04-08 [08:50:21] [Server thread/DEBUG]: #5 src/pocketmine/Server(1783): pocketmine\plugin\PluginManager->enablePlugin(object Nurtzatvchkung\Stat\Loader)
    2020-04-08 [08:50:21] [Server thread/DEBUG]: #6 src/pocketmine/Server(1769): pocketmine\Server->enablePlugin(object Nurtzatvchkung\Stat\Loader)
    2020-04-08 [08:50:21] [Server thread/DEBUG]: #7 src/pocketmine/Server(1582): pocketmine\Server->enablePlugins(integer 1)
    2020-04-08 [08:50:21] [Server thread/DEBUG]: #8 src/pocketmine/PocketMine(273): pocketmine\Server->__construct(object BaseClassLoader, object pocketmine\utils\MainLogger, string[21] /home/mc_39072/17557/, string[29] /home/mc_39072/17557/plugins/)
    2020-04-08 [08:50:21] [Server thread/DEBUG]: #9 src/pocketmine/PocketMine(296): pocketmine\server()
    2020-04-08 [08:50:21] [Server thread/DEBUG]: #10 (11): require(string[90] phar:///usr/share/shareport/exec/mcpe/PocketMine-MP-140.phar/src/pocketmine/Pock)
    My Code
    PHP:
    <?php

    namespace Nurtzatvch\Stat;

    use 
    pocketmine\scheduler\Task;
    use 
    pocketmine\Player;
    use 
    pocketmine\Server;
    use 
    pocketmine\level\particle\FloatingParticle;
    use 
    pocketmine\level\particle\Particle;
    use 
    pocketmine\level\Level;
    use 
    pocketmine\utils\Config;
    use 
    Nurtzatvch\Stat\Loader;

    Class 
    Task extends Task{

                public 
    $load;
                public 
    $text;

        public function 
    __construct(Loader $load){
        
    $this->load $load;
        
    $config = new Config($this->load->getDataFolder() . "config.yml" Config::YAML);
                   if(
    $config->get("enable") === true){
                   
    $x $config->get("x");
                   
    $y $config->get("y");
                   
    $z $config->get("z");
          
    $this->text = new FloatingTextParticle(new Vector3($x$y$z), """");
       
    //line here }
    }

        public function 
    onRun(int $currentTick)
        {
    foreach(
    $this->load->getServer()->getOnlinePlayer() as $sender){
       
    $config = new Config($this->load->getDataFolder() . "config.yml" Config::YAML);
       
    $world $config->get("world");
      
    $level $this->getServer()->getLevelByName("$world");
     
    $join = new Config($this->load->getDataFolder() . "Data/Join/" strtolower($sender->getName()) . ".yml"Config::YAML)->get("Join");
          
    $kill = new Config($this->load->getDataFolder() . "Data/Kill/" strtolower($sender->getName()) . ".yml"Config::YAML)->get("Kill");
          
    $death = new Config($this->load->getDataFolder() . "Data/Death/" strtolower($sender->getName()) . ".yml"Config::YAML)->get("Death");
          
    $chat = new Config($this->load->getDataFolder() . "Data/Chat/" strtolower($sender->getName()) . ".yml"Config::YAML)->get("Chat");
          
    $place = new Config($this->load->getDataFolder() . "Data/Place/" strtolower($sender->getName()) . ".yml"Config::YAML)->get("Place");
          
    $break = new Config($this->load->getDataFolder() . "Data/Break/" strtolower($sender->getName()) . ".yml"Config::YAML)->get("Break");
            
    $this->text->setText("สถิติของคุณ $sender->getName()\nจำนวนการเข้า $join\nจำนวนการฆ่า $kill\nจำนวนการตาย $death\nจำนวนการวางบล็อก $place\nจำนวนการทุบบล็อก $break\nจำนวนการแชท $chat\nจะอัพเดพทุก 2วิ");
            
    $level->addParticle($this->text);
           }
         }
    }
     
    Last edited: Apr 8, 2020
  2. wolfdale

    wolfdale Zombie Pigman

    Messages:
    535
    GitHub:
    diamond-gold
    If you cant even spot the mistake please use an IDE like Phpstorm or Netbeans
    Change //line here } to }
     
  3. NutXzG

    NutXzG Baby Zombie

    Messages:
    132
    GitHub:
    NutXzG
    Default not have //line here
     
  4. wolfdale

    wolfdale Zombie Pigman

    Messages:
    535
    GitHub:
    diamond-gold
    Then use an IDE instead, your code have too many errors
     
  5. HimbeersaftLP

    HimbeersaftLP Fish

    Messages:
    2,402
    GitHub:
    HimbeersaftLP
    Please see what I changed for yourself and try to learn from it
    PHP:
    <?php

    namespace Nurtzatvch\Stat;

    use 
    pocketmine\level\particle\FloatingTextParticle;
    use 
    pocketmine\math\Vector3;
    use 
    pocketmine\scheduler\Task;
    use 
    pocketmine\utils\Config;
    use 
    Nurtzatvch\Stat\Loader;

    class 
    MyTask extends Task {

         private 
    $load;
         
    /** @var FloatingTextParticle  */
         
    private $text;

         public function 
    __construct(Loader $load) {
              
    $this->load $load;
              
    $config = new Config($this->load->getDataFolder() . "config.yml" Config::YAML);
              if (
    $config->get("enable") === true) {
                   
    $x $config->get("x");
                   
    $y $config->get("y");
                   
    $z $config->get("z");
                   
    $this->text = new FloatingTextParticle(new Vector3($x$y$z), """");
              }
         }

         public function 
    onRun(int $currentTick) {
              foreach (
    $this->load->getServer()->getOnlinePlayers() as $sender) {
                   
    $config = new Config($this->load->getDataFolder() . "config.yml" Config::YAML);
                   
    $world $config->get("world");
                   
    $level $this->load->getServer()->getLevelByName("$world");
                   
    $join  = (new Config($this->load->getDataFolder() . "Data/Join/"  strtolower($sender->getName()) . ".yml"Config::YAML))->get("Join");
                   
    $kill  = (new Config($this->load->getDataFolder() . "Data/Kill/"  strtolower($sender->getName()) . ".yml"Config::YAML))->get("Kill");
                   
    $death = (new Config($this->load->getDataFolder() . "Data/Death/" strtolower($sender->getName()) . ".yml"Config::YAML))->get("Death");
                   
    $chat  = (new Config($this->load->getDataFolder() . "Data/Chat/"  strtolower($sender->getName()) . ".yml"Config::YAML))->get("Chat");
                   
    $place = (new Config($this->load->getDataFolder() . "Data/Place/" strtolower($sender->getName()) . ".yml"Config::YAML))->get("Place");
                   
    $break = (new Config($this->load->getDataFolder() . "Data/Break/" strtolower($sender->getName()) . ".yml"Config::YAML))->get("Break");
                   
    $this->text->setText("สถิติของคุณ $sender->getName()\nจำนวนการเข้า $join\nจำนวนการฆ่า $kill\nจำนวนการตาย $death\nจำนวนการวางบล็อก $place\nจำนวนการทุบบล็อก $break\nจำนวนการแชท $chat\nจะอัพเดพทุก 2วิ");
                   
    $level->addParticle($this->text);
              }
         }
    }
     
  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.