Mods / Whitelist List
Author: YangWenLi
Side: Both
Created: Oct 20th at 9:37 PM
Last modified: Oct 20th at 11:10 PM
Downloads: 23
Follow Unfollow 4
Recommended download (for Vintage Story 1.19.8, 1.20.12, 1.21.0, 1.21.1, 1.21.2 and 1.21.5):
whitelistlist.zip
1-click install
Yang's Whitelist List
Makes the whitelist into an actual list you can input raw names into,
the mod then automatically clears and re-whitelists everyone in the list whenever the server starts.
Designed for large events of >100 players where otherwise you'd have to manually whitelist everyone.
This mod was requested by Def-Con Games, which was previously manually whitelisting hundreds of players by hand.
How to Use:
Install the mod on the server. Then go into the modconfig folder and edit the whitelist.txt file inside whitelistlist.
If there is no whitelist.txt, run the server once and then stop it again, or manually create one.
Source Code:
using System;
using System.IO;
using System.Text;
using System.Collections.Generic;
using Vintagestory.API.Common;
using Vintagestory.API.Server;
using Vintagestory.API.Config;
namespace WhitelistList
{
public class WhitelistListSystem : ModSystem
{
private ICoreServerAPI ?ServerAPI;
public override bool ShouldLoad(EnumAppSide side) => side == EnumAppSide.Server;
public override void StartServerSide(ICoreServerAPI api)
{
ServerAPI = api;
ServerAPI.Event.ServerRunPhase(EnumServerRunPhase.RunGame, OnServerStarted);
}
private void OnServerStarted()
{
// Verify that whitelist is enabled, warn otherwise
var WhitelistSetting = ServerAPI!.Server?.Config?.WhitelistMode ?? EnumWhitelistMode.Default;
if (WhitelistSetting == EnumWhitelistMode.Off)
{
ServerAPI.Logger.Error("[whitelistlist] Whitelist is turned off, mod disabled. Turn it on and restart the server!");
return;
}
try
{
Directory.CreateDirectory(Path.Combine(GamePaths.ModConfig, "whitelistlist"));
var whitelistdir = Path.Combine(GamePaths.ModConfig, "whitelistlist", "whitelist.txt");
if (!File.Exists(whitelistdir))
{
ServerAPI.Logger.Error("[whitelistlist] [Critical Error] Whitelist file is missing! Aborting and creating one...");
File.WriteAllText(whitelistdir, "YangWenLi", Encoding.UTF8); // Whitelist myself, users will overwrite
return;
}
ServerAPI.Logger.Notification("[whitelistlist] Whitelist location: {0}", whitelistdir);
// Clear out existing list
ServerAPI.InjectConsole("/player a[] whitelist off");
// Apply list
foreach (var raw in File.ReadAllLines(whitelistdir, Encoding.UTF8))
{
var line = raw.Trim();
if (line.Length == 0) continue;
ServerAPI.InjectConsole($"/player {line} whitelist on");
//ServerAPI.Logger.Notification("[whitelistlist] Whitelisted: {0}", line);
}
ServerAPI.Logger.Notification("[whitelistlist] End of file. Whitelisting process complete.");
}
catch (Exception error) { ServerAPI?.Logger?.Error($"[whitelistlist] Error attempting to apply whitelist: {error}"); }
}
}
}
// ░░░░░░░░░░░░░░░░░░░░░░░░░░▒▓▒▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▓▓▒▒▒▒░
// ░░░░YOU THOUGHT░░░░░░░░░░░▓▒▒▒▓▓▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█▓▓▓▓▓▓▓▓▓▒▓▒▒▒▒
// ░░░░░░░THIS WAS THE░░░░░░░▒▒▒▒▒▓▓▓▓▓▓▓▓▓▓▓█▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▒▒▒▓
// ░░░░END OF THE CODE░░░░░░░▒▒▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓█▓▓▓▓▓▓▒▒▒
// ░░░░░░░░░░░░░░░░░░░░▒░░░░▒▒▒▒▓▓▓▓▓▓▓██▓▓█▓▓▓▓▓▓▓▓▓█▓▓▓▓▓▓▓▓▓▓███▓▓▓▓▓▓▓▓
// ░░░░░░░░░BUT░░░░░░░░░▓▒▒▒▒▒▒▓▓▓▓▓▓█▓▓▓▓▓▓▓▓▓▓██▓▓██▓▓▓██▓▓▓▓▓▓▓█▓▓▓▓▓▓▓▓
// ░░░░░░░░░IT░░░░░░░░░░░░▒▒▒▒▒▓▓▓▓▓▓▓▒▒▒▓▓▓▓▓▓██▓▓██▓█▓▓▓▓▓██▓██▓█▓▓▓▓▓▓▓▓
// ░░░░░░░░░WAS░░░░░░░░░░░░▒▓▒▒▒▓▓▓▓▓▓▒▒▒▒▓▒▓▓█▓▓██▒▒█▓▓▓▓▓▓▓▓▓▓▓▓████▓▓█▓▓
// ░░░░░░░░░ME...░░░░░░░░░▒░▒▒▒▒▓▓▓▓▓▓▒▒▒▒▒▓▓▒▒▓▒▓▓▒▒▒▒▒▒▓▓▓▓▓█▓▓▓███████▓▓
// ░░░░░░░░░░░░░░░░░░░░░░░░░▓▒▒▒▓▓██▒▒▓▓▓▒▒▒▒▒▓▒▒▒▓▒▒▒▒▒▒▒▓▓▓▓▓▓████████▓▓▒
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░▒▒▓▓▓▓█▓▒▓▒▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓▓█████▓▓██▓▓▓
// ░░░░░█▀▄░▀█▀░█▀█░█░░░░░▒▒▒▒▓▓▓▓▓▓▓▒▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓██████▓▓███▓▓▓
// ░░░░░█░█░░█░░█░█░▀░░░░░░░░░░▓░▓▓▓▓▒▒▒▒▒▒▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓█████▓▓████▓▓▒
// ░░░░░▀▀░░▀▀▀░▀▀▀░▀░░░░░░░░░░▒░░▒░▒▒▒▒▒▒▓▓▓▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓████████████▓▓░
// ░░█▀▄░█▀▄░█▀█░█▀█░█▀▄░█▀█░█░░░░░░░░▒▒▒▒▒▒▒▒▒▒▒▓▓▒▓▓▒▒▒▓▓▓█████████████▓▓
// ░░█▀▄░█▀▄░█▀█░█░█░█░█░█░█░▀░░░░░░░░░▒▒▒▒▒▒▒▒▓▓████▒▒▒▒▓▓█████████████▓▓▓
// ░░▀▀░░▀░▀░▀░▀░▀░▀░▀▀░░▀▀▀░▀░░░░░░░░░░▒▒▒▒▒▓██▓▓▓▓▓▒▒▒▓▓▓███████████████▓
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒▒▒▒▒▒▓▓▓▓▒▒▒▒▒▓▓█████████████████
// ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░▒▒▒▒▓▓▒▒▒▒▒▒▓▓██████████████████
// ░░░░░░░░░░░░░░░░░░░▓▒▒░░░░░░░░░░░░░░░░░░░▒▒▒▓▓▓▓▓▒▒▒▓███████████████████
// ░░░░░░░░░░░░░░░█▓▒▒▒▒▒▓░░░▒▓▓▓▓▓░░░░░░░░░░░▒▒▒▒▒▒▒▒▓▓███████████████████
// ░░░░░░░░░▒▓███▓▓▓▒▒▒▒▓▓▓▒▓▓▓████▓░░░░░░░░░░░▓▒▒▒▓▓▓█████████████████████
// ░░░░░░░░████▓▓▒▒▒▒▒▓▓▓▓▓▓▓███░░░░░░░░░░░░███▓▓▓▓████████████████████████
// ░░░░░░█████▓▓▓▒▒▒▓▓▓█▓▓████▓░░░░░░░░░░▓▓█▓▓▓▓▓▓█████████████████████████
// ░░░░▒███▓▓▓▓▒▒▒▒▓▓▓▓█▓████░░░░░░░░░░░░░▓▒▓▓█████████████████████████████
// ░░░░████▓▒▒▒▒▓▓▓█▓▓▓██████░░░░░░░░░░░░░░▒▒▓▓▓███████████████████████████
// ░░░████▓▓▒▒▒▒▓▓▓▓▓▓█████░░░░░░░░░░░░░░░▓▓▒▒▒████████████████████████████
// ░░█████▓▒▒▒▓▓▓▓▓███████▒░░░░░░░░░░░░░░▓▒▒▒▒▒▓▒██████████████████████████
// ░███████▓▒▓▓██████████▒░░░░░░░▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▓▓▓██████████████████████
// █████████████████████▒░░░▓▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▒▒▒▒▒▒███████████████████████
// ████████████████████▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▓▒▓▒▒▒▒▒▒▒▓▓███████████████████
This mod is brought to you by...

The Unofficial Vintage Story Modding Co-op, click here to join.
As modders, we can help each other make even better stuff. Plus we have dedicated channels for better organization.
| Mod Version | Mod Identifier | For Game version | Downloads | Released | Changelog | Download | 1-click mod install* |
|---|---|---|---|---|---|---|---|
| 1.0.0 | whitelistlist | 23 | Oct 20th at 11:10 PM | whitelistlist.zip | 1-click install | ||
|
first and only release | |||||||
And this is why we love Yang even when he murders half of a server's population.