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

Mistery Box

Discussion in 'Development' started by AffanStarPure, Jun 22, 2017.

  1. AffanStarPure

    AffanStarPure Baby Zombie

    Messages:
    106
    GitHub:
    AffanStarPure
    Code:
    $ciih = $ev->getPlayer()->getItemInHand(); 
    I see this code but when i saw on console
    Code:
     
    2017-06-22 [15:45:34] [Server thread/CRITICAL]: Could not pass event 'pocketmine\event\player\PlayerInteractEvent' to 'MisteryBox v1.1.0': Call to undefined method pocketmine\Player::getItemInHand() on mb\main
    2017-06-22 [15:45:34] [Server thread/CRITICAL]: Error: "Call to undefined method pocketmine\Player::getItemInHand()" (EXCEPTION) in "/MisteryBox_v1/src/mb/main" at line 47 
    I getting error this how i fix code it?
     
  2. Miste

    Miste Baby Zombie

    Messages:
    109
    GitHub:
    Misteboss
    PHP:
    $ciih $ev->getPlayer()->getInventory()->getItemInHand(); 
     
  3. jasonwynn10

    jasonwynn10 Moderator Poggit Reviewer

    Messages:
    1,489
    GitHub:
    jasonwynn10
    The getItemInHand() method isn't in Player.php
    You need to access the player's inventory to use that method.
     
    Palente, Muqsit and SalmonDE like this.
  4. Ekko

    Ekko Silverfish

    Messages:
    21
    GitHub:
    TaiXeko
    I sell :3
     
  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.