-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathExampleMod.java
More file actions
34 lines (28 loc) · 1.04 KB
/
Copy pathExampleMod.java
File metadata and controls
34 lines (28 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package com.example;
import dev.faststats.ErrorTracker;
import dev.faststats.data.Metric;
import dev.faststats.quilt.QuiltContext;
import net.fabricmc.api.ModInitializer;
import java.util.concurrent.atomic.AtomicInteger;
public final class ExampleMod implements ModInitializer {
public static final ErrorTracker ERROR_TRACKER = ErrorTracker.contextAware();
private final AtomicInteger gameCount = new AtomicInteger();
private final QuiltContext context = new QuiltContext.Factory(
"example_mod",
"YOUR_TOKEN_HERE"
)
.metrics(factory -> factory
.addMetric(Metric.number("game_count", gameCount::get))
.addMetric(Metric.string("server_version", () -> "1.0.0"))
.onFlush(() -> gameCount.set(0))
.create())
.errorTrackerService(ERROR_TRACKER)
.create();
@Override
public void onInitialize() {
// your actual logic
}
public void startGame() {
gameCount.incrementAndGet();
}
}