Treevite
一个服务端 Minecraft Fabric 模组,通过邀请链实现基于树的白名单系统来管理玩家访问权限。
概述
Treevite 允许你通过层级化的邀请系统控制谁能加入你的服务器。从控制台作为根管理员开始,被白名单的玩家可以在他人之间进行邀请,从而创建一个“树”状的授权玩家网络。这提供了一种灵活、有机的方式来管理服务器访问权限,而无需手动将每个玩家添加到白名单中。
主要功能:
- 以控制台为根的基于树的白名单系统
- 使用
/invite 命令的玩家间邀请系统
- 支持撤销邀请并自动调整权限
- 每位玩家的每日邀请速率限制(可配置)
- 支持 Java 版和基岩版玩家
- 邀请历史记录追踪
- 基于权限的命令(通过 Fabric Permissions API)
依赖项
- Minecraft Server 26.1.2(或兼容版本)
- Fabric Loader 0.19.2 或更高版本
- Java 25 或更高版本
- Fabric API
安装
- 下载
tree-invite.jar 模组文件
- 将其放入服务器的
mods 文件夹中
- 启动服务器
- (可选)安装 Fabric Permissions API 以启用基于权限的命令访问
命令
玩家命令
/invite <player> [java|bedrock]
- 邀请一名玩家加入服务器
- 如果未指定平台,默认为 Java 版
- 用户名通过 Mojang API(Java 版)或转换为 XUID 格式(基岩版)查找
- 受每日速率限制约束(默认:每天 4 次邀请,在服务器时间凌晨 02:00 重置)
/revokeinvite <player> [java|bedrock]
- 撤销你发送给某玩家的邀请
- 只有原始邀请人才能撤销
- 平台为可选参数;如果未指定,则检查两个平台
- 如果玩家没有其他路径回到控制台,他们将失去访问权限
- 邀请数据会被保留,以便在被重新邀请时自动恢复访问权限
/inviteinfo [player]
- 查看邀请信息
- 列出谁邀请了该玩家以及他们邀请了哪些人
- 如果未指定玩家,默认为命令执行者
管理员命令
/setmaxinvites <player> <count>
- 为某位玩家设置自定义的每日邀请上限
- 覆盖全局默认速率限制
- 设置为 0 以禁用该玩家的邀请功能
/setglobalmaxinvites <count>
- 设置所有玩家的默认每日邀请上限
- 仅控制台或高权限管理员可访问
工作原理
- 初始化: 初始状态下只有控制台在白名单中
- 邀请: 任何在白名单中的玩家都可以使用
/invite 邀请其他人
- 访问控制: 如果玩家通过邀请链至少有一条有效路径能回到控制台,则可以加入服务器
- 撤销: 当邀请被撤销时,受影响玩家将失去访问权限,除非他们有另一条通往控制台的路径
- 恢复访问: 如果被撤销的玩家再次被邀请(直接或间接),他们将自动恢复访问权限
示例场景
Console (root)
├── Alice (由 Console 邀请)
│ ├── Bob (由 Alice 邀请)
│ └── Carol (由 Alice 邀请)
└── Dave (由 Console 邀请)
└── Eve (由 Dave 邀请)
- 所有玩家均可加入
- 如果 Console 撤销了 Dave 的邀请,Eve 将失去访问权限(无其他路径)
- 如果 Console 撤销了 Alice 的邀请,Bob 和 Carol 将失去访问权限
- 如果 Console 重新邀请 Dave,Eve 将自动恢复访问权限
配置
配置文件存储在 config/tree-invite-messages.json 中,并在重启后持久保存。模组会自动管理白名单数据——你无需修改原版白名单。
权限
当可用 Fabric Permissions API 时,以下权限将被识别:
tree-invite.invite - 允许使用 /invite 命令
tree-invite.revoke - 允许使用 /revokeinvite 命令
tree-invite.info - 允许使用 /inviteinfo 命令
tree-invite.admin.setmaxinvites - 允许使用 /setmaxinvites 命令
tree-invite.admin.setglobalmaxinvites - 允许使用 /setglobalmaxinvites 命令
数据库
Treevite 默认使用 SQLite 进行持久化存储,但也支持 PostgreSQL。所有邀请关系和速率限制数据都会自动存储。
支持
- 问题反馈: 在 GitHub 仓库报告错误
- 疑问解答: 查阅文档或在仓库讨论区提问
- 作者: AwesomestOwl
许可证
GNU General Public License v3.0 - 详见 LICENSE 文件
Treevite
A server-side Minecraft Fabric mod that implements a tree-based whitelist system for managing player access through an invitation chain.
Overview
Treevite allows you to control who can join your server through a hierarchical invitation system. Starting with just the console as the root administrator, whitelisted players can invite others, creating a "tree" of authorized players. This provides a flexible, organic way to manage server access without manually adding each player to a whitelist.
Key Features:
- Tree-based whitelist system starting from console as root
- Player-to-player invitation system with
/invite command
- Invite revocation with automatic privilege adjustment
- Daily invitation rate limits per player (configurable)
- Support for both Java and Bedrock Edition players
- Invite history tracking
- Permission-based commands (via Fabric Permissions API)
Requirements
- Minecraft Server 26.1.2 (or compatible)
- Fabric Loader 0.19.2 or later
- Java 25 or later
- Fabric API
Installation
- Download the
tree-invite.jar mod file
- Place it in your server's
mods folder
- Start your server
- (Optional) Install Fabric Permissions API for permission-based command access
Commands
Player Commands
/invite <player> [java|bedrock]
- Invite a player to join the server
- If platform not specified, Java Edition is assumed
- Usernames are looked up via Mojang API (Java) or converted to XUID format (Bedrock)
- Limited by daily rate limit (default: 4 invites per day, resets at 02:00 AM server time)
/revokeinvite <player> [java|bedrock]
- Revoke an invitation you sent to a player
- Only the original inviter can revoke
- Platform optional; if not specified, both platforms are checked
- Players lose access if they have no alternate path back to console
- Invite data is preserved for automatic reinstatement if re-invited
/inviteinfo [player]
- View invitation information
- Lists who invited the player and who they've invited
- Defaults to the command executor if no player specified
Admin Commands
/setmaxinvites <player> <count>
- Set a custom daily invitation limit for a player
- Overrides the global default rate limit
- Set to 0 to disable invites for a player
/setglobalmaxinvites <count>
- Set the default daily invitation limit for all players
- Only accessible to console or high-permission admins
How It Works
- Initialization: Only the console is whitelisted initially
- Invitations: Any whitelisted player can invite others using
/invite
- Access Control: A player can join if they have at least one valid path back to console through the invitation chain
- Revocation: When an invite is revoked, affected players lose access unless they have another path to console
- Reinstatement: If a revoked player is invited again (directly or indirectly), they automatically regain access
Example Scenario
Console (root)
├── Alice (invited by Console)
│ ├── Bob (invited by Alice)
│ └── Carol (invited by Alice)
└── Dave (invited by Console)
└── Eve (invited by Dave)
- All players can join
- If Console revokes Dave's invite, Eve loses access (no alternate path)
- If Console revokes Alice's invite, Bob and Carol lose access
- If Console invites Dave back, Eve automatically regains access
Configuration
Configuration is stored in config/tree-invite-messages.json and persists across restarts. The mod manages whitelist data automatically—you don't need to modify the vanilla whitelist.
Permissions
When Fabric Permissions API is available, the following permissions are recognized:
tree-invite.invite - Allow /invite command
tree-invite.revoke - Allow /revokeinvite command
tree-invite.info - Allow /inviteinfo command
tree-invite.admin.setmaxinvites - Allow /setmaxinvites command
tree-invite.admin.setglobalmaxinvites - Allow /setglobalmaxinvites command
Database
Treevite uses SQLite for persistent storage by default, but can also use PostgreSQL. All invite relationships and rate limit data are stored automatically.
Support
- Issues: Report bugs on the GitHub repository
- Questions: Check the documentation or ask in the repository discussions
- Author: AwesomestOwl
License
GNU General Public License v3.0 - See LICENSE file for details
评论 0
登录后参与评分
还没有评论,来抢沙发吧