SkillAgentSearch skills...

MCStatsCompiler

Takes a load of JSON and DAT data files generated by a Minecraft server and outputs nice stats

Install / Use

/learn @Elric02/MCStatsCompiler
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

MCStatsCompiler

This project aims at taking a bunch of stats data file generated from Minecraft players and outputing nicely formatted statistics.

Example 1 Example 2 Example 3

Disclaimer

This was coded for my own use originally, but I've decided to share it in case it can be useful to someone else. It is still work in progress, and requires some knowledge of Python.

The script is intended to be executed on your own computer and not on a server. It could be executed on a server, but it probably requires a little adaptation.

Also, most of the recent features have not been tested extensively, so there are probably some bugs. Feel free to report them in the Issues section.

Modules

For now, there are 2 "modules" in this project. Note: the 2 modules are now in the same Python file main.py

Main module

This module takes vanilla stats files (json and dat format) that can be found in the folder "stats". It has currently the following features:

  • A leaderboard (console printed-only for now) of the desired statistic. For example, minecraft:play_time for the play time of each player.
  • A "best-and-worst" (console printed-only for now) for the desired player. This gives the position of the player in each of the leaderboards of individual stats.
  • An image containing multiple small leaderboards for desired statistics (configurable in the config). Also works with the Cobblemon module.

Cobblemon module

This module takes statistics files generated by the Cobblemon mod (json format) that can be found in the folder "cobblemonplayerdata". It has currently the following features:

  • A leaderboard of the players who caught the most Cobblemons, the most shiny Cobblemons, the most Legendary Cobblemons, and who has the most money. The leaderboard is output on an Excel sheet.
  • (DEPRECATED) A network graph representing the PvP duels done by players, where each player is represented by a node.
  • A bar chart representing how often each Cobblemon type has been caught.
  • A CSV file containing some stats about pokeballs used by the players.
  • Individual player cards, formatted in a Minecraft way, each containing some stats about the player.

Running the scripts

1. Installation

In order to run the scripts, start by downloading this repo. You need a valid installation of Python, as well as the required libraries. The necessary libraries are listed in requirements.txt.

You can install them all at once by executing the following command in the project folder: pip install -r requirements.txt

2. Edit the config

There is 1 config to edit, config.ini. Read it, and if needed, edit it based on what you want.

3. Update usercache.json

All of your data files should be named [uuid].json, where [uuid] is the Minecraft UUID of the player. In order to work with the usernames of the players instead, you need to update the file data/usercache.json. Simply download it from your server (it should be at the root folder) and put it there. If you use the FTP setting (see below), the script will go and file the file for you (no need to update it manually then).

Note: if your server is in offline-mode (cracked mode), you might have players with same name but different UUIDs, which will crash the script. You need to fix that manually in the usercache.json.

4. Input files

You have the choice between 4 options to input data files: manual, local, ftp or sftp. In the config, manual is by default.

  • manual: upload manually all the files in the relevant folders in the data folder of the project
  • local: you have a server on your local machine/computer, in this case simply give the path to the main folder in the config.
  • ftp: use an ftp connection to a distant server
  • sftp: use an sftp connection to a distant server

If you use the manual option, drop the files in the appropriate subfolders in the data folder (stats, usercache...). The subfolders have the same name that they should have on your server. If you use other options, follow the instructions in the config.

5a. Prepare leaderboard_usernames.csv

If you intend on using the top-image, pvp network or player cards feature, you can update staticdata/leaderboard_usernames.csv to display other "real" nicknames instead of the Minecraft usernames.

(Cobblemon module only) 5b. Prepare output.xlsx

If you intend on using the leaderboard feature of the Cobblemon module, you can optionally modify the output.xlsx file. Simply adapt the table to your desired number of players (for example, if you expect 20 players, you can for example have a 5x4 table or a 10x2 table). You can also change the title, the colors and other formatting elements. Just make sure to keep 3 Excel columns per leaderboard column, and start it in the cell B3 (see example in the image below).

Don't forget to adapt the config file to your changes, especially the number of rows and columns if you have changed them! The subtitles of the table can also be configured there.

Cobblemon example

(Cobblemon module only) 5c. Prepare Pokemon.csv

If you intend on using the "Most Legendary Cobblemons" Leaderboard (which is disabled by default), you can edit staticdata/Pokemon.csv. This is not needed, but if you want to change which pokémons are considered as legendary for the leaderboard, it is done there.

