Skip to main content

bStats Metrics for Endstone Plugins

Project description

endstone-bstats

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

  • 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:

pip install endstone-bstats

Quick start

bStats 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.

from endstone.plugin import Plugin
from endstone_bstats import Metrics


class ExamplePlugin(Plugin):
    def on_enable(self):
        plugin_id = 1234  # <-- Replace with the id of your plugin!
        self._metrics = Metrics(self, plugin_id)

    def on_disable(self):
        self._metrics.shutdown()

After adding bStats to your plugin you have to create an account 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.

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:

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!
        self._metrics = Metrics(self, plugin_id)
        self._metrics.add_custom_chart(
            SimplePie("used_language", lambda: "en_US")
        )

    def on_disable(self):
        self._metrics.shutdown()

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 file for details.

Acknowledgments

This library is inspired by bStats for Java, ported by the EndstoneMC team to Python.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

endstone_bstats-0.1.0.tar.gz (13.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

endstone_bstats-0.1.0-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file endstone_bstats-0.1.0.tar.gz.

File metadata

  • Download URL: endstone_bstats-0.1.0.tar.gz
  • Upload date:
  • Size: 13.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/5.1.1 CPython/3.12.7

File hashes

Hashes for endstone_bstats-0.1.0.tar.gz
Algorithm Hash digest
SHA256 4743a934c7990e8c66872d7267806e0b1fcb889aeabac21830bc02aa357a7e6b
MD5 f5f7091d57c57ee4cd8c4acb8773edc1
BLAKE2b-256 900e9cb6ab7d083341301d222acb8c229ae14f763047f104be825e53bb3647c7

See more details on using hashes here.

Provenance

The following attestation bundles were made for endstone_bstats-0.1.0.tar.gz:

Publisher: cd.yml on EndstoneMC/bstats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file endstone_bstats-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for endstone_bstats-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 97b42d1f7b0580c46333bc33d8c24ae350f30ce3dbe0964c5189bb9f88250325
MD5 8652758c225614e7642234c35eea3a86
BLAKE2b-256 94106b75d9a0b485aeae5891dc0e9e6a7027f384702bffe4f99271ff180c46a5

See more details on using hashes here.

Provenance

The following attestation bundles were made for endstone_bstats-0.1.0-py3-none-any.whl:

Publisher: cd.yml on EndstoneMC/bstats

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page