If you are inside the plugin class you can do: PHP: $player = $this->getServer()->getPlayer($name); Where $name is the username of the player. You should also check that $player !== null unless you are sure they will be online.
Since the PocketMine API is messy with some functions returning null and some returning false on failure/empty, I recommend using instanceof Player to check as a practice.
That would require a use statement and I didn't want to confuse getPlayer() returns null and has done since API 1.0.0