You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My general use case here is that the majority of my plugins/mods support all modding/plugin APIs in one Jar, so it's a bit of a pain to include metrics for 4 different implementations in a reasonable manner (my current implementation works, but is a bit sketchy imo).
If bStats ever expands to more server types, it should have a generalized implementation available at bStats-Metrics, allowing for it to be easily expanded upon, probably using something similar to this:
publicclassMetrics {
privatestaticSupplier<Integer> playerCountFunc = () -> 0publicstaticsetPlayerCountFunc(Supplier<Integer> playerCountFunc) {
this.playerCountFunc = playerCountFunc
}
// ... The rest of the Metrics class
}
Or alternatively, bStats could ship all the logic in one dependancy that can be shaded, that checks the server type/version and applies the right methods automagically.
The jump to multi-platform is a bit much tbh, but after the initial setup it's a lot nicer to maintain, given that everything except for platform-dependent methods is common code.
If bStats ever goes that route, the server type could be another field in the API, allowing for developers to just set up any multi-platform plugin with the same pluginId.
The main future maintainability concern here will obviously be Forge, as you can't leverage intermediaries like you can with Fabric to get multi-version support from one artifact, though if multi-platform support were to be implemented, I'd be willing to take on Forge and create some decent abstractions.
The text was updated successfully, but these errors were encountered:
My general use case here is that the majority of my plugins/mods support all modding/plugin APIs in one Jar, so it's a bit of a pain to include metrics for 4 different implementations in a reasonable manner (my current implementation works, but is a bit sketchy imo).
If bStats ever expands to more server types, it should have a generalized implementation available at bStats-Metrics, allowing for it to be easily expanded upon, probably using something similar to this:
Or alternatively, bStats could ship all the logic in one dependancy that can be shaded, that checks the server type/version and applies the right methods automagically.
The jump to multi-platform is a bit much tbh, but after the initial setup it's a lot nicer to maintain, given that everything except for platform-dependent methods is common code.
If bStats ever goes that route, the server type could be another field in the API, allowing for developers to just set up any multi-platform plugin with the same pluginId.
Edit:
Wrote up a generalized example here:
https://github.com/p0t4t0sandwich/TaterLib/blob/dev/common/src/main/java/dev/neuralnexus/taterlib/bstats/MetricsAdapter.java
Main idea is to check what platform the server is running on, then use whatever helper class to safely get the proper platform methods.
The main future maintainability concern here will obviously be Forge, as you can't leverage intermediaries like you can with Fabric to get multi-version support from one artifact, though if multi-platform support were to be implemented, I'd be willing to take on Forge and create some decent abstractions.
The text was updated successfully, but these errors were encountered: