From 8dd493e50e9663578e31c25847bbd7c09e1a9138 Mon Sep 17 00:00:00 2001 From: Vincent Date: Tue, 3 Dec 2024 16:31:53 +0000 Subject: [PATCH] docs: update README.md --- README.md | 92 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 81 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index f2b7096..d873f26 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,85 @@ -# bstats +# endstone-bstats -bStats Metrics for Endstone Plugins +`endstone-bstats` is a Python library that provides functionality for integrating bStats metrics into your Endstone +plugins. It is designed to be simple, extensible, and lightweight. ## Features -- [x] Metrics Class -- Custom Charts - - [x] Simple Pie - - [x] Advanced Pie - - [x] Drilldown Pie - - [x] Single Line - - [ ] Multi Line - - [ ] Simple Bar - - [ ] Advanced Bar \ No newline at end of file +- Supports various types of charts, including: + - Simple Pie + - Advanced Pie + - Drilldown Pie + - Single Line + - Multi Line + - Simple Bar + - Advanced Bar +- Easy-to-use APIs for collecting and sending metric data. +- Designed for flexibility and extensibility. + +## Installation + +Install the package using pip: + +```bash +pip install endstone-bstats +``` + +## Quick start + +[bStats](https://bstats.org/getting-started) is a free and open source website that helps you to collect usage data for +your plugin. Integrating bStats into your plugin is straight forward and done in a matter of seconds. + +Here’s a simple example of how to add bStats to your plugin. + +```python +from endstone.plugin import Plugin +from endstone_bstats import Metrics + + +class ExamplePlugin(Plugin): + def on_enable(self): + # Initialize Metrics + plugin_id = 1234 # <-- Replace with the id of your plugin! + metrics = Metrics(self, plugin_id) +``` + +After adding bStats to your plugin you have to [create an account](https://bstats.org/register) to register your plugin. +You can manage your plugins with this account, e.g. adding customs graphs, etc. + +## Add custom charts + +Adding charts to your plugin consists of two parts: + +- Adding charts to your code +- Adding charts on the website + +To add a chart on the website, check the [detailed instructions here](https://bstats.org/help/custom-charts). + +A **Simple Pie** is the most basic chart type. It's a great option for config settings as it only accepts one value per +server. Adding the chart to your code is fairly easy: + +```python +from endstone.plugin import Plugin +from endstone_bstats import Metrics, SimplePie + + +class ExamplePlugin(Plugin): + def on_enable(self): + plugin_id = 1234 # <-- Replace with the id of your plugin! + metrics = Metrics(self, plugin_id) + metrics.add_custom_chart( + SimplePie("used_language", lambda: "en_US") + ) +``` + +## Contributing + +We welcome contributions! Feel free to open an issue or submit a pull request to improve the library. + +## License + +This project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details. + +## Acknowledgments + +This library is inspired by [bStats for Java](https://bstats.org/), ported by the EndstoneMC team to Python.