Getting Player Location

Discussion in 'Plugin Development' started by GeekPlaya, Oct 17, 2011.

Thread Status:
Not open for further replies.
  1. Offline


    As some of you may know, /tppos, is an Essentials command. I literally need them to run this command. It's not an issue of the command not running, but something in the way I set this up makes the command arguments invalid or something..

    Any idea why:
    Code:"/tppos " + p.getLocation().getBlockX() + p.getLocation().getBlockY() + p.getLocation().getBlockZ());
    is not working?

    Essentials recognizes that the player is running the command, but it is not teleporting them because something is typed in correctly. Do I need to round the coords? Are they an incorrect object?
  2. Offline


    You don't want to do .getBlockX() since that gets the floored value of the X component, indicating the block that this location is contained with. I think that gives you the id of what block exists in that location.

    You want to do .getX() to get the coordinate of the location, but make sure to check a block doesn't exist at that location otherwise you would be stuck.
Thread Status:
Not open for further replies.

Share This Page