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

Solved yaml_parse(): end of stream reached

Discussion in 'Development' started by Bintang Putra, Jun 14, 2017.

  1. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
    This Is my Main Plugin
    PHP:
    <?php

    namespace Chaostix;

    use 
    Chaostix\commands\Commands;
    use 
    Chaostix\providers\Auth\EventListener;
    use 
    pocketmine\network\mcpe\protocol\AddEntityPacket;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\event\Listener;
    use 
    pocketmine\Player;
    use 
    Chaostix\providers\Auth;


    class 
    Main extends PluginBase implements Listener
    {

        public 
    $player "";
        public 
    $rpg;
        private 
    $msg;
        public 
    $commands;
        protected 
    $messages = [];
        public 
    $cfg;
        private 
    $auth;

        public 
    $playerKill;
        public function 
    __construct()
        {
            
    $this->listener = new EventListener();
            
    $this->auth = new Auth();
        }
        public function 
    onEnable()
        {
            
    $this->saveDefaultConfig();
            
    $this->reloadConfig();
            
    $this->getServer()->getPluginManager()->registerEvents($this->listener$this);
            
    $this->auth->Do();
            
    $this->saveDefaultConfig();
        }
    and This is my Auth file
    PHP:
    <?php

    namespace Chaostix\providers;

    use 
    Chaostix\providers\EventListener;
    use 
    pocketmine\command\Command;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\IPlayer;
    use 
    pocketmine\utils\Config;
    use 
    pocketmine\permission\PermissionAttachment;
    use 
    pocketmine\permission\Permission;
    use 
    pocketmine\Player;
    use 
    pocketmine\Server;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\utils\TextFormat;
    use 
    Chaostix\events\Auth\AuthEvent;
    use 
    Chaostix\events\Auth\DeAuth;

    class 
    Auth extends PluginBase{

     
       protected 
    $needAuth = [];
       protected 
    $listener;
       protected 
    $provider;
       protected 
    $blockPlayers 6;
       protected 
    $blockSessions = []; 
       protected 
    $messages = [];
       protected 
    $messageTask null;
        public function Do(){
            
    $this->saveResource("messages.yml"false);
            
    $messages = (new Config($this->getDataFolder() . "messages.yml"))->getAll();
            
    $this->messages $this->parseMessages($messages);
            
    $registerCommand $this->getCommand("sm");
            
    $registerCommand->setUsage("/sm {argument}");
            
    $registerCommand->setDescription("AUTH");
            
    $registerCommand->setPermissionMessage("TEST");
            
    $provider = new YAMLDataProvider($this);
           
    $this->provider $provider;

            foreach(
    $this->getServer()->getOnlinePlayers() as $player){
                
    $this->DeAuth($player);
            }
        }
     
  2. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
    My Fault, Its working now
     
  3. InspectorGadget

    InspectorGadget Zombie Pigman

    Messages:
    462
    GitHub:
    InspectorGadget
    Bagus xD // Good
     
  4. Lowkey

    Lowkey Slime

    Messages:
    94
    I know it isn't relevant, but why do you have two classes extending PluginBase?
     
    Sandertv likes this.
  5. Bintang Putra

    Bintang Putra Witch

    Messages:
    63
    GitHub:
    chaostixzix
    i've already edited it on my plugins.
    i thought if i extend pluginbase, i can use getServer() method. i was wrong
     
  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.