I use SQLite3 -> .... $stmt->bindValue(":x", $sender->getX()); $stmt->bindValue(":y", $sender->getY()); $stmt->bindValue(":z", $sender->getZ()); $stmt->bindValue(":world", $sender->getPlayer()->getLevel()); $result = $stmt->execute(); Later in the code -> .... $sender->getPlayer()->teleport(new Position($array['x'], $array['y'], $array['z'], $array['world'])); The player won't teleport to the given position. Instead, I get this -> Object of class pocketmine\level\Level could not be converted to string. Help?
You need to have the level OBJECT PHP: $worldAsObject = $this->getServer()->getLevelByName($array['world']); and then use it PHP: $sender->getPlayer()->teleport(new Position($array['x'], $array['y'], $array['z'], $worldAsObject));
I am sorry for any confusion guys. I mean MCPE 0.13.2 won't launch, not the plugin. And I can't test the plugin because of it
Done. The plugin still doesn't work. Error on this line - $stmt->bindValue(":world", $sender->getPlayer()->getLevel()); Object of class pocketmine\level\Level could not be converted to string. Still appears
I got a notification from this message saying you quoted my post...?! I didn't even post in this thread.
It isn't needed, tho it does work. It just returns $sender again. https://github.com/PocketMine/PocketMine-MP/blob/master/src/pocketmine/Player.php#L294
Player::getPlayer() returns $this. It is just for implementing a parent method from the interface IPlayer. You don't need it if you already know that it is a Player. You only need it if you are holding an OfflinePlayer.