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

Blocks coordinates are wrong?

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

  1. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    So, I'm saving a block's coordinates into my config file in PlayerInteractEvent using
    PHP:
    $this->getConfig()->setNested($player->getLevel()->getFolderName() . "." $this->mode, array($block->getX(), $block->getY() + 2$block->getZ()));
                    
    $this->getConfig()->save();
    while
    PHP:
    $block $event->getBlock();
    . It basically works, but somehow the x and the z coordinate is being saved wrong, when tping to them, it's not the coordinate of the block I clicked on(Around 3 blocks away from the block I tapped). Anyone has got a fix or a reason for this?
  2. Kvetinac97
    Offline

    Kvetinac97 Active Member Plugin Developer

    Joined:
    Nov 17, 2014
    Posts:
    276
    Plugins:
    1
    Minecraft User:
    Kvetinac97
    Are you using:
    PHP:
    $pl->teleport(new Position($x+0.5$y$z+0.5));
    ? If you forgot +0.5, your problem has been solved.
    iDirtPlayzMC and CraftYourBukkit like this.
  3. CraftYourBukkit
    Offline

    CraftYourBukkit Notable Member Plugin Developer

    Joined:
    Jan 20, 2015
    Posts:
    1,022
    Plugins:
    2
    Minecraft User:
    CraftYourBukkit
    No. I just realized, I used the x coordinate as z too! xD

Share This Page

Advertisement