Advertisement
  1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Teleport command problem

Comments in 'Plugin Development' started by LoveToBeDev, Aug 22, 2015.

  1. LoveToBeDev
    Offline

    LoveToBeDev Active Member

    Joined:
    Aug 19, 2015
    Posts:
    55
    Minecraft User:
    LoveToBeDev
    Hello guys, i established a command of tele transportation to join to a place, but the problem is that after setting up the position, when you execute the command of joining, it gives an error, the error is this part, but im not sure where:

    PHP:
    case 'joinpvpa':
                        
    $name $sender->getPlayer()->getName();
                        
    $coords $this->getConfig()->get("spawn");
                        
    $pos = new Vector3($coords[0], $coords[1], $coords[2]);
                        
    $sender->teleport($coords);
    It says this in the console:

  2. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
    PHP:
    use pocketmine\maths\Vector3;
    Make sure your "using" or importing all the classes your referencing in your code.
    LoveToBeDev likes this.
  3. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
    That will fix the next problem he would've ran into :p
  4. LoveToBeDev
    Offline

    LoveToBeDev Active Member

    Joined:
    Aug 19, 2015
    Posts:
    55
    Minecraft User:
    LoveToBeDev
    already tried that, but Crazed Miner has the reason, i didn't import the Vector3 class, Thanks!
    Legoboy0215 and CrazedMiner like this.
  5. Gamecrafter
    Offline

    Gamecrafter

    Joined:
    Nov 20, 2014
    Posts:
    978
    Plugins:
    9
    For the last time, $sender is already an instance of a Player if the sender is a Player. And learn PHP, it helps. :p
    CrazedMiner likes this.
  6. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
    Not necessarily, the console can run commands as well.
  7. PEMapModder
    Offline

    PEMapModder Notable Member Plugin Developer

    Joined:
    Oct 9, 2013
    Posts:
    7,294
    Plugins:
    11
    Minecraft User:
    PEMapModder
    It is pocketmine\math\Vector3 not pocketmine\maths\Vector3
  8. CrazedMiner
    Offline

    CrazedMiner Notable Member Plugin Developer

    Joined:
    Jan 31, 2015
    Posts:
    348
    Plugins:
    2
    Minecraft User:
    CrazedMinerYT
    Auto correct :p

Share This Page

Advertisement