Send the bStats ID

This commit is contained in:
NotMyFault 2020-01-24 18:10:19 +01:00
parent 0953b5627e
commit 312b2ad1a8

View File

@ -79,6 +79,9 @@ public class Metrics {
// The plugin
private final Plugin plugin;
// The plugin id
private final int bstatsId;
// A list with all custom charts
private final List<CustomChart> charts = new ArrayList<>();
@ -86,13 +89,14 @@ public class Metrics {
* Class constructor.
*
* @param plugin The plugin which stats should be submitted.
* @param bstatsId ID of the plugin
* @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, 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");
@ -207,6 +211,7 @@ public class Metrics {
String pluginVersion = plugin.getDescription().getVersion();
data.put("pluginName", pluginName); // Append the name of the plugin
data.put("id", bstatsId); // Append the id of the plugin
data.put("pluginVersion", pluginVersion); // Append the version of the plugin
JSONArray customCharts = new JSONArray();
for (CustomChart customChart : charts) {