MySQL Vault
A virtual storage plugin for Unturned that lets players store items in vaults that persist across server restarts and can be shared between multiple servers.
What it does
Players can open virtual storage containers (vaults) to store their items safely. Each vault has a specific size and can be accessed with commands. The plugin supports different vault sizes for different player ranks and can store data in either MySQL databases or JSON files.
Commands
Player Commands
/vault- Opens your default vault or the last vault you used/vault <name>- Opens a specific vault (like/vault vip)/vaults- Shows all vaults you can access/trash- Opens a temporary trash container where items disappear when closed/fixvault- Removes broken items from your vaults (useful after removing mods)
Admin Commands
/vaultadmin <player|steamid> [vaultname]- Opens another player's vault for inspection or editing. Works with online players by name or offline players by SteamID. Shows a 3-second countdown before opening so you can confirm it's the right player./vaultadminlist <player|steamid>- Lists all vaults a player has stored in the database, showing the number of items in each vault/unlockvault <steamid> [vaultname]- Manually clears a stale vault lock (useful if a server crashed while an admin had a vault open)/migratevaults- Moves all vault data between MySQL and JSON storage (console only)
Configuration
The plugin creates a configuration file with these settings:
Basic Settings
- MessageColor - Color of chat messages (like "yellow", "red", "green")
- DatabaseProvider - Choose "mysql" for database storage or "json" for file storage
- ConnectionString - Your MySQL database connection info (only needed for MySQL)
- VaultsTableName - Name of the database table (default: "Vaults")
Vault Settings
- TrashHeight/TrashWidth - Size of the trash container (default: 10x8)
- OpenBiggestVault - If true,
/vaultopens your largest available vault instead of the last used one
Admin Settings
- AdminAutoCloseSeconds - Seconds of inactivity before an admin vault view auto-closes (default: 300)
- VaultLockExpiryMinutes - Minutes before a vault lock expires, prevents cross-server conflicts (default: 15)
Vault Types
Define different vault sizes in the <Vaults> section:
<Vault Name="default" Width="3" Height="4" />
<Vault Name="vip" Width="5" Height="6" />
<Vault Name="premium" Width="8" Height="10" />
Permissions
Player Permissions
Give players access to specific vaults using these permissions:
vault.default- Access to the default vaultvault.vip- Access to the VIP vaultvault.premium- Access to the premium vault
Players without any vault permissions can still use the default vault.
Admin Permissions
vaultadmin- Access to/vaultadmincommandvaultadminlist- Access to/vaultadminlistcommandunlockvault- Access to/unlockvaultcommand
Admin Vault Feature
Admins can open and edit any player's vault for moderation purposes. When an admin opens a player's vault:
- The vault is locked both in memory and in the database, preventing the player from opening it and other admins from accessing it simultaneously
- A 3-second countdown is shown before the vault opens, so the admin can confirm they're opening the correct player's vault
- The player sees a "vault is being accessed by an admin" message if they try to open their vault while it's locked
- After 5 minutes of inactivity (configurable), the vault auto-closes and saves
- When the vault is closed, a confirmation message shows whose vault was saved
- Vault locks have a 15-minute expiry (configurable) to prevent stale locks from server crashes
This feature is cross-server safe when using MySQL storage. Only one admin across all servers can access a specific vault at a time.
How to use
For players: Use
/vaultto open your storage. Items placed inside will be saved when you close it.For admins: Set up different vault sizes for different player groups. Give VIP players the
vault.vippermission to access larger vaults. Use/vaultadminto inspect or modify player vaults for moderation.Switching storage types: Create a file named "migrate" in the plugin folder and restart the server, OR use the
migratevaultsconsole command to automatically transfer all vault data between JSON and MySQL storage.
Example Configuration
<?xml version="1.0" encoding="utf-8"?>
<MySQLVaultConfiguration>
<MessageColor>yellow</MessageColor>
<DatbaseProvider>json</DatbaseProvider>
<ConnectionString>Server=localhost;Database=unturned;User Id=root;Password=yourpassword;</ConnectionString>
<VaultsTableName>PlayerVaults</VaultsTableName>
<TrashHeight>8</TrashHeight>
<TrashWidth>6</TrashWidth>
<OpenBiggestVault>true</OpenBiggestVault>
<AdminAutoCloseSeconds>300</AdminAutoCloseSeconds>
<VaultLockExpiryMinutes>15</VaultLockExpiryMinutes>
<Vaults>
<Vault Name="default" Width="4" Height="4" />
<Vault Name="donator" Width="6" Height="6" />
<Vault Name="vip" Width="8" Height="8" />
</Vaults>
</MySQLVaultConfiguration>
Storage Options
JSON Storage: Simple file-based storage. Good for single servers or small communities. Data is saved in a JSON file in your map's level folder. For example, if you're using the Washington map, the file will be at Servers/unturned/Level/Washington/MySQLVault.json. The file is automatically saved whenever the server saves and when the server shuts down.
MySQL Storage: Database storage that can be shared between multiple servers. Good for networks where players should access the same vaults on different servers.