Skip to content

Config file

RedPolygon edited this page Apr 17, 2025 · 11 revisions

At first startup, the config file is created. Be sure to also look there as it contains the default values and the format in which the file is expected. By default it only enables the scoreboard source, and it will use all objectives.

General configuration

port

(since v1.0)
The port number to use. Set this to the port you opened in getting Started step 2.

Example:

port: 8080

tables

(since v1.8)
A list of tables to show on the webpage. A table contains:

  • name: The name of the table, which is displayed above it. By default, a table has no name.
  • columns: A list of columnn names, to specify a custom column order. Columns not present in this list will be hidden (you don't need to specify the 'player' column; it is always present, and always as the first column). By default, all columns are displayed in alphabetical order.

    Example: this will only display the columns with names Mine Diamond, Biome and Deaths, in that order. (these names correspond to scoreboard objectives / placeholder names / database items defined in their respective configuration sections)

    columns: [Mine Diamond, Biome, Deaths]
    Player Mine Diamond Biome Deaths

    The columns "Player", "Mine Diamond", "Biome" and "Deaths"

  • sort-column: The table on the webpage will initially be sorted by this column.
  • sort-direction: In which direction to sort. Either ascending (smallest first, default) or descending.

columns

(since v1.5, deprecated in v1.8)
See the columns item of tables.

server-columns

(since v1.8)
A list of column names which belong to the server itself instead of to a specific player. Instead of being displayed next to a player, they will be shown on the server's own row.

column-units

(since v1.9)
A map from column names to the unit in which the values of that column are stored. WebStats will use this information to automatically convert the values into the best readable form.

These are the available units:

  • Time: ticks, milliseconds/ms, seconds/s, minutes/min, hours/h, days/d
    WebStats will format these time durations in the form 0 days 00:00:00 (leaving out days and hours when zero), or 0.000 s.
  • Distance: millimetres/millimeters/mm, centimetres/centimeters/cm, blocks/metres/meters/m, kilometres/kilometers/km
    WebStats will convert between any of these units, choosing the unit resulting in a value between 1–999.
  • Date: timestamp (values like 1693672607), formatted date (values such as Sat, 02 Sep 2023 16:38:32 GMT or similar)
    WebStats will format all dates in the user's locale.
  • Items: items, items16 (for 16-stackables such as ender pearls)
    WebStats will format item counts in the form 0 st 0.
  • Percentage: percent
    WebStats will format these values with a % appended, values are assumed to be between 0 and 100.

Example:

column-units:
  Play Time: ticks
  Aviate: cm
  Mine Diamond: items
  Last Seen: timestamp

https

(since v1.9)
The configuration for serving content over HTTPS (as opposed to plain HTTP). To use WebStats with HTTPS, you need to supply (and renew!) a valid certificate yourself and put it in plugins/WebStats/. Note that if you enable HTTPS, you can no longer access the stats over plain HTTP.

https.keystore-file

The path to the .p12 keystore file, relative to plugins/WebStats/.

https.keystore-password

The password with which the keystore file is locked.

store-player-ips

(since v1.7)
Whether to persistently store the mapping of IPs to player names. This mapping is used to highlight you on the webpage, and will otherwise be lost every time the server stops.

serve-webpage

(since v1.7)
Whether to use the internal webserver to serve the webpage, instead of only the raw stats.json

additional-resources

(since v1.9)
A list of files in the plugins/WebStats/web/ directory to expose to the public. Note that serve-webpage needs to be enabled for these files to be served!

Example: this will serve the file at plugins/WebStats/web/logo.png to ip:port/logo.png.

additional-resources: [logo.png]

webpage-title

(since v1.8)
When using serve-webpage, this is the title of the webpage.

Scoreboard source

objectives

(since v1.1)
The list of scoreboard objectives to collect. * means all objectives. Since v1.11, you can customise the display name of scoreboard objectives.

Example: this will add the scoreboard objectives called Deaths and Mine Diamond, and display the latter one as Mine Shiny Rocks

objectives:
- Deaths
- Mine Diamond: Mine Shiny Rocks

Example: this will list all scoreboard objectives

objectives: ['*']

Database connectivity

database

(since v1.4)
The database credentials, as used by both the MySQL database connectivity and the placeholder storer. You can use multiple databases, as long as they are located on the same machine. (this was just convenience, open an issue if you want multiple databases on multiple machines)

database.hostname

If you use the database(s) on the same server as your Minecraft server, this will be localhost. Otherwise, this is the IP or URL to the database server.

database.username & database.password

You know what to do.

database.config

A list of database-table configurations. This item is specific to the MySQL connectivity, the placeholder storer does not use this. To enable the MySQL source, uncomment this. Each item contains:

  • database: the name of the database to use.
  • table: the name of the table within the database to use.
  • convert: a list of conversion commands. See the wiki page on MySQL database connectivity for command-specific information. The config.yml contains an example usage which may be helpful.

Example: This will connect to localhost with given username and password. On request, the table 'mytable' in database 'mydatabase' is loaded. First, the JSON in column 'value' is read and the value in each key of the object is stored in the corresponding column. Then, the UUIDs in column 'id' are converted to player names and the column is renamed to 'Player'.

database:
  hostname: localhost
  username: mydatabaseuser
  password: mypassword123
  config:
    - database: mydatabase
      table: mytable
      convert:
        - [json, value]
        - [uuid, id]

With this config, the following database table:

id value
8fe4d255-bdb4-48fc-a364-e8c94a22b421
{"exp": 42.0, "offlineExp": 0.0}
8fe4d255-bdb4-48fc-a364-e8c94a22b421
{"money": 0.0}
069a79f4-44e9-4726-a5be-fca90e38aaf5
{"exp": 16.0, "offlineExp": 16.0}

Is converted to this output on the webpage:

Player exp offlineExp money
RedPolygon 42.0 0.0 0.0
Notch 16.0 16.0

PlaceholderAPI connectivity

placeholders

(since v1.4)
The configuration for the PlaceholderAPI connectivity. The key of every entry here specifies the placeholder to use, the value sets the displayed name.

Example: This will add a column called Biome from the placeholder %player_biome%

placeholders:
  '%player_biome%': Biome

store-placeholders-in-file

(since v1.8)
Because many placeholderAPI sources don't have data for offline players, you can enable this to store offline players' placeholders locally in a csv file and remember their statistics even when they go offline. (mutually exclusive with store-placeholders-database)

store-placeholders-database

(since v1.5)
Instead of storing the placeholders in a csv file, it is also possible to use a database instead. This is the name of the database to use (mutually exclusive with store-placeholders-in-file). When you use this, you need to set the hostname, username and password fields under the database config. (see above, you can leave the config option commented out)

Example: this is what our configuration looks like (with PebbleHost). If you have created a database called customer_12345_mydatabase with corresponding username and password, this will store the placeholder values of offline players in a table called WebStats_placeholders (it will create this table automatically)

database:
  hostname: localhost
  username: customer_12345_mydatabaseuser
  password: 'GYEXMn7dA$11Nvb9pWZt' # not my password, don't worry

store-placeholders-database: customer_12345_mydatabase

placeholder-empty-values

(since v1.11)
These are the values that placeholders return when there is no data. WebStats automatically detects an empty response and the name of the placeholder as empty, but some placeholders have some default content.

Example: this sets the "empty" value for the placeholder '%player_biome%' to '"0"' (nonsensical example but you get the point)

placeholder-empty-values:
  '%player_biome%': 0

Discord webhook

discord-webhook

(since v1.7)
The configuration for the Discord webhook.

discord-webhook.url

The URL to send the webhook requests to. More information on how to get this in the Discord webhook page.

discord-webhook.update-interval

The amount of minutes to wait between updating the embed message.

discord-webhook.display-count

The maximum number of players to show in the embed message.

discord-webhook.title

Text to be displayed before the embed, as a title. This is the title of the entire message, individual embeds can also have a title.

Example:

title: Here are the stats for my awesome server!

discord-webhook.embeds

A list of embed configs. Each element in this list defines one embed that gets added to the message:

  • title: an optional title that gets displayed op top of the embed.
  • sort-column: the name of the column (statistic) by which the players will be sorted.
  • sort-direction: this can be either ascending or descending. Ascending means that the smallest value will come first, descending will put the largest values on top.
  • columns: the list of columns (statistics) to display. Note that when you add more than 2 columns, they will not line up anymore.
    If you comment this out, all the columns from columns at the top of the file will be added, or all columns in general if that is not present.

Example:

- title: Location
  sort-column: Player
  sort-direction: ascending
  columns: [biome]

A discord message with embed titled "Location", showing player "RedPolygon" with biome "taiga"

Clone this wiki locally