package dk.thoerup.bukkit.hoeruputils; import org.bukkit.Location; import org.bukkit.command.Command; import org.bukkit.command.CommandExecutor; import org.bukkit.command.CommandSender; import org.bukkit.entity.Player; public class GetposCommand implements CommandExecutor { @Override public boolean onCommand(final CommandSender sender, Command command, String label, String[] args) { if (! (sender instanceof Player) ) { return false; } Player p = (Player) sender; Location l = p.getLocation(); String message = String.format("Your current location is %d,%d,%d", (int)l.getX(), (int)l.getY(), (int)l.getZ() ); p.sendMessage(message); //pitch is how much user is looking up/down //yaw is left,right looking direction, 0=straight west int compass = ( (int)l.getYaw() + 270) % 360; String compStr = WhereisCommand.getBearingStr(compass); p.sendMessage( String.format("Facing direction %d (%s)", compass, compStr ) ); // // TODO Auto-generated method stub return true; } }