Removes unused player accounts
This mod is a work-in-progress, and highly customized to EdenLost. A stock minetest server will lack many of the mods that populate player metadata that this mod requires to determine if a player account should be kept or not. Furthermore, there is no minetest API that lets the server load the metadata for an offline player. Such a thing was asked for many times (see the forums), but never implemented. So this mod is split into two pieces:
-
player_analyzer.py
- A python script which runs "offline" and performs raw reads onauth.sqlite
andplayers.sqlite
. The output is a list of players to be removed. -
The in-game mod, which exposes a chat command
/pcleaner
, which performs the actual player removal.
-
Make a backup of your server. Seriously. You've been warned.
-
Install the mod, restart the server.
-
Carefully read
player_analyzer.py
functionkeep_player()
. -
CD into the
world
folder (has theplayers.sqlite
file in it). -
Run
./worldmods/player_cleanup/player_analyzer.py
. Carefully examine the output (it writes to STDOUT). -
Re-run the above command, grep out any players that you want to keep, write only the first column of text to a text file. Ex:
$ cd ${WORLDIR} $ ./worldmods/player_cleanup/player_analyzer.py | \ grep -v "^#" | awk '{ print $1 }' | sort > list.txt
-
Carefully examine
list.txt
. These are the players that will be removed from the server. You can hand-edit this file if you want to. -
Leave a shell open with a
tail -f
on the server log file. If the logs are too spammy due to other player or mod activity, then do something like this:$ tail -f ./logs/debug.txt | grep --line-buffered pcleaner
-
Log into the game world as a user with
staff
privs. -
Chat command:
/pcleaner load list.txt
and note the returned chat message. -
(Optional), Adjust how long the mod sleeps (in seconds) between batches of player deletions.
/pcleaner delay 10.0
. -
When satisfied, run
/pcleaner run
and the mod will remove all data for that player (player inventory, auth data, mailbox, etc...). To avoid halting the server while processing a huge list, the server will actually perform the removal in small batches, and run cycles every second until all targetted player accounts are removed. -
If you want to abort a run in progress, then
/pcleaner cancel
. You should regenerate the list and reload it before trying again.
The following things are removed:
-
Player's inventory, via
minetest.remove_player()
-
Player's auth data, via
minetest.remove_player_auth()
-
Players mail box and contact list from the
mail
mod (if present).${WORLD}/mails/${NAME}.json
${WORLD}/mails/contacts/${NAME}.json
-
Player's
dreambuilder_hotbar
setting${WORLD}/hotbar_settings
(serialized lua table)
-
Player's ATM account and account history (
atm
mod)${WORLD}/atm_accounts
(flat text file)${WORLD}/atm_wt_transactions
(serialized lau table)
-
Protected areas (non-recursively) via the
areas
mod${WORLD}/areas.dat
(serialized lua table)
-
beds
mod respawn position.${WORLD}/beds_spawn
(flat text file)
-
highscore.txt
entry (fromxp_redo
mod).
Other things that we could possibly remove player data from are:
jailData.txt
(requires change to thejail
mod first).mod_storage/awards
mod_storage/draconis
(aux_key_setting, bonded_dragons)mod_storage/moremesecons_wireless
mod_storage/playerfactions
mod_storage/rhotator
mod_storage/skinsdb
- Needs update to mod, or add a command to clear all entries for non-existant players.
These things are indexed by custom data files and could be removed, but also require the mod to edit the actual map data as well.
- travelnets (indexed by player in
mod_travelnet.data
, json format) need to load the mapblock, nuke the node). - elevators.
- Smartshop data (also need to remove the smart-shop nodes).
These cannot be removed, as they require a full scan of the map database:
protector:protection
("prot blocks")bones:bones