PlayerSync
一个适用于 Bukkit/Spigot/Paper 的插件,用于在多个 Minecraft 服务器之间同步玩家的物品栏和末影箱数据。
概述
PlayerSync 使用 MySQL 数据库在多个服务器之间同步玩家的物品栏和末影箱数据。当玩家加入服务器时自动加载数据,离开时保存数据。
支持版本
- Minecraft: 1.21.x
- 服务端: Bukkit, Spigot, Paper
- Java: Java 21 或更高版本
安装
- 从发布页面下载最新的
PlayerSync-X.X.X.jar
- 将其放入服务端的
plugins 文件夹中
- 启动服务器以加载插件
- 编辑
plugins/PlayerSync/config.yml 以配置数据库
- 重启服务器
数据库设置
PlayerSync 需要一个 MySQL 数据库。
创建 MySQL 数据库
CREATE DATABASE player_sync CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
配置文件
config.yml
编辑 plugins/PlayerSync/config.yml 以配置相关设置。
mysql:
# MySQL 服务器主机名
host: localhost
# MySQL 服务器端口号
port: 3306
# MySQL 用户名
username: root
# MySQL 密码
password: password
# 要使用的数据库名称
database: player_sync
# 使用 SSL 连接
useSSL: false
settings:
# 只读模式 (true: 仅读取数据, false: 读写均可)
read-only: false
# 服务器标识 UUID(留空则自动生成)
uuid: “”
# 自动同步间隔(秒)
# 按指定间隔自动保存所有在线玩家的数据
auto-sync-interval: 60
settings
read-only(默认值:false)
true: 仅从数据库读取(不保存)
false: 对数据库执行读取和写入操作
- 在使用多个服务器时,可以将其中一个服务器设置为
false,其余保持为 true
uuid(可选)
- 服务器标识 UUID
- 如果留空,将自动生成
- 生成后,会保存在
config.yml 中
auto-sync-interval(推荐:60)
- 自动同步间隔(秒)
- 按指定间隔自动保存所有在线玩家的数据
- 玩家离开时始终会保存数据,因此此设置用于定期备份
- 将此值设置为
0 或更低可禁用自动同步
消息文件
plugins/PlayerSync/messages.yml 包含插件输出的日志消息。你可以通过编辑此文件来自定义这些消息。
用法
基本用法
- 设置数据库
- 在
config.yml 中配置数据库连接详情
- 启动服务器
- 当玩家加入时,其物品栏和末影箱数据会自动加载
- 当玩家离开时,其数据会自动保存
使用多个服务器
- 将所有服务器配置为使用同一个数据库
- 为每个服务器的
uuid 设置唯一的值(可以使用自动生成)
- 通常将所有服务器的
read-only 设置为 false
- 如果只有一个服务器保存数据,请将其他服务器设置为
read-only: true
故障排除
数据库连接错误
- 验证 MySQL 服务器是否正在运行
- 确认主机名、端口、用户名和密码正确无误
- 验证防火墙中已开放 MySQL 端口
数据不同步
- 确认所有服务器使用相同的数据库
- 检查
read-only 设置
- 验证数据库权限
性能问题
- 增加
auto-sync-interval 的值(例如 120 秒)
- 调整 MySQL 连接池设置
许可证
本项目基于 Apache License 2.0 发布。
详情请参阅 LICENSE 文件。
支持
如果遇到任何问题,请通过 GitHub Issues 报告。
链接
PlayerSync
A Bukkit/Spigot/Paper plugin that synchronizes player inventory and Ender Chest data across multiple Minecraft servers.
Overview
PlayerSync uses a MySQL database to synchronize player inventory and Ender Chest data across multiple servers. It automatically loads data when a player joins a server and saves data when they leave.
Supported Versions
- Minecraft: 1.21.x
- Server: Bukkit, Spigot, Paper
- Java: Java 21 or higher
Installation
- Download the latest
PlayerSync-X.X.X.jar from the release page
- Place it in the server's
plugins folder
- Start the server to load the plugin
- Edit
plugins/PlayerSync/config.yml to configure the database
- Restart the server
Database Setup
PlayerSync requires a MySQL database.
Creating the MySQL Database
CREATE DATABASE player_sync CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
Configuration File
config.yml
Edit plugins/PlayerSync/config.yml to configure settings.
mysql:
# MySQL server hostname
host: localhost
# MySQL server port number
port: 3306
# MySQL username
username: root
# MySQL password
password: password
# Database name to use
database: player_sync
# Use SSL connection
useSSL: false
settings:
# Read-only mode (true: read data only, false: read/write)
read-only: false
# UUID for server identification (left blank, it will be auto-generated)
uuid: “”
# Auto-sync interval (in seconds)
# Automatically saves all online players' data at the specified interval
auto-sync-interval: 60
settings
read-only (default: false)
true: Read only from the database (does not save)
false: Performs both read and write operations to the database
- When using multiple servers, it is possible to set only one server to
false and leave the others at true
uuid (optional)
- UUID for server identification
- If left blank, it will be generated automatically
- Once generated, it is saved in
config.yml
auto-sync-interval (Recommended: 60)
- Automatic sync interval (in seconds)
- Automatically saves all online players' data at the specified interval
- Player data is always saved when they leave, so this setting is for periodic backups
- Setting this to
0 or lower disables auto-sync
Message File
plugins/PlayerSync/messages.yml contains log messages output by the plugin. You can customize these messages by editing this file.
Usage
Basic Usage
- Set up the database
- Configure database connection details in
config.yml
- Start the server
- When a player joins, their inventory and ender chest data are automatically loaded
- When a player leaves, their data is automatically saved
Using Multiple Servers
- Configure all servers to use the same database
- Set each server's
uuid to a unique value (auto-generated is acceptable)
- Typically set
read-only: false on all servers
- If only one server saves data, set other servers to
read-only: true
Troubleshooting
Database Connection Errors
- Verify MySQL server is running
- Confirm hostname, port, username, and password are correct
- Verify MySQL ports are open in the firewall
Data Not Syncing
- Confirm all servers use the same database
- Check
read-only settings
- Verify database permissions
Performance Issues
- Increase
auto-sync-interval value (e.g., 120 seconds)
- Adjust MySQL connection pool settings
License
This project is released under the Apache License 2.0.
For details, see the LICENSE file.
Support
If you encounter issues, please report them via GitHub Issues.
Links
评论 0
登录后参与评分
还没有评论,来抢沙发吧