EmptyNet
一个独立的 Paper 1.21.1+ 插件,提供服务器转移功能、内置的登录/注册系统以及双因素认证(2FA)支持。
功能特性
- 独立运行 - 无需 BungeeCord、Velocity 或其他任何代理
- 无限服务器 - 在配置文件中添加任意数量的服务器条目
- 自定义命令 - 每个服务器都拥有其专属命令(例如
/lobby、/survival)
- 服务器列表 - 使用
/server 列出所有可用服务器
- 返回原服 - 使用
/serverback 返回到你上次连接的服务器
- 转移超时 - 可配置的超时时间,若转移连接失败则通知玩家
- 登录/注册系统 - 玩家必须在游玩前完成注册和登录
- 2FA 支持 - 可选的 6 位双因素认证代码,提供额外安全保障
- H2 数据库 - 所有密码均以 BCrypt 哈希形式存储在嵌入式 H2 数据库中
- 配置开关 - 可独立启用或禁用转移系统和登录系统
- 自定义消息 - 可配置连接到每个服务器时显示的消息
- Tab 补全 - 在
/server 命令中自动补全服务器名称
要求
- Paper 1.21.1 或更高版本
- Java 21 或更高版本
安装
- 从发布页面下载
EmptyNet-1.2.0.jar
- 将 jar 文件放入服务器的
plugins/ 文件夹中
- 重启你的服务器
- 编辑
plugins/EmptyNet/config.yml 以配置你的服务器
- 重启服务器或使用
/reload 应用更改
配置
编辑 plugins/EmptyNet/config.yml:
# EmptyNet 配置
# 通过复制并粘贴以下部分,可以添加任意数量的服务器。
# =====================================================
# 转移设置
# =====================================================
# 服务器转移系统的主开关。设置为 false 以禁用所有转移命令。
transfer-enabled: true
# 等待玩家成功连接到目标服务器的时间(秒)。
# 如果玩家在此时间内未连接成功,系统将通知他们
# 连接失败,玩家可以尝试重新连接。设置为 0 以禁用。
timeout: 120
# =====================================================
# 登录系统
# =====================================================
# 登录/注册系统的主开关。设置为 false 以禁用。
login-enabled: true
# 在未登录状态下给予玩家失明效果。
login-blindness: true
# 如果在超时时间内未完成登录/注册,则踢出玩家。设置为 false 以禁用。
login-kick-enabled: true
# 玩家在因未登录/注册被踢出之前拥有的时间(秒)。
login-kick-timeout: 30
servers:
example:
# 向玩家显示的显示名称
name: "Example Server"
# 命令名称(例如 /example)
command: "example"
# 要连接的服务器 IP 和端口
ip: "127.0.0.1:25566"
# 连接时向玩家显示的消息
message: "&aConnecting to Example Server..."
添加更多服务器
只需复制并粘贴服务器条目块,然后修改值即可:
servers:
lobby:
name: "Lobby"
command: "lobby"
ip: "192.168.1.10:25565"
message: "&aSending you to the Lobby..."
survival:
name: "Survival Server"
command: "survival"
ip: "192.168.1.10:25566"
message: "&aConnecting to Survival..."
creative:
name: "Creative Server"
command: "creative"
ip: "192.168.1.10:25567"
message: "&aTeleporting to Creative..."
配置字段说明
| 字段 |
描述 |
示例 |
transfer-enabled |
转移系统的主开关 |
true |
timeout |
在判定转移失败前等待的秒数(0 = 禁用) |
120 |
login-enabled |
登录/注册系统的主开关 |
true |
login-blindness |
给未认证的玩家施加失明效果 |
true |
login-kick-enabled |
踢出未能及时登录的玩家 |
true |
login-kick-timeout |
未认证玩家被踢出前的秒数 |
30 |
name |
在 /server 列表中显示的显示名称 |
"Survival Server" |
command |
玩家使用的命令(例如 /survival) |
"survival" |
ip |
服务器 IP 地址和端口 |
"192.168.1.10:25566" |
message |
连接时显示的消息(使用 & 表示颜色代码) |
"&aConnecting..." |
命令
| 命令 |
描述 |
权限 |
/server |
列出所有可用服务器 |
emptynet.use |
/server <name> |
连接到特定服务器 |
emptynet.use |
/serverback |
返回到你的上一台服务器 |
emptynet.use |
/<command> |
每个已配置服务器的直接命令 |
emptynet.use |
/register <password> <confirm> |
注册账号 |
true |
/login <password> |
登录账号 |
true |
/2fa <code> |
登录后输入你的 2FA 验证码 |
true |
/2fa set <code> |
设置 6 位 2FA 验证码(需处于登录状态) |
true |
/2fa remove |
移除你的 2FA 验证码(需处于登录状态) |
true |
示例
/server - 显示所有已配置服务器的列表
/server lobby - 连接到 "lobby" 服务器
/lobby - 与上述相同(如果配置了 command: "lobby")
/serverback - 返回到你之前的服务器
/register mypass mypass - 注册新账号
/login mypass - 使用密码登录
/2fa 123456 - 登录后输入你的 2FA 验证码
/2fa set 654321 - 设置 2FA 验证码(需处于登录状态)
/2fa remove - 移除你的 2FA 验证码(需处于登录状态)
权限
| 权限 |
描述 |
默认值 |
emptynet.use |
允许使用 /server 和 /serverback 命令 |
true (所有玩家) |
emptynet.admin |
保留用于未来的管理员命令 |
op |
工作原理
服务器转移
此插件使用 Paper 内置的 Player#transfer(String host, int port) API 将玩家直接传输至另一台服务器。无需代理或外部依赖——插件内部处理一切。
当玩家使用 /server <name> 或直接命令如 /lobby 时,插件会:
- 查找服务器配置
- 将目标服务器保存为
/serverback 的“上一服务器”
- 启动传输超时监控器(可配置,默认 120 秒)
- 向玩家发送配置好的消息
- 将玩家传输至目标 IP:端口
如果超时后玩家仍停留在当前服务器,则会收到连接失败的提示,并可尝试重新连接。
登录系统
当玩家加入服务器时,系统会提示其注册或登录:
- 新玩家使用
/register <密码> <确认密码> 创建账号
- 老玩家使用
/login <密码> 进行身份验证
- 如果启用了双重认证(2FA),玩家随后需输入
/2fa <验证码>
- 验证通过后,玩家即可正常游戏
在未认证状态下,玩家无法:
- 移动
- 破坏或放置方块
- 与世界互动
- 丢弃物品
- 打开物品栏
- 受到伤害
- 聊天
- 使用除
/login、/register 和 /2fa 之外的任何命令
此外,未认证的玩家会获得失明效果(可通过 login-blindness 配置)。如果 login-kick-enabled 为 true,未在 login-kick-timeout 秒内登录/注册的玩家将被踢出服务器。
双因素认证
玩家可以在登录后使用 /2fa set <6位数字代码> 启用双重认证(2FA)。启用后,每次登录时都必须在密码之后输入此代码。使用 /2fa remove 来禁用它。
H2 数据库
所有用户账户均存储在嵌入式 H2 数据库中,路径为 plugins/EmptyNet/emptynet.mv.db。密码以 BCrypt 哈希形式存储(绝非明文)。数据库会在首次运行时自动创建。
赞助商

