bStats - A modern alternative to McStats


#1

bStats

Hello and welcome!

Today I want to show you my latest project I'm working on the last 3-4 month: bStats.


What is bStats?

bStats is a service/website which collects data for plugins. I started developing it about 4 month ago, because I was pretty annoyed that McStats was down for weeks (the last two month it was stable again) and I couldn't find any alternatives. In the first place it was intended to be only used by me and some friends, but finally I decided to make it accessible to everyone who wants to use it. bStats is still in development, but already supports everything a good metrics service should have.


How do I use bStats?

bStats is as very easy to setup. It's done in less than 5 minutes: All you need to do is to add the Metrics class to your plugin and register the plugin on the website. Just take a look here: Getting started.


Are custom charts supported?

Yes! Custom charts are very easy to implement.
Let's say your plugin supports serveral languages which can be toggled in the configuration and you want to know which languages are the most used:

ConfigurationNode node; // A configuration node
metrics.addCustomChart(new Metrics.SimplePie("used_language") {
    @Override
    public String getValue() {
        return node.getNode("language").getString("en");
    }
});

The result may look like this one:

(Live preview)

A more detailed tutorial on how to setup custom charts can be found here. The examples are for Bukkit plugins, but the system is the same for Sponge.


What features are planned for the future
Though there are already lot's of features which are still missing but planned:

  • More custom chart types (e.g. map charts)
  • Signature images!
  • Plugin Ranking
  • Customizable plugin page (e.g. adding a description)
  • Profile pages for developers (optional)
  • Support for Bungeecord
  • Maven Repo!
  • Login with GitHub, Google, Twitter, ...
  • A documented REST-Api.
  • ...

Sounds great! Can I support you?

  • The best way to support me/bStats is to try it and give me feedback:
  • Do you like the design of the website? Would you make things different?
  • Did you find any bugs?
  • Are all tutorials/descriptions clear or do you have any trouble using the service?
  • Are there any spelling or grammar mistakes? English isn't my mother tongue so there might be some mistakes.
  • Are you missing some charts?

Beta? Is it already safe to use?

There may be some small downtimes or in the worst case lost data, but's it's already very stable. Futures versions of bStats will be completely downwards compatible so you can already integrate bStats in your plugin without being afraid it may break in the future. I already use bStats for my own plugin SafeTrade, so it's in my own interest not to break anything. :slight_smile:


Useful links


:moneybag: EconomyLite v2.13.0 | API 7.0
SimpleGamemode [v1.1]
:snowman: NPCs [v3.0.0] - Easiest and Best NPC plugin
Kosp - helpful plugin library for Kotlin
PlaceholderAPI - A hub for your placeholders
NPCs - A plugin that adds simple custom NPC's to your worlds
MMCPrefix [1.2.1] - A Simple Custom Prefix Handler [API 5.1 + 7]
MMCLogger - Simple chat and command logger
VirtualChest - A sponge plugin providing virtual chest GUIs for menus like ChestCommands
MMCRules [1.2] - Force players to read and accept the rules
MMCReboot [2.3.0] - A server restart plugin
MMCRules - Force players to read and accept the rules
MMCTickets - A real time ticket system
MMCRestrict - A simple item restriction plugin
PlaceholderAPI - A hub for your placeholders
FriskStick - Act like a cop!
MMCReboot - A server restart timer and voting system
SimpleGamemode - A simple way to switch between survival and creative
MMCTickets [2.0.2] - A simple real time tickets system
:cop: FriskStick - Act like a cop! [v1.0.1] [API 5.0.0] [MC 1.10.2]
MMCPrefix - A simple and easy to use custom prefix manager
#2

First of all, let me say that this is an extremely impressive service! You've done an amazing job!

I have a few suggestions to make:

  • The Metrics class does not currently work when more than one plugin uses it at a time on the same server. From looking at it, I think your intention was that it would be loaded once for each plugin that uses it. However, Sponge uses one classloader for all plugins - unlike Bukkit, which creates a separate classloader for each plugin.
  • There's currently no link to the Github repository in the 'Useful links' section of this post - I would suggest adding it, as it took me a few minutes to find.

Keep up the great work!


#3

