From 5e20c871a56162dc311faa0b3c993cb01e5a31ae Mon Sep 17 00:00:00 2001 From: N0tMyFaultOG Date: Fri, 14 Aug 2020 11:36:17 +0200 Subject: [PATCH] Fix metrics setting --- .../java/com/plotsquared/bukkit/BukkitPlatform.java | 13 +++++++++---- .../plotsquared/core/configuration/Settings.java | 8 ++++++-- 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java index 65233e117..ac1769256 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitPlatform.java @@ -100,7 +100,6 @@ import com.plotsquared.core.plot.world.SinglePlotArea; import com.plotsquared.core.plot.world.SinglePlotAreaManager; import com.plotsquared.core.setup.PlotAreaBuilder; import com.plotsquared.core.setup.SettingsNodesWrapper; -import com.plotsquared.core.util.ConsoleColors; import com.plotsquared.core.util.EconHandler; import com.plotsquared.core.util.EventDispatcher; import com.plotsquared.core.util.FileUtils; @@ -120,7 +119,6 @@ import io.papermc.lib.PaperLib; import net.kyori.adventure.audience.Audience; import org.bstats.bukkit.Metrics; import org.bukkit.Bukkit; -import org.bukkit.ChatColor; import org.bukkit.Chunk; import org.bukkit.Location; import org.bukkit.World; @@ -305,7 +303,7 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl new WE_Anywhere(); } } catch (Throwable e) { - logger.error("[P2] Incompatible version of WorldEdit, please upgrade: http://builds.enginehub.org/job/worldedit?branch=master"); + logger.error("[P2] Incompatible version of WorldEdit, please upgrade: https://builds.enginehub.org/job/worldedit?branch=master"); } } @@ -502,7 +500,14 @@ public final class BukkitPlatform extends JavaPlugin implements Listener, PlotPl logger.info("[P2] PlaceholderAPI is not in use. Hook deactivated"); } - this.startMetrics(); + if (Settings.Enabled_Components.BSTATS) { + this.startMetrics(); + } + else { + logger.info("[P2] bStats is disabled. Enabling it in /plugins/PlotSquared/config/settings.yml helps the developers to identify the features most used"); + logger.info("[P2] and organize future updates better. Cheers."); + } + if (Settings.Enabled_Components.WORLDS) { TaskManager.getPlatformImplementation().taskRepeat(this::unload, TaskTime.seconds(1L)); try { diff --git a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java index 79bf6e71e..4ccadcd8c 100644 --- a/Core/src/main/java/com/plotsquared/core/configuration/Settings.java +++ b/Core/src/main/java/com/plotsquared/core/configuration/Settings.java @@ -184,10 +184,12 @@ public class Settings extends Config { Limit.MAX_PLOTS = config.getInt("max_plots", Limit.MAX_PLOTS); Limit.GLOBAL = config.getBoolean("global_limit", Limit.GLOBAL); - // Misc + // Miscellaneous DEBUG = config.getBoolean("debug", DEBUG); Chat.CONSOLE_COLOR = config.getBoolean("console.color", Chat.CONSOLE_COLOR); Chat.INTERACTIVE = config.getBoolean("chat.fancy", Chat.INTERACTIVE); + Enabled_Components.BSTATS = + config.getBoolean("bstats", Enabled_Components.BSTATS); Enabled_Components.DATABASE_PURGER = config.getBoolean("auto-purge", Enabled_Components.DATABASE_PURGER); @@ -421,7 +423,7 @@ public class Settings extends Config { } - @Comment("Misc settings") + @Comment("Miscellaneous settings") public static final class Done { @Comment("Require a plot marked as done to download (/plot download)") public static boolean REQUIRED_FOR_DOWNLOAD = false; @@ -590,6 +592,8 @@ public class Settings extends Config { public static boolean EXTENDED_USERNAME_COMPLETION = true; @Comment("Command aliases that will be tab completed") public static List TAB_COMPLETED_ALIASES = Arrays.asList("plot", "plots", "p", "plotsquared", "plot2", "p2", "ps", "2", "plotme", "plotz", "ap"); + @Comment({"Send anonymous PlotSquared statistics to https://bstats.org/.", + "Please keep this setting enabled. It helps us identifying which parts of PlotSquared are used the most to organize future updates better."}) public static boolean BSTATS = true; } }