EmptyNet
A self-standing Paper 1.21.1+ plugin that provides server transfers, a built-in login/register system with 2FA
Features
- Self-standing - No BungeeCord, Velocity, or any other proxy required
- Unlimited servers - Add as many server entries as you want in the config
- Custom commands - Each server gets its own command (e.g.,
/lobby, /survival)
- Server listing -
/server lists all available servers
- Server back -
/serverback returns to the last server you connected to
- Transfer timeout - Configurable timeout that notifies players if a transfer fails to connect
- Login/Register system - Players must register and login before playing
- 2FA support - Optional 6-digit 2FA code for extra security
- H2 database - All passwords stored as BCrypt hashes in an embedded H2 database
- Config toggles - Enable/disable the transfer system and login system independently
- Custom messages - Configure the message shown when connecting to each server
- Tab completion - Auto-completes server names in
/server command
Requirements
- Paper 1.21.1 or higher
- Java 21 or higher
Installation
- Download the
EmptyNet-1.2.0.jar from the releases page
- Place the jar file in your server's
plugins/ folder
- Restart your server
- Edit the
plugins/EmptyNet/config.yml to configure your servers
- Restart your server or use
/reload to apply changes
Configuration
Edit plugins/EmptyNet/config.yml:
# EmptyNet Configuration
# Add as many servers as you want by copying and pasting the section below.
# =====================================================
# Transfer Settings
# =====================================================
# Master switch for the server transfer system. Set to false to disable all transfer commands.
transfer-enabled: true
# Time in seconds to wait for a player to successfully connect to the target server.
# If the player does not connect within this time, they will be notified that the
# connection failed and can try again. Set to 0 to disable.
timeout: 120
# =====================================================
# Login System
# =====================================================
# Master switch for the login/register system. Set to false to disable.
login-enabled: true
# Give players the blindness effect while they are not logged in.
login-blindness: true
# Kick players who do not login/register within the timeout. Set to false to disable.
login-kick-enabled: true
# Time in seconds a player has to login/register before being kicked.
login-kick-timeout: 30
servers:
example:
# The display name shown to players
name: "Example Server"
# The command name (e.g., /example)
command: "example"
# The server IP and port to connect to
ip: "127.0.0.1:25566"
# The message shown to the player when connecting
message: "&aConnecting to Example Server..."
Adding More Servers
Simply copy and paste the server entry block and change the values:
servers:
lobby:
name: "Lobby"
command: "lobby"
ip: "192.168.1.10:25565"
message: "&aSending you to the Lobby..."
survival:
name: "Survival Server"
command: "survival"
ip: "192.168.1.10:25566"
message: "&aConnecting to Survival..."
creative:
name: "Creative Server"
command: "creative"
ip: "192.168.1.10:25567"
message: "&aTeleporting to Creative..."
Config Fields
| Field |
Description |
Example |
transfer-enabled |
Master switch for the transfer system |
true |
timeout |
Seconds to wait before considering a transfer failed (0 = disabled) |
120 |
login-enabled |
Master switch for the login/register system |
true |
login-blindness |
Give blindness to unauthenticated players |
true |
login-kick-enabled |
Kick players who don't login in time |
true |
login-kick-timeout |
Seconds before unauthenticated players are kicked |
30 |
name |
Display name shown in /server list |
"Survival Server" |
command |
The command players use (e.g., /survival) |
"survival" |
ip |
Server IP address and port |
"192.168.1.10:25566" |
message |
Message shown when connecting (use & for color codes) |
"&aConnecting..." |
Commands
| Command |
Description |
Permission |
/server |
Lists all available servers |
emptynet.use |
/server <name> |
Connect to a specific server |
emptynet.use |
/serverback |
Return to your last server |
emptynet.use |
/<command> |
Direct command for each configured server |
emptynet.use |
/register <password> <confirm> |
Register an account |
true |
/login <password> |
Login to your account |
true |
/2fa <code> |
Enter your 2FA code after login |
true |
/2fa set <code> |
Set a 6-digit 2FA code (while logged in) |
true |
/2fa remove |
Remove your 2FA code (while logged in) |
true |
Examples
/server - Shows a list of all configured servers
/server lobby - Connects to the "lobby" server
/lobby - Same as above (if configured with command: "lobby")
/serverback - Returns to the server you were on before
/register mypass mypass - Registers a new account
/login mypass - Logs in with your password
/2fa 123456 - Enters your 2FA code after login
/2fa set 654321 - Sets a 2FA code (while logged in)
/2fa remove - Removes your 2FA code (while logged in)
Permissions
| Permission |
Description |
Default |
emptynet.use |
Allows using /server and /serverback commands |
true (all players) |
emptynet.admin |
Reserved for future admin commands |
op |
How It Works
Server Transfers
This plugin uses Paper's built-in Player#transfer(String host, int port) API to transfer players directly to another server. No proxy or external dependencies are needed - the plugin handles everything internally.
When a player uses /server <name> or a direct command like /lobby, the plugin:
- Looks up the server configuration
- Stores the target server as the "last server" for
/serverback
- Starts a transfer timeout monitor (configurable, default 120 seconds)
- Sends the configured message to the player
- Transfers the player to the target IP:port
If the player is still on this server after the timeout expires, they are notified that the connection failed and can try again.
Login System
When a player joins, they are prompted to either register or login:
- New players use
/register <password> <confirm-password> to create an account
- Returning players use
/login <password> to authenticate
- If the player has 2FA enabled, they must then enter
/2fa <code>
- Once authenticated, the player can play normally
While unauthenticated, players cannot:
- Move
- Break or place blocks
- Interact with the world
- Drop items
- Open inventories
- Take damage
- Chat
- Use any commands except
/login, /register, and /2fa
Additionally, unauthenticated players receive the blindness effect (configurable with login-blindness). If login-kick-enabled is true, players who don't login/register within login-kick-timeout seconds are kicked from the server.
2FA
Players can enable 2FA after logging in with /2fa set <6-digit-code>. Once enabled, they must enter this code after their password on every login. Use /2fa remove to disable it.
H2 Database
All user accounts are stored in an embedded H2 database at plugins/EmptyNet/emptynet.mv.db. Passwords are stored as BCrypt hashes (never plaintext). The database is automatically created on first run.
Sponsor

评论 0
登录后参与评分
还没有评论,来抢沙发吧