Skip to content

Getting Started

RedPolygon edited this page Jan 3, 2024 · 10 revisions

Set up plugin

  1. Download the .jar file from the latest release and place it in the plugins/ folder, like you would with any plugin.
    (note: if you downloaded from the Spigot resources page, you will get a .zip file with the files needed for both the minecraft server and the web server)

  2. Open a port for the plugin to communicate over.

  3. Restart your server to let it generate the config file. Change the port number in plugins/WebStats/config.yml to the one you opened in the previous step.

Set up webpage front-end

It is possible to host the web files on your own website, but since version 1.7 WebStats can also serve the webpage for you (like Dynmap). Choose one of these two options:

  1. Easy option: webpage served by WebStats
    To enable WebStats' internal web server, set serve-webpage to true in config.yml.
    It is still possible to customise the webpage, by manually adding a modified version of index.html or style.css to WebStats/web/. Note that they will not be updated automatically when you update the plugin.

  2. Advanced option: webpage served by own web server

    1. Download the WebStats-dist.js file from the latest release, and upload it to a directory on your web server.
      (note: if you downloaded from the Spigot resources page, the file you need is in that zip file, along with the .jar)
    2. Have a look at web/example/index.html. It contains a basic starting point for you to use, along with some nice-to-have features. The most important things are:
      1. Import the JavaScript module
      2. Initialise WebStats when the page is loaded

Further steps

WebStats can gather statistics from multiple sources: the scoreboard, PlaceholderAPI and MySQL databases. Make sure you have at least one of these set up, otherwise your statistics webpage will stay empty!

Scoreboard

By default only the scoreboard source is enabled. In order to populate the scoreboard, you will need other plugins or datapacks, like VanillaTweaks track (raw) statistics.
Since this is the simplest source, there is not a lot of configuration possible. You can list the scoreboard objectives you want to display in the objectives config file item. If you add '*' (default), the plugin will gather all objectives.

PlaceholderAPI

The PlaceholderAPI source is disabled by default. You need to uncomment placeholders in the config file to enable it. You can specify which placeholders to use and give the name of their columns.
Since many placeholders are not available for offline players, WebStats offers a way to store these when players are online so that they are still visible after players go offline. To do this, WebStats needs a database to store the placeholders in. Set store-placeholders-database to the name of the database to use for this and fill in the database access fields as mentioned in that link.

MySQL Database

Disabled by default. If you have a plugin that stores its data in a database but does not expose that through for example the PlaceholderAPI, you can use this to directly read from that database. You first need to fill in the database access details (hostname, username and password). Then, you can add a configuration for each table to read from. More detailed info can be found on the MySQL database connectivity page.

Clone this wiki locally