No Description

Leonardo Santos c33b51bf4e update version 8 months ago
dist 231b36a0a9 mcapi.ca is now gameapis.net 11 months ago
examples 2789d10176 Add 'status' 1 year ago
src 231b36a0a9 mcapi.ca is now gameapis.net 11 months ago
.babelrc baab89906c :rocket: init 1 year ago
.gitignore baab89906c :rocket: init 1 year ago
LICENSE 1e652b29b2 Create LICENSE 1 year ago
README.md c33b51bf4e update version 8 months ago
gulpfile.js baab89906c :rocket: init 1 year ago
package.json 2789d10176 Add 'status' 1 year ago
yarn.lock baab89906c :rocket: init 1 year ago

README.md

mc-player-counter

Displays the number of online players of your Minecraft Server in your site with 2 lines of HTML.

Options

  • refreshRate - Rate that the counter will refresh.
  • 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, should be prefixed with data-playercounter-. E.g (data-playercounter-ip)

You can also display the server status by adding the attribute data-playercounter-status. It will display "online" or "offline".
See example

Demo

Usage:

HTML

<!DOCTYPE html>
<html>
  <head>
    <!-- ... -->
    <script src="https://cdn.jsdelivr.net/gh/leonardosnt/[email protected]/dist/mc-player-counter.min.js"></script>
  </head>
  <body>
    There are <span data-playercounter-ip="my.server.ip">0</span> players online on my server.
  </body>
</html>

JS (Optional)

new PlayerCounter({
  element: element,
  ip: 'server ip',
  format: '{online}/{max}' // default {online}
  refreshRate: 1000 // default 5s (5000)
});

License

Copyright (C) 2017-2018 leonardosnt [email protected]
Licensed under the MIT License. See LICENSE file in the project root for full license information.