From f8ff10a9840582ec70cab5b3efe91699a6c5d4f6 Mon Sep 17 00:00:00 2001 From: Vincent Date: Tue, 3 Dec 2024 16:35:28 +0000 Subject: [PATCH] docs: update examples in README.md --- README.md | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d873f26..d1f415d 100644 --- a/README.md +++ b/README.md @@ -38,9 +38,11 @@ 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) + 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](https://bstats.org/register) to register your plugin. @@ -66,10 +68,13 @@ 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( + 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