IPLock 是一个专为运行在 Paper 1.21.1 上的 Minecraft 服务器设计的插件,旨在通过将账户绑定到特定 IP 地址来增强玩家账户安全性。该插件限制账户仅允许通过已注册的 IP 访问,从而在账户被盗用时防止未经授权的登录。所有消息均可通过语言文件完全自定义,使其能够适应具有不同语言偏好的服务器。
插件功能
自动 IP 绑定:
当玩家首次登录服务器时,其 UUID(唯一标识符)和 IP 地址会自动存储在 ipdata.yml 文件中。
这确保了无需玩家进行任何操作即可实现无缝的 IP 注册。
登录时的 IP 验证:
每次玩家登录时,插件会将其当前 IP 地址与 ipdata.yml 中存储的地址进行比较。
如果 IP 不匹配,则拒绝登录,并向玩家显示可自定义的错误消息(默认:“§cYour IP does not match the registered IP for this account!”)。
这保护了账户免受来自未识别设备或网络的访问。
解除 IP 绑定命令:
插件提供了 /ipdel <player_name> 命令,仅限服务器操作员使用。
此命令移除指定玩家的 IP 绑定,允许他们在下一次尝试时从新的 IP 登录。
与命令相关的消息(例如成功、错误或未找到绑定)均可完全自定义。
可自定义的消息:
所有插件消息均存储在 lang.yml 文件中,该文件在首次启动时在 plugins/IPLock/ 文件夹中生成。
消息支持 Minecraft 颜色代码 (§) 和占位符(例如 {player} 用于玩家名称,{error} 用于错误详情)。
可自定义消息示例:
登录错误:“§cYour IP does not match the registered IP for this account!”。
成功解绑:“§aIP binding for {player} has been removed!”。
命令错误:“§cUsage: /ipdel <player>”。
管理员可以编辑 lang.yml 以修改文本、语言或样式,而无需重新构建插件。
数据存储:
IP 绑定数据以 UUID: IP 的格式存储在 ipdata.yml 中。
该文件会在玩家登录或使用 /ipdel 命令时自动创建和更新。
使用 YAML 格式确保了数据的可读性和可靠的持久性。
安全性和性能:
插件使用 UUID 而非玩家名称,以避免因名称更改引发的问题。
IP 检查仅在登录时执行,从而最大限度地减少服务器负载。
语言文件在启动时加载一次,确保运行期间无性能影响。
用法
对于玩家:
无需采取任何操作——IP 绑定会在首次登录时自动发生。
如果玩家的 IP 发生变化(例如由于动态 IP),他们将无法登录,直到操作员使用 /ipdel 移除旧的绑定。
对于管理员:
使用 /ipdel <player_name> 重置玩家的 IP 绑定。
在 lang.yml 中自定义消息以匹配服务器的风格(例如翻译成其他语言或添加独特的前缀)。
检查 ipdata.yml 以查看当前的 IP 绑定(对调试很有用)。
示例工作流程
玩家 Steve 从 IP 192.168.1.1 首次登录:
插件将以下内容保存至 ipdata.yml:Steve_UUID: 192.168.1.1。
Steve 尝试从 IP 192.168.1.2 登录:
插件拒绝登录并显示:“§cYour IP does not match the registered IP for this account!”。
操作员运行 /ipdel Steve:
插件从 ipdata.yml 中移除绑定并发送:“§aIP binding for Steve has been removed!”。
Steve 再次从新 IP 登录,绑定过程重复。
技术细节
兼容性:Paper 1.21.1。
依赖项:Maven、Paper API(包含在 pom.xml 中)。
插件文件:
IPLock.java — 主代码(包 org.example.iplock.iplock)。
plugin.yml — 插件配置。
ipdata.yml — IP 绑定存储。
lang.yml — 可自定义消息。
构建:使用 Maven(mvn clean install)。
局限性:
每个账户仅支持一个 IP。动态 IP 需要手动通过 /ipdel 解除绑定。
没有内置支持在不重启服务器的情况下重新加载 lang.yml(如有需要可以添加)。
总结
IPLock 是一个简单但有效的工具,用于保护 Minecraft 服务器上的玩家账户安全。它结合了自动 IP 绑定、操作员控制的解绑以及完全可自定义的消息,使其对玩家和管理员都易于使用。该插件非常适合优先考虑账户安全的服务器,其灵活的消息系统允许无缝集成到任何服务器的品牌或语言中。
IPLock is a plugin designed for Minecraft servers running on Paper 1.21.1, aimed at enhancing player account security by binding accounts to a specific IP address. The plugin restricts account access to only the registered IP, helping to prevent unauthorized logins in case an account is compromised. All messages are fully customizable via a language file, making it adaptable for servers with diverse language preferences.
Plugin Functionality
Automatic IP Binding:
Upon a player's first login to the server, their UUID (unique identifier) and IP address are automatically stored in the ipdata.yml file.
This ensures seamless IP registration without requiring any action from the player.
IP Verification on Login:
Each time a player logs in, the plugin compares their current IP address with the one stored in ipdata.yml.
If the IP does not match, the login is denied, and the player receives a customizable error message (default: "§cYour IP does not match the registered IP for this account!").
This protects accounts from being accessed from unrecognized devices or networks.
IP Unbinding Command:
The plugin provides the /ipdel <player_name> command, accessible only to server operators.
This command removes the IP binding for the specified player, allowing them to log in from a new IP on their next attempt.
Command-related messages (e.g., success, error, or no binding found) are fully customizable.
Customizable Messages:
All plugin messages are stored in the lang.yml file, which is generated in the plugins/IPLock/ folder on first startup.
Messages support Minecraft color codes (§) and placeholders (e.g., {player} for the player’s name, {error} for error details).
Examples of customizable messages:
Login error: "§cYour IP does not match the registered IP for this account!".
Successful unbinding: "§aIP binding for {player} has been removed!".
Command error: "§cUsage: /ipdel <player>".
Administrators can edit lang.yml to modify text, language, or style without rebuilding the plugin.
Data Storage:
IP binding data is stored in ipdata.yml in the format UUID: IP.
The file is automatically created and updated during player logins or when the /ipdel command is used.
YAML usage ensures readability and reliable data persistence.
Security and Performance:
The plugin uses UUIDs instead of player names to avoid issues with name changes.
IP checks are performed only during login, minimizing server load.
The language file is loaded once at startup, ensuring no performance impact during operation.
Usage
For Players:
No action is required — IP binding happens automatically on first login.
If a player’s IP changes (e.g., due to a dynamic IP), they won’t be able to log in until an operator removes the old binding with /ipdel.
For Administrators:
Use /ipdel <player_name> to reset a player’s IP binding.
Customize messages in lang.yml to match the server’s style (e.g., translate to another language or add a unique prefix).
Check ipdata.yml to view current IP bindings (useful for debugging).
Example Workflow
Player Steve logs in for the first time from IP 192.168.1.1:
The plugin saves to ipdata.yml: Steve_UUID: 192.168.1.1.
Steve tries to log in from IP 192.168.1.2:
The plugin denies the login and displays: "§cYour IP does not match the registered IP for this account!".
An operator runs /ipdel Steve:
The plugin removes the binding from ipdata.yml and sends: "§aIP binding for Steve has been removed!".
Steve logs in again from the new IP, and the binding process repeats.
Technical Details
Compatibility: Paper 1.21.1.
Dependencies: Maven, Paper API (included in pom.xml).
Plugin Files:
IPLock.java — main code (package org.example.iplock.iplock).
plugin.yml — plugin configuration.
ipdata.yml — IP binding storage.
lang.yml — customizable messages.
Build: Uses Maven (mvn clean install).
Limitations:
Only one IP per account is supported. Dynamic IPs require manual unbinding via /ipdel.
No built-in support for reloading lang.yml without a server restart (can be added if needed).
Summary
IPLock is a straightforward yet effective tool for securing player accounts on Minecraft servers. It combines automatic IP binding, operator-controlled unbinding, and fully customizable messages, making it user-friendly for both players and administrators. The plugin is ideal for servers prioritizing account security, with its flexible message system allowing seamless integration into any server’s branding or language.
评论 0
登录后参与评分
还没有评论,来抢沙发吧