Code: $player->teleport(new Vector3($this->L["Location"])); Code: $this->L["Location"] = array('x'=>(int)$player->getX(),'y'=>(int)$player->getY(),'z'=>(int)$player->getZ()); Error: "Unsupported operand types" (EXCEPTION) in "src/pocketmine/entity/Entity" at line 706 TypeError: "Argument 2 passed to pocketmine\nbt\tag\DoubleTag::__construct() must be of the type float, array given, called in phar... . . . .src/pocketmine/entity/Entity.php on line 887" (EXCEPTION) in "vendor/pocketmine/nbt/src/tag/DoubleTag" at line 40
Vector3 needs 3 optional arguments: X, Y, and Z You only give the X (which is an array and only one argument), and the Y and Z default to 0 https://github.com/PocketMine/PocketMine-MP/blob/master/src/pocketmine/math/Vector3.php#L37-L41 Now, Pocketmine does something like this (the example array comes from the first argument is): Code: ethaniccc@ethaniccc-idot:~$ php -r 'var_dump(["x" => 0, "y" => 0, "z" => 0] - 1);' PHP Fatal error: Unsupported operand types in Command line code on line 1 https://github.com/pmmp/PocketMine-MP/blob/stable/src/pocketmine/entity/Entity.php#L706 What you can do is make "$this->L["Location"]" be a Vector3 instance: PHP: $this->L["Location"] = new Vector3($player->getX(), $player->getY(), $player->getZ()); And then teleport like this: PHP: $player->teleport($this->L["Location"]);
there is no error but it doesn't work here is the yaml of $this->L["Location"]. Code: Location: !php/object "O:23:\"pocketmine\\math\\Vector3\":3:{s:1:\"x\";d:110.9058;s:1:\"y\";d:109;s:1:\"z\";d:121.6894;}"