DevelopersยปWeb SDK



This guide will show you how to use the Analyse Web SDK.

If you haven't already, you should read the SDK Documentation first to get an understanding of how the SDK works.

Get Server

Access basic information about the server connected to Analyse using the getServerInformation method from the SDK interface. This method returns a CompletableFuture<ServerInformation>.

Example Usage

CompletableFuture<ServerInformation> result = platform.getSDK().getServerInformation();
result.thenAccept(server -> {
    String serverName = server.getName();
    UUID serverUuid = server.getUniqueId();
    Date serverCreatedAt = server.getCreatedAt();
    // Do something with the server information...

An ServerNotFoundException exception will be thrown if the token is invalid.

Get Player

Obtain player information using the getPlayer method from the SDK interface, which accepts either a username or a UUID and returns a CompletableFuture<PlayerProfile>.

Example Usage

CompletableFuture<PlayerProfile> profileFuture = platform.getSDK().getPlayerProfile("Siri");
profileFuture.thenAccept(profile -> {
    String playerName = profile.getName();
    UUID playerUUIDResult = profile.getUuid();
    Date playerCreatedAt = profile.getCreatedAt();
    Date playerUpdatedAt = profile.getUpdatedAt();
    Date playerFirstJoinedAt = profile.getFirstJoinedAt();
    Date playerLastLoggedInAt = profile.getLastLoggedInAt();
    int playerTotalSessionTime = profile.getTotalSessionTime();
    List<PlayerProfile.Statistic> playerStatistics = profile.getStatistics();

    // Do something with the player profile information...

Get Leaderboard

Fetch leaderboard information using the getLeaderboard method from the SDK interface, which requires the statistic ID of interest and returns a CompletableFuture<AnalyseLeaderboard>.

Example Usage

CompletableFuture<AnalyseLeaderboard> leaderboardFuture = platform.getSDK().getLeaderboard("kills");
leaderboardFuture.thenAccept(leaderboard -> {
    int currentPage = leaderboard.getCurrentPage();
    List<AnalyseLeaderboard.Player> players = leaderboard.getData();
    int totalPlayers = leaderboard.getTotal();

    // Do something with the leaderboard information...

You can also specify a page number to get a specific page of the leaderboard, for example:

platform.getSDK().getLeaderboard("kills", 2);