Skip to content

Commit

Permalink
Only enable FH in dev builds
Browse files Browse the repository at this point in the history
  • Loading branch information
OliverSchlueter committed Nov 21, 2024
1 parent 425d4b7 commit cd0c85b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/main/java/de/oliver/fancyholograms/FancyHolograms.java
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public final class FancyHolograms extends JavaPlugin implements FancyHologramsPl

private static @Nullable FancyHolograms INSTANCE;
private final ExtendedFancyLogger fancyLogger;
private final FancyAnalyticsAPI fancyAnalytics;
private final VersionFetcher versionFetcher = new MasterVersionFetcher("FancyHolograms");
private final VersionConfig versionConfig = new VersionConfig(this, versionFetcher);
private final ScheduledExecutorService hologramThread = Executors.newSingleThreadScheduledExecutor(
Expand All @@ -70,6 +69,7 @@ public final class FancyHolograms extends JavaPlugin implements FancyHologramsPl
.setNameFormat("FancyHolograms-FileStorageExecutor")
.build()
);
private FancyAnalyticsAPI fancyAnalytics;
private HologramConfiguration configuration = new FancyHologramsConfiguration();
private HologramStorage hologramStorage = new FlatFileHologramStorage();
private @Nullable HologramManagerImpl hologramsManager;
Expand All @@ -90,8 +90,6 @@ public FancyHolograms() {
}
JsonAppender jsonAppender = new JsonAppender(false, false, true, logsFile.getPath());
this.fancyLogger = new ExtendedFancyLogger("FancyHolograms", LogLevel.INFO, List.of(consoleAppender, jsonAppender), new ArrayList<>());
fancyAnalytics = new FancyAnalyticsAPI("", "");
fancyAnalytics.getConfig().setDisableLogging(true);
}

public static @NotNull FancyHolograms get() {
Expand Down Expand Up @@ -325,14 +323,20 @@ private void registerMetrics() {
metrics.addCustomChart(new Metrics.SimplePie("update_notifications", () -> configuration.areVersionNotificationsMuted() ? "No" : "Yes"));
metrics.addCustomChart(new Metrics.SimplePie("using_development_build", () -> isDevelopmentBuild ? "Yes" : "No"));

if (!isDevelopmentBuild) {
return;
}

fancyAnalytics = new FancyAnalyticsAPI("3b77bd59-2b01-46f2-b3aa-a9584401797f", "E2gW5zc2ZTk1OGFkNGY2ZDQ0ODlM6San");
fancyAnalytics.getConfig().setDisableLogging(true);

fancyAnalytics.registerMinecraftPluginMetrics(INSTANCE);
fancyAnalytics.getExceptionHandler().registerLogger(getLogger());
fancyAnalytics.getExceptionHandler().registerLogger(Bukkit.getLogger());
fancyAnalytics.getExceptionHandler().registerLogger(fancyLogger);

fancyAnalytics.registerStringMetric(new MetricSupplier<>("commit_hash", () -> versionConfig.getHash().substring(0, 7)));


fancyAnalytics.registerStringMetric(new MetricSupplier<>("server_size", () -> {
long onlinePlayers = Bukkit.getOnlinePlayers().size();

Expand Down

0 comments on commit cd0c85b

Please sign in to comment.