Skip to content

Universalis Java

Links: Source Code

Used Frameworks: Jackson, NV-Websocket-Client, Apache HttpClient, Bson

Universalis Java is a library for requesting crowdsourced market board data of the game Final Fantasy XIV from Universalis. It also contains a websocket implementation, allowing to subscribe to receive realtime updates from universalis.

This was my first time using web sockets to retrieve and parse data. It was also my first time providing a complete wrapper for an existing external RESTApi. Requests to the api are build and send via builders which allow easy configuration of requests.

    public static void main(String[] args) {
        // Create a rest client with default settings.
        UniversalisRest rest = UniversalisRest.builder().build();

        // retrieve valid worlds synchronours
        WorldsResponse worlds = rest.worlds().complete();
        for (World world : worlds) {
            System.out.printf("World %s exists%n", world.name());
        }
        // create a market board request.
        rest.marketBoard()
            // Restrict prices to the european datacenters
            .region(Worlds.europe())
            // Get data for only one item
            .itemsIds(36113)
            // only retrieve high quality prices
            .highQuality()
            // exclude taxes
            .noGst()
            // send the request async
            .queue()
            // handle the result
            .whenComplete((res, err) -> {
                System.out.println("Min hq price is" + res.minPrice().highQuality());
            });
    }