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

Player moved wrongly when tping

Comments in 'Plugin Development' started by CraftYourBukkit, Dec 1, 2015.

  1. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    I am tping a player through code(down below) but when the distance is bigger than around 7 blocks, it's bugging and says "Player moved wrongly".
    PHP:
    $number 5Normally saved in config
    $this
    ->tpTo($player$number$player->getLevel()->getFolderName());
    public function 
    tpTo(Player $player$to$level) {
            
    $spawns $this->getConfig()->getNested($level "." $to);
            
    $x $spawns[0];
            
    $y $spawns[1];
            
    $z $spawns[2];
            
    $lvl $this->getServer()->getLevelByName($level);
            
    $player->teleport(new Position($x$y$z$lvl));
        }
    Config looks like this, just saying(example):
    Code:
    world:
        players:
            Steve: 1
        1:
            - 23
            - 5
            - 4
    Anyone know how to fix?

Share This Page

Advertisement