Information
This guide will show you how to use the Analytics Platform SDK.
Build Tools
Depending on which build tool you use, you can easily add the Tebex Analytics Java SDK to your project using Gradle or Maven.
Gradle
To add the SDK into your Gradle project, head to your build.gradle
file and add the following to the repositories
section like so:
Then add the following to the dependencies
section:
That's it! You're now ready to use the SDK in your project.
Maven
To add the SDK into your Maven project, head to your pom.xml
file and add the following to the dependencies
section like so:
That's it! You're now ready to use the Analyse SDK in your project.
Using the SDK
To access the API you will need to fetch the live instance of Platform
, this provides access to the Platform & Server SDK methods and can be accessed like so:
Building a custom platform
If you run a complicated set-up, such as one that involves multiple shards or any form of load balancing, you can build your own platform using the Platform SDK. This allows you to run Analyse freely on your own infrastructure, whilst still able to send data to the Analyse Web API and dashboard.
To do this, you'll need to create a class which implements the Platform
interface, and then implement any required methods. You can check out our Bukkit Codebase for an example of how to do this.
Implementing the SDK
Once you've got your platform class set-up, you can initialise the SDK like so:
Sending data to Analyse
You can start tracking player sessions with Analyse now that you've initialised the SDK. You'll need to call the trackPlayerSession
SDK method once the player leaves the server, this takes an AnalysePlayerobject as an argument. It's recommended to create this object once the player joins the server, and then remove it once they leave.
You can also call the trackHeartbeat
SDK method to send a heartbeat to Analyse which takes the current player count as its argument. This is useful for tracking the amount of players online at any given time.
Check out the Javadocs for up-to-date information on the latest available methods. You may also view the Platform SDK Documentation to learn about the other Platform SDK methods.
Last updated