feat: BStats Metrics#517
Merged
Merged
Conversation
Exanthiax
approved these changes
May 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
bStats Custom Metrics
What changed
New API — EcoMetricsChart (eco-api)
Sealed Kotlin class exposing all bStats chart types as a clean, type-safe API. Supports SimplePie, AdvancedPie, DrilldownPie, SingleLineChart, MultiLineChart, SimpleBarChart, and AdvancedBarChart. Companion object provides
@JvmStaticfactory methods for Java compatibility.EcoPlugin.getCustomCharts()
New opt-in method returning List. Returns empty list by default — zero breakage for existing plugins. Override to declare custom bStats charts submitted alongside standard metrics.
bStats vendoring via Gradle
Replaced the hand-rolled vendored Metrics.kt with a vendorBStats Gradle task that clones the official bStats-Metrics repo at a pinned tag (v3.2.1), relocates all sources from org.bstats → com.willfp.eco.libs.bstats, and prepends attribution headers. Output lands in build/generated/sources/bstats/ (not committed). Task is cached by version... re-runs only when bStatsVersion changes (or gradle clean). Solves a classpath conflict where MythicMobs bundles an unrelocated old bStats, which previously caused compile-time resolution to the wrong Metrics class.
Eco-specific charts (EcoImpl)
Eco now submits its own charts:
getRegisteredIntegrations() added to AntigriefManager, AnticheatManager, CustomItemsManager
Mirrors the existing pattern from ShopManager. Used by the Eco metrics charts above.