From 9e7dcea54ba5352d22263aa971e23f446930a773 Mon Sep 17 00:00:00 2001 From: Minecon724 Date: Sun, 8 Dec 2024 13:49:54 +0100 Subject: [PATCH] Add mStats toggle --- src/main/java/eu/m724/tweaks/TweaksConfig.java | 5 +++++ src/main/java/eu/m724/tweaks/TweaksPlugin.java | 3 ++- src/main/resources/config.yml | 3 +++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/java/eu/m724/tweaks/TweaksConfig.java b/src/main/java/eu/m724/tweaks/TweaksConfig.java index a3702cb..3b68894 100644 --- a/src/main/java/eu/m724/tweaks/TweaksConfig.java +++ b/src/main/java/eu/m724/tweaks/TweaksConfig.java @@ -10,6 +10,8 @@ import org.bukkit.configuration.file.FileConfiguration; import org.bukkit.plugin.Plugin; public record TweaksConfig( + boolean metrics, + boolean worldborderExpand, boolean worldborderHide, @@ -69,6 +71,8 @@ public record TweaksConfig( throw new RuntimeException("Did you downgrade the plugin? Remove config.yml and let the plugin re-create it", exception); } + boolean metrics = config.getBoolean("metrics"); + boolean worldborderExpand = config.getBoolean("worldborder.expand"); boolean worldborderHide = config.getBoolean("worldborder.hide"); @@ -108,6 +112,7 @@ public record TweaksConfig( String authHostname = config.getString("auth.domain"); TweaksConfig.config = new TweaksConfig( + metrics, worldborderExpand, worldborderHide, brandEnabled, brandText, brandShowPing, brandShowMspt, doorEnabled, doorDoubleOpen, doorKnocking, diff --git a/src/main/java/eu/m724/tweaks/TweaksPlugin.java b/src/main/java/eu/m724/tweaks/TweaksPlugin.java index 19add2f..5462ddf 100644 --- a/src/main/java/eu/m724/tweaks/TweaksPlugin.java +++ b/src/main/java/eu/m724/tweaks/TweaksPlugin.java @@ -99,7 +99,8 @@ public class TweaksPlugin extends MStatsPlugin { new AuthManager(this).init(getCommand("tauth")); } - mStats(1); + if (config.metrics()) + mStats(1); getLogger().info("Took %.3f milliseconds".formatted((System.nanoTime() - start) / 1000000.0)); } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 060854b..1a49d93 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -5,6 +5,9 @@ # - https://discord.gg/86X4Z5JUeq # - https://www.spigotmc.org/threads/tweaks724.670906/ +# Metrics toggle. Ideally opt-in, but the system is very new and it needs testing. +metrics: true + # Warning: Don't use /worldborder while this is on worldborder: # Expands the worldborder to 30,000,000