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

Want help with new API 3.0.0

Discussion in 'Development' started by Nora1903, Jun 12, 2018.

  1. Nora1903

    Nora1903 Slime

    Messages:
    82
    GitHub:
    cuongvnz
    I just use new api 3.0.0 build 1665 instead of 3.0.0alpha12 and my plugin that working in 3.0.0-alpha12 now got error
    Code:
    Fatal error: Declaration of Sergey_Dertan\SClearLagg\SClearLaggMainFolder\SClearLaggMain::__construct() must be compatible with pocketmine\plugin\Plugin::__construct(pocketmine\plugin\PluginLoader $loader, pocketmine\Server $server, pocketmine\plugin\PluginDescription $description, string $dataFolder, string $file) in /home/gs/gs/data/servers/10138454/plugins/.RPAntiLagg/src/Sergey_Dertan/SClearLagg/SClearLaggMainFolder/SClearLaggMain.php on line 84
    My code:
    PHP:
    <?php
    namespace Sergey_Dertan\SClearLagg\SClearLaggMainFolder;

    use 
    pocketmine\command\Command;
    use 
    pocketmine\command\CommandSender;
    use 
    pocketmine\plugin\PluginBase;
    use 
    pocketmine\utils\Config;
    use 
    Sergey_Dertan\SClearLagg\Command\SClearLaggCommandExecutor;
    use 
    Sergey_Dertan\SClearLagg\Entity\EntityManager;
    use 
    pocketmine\utils\TextFormat as F;
    use 
    Sergey_Dertan\SClearLagg\Task\TaskCreator;
    use 
    pocketmine\scheduler\Task;
    use 
    pocketmine\scheduler\TaskScheduler;
    use 
    pocketmine\scheduler\TaskHandler;

    /**
     * Class SClearLaggMain
     * @package Sergey_Dertan\SClearLagg\SClearLaggMainFolder
     */
    class SClearLaggMain extends PluginBase
    {
        
    /**
         * @var SClearLaggMain
         */
        
    private static $instance;
        public 
    $config;
        
    /**
         * @var \Sergey_Dertan\SClearLagg\Entity\EntityManager
         */
        
    private $entityManager;

        function 
    __construct()
        {
            
    self::$instance $this;
            
    $this->entityManager = new EntityManager($this);
        }

        
    /**
         * @return SClearLaggMain
         */
        
    static function getInstance()
        {
            return 
    self::$instance;
        }

        
    /**
         * @return EntityManager
         */
        
    function getEntityManager()
        {
            return 
    $this->entityManager;
        }

        function 
    onEnable()
        {
            @
    mkdir($this->getDataFolder());
            
    $this->config = new Config($this->getDataFolder() . "Config.yml"Config::YAML, array(
                
    "Clear-msg" => " → Luxury Antilagg ← Đã dọn @count rác trên mặt đất!",
                
    "PreClear-msg" => " → Luxury Antilagg ← Đang dọn rác...",
                
    "Clear-time" => 69
            
    ));
            new 
    TaskCreator();
            
    $this->getLogger()->info(F::GREEN "SClearLagg V_" $this->getDescription()->getVersion() . " by CuongDZ");
        }

        
    /**
         * @param CommandSender $s
         * @param Command $cmd
         * @param string $label
         * @param array $args
         * @return bool|SClearLaggCommandExecutor
         */
        
    function onCommand(CommandSender $sCommand $cmd$label, array $args) : bool
        
    {
            new 
    SClearLaggCommandExecutor($s$cmd$args);
            return 
    true;
        }

        function 
    onDisable()
        {
            
    $this->config->save();
            
    $this->getLogger()->info(F::RED "SClearLagg V_" $this->getDescription()->getVersion() . " by CuongDZ");
        }
    }
    Please help me to fix , thanks!
     
  2. dktapps

    dktapps Administrator Staff Member PMMP Team

    Messages:
    774
    GitHub:
    dktapps
     
  3. Nora1903

    Nora1903 Slime

    Messages:
    82
    GitHub:
    cuongvnz
    I use it for plugin testing....
    So please help
     
  4. xXNiceAssassinlo YT

    xXNiceAssassinlo YT Zombie Pigman

    Messages:
    499
    GitHub:
    xXNiceYT
    :facepalm:why are using construct on plugin base
     
  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.