So I' really want to fix this error Spoiler Code: Error: Declaration of particle\Main::__construct(pocketmine\level\Location &$location, bool $sphere) must be compatible with pocketmine\plugin\Plugin::__construct(pocketmine\plugin\PluginLoader $loader, pocketmine\Server $server, pocketmine\plugin\PluginDescription $description, string $dataFolder, string $file) File: plugins/SpawnParticlesByAotGamerz.phar/src/particle/Main Line: 50 Type: E_COMPILE_ERROR Code is PHP: use pocketmine\plugin\PluginBase;use pocketmine\math\Vector3;use pocketmine\Server;use pocketmine\Player;use pocketmind\level\Level;use pocketmine\level\Location;use pocketmine\level\particle\FlameParticle;;class Main extends PluginBase { private $radius = 3; private $particles = 50; private $location, $level; private $sphere = false; public function __construct(Location &$location, bool $sphere) { $this->level = $location->getLevel(); $this->location = &$location; $this->sphere = $sphere; } private static function getRandomVector() : Vector3 { $x = 0; $y = 0; $z = 0; $x = rand()/getrandmax() * 2 - 1; $y = rand()/getrandmax() * 2 - 1; $z = rand()/getrandmax() * 2 - 1; $v = new Vector3($x, $y, $z); return $v->normalize(); } public function onRun($tick) { for ($i = 0; $i < $this->particles; ++$i) { $vector = self::getRandomVector()->multiply($this->radius); if (!$this->sphere) { $vector->y = abs($vector->getY()); } $this->level->addParticle(new FlameParticle($this->location->add($vector->x, $vector->y, $vector->z))); $this->location->add($vector->x, $vector->y, $vector->z); } }} Pls try to do fast
Don't override the __construct method. That is reserved for internal use. Move those properties elsewhere. Or simply initialize them onEnable()
Are you sure you are extending the right class? This structure seems more like a Task than a plugin (you are extending PluginBase)
Like this? PHP: use pocketmine\plugin\PluginBase;use pocketmine\math\Vector3;use pocketmine\Server;use pocketmine\Player;use pocketmind\level\Level;use pocketmine\level\Location;use pocketmine\level\particle\FlameParticle;;class Main extends PluginBase { private $radius = 3; private $particles = 50; private $location, $level; private $sphere = false; private static function getRandomVector() : Vector3 { $x = 0; $y = 0; $z = 0; $x = rand()/getrandmax() * 2 - 1; $y = rand()/getrandmax() * 2 - 1; $z = rand()/getrandmax() * 2 - 1; $v = new Vector3($x, $y, $z); return $v->normalize(); } public function onRun($tick) { for ($i = 0; $i < $this->particles; ++$i) { $vector = self::getRandomVector()->multiply($this->radius); if (!$this->sphere) { $vector->y = abs($vector->getY()); } $this->level->addParticle(new FlameParticle($this->location->add($vector->x, $vector->y, $vector->z))); $this->location->add($vector->x, $vector->y, $vector->z); } }}
I tried to fix alot of time is gone waste mein wasted{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}{}
Im not sure where you get those code from, but I would imagine it to be used in this way, you get the idea PHP: class Main extends PluginBase{ function onEnable(){$l = $this->getServer()->getDefaultLevel()->getSpawnLocation(); $this->getScheduler()->scheduleRepeatingTask(new Draw(Location::fromObject($l,$l->getLevel()),true),1); }}class Draw extends Task { private $radius = 3; private $particles = 50; private $location, $level; private $sphere = false; public function __construct(Location &$location, bool $sphere) { $this->level = $location->getLevel(); $this->location = &$location; $this->sphere = $sphere; } private static function getRandomVector() : Vector3 { $x = 0; $y = 0; $z = 0; $x = rand()/getrandmax() * 2 - 1; $y = rand()/getrandmax() * 2 - 1; $z = rand()/getrandmax() * 2 - 1; $v = new Vector3($x, $y, $z); return $v->normalize(); } public function onRun($tick) { for ($i = 0; $i < $this->particles; ++$i) { $vector = self::getRandomVector()->multiply($this->radius); if (!$this->sphere) { $vector->y = abs($vector->getY()); } $this->level->addParticle(new FlameParticle($this->location->add($vector->x, $vector->y, $vector->z))); $this->location->add($vector->x, $vector->y, $vector->z); } }}