Skip to content

Scalamobile/mysqlEssentials

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

Userdata Exporter (Paper 1.21.8)

Paper plugin that scans Essentials-like userdata YAML files and exports last-account-name and money to a MySQL/MariaDB table at a configurable interval.

Build

mvn -q -f /home/scala/Desktop/mysqlEssentials/pom.xml package

The shaded jar will be at target/userdata-exporter-1.0.0.jar.

Install

  • Place the jar in your server's plugins/ folder.
  • Start the server to generate config.yml.

Configure

  • Edit plugins/UserdataExporter/config.yml:
    • database.jdbcUrl example: jdbc:mysql://localhost:3306/minecraft?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC
    • database.username / database.password
    • userdataPath leave empty to default to plugins/Essentials/userdata
    • exportIntervalSeconds set to 0 to disable periodic exports
    • tableName default userdata_export

How it works

  • On enable, the plugin creates the table if missing and runs an initial export.
  • Then, if exportIntervalSeconds > 0, it runs asynchronously every N seconds.
  • Each export scans all *.yml or *.yaml files in the userdata directory. The UUID is derived from the filename.

Schema

CREATE TABLE IF NOT EXISTS `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 export (requires userdataexport.export permission)

Configuration

  • debug: true/false - Enable detailed logging for troubleshooting

Notes

  • Requires MySQL 5.7+/MariaDB 10.2+ for the DDL as written.
  • The plugin shades HikariCP and SnakeYAML to avoid classpath issues.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages