Okay, so I'm trying to make a border plugin where if a player tries to walk out of the border it knocks them away from it. How can I get the direction that the player is facing in and how do I get the opposite of that..
You could take a look at LeetBorder... http://forums.pocketmine.net/plugins/lightweight-world-border.1100/
Using Player::getDirection() is bad practice as you are statically accessing the Player. Instead you should use $event->getPlayer()->getDirection();
To knock a player a player to his back, use $player->getDirectionVector(); PHP: // on border event $player->setMotion($player->getDirectionVector()->multiply(-2));
No you don't. Also, Player::functionName is just a way of showing a function. I believe getDirection cannot be statically used on Player object. Also, nobody said it has to be $event->getPlayer()...
Sorry, I'm getting things mixed up with the MiNET API . I thought he was saying to use it statically, that's why I was correcting him.
Undefined variable $event. Who gives the wrong examples? Please go and check what Player::getDirection() means. I am pointing on the function getDirection() in the Player class. Doesn't matter what player event, $event->getPlayer() returns a Player.