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

Solved Undefined method, But i was using it before

Discussion in 'Development' started by Khaled, Mar 18, 2018.

  1. Khaled

    Khaled Slime

    Messages:
    81
    GitHub:
    xXKHaLeD098Xx
    I'm using a code that was working fine but now its causing an error.
    The Error:
    PHP:
    Error"Call to undefined method pocketmine\inventory\PlayerInventory::setHelmet()" (EXCEPTIONin "Test2/src/test2/Main" at line 102
    2018
    -03-18 [06:22:04] [Server thread/DEBUG]: #0 src/pocketmine/plugin/MethodEventExecutor(38): test2\Main->onInteract(pocketmine\event\player\PlayerInteractEvent object)
    The Code:
    PHP:
    $player->getInventory()->setHelmet(Item::get(29801));
     
  2. Thunder33345

    Thunder33345 Moderator Staff Member

    Messages:
    2,137
    GitHub:
    Thunder33345
    did you blindly try to hack API version by allowing all alphas in plugin.yml?
    things changes when you update, and you are only suppose to accept said version when you actually have updated your plugin to work with latest version
    if you didnt get the note, each update changes things so yeah, it caused an error because update changes things
    consider upgrading your plugin to support it
     
  3. SalmonDE

    SalmonDE Zombie Pigman

    Messages:
    739
    GitHub:
    SalmonDE
    PHP:
    $player->getArmorInventory()->setHelmet(Item::get(29801));
    And consider what @Thunder33345 said.
     
    xXNiceAssassinlo YT likes this.
  4. Khaled

    Khaled Slime

    Messages:
    81
    GitHub:
    xXKHaLeD098Xx
    Nvm i firgured it out
     
  5. Khaled

    Khaled Slime

    Messages:
    81
    GitHub:
    xXKHaLeD098Xx
    thx but i figured it out
     
  6. Khaled

    Khaled Slime

    Messages:
    81
    GitHub:
    xXKHaLeD098Xx
    i just didnt know they changed some options in the Inventory OK?
     
  7. robske_110 (Tim)

    robske_110 (Tim) Wither Skeleton Poggit Reviewer

    Messages:
    1,342
    GitHub:
    robske110
    xXNiceAssassinlo YT likes this.
  8. Khaled

    Khaled Slime

    Messages:
    81
    GitHub:
    xXKHaLeD098Xx
  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.