Skip to content

Commit

Permalink
docs: update examples in README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
wu-vincent committed Dec 3, 2024
1 parent 8dd493e commit f8ff10a
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down

0 comments on commit f8ff10a

Please sign in to comment.