Skip to content

Commit

Permalink
feat(stats): Add bstats support.
Browse files Browse the repository at this point in the history
  • Loading branch information
CarmJos committed Jan 4, 2024
1 parent 1bf117d commit 5cdd0ed
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Will be generated on the first boot up.

## Statistics

[![bStats](https://bstats.org/signatures/bukkit/TemplatePlugin.svg)](https://bstats.org/plugin/bukkit/TemplatePlugin/18946)
[![bStats](https://bstats.org/signatures/bukkit/UserSuffix.svg)](https://bstats.org/plugin/bukkit/UserSuffix/20648)

## Open Source Licence

Expand Down
7 changes: 6 additions & 1 deletion src/main/java/com/artformgames/plugin/usersuffix/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import com.artformgames.plugin.usersuffix.hooker.SuffixPlaceholder;
import com.artformgames.plugin.usersuffix.user.SuffixLoader;
import dev.rollczi.litecommands.LiteCommands;
import org.bstats.bukkit.Metrics;
import org.bukkit.Bukkit;
import org.bukkit.command.CommandSender;

Expand Down Expand Up @@ -40,14 +41,18 @@ protected boolean initialize() {
this.commands = ArtCore.createCommand().commands(UserSuffixCommands.class).build();
this.commands.register();

if (PluginConfig.METRICS.getNotNull()) {
log("Initializing bStats...");
new Metrics(this, 20648);
}

if (PluginConfig.CHECK_UPDATE.getNotNull()) {
log("Start to check the plugin versions...");
getScheduler().runAsync(GHUpdateChecker.runner(this));
} else {
log("Version checker is disabled, skipped.");
}


log("Register placeholders...");
if (Bukkit.getPluginManager().isPluginEnabled("PlaceholderAPI")) {
new SuffixPlaceholder(this, getName());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,14 @@ public interface PluginConfig extends Configuration {

ConfiguredValue<Boolean> DEBUG = ConfiguredValue.of(false);

@HeaderComment({
"Statistics Settings",
"This option is used to help developers count plug-in versions and usage, and it will never affect performance and user experience.",
"Of course, you can also choose to turn it off here for this plugin,",
"or turn it off for all plugins in the configuration file under \"plugins/bStats\"."
})
ConfiguredValue<Boolean> METRICS = ConfiguredValue.of(Boolean.class, true);

@HeaderComment({
"Check update settings",
"This option is used by the plug-in to determine whether to check for updates.",
Expand Down

0 comments on commit 5cdd0ed

Please sign in to comment.