(Cobblemon module only) 5d. Prepare cards.csv

If you intend on using the individual player cards feature (which is disabled by default), you can edit staticdata/cards.csv. This is where you can edit the text on the player cards.

6. Run the script

You can now run the main.py script of the module with your Python installation.

Frequent problems

  1. This script uses local paths, so make sure that you are executing the Python script from the folder! If you get errors related json files, it's probably that the script couldn't find it.
  2. The Cobblemon leaderboard feature only produces the XLSX table. To display an image in-game, you still need to convert the table to an image and then upload it somewhere. Feel free to contact me if you need help or tips with that.
  3. This script is not automatic by default; you need to run it manually periodically for it to work. Optionnally, you can setup something on your own machine to run it automatically.

Interesting forks

The following forks of this project might be of interest to you:

  • floooz/MCStatsCompiler-autoupload This fork implements a possible next step for the Cobblemon leaderboards, which is automatically converting the tables from the output.xlsx file to images and uploading them to a GitHub repo. These images can then be used in-game, for example with the projector from the SlideShow mod.
  • ThibautChoppy/MCStatsCompiler This fork runs the script in a Docker container and outputs the leaderboard on a nice-looking web page rather than in an XLSX file.

Version française

MCStatsCompiler

Description

Ce projet vise à traiter un ensemble de fichiers de statistiques générés par des joueurs de Minecraft et à produire des statistiques formatées de manière lisible.

Avertissement

Ce projet a été initialement codé pour mon propre usage, mais j'ai décidé de le partager au cas où il pourrait être utile à quelqu'un d'autre. Il est encore en cours de développement et nécessite une certaine connaissance de Python.

Le script est destiné à être exécuté sur votre propre ordinateur et non sur un serveur. Il pourrait être exécuté sur un serveur, mais cela nécessiterait probablement quelques adaptations.

De plus, la plupart des fonctionnalités récentes n'ont pas été testées de manière approfondie, et il est donc probable qu'il y ait des bugs. N'hésitez pas à les signaler dans la section Issues.

Modules

Actuellement, ce projet comporte deux "modules". Note : les deux modules sont désormais dans le même fichier Python, main.py.

Module principal

Ce module traite les fichiers de statistiques vanilla (au format JSON et dat) situés dans le dossier "stats". Il propose actuellement les fonctionnalités suivantes :

  • Un classement (affiché uniquement en console pour l'instant) de la statistique souhaitée. Par exemple, minecraft:play_time pour le temps de jeu de chaque joueur.
  • Un "meilleur-et-pire" (affiché uniquement en console pour l'instant) pour un joueur donné. Cela indique la position du joueur dans chaque classement de statistiques individuelles.
  • Une image contenant plusieurs petits classements pour les statistiques souhaitées (configurables dans la config). Fonctionne également avec le module Cobblemon.

Module Cobblemon

Ce module traite les fichiers de statistiques générés par le mod Cobblemon (au format JSON) situés dans le dossier "cobblemonplayerdata". Il propose actuellement les fonctionnalités suivantes :

  • Un classement des joueurs qui ont attrapé le plus de Cobblemons, le plus de Shiny Cobblemons, le plus de Cobblemons légendaires, et qui ont le plus d'argent. Le classement est affiché sur une feuille Excel.
  • (OBSOLÈTE) Un graphique en réseau représentant les duels PvP effectués par les joueurs, où chaque joueur est représenté par un noeud.
  • Un diagramme à barres représentant le nombre de fois où chaque type de Cobblemon a été attrapé.
  • Un fichier CSV contenant des statistiques sur les pokéballs utilisées par les joueurs.
  • Des fiches individuelles de joueurs, formatées à la manière de Minecraft, contenant chacune des statistiques sur le joueur.

Exécution des scripts

1. Installation

Pour exécuter les scripts, commencez par télécharger ce dépôt. Vous avez besoin d'une installation valide de Python ainsi que des bibliothèques requises. Les bibliothèques nécessaires qui ne sont pas installées par défaut avec Python sont listées dans **requireme

Related Skills

View on GitHub
GitHub Stars4
CategoryDevelopment
Updated11d ago
Forks9

Languages

Python

Security Score

70/100

Audited on Mar 26, 2026

No findings