Home›Java›Mods›userdata exporter
# Userdata Exporter, By Scalamobile

A Paper 1.21.8 plugin that automatically exports Essentials userdata to MySQL/MariaDB database with configurable intervals.

## Features

- **Automatic Export**: Scans Essentials userdata YAML files and exports to MySQL/MariaDB
- **Configurable Schedule**: Set custom export intervals or disable automatic exports
- **Manual Export**: Use `/userdataexport` command for on-demand exports
- **Debug Mode**: Detailed logging for troubleshooting
- **Database Integration**: Uses HikariCP for efficient database connections
- **Folia Support**: Compatible with Folia servers

## What it does

This plugin reads Essentials userdata files (typically located in `plugins/Essentials/userdata/`) and exports the following data to your MySQL/MariaDB database:

- **UUID**: Player's unique identifier (from filename)
- **Username**: Player's last account name (`last-account-name` field)
- **Money**: Player's balance (`money` field)
- **Updated timestamp**: When the record was last updated

## Installation

1. Download the plugin JAR file
2. Place it in your server's `plugins/` folder
3. Start your server to generate the configuration file
4. Configure your database settings in `plugins/UserdataExporter/config.yml`
5. Restart your server

## Configuration

Edit `plugins/UserdataExporter/config.yml`:

```yaml
# Database configuration
database:
host: "localhost"
port: 3306
database: "essentials"
user: "essentials"
password: ""
maximumPoolSize: 5

# Path to userdata directory (leave empty for default)
userdataPath: ""

# Export interval in seconds (0 to disable)
exportIntervalSeconds: 300

# Table name in database
tableName: "userdata_export"

# Enable debug logging
debug: false
```

## Database Setup

The plugin automatically creates the required table with this schema:

```sql
CREATE TABLE `userdata_export` (
`uuid` VARCHAR(36) NOT NULL,
`username` VARCHAR(64) NOT NULL,
`money` DECIMAL(18,2) NOT NULL DEFAULT 0,
`updated_at` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`uuid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
```

## Commands

- `/userdataexport` - Manually trigger data export
- Permission: `userdataexport.export` (default: OP)

## Permissions

- `userdataexport.export` - Allows manual export command (default: OP)

## Requirements

- **Server**: Paper 1.21.8+ (Folia supported)
- **Database**: MySQL 5.7+ or MariaDB 10.2+
- **Dependencies**: Essentials plugin (for userdata files)

## How it works

1. **Startup**: Plugin connects to your database and creates the table if it doesn't exist
2. **Initial Export**: Runs an automatic export on startup
3. **Scheduled Exports**: If `exportIntervalSeconds > 0`, runs periodic exports
4. **File Scanning**: Scans all `.yml` and `.yaml` files in the userdata directory
5. **Data Parsing**: Extracts UUID (from filename), username, and money from each file
6. **Database Update**: Uses UPSERT to insert or update records

## Troubleshooting

### Enable Debug Mode
Set `debug: true` in config.yml to see detailed logging:

```
[UserdataExporter] UserdataScanner: Found 5 YAML files
[UserdataExporter] UserdataScanner: Processing file: 12345678-1234-1234-1234-123456789abc.yml
[UserdataExporter] UserdataScanner: Parsed user: 12345678-1234-1234-1234-123456789abc -> PlayerName (money: 1000.0)
```

### Common Issues

1. **No data exported**: Check if userdata directory path is correct
2. **Database connection failed**: Verify database credentials and network access
3. **Permission denied**: Ensure database user has CREATE/INSERT/UPDATE permissions

### Manual Testing

Use `/userdataexport` command to test exports manually and see immediate results.

## Support

- **Issues**: Report bugs and issues on the plugin page
- **Configuration**: Check the debug logs for detailed information
- **Database**: Ensure your MySQL/MariaDB server is accessible and credentials are correct

## Version History

### v1.0.0
- Initial release
- MySQL/MariaDB integration
- Configurable export intervals
- Manual export command
- Debug logging
- Folia support

## License

This plugin is provided as-is for educational and server management purposes.

---

**Note**: This plugin requires Essentials to generate userdata files. It will not work without existing Essentials userdata to export.

Plugin details

Read from the plugin's own plugin.yml.

Quick facts

Install steps are the general flow for this file type — How to install Minecraft Java mods & modpacks walks through it step by step.

userdata exporter is a free Minecraft Java mod. Compatible with Minecraft 1.20, 1.20.6, 1.21. Downloaded 22 times (via Spigot). Download it and open it directly in the game.

Explore more