File tree Expand file tree Collapse file tree
bungeecord/example-plugin/src/main/java/com/example
core/example/src/main/java/dev/faststats/example
fabric/example-mod/src/main/java/com/example
hytale/example-plugin/src/main/java/com/example Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ public class ExamplePlugin extends Plugin {
2424 // This is useful for cleaning up cached data
2525 .onFlush (() -> gameCount .set (0 )) // reset game count on flush
2626
27- .create (this );
27+ .create ();
2828
2929 @ Override
3030 public void onDisable () {
Original file line number Diff line number Diff line change 11package dev .faststats .example ;
22
33import dev .faststats .Attributes ;
4+ import dev .faststats .FastStatsContext ;
45import dev .faststats .FeatureFlag ;
56import dev .faststats .FeatureFlagService ;
67
78import java .time .Duration ;
89import java .time .Instant ;
910
1011public final class FeatureFlagExample {
11- public static final FeatureFlagService SERVICE = FeatureFlagService .create (
12- "YOUR_TOKEN_HERE" , // token can be found in the settings of your project
12+ public static final FeatureFlagService SERVICE = getContext ().featureFlags (
1313 Attributes .create () // Define global attributes
1414 .put ("version" , "1.2.3" )
1515 .put ("java_version" , System .getProperty ("java.version" ))
@@ -60,4 +60,8 @@ public static void usage() {
6060 }
6161 });
6262 }
63+
64+ private static FastStatsContext getContext () {
65+ return null ;
66+ }
6367}
Original file line number Diff line number Diff line change 77import net .fabricmc .api .ModInitializer ;
88
99public class ExampleMod implements ModInitializer {
10- private final FabricContext context = new FabricContext ("YOUR_TOKEN_HERE" );
10+ private final FabricContext context = new FabricContext (
11+ "example-mod" , // your mod id as defined in fabric.mod.json
12+ "YOUR_TOKEN_HERE"
13+ );
1114 private final Metrics metrics = context .metrics ()
1215 // Custom metrics require a corresponding data source in your project settings
1316 .addMetric (Metric .number ("example_metric" , () -> 42 ))
1417
1518 // Error tracking must be enabled in the project settings
1619 .errorTracker (ErrorTracker .contextAware ())
1720
18- .create ("example-mod" ); // your mod id as defined in fabric.mod.json
21+ .create ();
1922
2023 @ Override
2124 public void onInitialize () {
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ public class ExamplePlugin extends JavaPlugin {
1616 // Error tracking must be enabled in the project settings
1717 .errorTracker (ErrorTracker .contextAware ())
1818
19- .create (this );
19+ .create ();
2020
2121 public ExamplePlugin (final JavaPluginInit init ) {
2222 super (init );
You can’t perform that action at this time.
0 commit comments