Hey, thank you for your feedback! :slight_smile:
I tested it several times on my local Pc with more than 1 plugin and it worked fine. Maybe I messed up something in the code I released.
My intention is not to load the class only one time, but to let only one (the first one) Metrics class submit all data. Are there any errors when you use more than 1 plugin or does it just not work?
I'll test it later.

// Edit: For different plugins the class must be in different packages, too. Maybe that's the problem?
// Edit2: Tested it again: For me it works with 2 plugins, too.


#4

Would just like to also mention that it is currently working with 2 of my plugins, I had some issues previously but I'm still unsure as to why they were not sending data, but it seems to be perfectly fine now.


#5

Oops, you're right. While I did copy the class to the two different plugins I was using, I accidentally imported the same class in both (both plugin projects were imported into my IDE). My bad.


#6

I am trying to compile my plugin with Gradle after I added this class, but it seems to fail due to some of the characters in the language enum being "illegal". Here is the resulting error it gives: http://pastebin.com/FAChBThE


#7

Try adding this to your gradle build script:
compileJava.options.encoding = 'UTF-8'
That should fix your error.


#8

That worked perfectly, thank you very much.


#9

Small changelog:


#10

I get this error when compiling my plugin:
http://pastebin.com/0t2dveqq

Seems like it doesn't like the characters in the country names


#11

Try to add this to your pom.xml:

<project>
...
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
...
</project>


#12

I am using gradle.
When I build normally it works, but for example TeamCity doesn't like those characters.
It is not a problem for me, as I was just testing around with TeamCity, but maybe someone else might have problems with that in the future.


#13

I'm planning to make a lite version of the bStats class, too.
If someone has problems with the encoding and doesn't need the custom charts he can use this version.
How to solve the problem with Gradle can be found a few comments above: https://forums.spongepowered.org/t/bstats-a-modern-alternative-to-mcstats/16065/6?u=btobastian


#14

Does bStats support plugins that run on multiple platforms (e.g. a plugin with a Bukkit version and a Sponge version)?


#15

I don't believe so at the moment, they'd have to be set up separately it seems: https://github.com/BtoBastian/bStats/issues/9


#16

I separated the platforms, because I don't want to mess up the statistics. This was mainly because of Bungeecord (which would result in the player amount of the global stats being doubled), but I also think it's better for Plugin authors to see the stats individual for the different platforms. What I want to do is adding a message like "This plugin is also available for xyz, click here to see it's stats".


#17

Time for a small update note:

  • Added new custom chart: Bar-Charts. They still seem to be a little buggy, but I think I'm able to fix this soon. :slight_smile:
    Here's an example on how the chart can look like. They are very customizable so maybe you find an other use for them than just config options:
  • Bugfixes
  • bStats now has a status page: https://bstats-monitor.layerwall.com/

There's also one other thing I'm really excited about: bStats now has a sponsor: LayerWall.
I know some of you were curious if bStats would be able to handle the same amount of traffic like McStats and now I can say for sure: Yes, it would be!

You might also be interested in what my plans for the nearby future are:

  • A Maven Repo: I wasn't aware, that a Maven repo is something requested so much. I noticed a lot of people were complaining, that they had to inlclude such a large class and check for updates manually. That's the reason a Maven repo and a Lite version of the class now have a very high priority for me. I will also move the metrics classes from gist to a "real" GitHub repository and remove these nasty non-UTF8 characters from the Country enum names.
  • Scalability: At the moment bStats is limited to running on a single powerful maschine, which is fine for most of the time but I want make sure bStats is able to deal with huge amount traffic which may not only be limited to requests from servers but also traffic like REST-Api calls, signature images, etc. Running as cluster of 2 or more servers also makes everything more reliable: If one server crashes it doesn't matter because there are still other servers able to handle the requests. This change requires me to change a lot of the current code, but being able to utilize more then one machine is a huge benefit for the future growth.

#18

The Maven repository is now online.
All necessary information can be found here: https://bstats.org/getting-started/include-metrics


#19

Hey,
bStats now has a Discord channel, too.
If you use Discord, feel free to join. :slight_smile:
https://discord.gg/qTXtXuf


#20

I just added bstats to my plugin and it worked perfectly on the first try. Amazing system. :smile:
It would be amazing if you added some sort of update-available system. Keep up then good work.