PHP: Error: HG\game\GameManager::refillChests(): Argument #1 ($tile) must be of type pocketmine\block\tile\Chest, bool given, called in /home/gs-40587/plugins/MushHG_Testes_2/src/game/GameManager.php on line 761File: plugins/MushHG_Testes_2/src/game/GameManagerLine: 400Type: TypeErrorTHIS CRASH WAS CAUSED BY A PLUGINBAD PLUGIN: HGCode:[391] mt_rand(25, 26) => array_shift($contents),[392] ];[393] [394] $templates[] = $fcontents;[395] }[396] [397] shuffle($templates);[398] return $templates;[399] }[400] public function refillChests(Chest $tile) : void[401] {[402] $contents = $this->getChestContents();[403] [404] $inventory = $tile->getInventory();[405] $inventory->clearAll();[406] [407] if (empty($contents)) {[408] $contents = $this->getChestContents();[409] }[410]
Hi, Primus! Thanks for replying to my post. Well, I found out that, actually, I should get the chest of all worlds, however, I don't know how to do it. I tried to research and use the methods that were answered in posts, but I didn't get positive answers. It just gives error. Line code: PHP: foreach($this->getServer()->getWorldManager()->getWorldByName("#1")->getTiles() as $tile) {if($tile instanceof Chest){$this->refillChests($tile);}}foreach ($this->getPlayers() as $p) {$p->sendMessage("§aMessage of Refill");}