-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathExampleMod.java
More file actions
30 lines (25 loc) · 989 Bytes
/
ExampleMod.java
File metadata and controls
30 lines (25 loc) · 989 Bytes
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
package com.example;
import dev.faststats.ErrorTracker;
import dev.faststats.data.Metric;
import dev.faststats.neoforge.NeoForgeContext;
import net.neoforged.fml.common.Mod;
import java.util.concurrent.atomic.AtomicInteger;
@Mod("example_mod")
public final class ExampleMod {
public static final ErrorTracker ERROR_TRACKER = ErrorTracker.contextAware();
private final AtomicInteger gameCount = new AtomicInteger();
private final NeoForgeContext context = new NeoForgeContext.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();
public void startGame() {
gameCount.incrementAndGet();
}
}