Improve bStats playersPerServer chart (#1225)

Updated bStats to 1.7.
Removed the "metrics" config option as it is now part of bStats's own `config.yml`.
This commit is contained in:
NotMyFault 2020-03-18 08:32:35 +01:00 committed by GitHub
parent 41e9bccc67
commit 530a76b0a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 11 additions and 22 deletions

View File

@ -69,7 +69,7 @@
<mongodb.version>3.8.0</mongodb.version> <mongodb.version>3.8.0</mongodb.version>
<!-- More visible way to change dependency versions --> <!-- More visible way to change dependency versions -->
<spigot.version>1.15.2-R0.1-SNAPSHOT</spigot.version> <spigot.version>1.15.2-R0.1-SNAPSHOT</spigot.version>
<bstats.version>1.5</bstats.version> <bstats.version>1.7</bstats.version>
<vault.version>1.7</vault.version> <vault.version>1.7</vault.version>
<placeholderapi.version>2.10.4</placeholderapi.version> <placeholderapi.version>2.10.4</placeholderapi.version>
<mvdwplaceholderapi.version>master-SNAPSHOT</mvdwplaceholderapi.version> <mvdwplaceholderapi.version>master-SNAPSHOT</mvdwplaceholderapi.version>

View File

@ -15,6 +15,7 @@ import world.bentobox.bentobox.api.flags.Flag;
public class BStats { public class BStats {
private final BentoBox plugin; private final BentoBox plugin;
private final int bstatsId;
private Metrics metrics; private Metrics metrics;
/** /**
@ -24,13 +25,14 @@ public class BStats {
*/ */
private int islandsCreatedCount = 0; private int islandsCreatedCount = 0;
BStats(BentoBox plugin) { BStats(BentoBox plugin, int bstatsId) {
this.plugin = plugin; this.plugin = plugin;
this.bstatsId = bstatsId;
} }
void registerMetrics() { void registerMetrics() {
if (metrics == null) { if (metrics == null) {
metrics = new Metrics(plugin); metrics = new Metrics(plugin, bstatsId);
registerCustomMetrics(); registerCustomMetrics();
} }
} }
@ -133,7 +135,8 @@ public class BStats {
else if (players <= 30) return "11-30"; else if (players <= 30) return "11-30";
else if (players <= 50) return "31-50"; else if (players <= 50) return "31-50";
else if (players <= 100) return "51-100"; else if (players <= 100) return "51-100";
else if (players <= 200) return "101-200"; else if (players <= 150) return "101-150";
else if (players <= 200) return "150-200";
else return "201+"; else return "201+";
})); }));
} }

View File

@ -87,6 +87,7 @@ public class BentoBox extends JavaPlugin {
// Metrics // Metrics
@Nullable @Nullable
private BStats metrics; private BStats metrics;
private static final int BSTATS_ID = 3555;
private Config<Settings> configObject; private Config<Settings> configObject;
@ -195,10 +196,8 @@ public class BentoBox extends JavaPlugin {
flagsManager.registerListeners(); flagsManager.registerListeners();
// Load metrics // Load metrics
if (settings.isMetrics()) { metrics = new BStats(this, BSTATS_ID);
metrics = new BStats(this);
metrics.registerMetrics(); metrics.registerMetrics();
}
// Register Multiverse hook - MV loads AFTER BentoBox // Register Multiverse hook - MV loads AFTER BentoBox
// Make sure all worlds are already registered to Multiverse. // Make sure all worlds are already registered to Multiverse.

View File

@ -19,7 +19,7 @@ import world.bentobox.bentobox.database.DatabaseSetup.DatabaseType;
@ConfigComment("This configuration file contains settings that mainly apply to or manage the following elements:") @ConfigComment("This configuration file contains settings that mainly apply to or manage the following elements:")
@ConfigComment(" * Data storage") @ConfigComment(" * Data storage")
@ConfigComment(" * Gamemodes (commands, ...)") @ConfigComment(" * Gamemodes (commands, ...)")
@ConfigComment(" * Internet connectivity (metrics, web-based content-enriched features, ...)") @ConfigComment(" * Internet connectivity (web-based content-enriched features, ...)")
@ConfigComment("") @ConfigComment("")
@ConfigComment("Note that this configuration file is dynamic:") @ConfigComment("Note that this configuration file is dynamic:")
@ConfigComment(" * It gets updated with the newest settings and comments after BentoBox loaded its settings from it.") @ConfigComment(" * It gets updated with the newest settings and comments after BentoBox loaded its settings from it.")
@ -228,11 +228,6 @@ public class Settings implements ConfigObject {
private boolean autoOwnershipTransferIgnoreRanks = false; private boolean autoOwnershipTransferIgnoreRanks = false;
/* WEB */ /* WEB */
@ConfigComment("BentoBox uses bStats.org to get global data about the plugin to help improving it.")
@ConfigComment("bStats has nearly no effect on your server's performance and the sent data is completely")
@ConfigComment("anonymous so please consider twice if you really want to disable it.")
@ConfigEntry(path = "web.metrics")
private boolean metrics = true;
@ConfigComment("Toggle whether BentoBox can connect to GitHub to get data about updates and addons.") @ConfigComment("Toggle whether BentoBox can connect to GitHub to get data about updates and addons.")
@ConfigComment("Disabling this will result in the deactivation of the update checker and of some other") @ConfigComment("Disabling this will result in the deactivation of the update checker and of some other")
@ -257,14 +252,6 @@ public class Settings implements ConfigObject {
// --------------------------------------------- // ---------------------------------------------
// Getters and setters // Getters and setters
public boolean isMetrics() {
return metrics;
}
public void setMetrics(boolean metrics) {
this.metrics = metrics;
}
public String getDefaultLanguage() { public String getDefaultLanguage() {
return defaultLanguage; return defaultLanguage;
} }