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

must be of type pocketmine\player\GameMode

Discussion in 'Plugin Help' started by GeistFan, Jul 9, 2022.

  1. GeistFan

    GeistFan Slime

    Messages:
    86
    GitHub:
    GeistFan
    Hey
    I'm in the process of adapting one of my plugins to pocketmine 4.0, but I get this error message:
    [Server thread/CRITICAL]: TypeError: "pocketmine\player\Player::setGamemode(): Argument #1 ($gm) must be of type pocketmine\player\GameMode, int given, called in C:\Users\----\Desktop\PocketMine\plugins\GameMode\src\gamemode\main.php on line 33" (EXCEPTION) in "pmsrc/src/player/Player" at line 1049
    I'm new to 4.0 so i dont know anything about it.
    - GeistFan
     
  2. NutXzG

    NutXzG Baby Zombie

    Messages:
    132
    GitHub:
    NutXzG
    PHP:
    <?php

    use pocketmine\player\Player;
    use 
    pocketmine\player\GameMode;


    /**
    *@var $player Player
    */
    $player->setGamemode(GameMode::SURVIVAL())
    All Method in GameMode Class

    PHP:
    /**
     * This doc-block is generated automatically, do not modify it manually.
     * This must be regenerated whenever registry members are added, removed or changed.
     * @see build/generate-registry-annotations.php
     * @generate-registry-docblock
     *
     * @method static GameMode ADVENTURE()
     * @method static GameMode CREATIVE()
     * @method static GameMode SPECTATOR()
     * @method static GameMode SURVIVAL()
     */
     
  3. GeistFan

    GeistFan Slime

    Messages:
    86
    GitHub:
    GeistFan
    Thanks!!
     
  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.