Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/leonardosnt/mc-player-counter
Displays the number of online players in your Minecraft Server on your website using 2 lines of HTML.
https://github.com/leonardosnt/mc-player-counter
counter html javascript minecraft player
Last synced: about 13 hours ago
JSON representation
Displays the number of online players in your Minecraft Server on your website using 2 lines of HTML.
- Host: GitHub
- URL: https://github.com/leonardosnt/mc-player-counter
- Owner: leonardosnt
- License: mit
- Created: 2017-05-13T15:21:43.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-12T06:49:09.000Z (almost 2 years ago)
- Last Synced: 2024-04-14T11:01:32.179Z (7 months ago)
- Topics: counter, html, javascript, minecraft, player
- Language: JavaScript
- Homepage: https://leonardosnt.github.io/mc-player-counter/examples/
- Size: 118 KB
- Stars: 84
- Watchers: 7
- Forks: 25
- Open Issues: 17
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# mc-player-counter
Displays the number of online players in your Minecraft Server on your website using 2 lines of HTML.
The only two lines needed are the script tag and the element that will display the number. Example:
```htmlThere are 0 players on Hypixel right now.
```## Options
- refreshRate - The rate that the counter will refresh (1m by default. Note that https://mcapi.us/ has a 5 minute cache.)
- format - Format that the counter will be displayed
- `{max}` - Maximum players
- `{online}` - Online players
- ip - Server IP. E.g (`mc.hypixel.net`), with port (`mc.hypixel.net:25565`)
- element - Element that the counter will be rendered in.In HTML, the attributes should be prefixed with `data-playercounter-`. E.g (`data-playercounter-ip`)
It's also possible to display the server status by adding the attribute `data-playercounter-status`. It will display "online" or "offline".
See [example](examples/index.html#L12)## Demo
- https://leonardosnt.github.io/mc-player-counter/examples/ ([Source](https://github.com/leonardosnt/mc-player-counter/blob/master/examples/index.html#L10-L12))## Example (including HTML template):
HTML
```html
There are 0 players online on my server.
```
JS ("API")
```javascript
new PlayerCounter({
element: element,
ip: 'server ip',
format: '{online}/{max}' // default {online}
refreshRate: 60 * 1000 // default 1m
});
```## License
Copyright (C) 2017-2020 leonardosnt
Licensed under the MIT License. See LICENSE file in the project root for full license information.