Analyse
SDKAPI reference

SDK

API reference

Every public method in the SDK, grouped by class.

A quick reference of every public class and method the API exposes. Use this page to scan; use the other pages for worked examples.

net.analyse.api.Analyse

Static entry point. You'll touch this class more than any other.

Availability

MethodReturnsWhat it does
isAvailable()booleanTrue when the Analyse plugin is loaded. Always check this first.
isConnected()booleanTrue when the last API call succeeded (fresh heartbeat).
getLastConnectionError()StringThe reason the last call failed, or null if healthy.

Events

MethodReturnsWhat it does
trackEvent(String name)EventBuilderStart a fluent builder for a custom event.
trackEvent(String name, UUID uuid, String username)EventBuilderSame as above with the player preset.
trackEvent(String name, Map<String, Object> data)EventBuilderSame as above with properties preset.

A/B tests

MethodReturnsWhat it does
getVariant(UUID, String testKey)StringThe variant key assigned to the player. null when the test isn't active.
isTestActive(String testKey)booleanTrue when the test is running.
getActiveTests()List<? extends ABTest>Every currently active test.
getTest(String testKey)ABTestThe test by key, or null.
trackConversion(UUID, String username, String testKey, String eventName)voidRecord a conversion for a test.

Managers

MethodReturnsWhat it does
get()AnalysePlatformThe current platform (Spigot, Velocity, etc).
sessions()SessionManagerLive sessions.
abTests()ABTestManagerA/B test manager.

net.analyse.api.object.builder.EventBuilder

Returned by Analyse.trackEvent(...).

MethodReturnsWhat it does
withPlayer(UUID, String username)EventBuilderLink the event to a player.
withPlayer(UUID)EventBuilderLink by UUID only.
withData(String key, Object value)EventBuilderAdd a property.
withData(Map<String, Object>)EventBuilderAdd multiple properties at once.
withValue(double)EventBuilderSet the numeric main value.
send()voidSend the event. Non-blocking.

net.analyse.api.manager.SessionManager

MethodReturnsWhat it does
getSession(UUID)Optional<PlayerSession>The session for an online player.
hasSession(UUID)booleanTrue when the player has an active session.
getAllSessions()Collection<PlayerSession>Every active session.
getSessionCount()intCurrent session count.

net.analyse.api.session.PlayerSession

MethodReturnsWhat it does
getPlayerUuid()UUIDThe Minecraft UUID.
getHostname()StringThe hostname they joined through.
getJoinTime()InstantWhen they joined.
hasActiveSession()booleanTrue once Analyse has confirmed the session.

net.analyse.api.manager.ABTestManager

MethodReturnsWhat it does
getVariant(UUID, String testKey)StringVariant key for the player.
getActiveTests()List<? extends ABTest>Active tests.
getTest(String testKey)ABTestA test by key.
isTestActive(String testKey)booleanWhether a test is live.
trackConversion(UUID, String username, String testKey, String eventName)voidRecord a conversion.

net.analyse.api.object.abtest.ABTest

MethodReturnsWhat it does
getKey()StringThe test key you use to look it up.
getName()StringThe human readable name.
isActive()booleanWhether it's running right now.
getVariants()List<Variant>All configured variants.

net.analyse.api.messaging.AnalyseMessaging

Used from backend servers behind a proxy to push events through plugin messaging.

MethodReturnsWhat it does
event(String name)EventMessageBuilderFluent builder for an event message.
createEventMessage(name, uuid, username, data, value)byte[]Build the raw bytes directly.
createConversionMessage(uuid, username, testKey, eventName)byte[]Build a conversion message.
CHANNELStringThe plugin channel name (analyse:events).