This guide covers the breaking Java SDK changes between 0.23.0 and 0.24.0.
Version 0.24.0 moves FastStats from standalone metrics instances to a shared
platform context. The context owns the token, config, metrics, error tracking,
feature flags, and lifecycle.
// 0.24.0
new BukkitContext.Factory(this, "YOUR_TOKEN")
.metrics(Metrics.Factory::create)
.create();
Call context.ready() from your platform startup hook before metrics are used.
For runtime configuration, use the FastStats config and system properties. For
example, use -Dfaststats.debug=true to enable debug logging.
Error trackers are now attached to the context with .errorTrackerService(...).
They are no longer configured on the metrics factory.
// 0.23.0
public static final ErrorTracker ERROR_TRACKER = ErrorTracker.contextAware();
private final BukkitMetrics metrics = BukkitMetrics.factory()
.errorTracker(ERROR_TRACKER)
.token("YOUR_TOKEN")
.create(this);
// 0.24.0
public static final ErrorTracker ERROR_TRACKER = ErrorTracker.contextAware();
private final BukkitContext context = new BukkitContext.Factory(this, "YOUR_TOKEN")
.errorTrackerService(ERROR_TRACKER)
.metrics(Metrics.Factory::create)
.create();
public void onEnable() {
context.ready();
}
Context-unaware trackers still exist, but additional trackers must be registered
with the context error tracker service.
public static final ErrorTracker MANUAL_TRACKER = ErrorTracker.contextUnaware();
{
context.errorTrackerService().orElseThrow().registerErrorTracker(MANUAL_TRACKER);
}
trackError(...) now returns a TrackedError, so callers may attach additional
data to the tracked error after creating it.