I'm trying to teleport the $sender to the cords displayed in the code below: PHP: <?phpnamespace itsmemes\ipe;use pocketmine\event\Listener;use pocketmine\plugin\PluginBase;use pocketmine\command\Command;use pocketmine\command\CommandSender;use pocketmine\plugin\Plugin;use pocketmine\Server;use pocketmine\Player;use pocketmine\math\Vector3;use pocketmine\utils\Config;class Main extends PluginBase implements Listener{ private $config; public function onCommand(CommandSender $sender, Command $command, $label, array $args) : bool{ switch ($command->getName()) { case "bcastle": if($sender->hasPermission("bcastle.use")); $sender->sendMessage("§e[NPC] §7: §eManager: §fHave fun bouncing!"); $x = [-26]; $y = [53]; $z = [863]; $sender->teleport($x, $y, $z); } }} but when I run the command /bcastle this error apears in console: Code: [22:11:59] [Server thread/CRITICAL]: Unhandled exception executing command 'bcastle' in bcastle: Argument 1 passed to pocketmine\Player::teleport() must be an instance of pocketmine\math\Vector3, array given, called in C:\Users\Admin\Creative Cloud Files\Desktop\PrymePE Test Server\plugins\BoucyCastleCheck\src\itsmemes\ipe\Main.php on line 32 [22:11:59] [Server thread/CRITICAL]: TypeError: "Argument 1 passed to pocketmine\Player::teleport() must be an instance of pocketmine\math\Vector3, array given, called in C:\Users\Admin\Creative Cloud Files\Desktop\PrymePE Test Server\plugins\BoucyCastleCheck\src\itsmemes\ipe\Main.php on line 32" (EXCEPTION) in "src/pocketmine/Player" at line 3596 [22:11:59] [Server thread/DEBUG]: #0 BoucyCastleCheck/src/itsmemes/ipe/Main(32): pocketmine\Player->teleport(array Array(), array Array(), array Array()) [22:11:59] [Server thread/DEBUG]: #1 src/pocketmine/command/PluginCommand(58): itsmemes\ipe\Main->onCommand(pocketmine\Player object, pocketmine\command\PluginCommand object, string bcastle, array Array()) [22:11:59] [Server thread/DEBUG]: #2 src/pocketmine/command/SimpleCommandMap(241): pocketmine\command\PluginCommand->execute(pocketmine\Player object, string bcastle, array Array()) [22:11:59] [Server thread/DEBUG]: #3 src/pocketmine/Server(1966): pocketmine\command\SimpleCommandMap->dispatch(pocketmine\Player object, string bcastle) [22:11:59] [Server thread/DEBUG]: #4 src/pocketmine/Player(2151): pocketmine\Server->dispatchCommand(pocketmine\Player object, string bcastle) [22:11:59] [Server thread/DEBUG]: #5 src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(219): pocketmine\Player->chat(string /bcastle) [22:11:59] [Server thread/DEBUG]: #6 src/pocketmine/network/mcpe/protocol/CommandRequestPacket(47): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleCommandRequest(pocketmine\network\mcpe\protocol\CommandRequestPacket object) [22:11:59] [Server thread/DEBUG]: #7 src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(91): pocketmine\network\mcpe\protocol\CommandRequestPacket->handle(pocketmine\network\mcpe\PlayerNetworkSessionAdapter object) [22:11:59] [Server thread/DEBUG]: #8 src/pocketmine/network/mcpe/protocol/BatchPacket(115): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleDataPacket(pocketmine\network\mcpe\protocol\CommandRequestPacket object) [22:11:59] [Server thread/DEBUG]: #9 src/pocketmine/network/mcpe/PlayerNetworkSessionAdapter(91): pocketmine\network\mcpe\protocol\BatchPacket->handle(pocketmine\network\mcpe\PlayerNetworkSessionAdapter object) [22:11:59] [Server thread/DEBUG]: #10 src/pocketmine/Player(3023): pocketmine\network\mcpe\PlayerNetworkSessionAdapter->handleDataPacket(pocketmine\network\mcpe\protocol\BatchPacket object) [22:11:59] [Server thread/DEBUG]: #11 src/pocketmine/network/mcpe/RakLibInterface(143): pocketmine\Player->handleDataPacket(pocketmine\network\mcpe\protocol\BatchPacket object) [22:11:59] [Server thread/DEBUG]: #12 src/raklib/server/ServerHandler(97): pocketmine\network\mcpe\RakLibInterface->handleEncapsulated(string 192.168.8.105:51981, raklib\protocol\EncapsulatedPacket object, integer 0) [22:11:59] [Server thread/DEBUG]: #13 src/pocketmine/network/mcpe/RakLibInterface(82): raklib\server\ServerHandler->handlePacket() [22:11:59] [Server thread/DEBUG]: #14 src/pocketmine/network/Network(89): pocketmine\network\mcpe\RakLibInterface->process() [22:11:59] [Server thread/DEBUG]: #15 src/pocketmine/Server(2498): pocketmine\network\Network->processInterfaces() [22:11:59] [Server thread/DEBUG]: #16 src/pocketmine/Server(2252): pocketmine\Server->tick() [22:11:59] [Server thread/DEBUG]: #17 src/pocketmine/Server(2131): pocketmine\Server->tickProcessor() [22:11:59] [Server thread/DEBUG]: #18 src/pocketmine/Server(1713): pocketmine\Server->start() [22:11:59] [Server thread/DEBUG]: #19 src/pocketmine/PocketMine(556): pocketmine\Server->__construct(BaseClassLoader object, pocketmine\utils\MainLogger object, string phar://C:/Users/Admin/Creative Cloud Files/Desktop/PrymePE Test Server/PocketMine-MP.phar/, string C:\Users\Admin\Creative Cloud Files\Desktop\PrymePE Test Server\, string C:\Users\Admin\Creative Cloud Files\Desktop\PrymePE Test Server\plugins\) [22:11:59] [Server thread/DEBUG]: #20 C:/Users/Admin/Creative Cloud Files/Desktop/PrymePE Test Server/PocketMine-MP.phar(1): require(string phar://C:/Users/Admin/Creative Cloud Files/Desktop/PrymePE Test Server/PocketMine-MP.phar/src/pocketmine/PocketMine.php) I have no idea what to do I'm not great at php, please help thanks
did you even read the error?? https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/Player.php#L3626
"Argument 1 passed to pocketmine\Player::teleport() must be an instance of pocketmine\math\Vector3, array given"
You must do: PHP: $player->teleport(new \pocketmine\math\Vector3(-26, 53, 863)); teleport() needs an Vector3, not an Array ;D
If everyone gives up on writting plugins because of one error, would we still be in the place we were?
There isn't any need to put $x, $y and $z in an array, they can just be plain integers. PHP: $x = -26;$y = 53;$z = 863;$player->teleport(new Vector3($x, $y, $z));//OR$coords = [-26, 53, 863];$player->teleport(new Vector3(...$coords));
I would love to learn but where or how do I learn. I learn alot by posting threads like these because of helpful people who take the time to answer them. I do understand that a lot of people on pmmp are full plugin developers and ones who fully understand what they're doing but is it not ok to ask about some nooby errors from people like me who aren't as capable and as knowledgable as others at php?
Look at other people’s plugins, don’t copy but learn the methods and such. Also look at PocketMine-MP’s code for methods as well. You could also learn part of OOP.
How was it not? You started off as not knowing much, and asked me and others for help a lot. Almost all of us do, and you can't blame others for doing the same thing.