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

Error Argument

Discussion in 'Plugin Help' started by firen, Apr 11, 2022.

  1. firen

    firen Spider

    Messages:
    14
    PHP:
    ErrorHG\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 761
    Fileplugins/MushHG_Testes_2/src/game/GameManager
    Line
    400
    Type
    TypeError

    THIS CRASH WAS CAUSED BY A PLUGIN
    BAD PLUGIN
    HG

    Code
    :
    [
    391]                 mt_rand(2526) => 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
     
  2. Primus

    Primus Zombie Pigman

    Messages:
    749
    /home/gs-40587/plugins/MushHG_Testes_2/src/game/GameManager.php on line 761
     
    firen likes this.
  3. firen

    firen Spider

    Messages:
    14
    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");
     
  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.