Help About Player()

Discussion in 'Development' started by tungstenvm, Oct 8, 2019.

  1. tungstenvm

    tungstenvm Silverfish

    I cant find some function in pocketmine github code, for example, i cant find getX() function in Player class.
    And can i set the X,Y,Z of a player, like:
    $a = $player;
    but the real player doesnt be affect.Thank in advance
  2. HimbeersaftLP

    HimbeersaftLP Chicken

    The Player class inherits from the Human class which inherits from the Creature class which inherits from the Living class which inherits from the Entity class which inherits from the Location class which inherits from the Position class which inherits from the Vector3 class (located in the Math submodule).
    The Vector3 class has the getX function:

    Inheritance is one of the (if not the) most important principle of OOP programming, see this for more information about how it works in PHP:

    In order to properly move a player you should use $player->teleport() instead.

    Here's an example:
    $loc $player->getLocation();
    jasonwynn10, Sandertv and wolfdale like this.

Share This Page

  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.