From 93ebd21a61b3b41897560ff0d342c99268c72fc2 Mon Sep 17 00:00:00 2001 From: NotMyFault Date: Sat, 25 Jan 2020 02:26:49 +0100 Subject: [PATCH] Update bStats adding ID --- .../java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java | 3 ++- .../src/main/java/org/bstats/bukkit/Metrics.java | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java index 43cb8e16a..036d6b25f 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/WorldEditPlugin.java @@ -105,6 +105,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter private static final Logger log = LoggerFactory.getLogger(WorldEditPlugin.class); public static final String CUI_PLUGIN_CHANNEL = "worldedit:cui"; private static WorldEditPlugin INSTANCE; + private static final int BSTATS_ID = 1403; private BukkitImplAdapter bukkitAdapter; private BukkitServerInterface server; @@ -229,7 +230,7 @@ public class WorldEditPlugin extends JavaPlugin { //implements TabCompleter } // Enable metrics - new Metrics(this); + new Metrics(this, BSTATS_ID); PaperLib.suggestPaper(this); } diff --git a/worldedit-bukkit/src/main/java/org/bstats/bukkit/Metrics.java b/worldedit-bukkit/src/main/java/org/bstats/bukkit/Metrics.java index f9ad7ba01..e75280515 100644 --- a/worldedit-bukkit/src/main/java/org/bstats/bukkit/Metrics.java +++ b/worldedit-bukkit/src/main/java/org/bstats/bukkit/Metrics.java @@ -70,16 +70,21 @@ public class Metrics { // The plugin private final Plugin plugin; + // The plugin id + private final int bstatsId; + /** * Class constructor. * * @param plugin The plugin which stats should be submitted. + * @param bstatsId The ID of the plugin. It can be found in the url when you open the plugin on bStats. */ - public Metrics(Plugin plugin) { + public Metrics(Plugin plugin, int bstatsId) { if (plugin == null) { throw new IllegalArgumentException("Plugin cannot be null!"); } this.plugin = plugin; + this.bstatsId = bstatsId; // Get the config file File bStatsFolder = new File(plugin.getDataFolder().getParentFile(), "bStats"); @@ -181,6 +186,7 @@ public class Metrics { String pluginVersion = plugin.getDescription().getVersion(); data.addProperty("pluginName", pluginName); // Append the name of the plugin + data.addProperty("id", bstatsId); // Append the id of the plugin data.addProperty("pluginVersion", pluginVersion); // Append the version of the plugin data.add("customCharts", new JsonArray());