UltraWhitelist
UltraWhitelist 是一款支持 Paper/Folia 的白名单插件,具备多命名列表、JSON 导入以及 Folia 安全执行等功能。
功能
- 多白名单支持:设计用于同时管理多个列表
- 列表热切换:可通过单一命令切换列表
- 轻松导入:
/wl import whitelist.json xxx 可导入你现有的服务器 whitelist.json
- 强制执行:踢出所有不在列表中的玩家
- 丰富的列表管理:提供大量创建/删除/合并/管理列表的命令
- 对开发者友好的 API:易于插件集成
命令
| 命令 |
用途 |
/wl on |
启用白名单。 |
/wl off |
禁用白名单。 |
/wl info |
显示当前状态。 |
/wl list |
显示所有白名单。 |
/wl listplayers <list> [page] |
显示列表中玩家名称。 |
/wl find <player> |
显示包含该玩家的每个列表。 |
/wl create <name> |
创建列表。 |
/wl delete <list> |
删除列表 |
/wl add <list|all> <player> |
将玩家添加到列表 / 所有列表。 |
/wl remove <list|all> <player> |
从列表 / 所有列表中移除玩家。 |
/wl use <list> |
更改当前生效的列表。 |
/wl enforce [list] |
踢出被列表不允许的在线玩家。 |
/wl merge <a> <b> <new> |
将两个列表合并为一个新的列表。 |
/wl addfromlist <source> <destination> |
在列表之间复制新条目。 |
/wl import <file.json> <list> |
导入白名单风格的 JSON 文件。 |
/wl reload |
重载插件。 |
/wl help |
显示命令帮助。 |
权限
| 权限 |
用途 |
默认值 |
ultrawhitelist.admin |
使用白名单管理命令。 |
管理员 (Operators) |
ultrawhitelist.bypass |
避免被 /wl enforce 踢出。 |
管理员 (Operators) |
开发者 API
1. 添加依赖项:
Maven
<repositories>
<repository>
<id>lolyay-releases</id>
<url>https://maven.lolyay.dev/releases</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.lolyay.mc</groupId>
<artifactId>WhitelistPlugin</artifactId>
<version>1.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
Gradle (Kotlin DSL)
repositories {
maven("https://maven.lolyay.dev/releases")
}
dependencies {
compileOnly("io.lolyay.mc:WhitelistPlugin:1.0.0")
}
2. 声明依赖:
depend: [UltraWhitelist]
3. 获取服务
所有内容都通过 WhitelistService 进行交互,可从插件实例中访问:
import io.lolyay.mc.whitelistPlugin.WhitelistPlugin;
import io.lolyay.mc.whitelistPlugin.core.WhitelistService;
WhitelistPlugin wl = (WhitelistPlugin) Bukkit.getPluginManager().getPlugin("UltraWhitelist");
if (wl == null || wl.service() == null) return; // 未安装 / 尚未启用
WhitelistService service = wl.service();
3. WhitelistService API
全局状态
| 方法 |
描述 |
boolean isEnabled() |
是否全局启用了白名单? |
boolean setEnabled(boolean) |
开启/关闭白名单;如果状态未改变则返回 false。 |
String activeListName() |
活动(登录强制执行)列表的名称,或 null。 |
WhitelistList activeList() |
活动列表对象,或 null。 |
boolean setActiveList(String name) |
设置活动列表(null 清除它);如果状态未改变则返回 false。 |
成员资格
| 方法 |
描述 |
boolean isWhitelisted(UUID id, String name) |
登录时使用的确切检查。如果白名单已关闭、无活动列表或身份在活动列表中(通过 UUID 或 名称),则返回 true。 |
boolean allowed = service.isWhitelisted(event.getUniqueId(), event.getName());
列表
| 方法 |
描述 |
WhitelistList getList(String name) |
不区分大小写的查找,若不存在则返回 null。 |
Collection<WhitelistList> lists() |
所有列表。 |
List<String> findLists(UUID id, String name) |
匹配列表的排序名称列表。 |
boolean createList(String name) |
如果列表已存在则返回 false。 |
boolean deleteList(String name) |
如果不存在该列表则返回 false。 |
条目
| 方法 |
描述 |
boolean addUuid(String list, UUID id) |
添加条目;如果未改变或列表缺失则返回 false。 |
boolean addName(String list, String name) |
添加名称条目;如果未改变或列表缺失则返回 false。 |
boolean removeUuid(String list, UUID id) |
移除条目;如果未改变或列表缺失则返回 false。 |
boolean removeName(String list, String name) |
移除条目;如果未改变或列表缺失则返回 false。 |
List<String> addUuidToAll(UUID) / addNameToAll(String) |
添加到所有列表并返回更改过的列表名称。 |
List<String> removeUuidFromAll(UUID) / removeNameFromAll(String) |
从所有列表中移除并返回更改过的列表名称。 |
MergeResult merge(String a, String b, String newName) |
将两个列表合并为一个新的列表。 |
int addFromList(String src, String dest) |
复制条目并返回添加的数量(如果缺失则返回 -1)。 |
名称缓存 (UUID <-> 名称)
条目以 UUID 优先 方式存储;持久化缓存将 UUID 映射到最后已知的名称
(由登录、导入和 playerdb.co 查询提供数据)。
| 方法 |
描述 |
void cacheName(UUID id, String name) |
记录/持久化 UUID -> 名称的映射。 |
String nameFor(UUID id) |
UUID 的最后已知名称,或 null。 |
UUID uuidForName(String name) |
名称的缓存 UUID(不区分大小写),或 null。 |
WhitelistList
| 方法 |
描述 |
String name() |
显示名称。 |
boolean contains(UUID id, String name) |
按 UUID 或名称进行匹配。 |
Set<UUID> uuids() |
实时 UUID 条目。 |
Map<String,String> names() |
小写名称 -> 显示名称。 |
int size() |
总条目数。 |
MergeResult: { OK, MISSING_A, MISSING_B, TARGET_EXISTS }。
UltraWhitelist
UltraWhitelist is a Paper/Folia whitelist plugin with multiple named lists, JSON imports, and folia-safe enforcement.
Features
- Multi Whitelist support: Designed for multiple Lists at the same time
- Hotswapping Lists: Lists can be swapped using a single command
- Easy Import:
/wl import whitelist.json xxx imports your already existing Server whitelist.json
- Enforcement: Kicks all players not on the list
- Extensive list management: Lots of commands to Create/Delete/Merge/Manage lists
- Developer friendly API: Easy plugin integration
Commands
| Command |
Purpose |
/wl on |
Enable whitelist. |
/wl off |
Disable whitelist. |
/wl info |
Show current status. |
/wl list |
Show every whitelist. |
/wl listplayers <list> [page] |
Show player names in a list. |
/wl find <player> |
Show every list containing a player. |
/wl create <name> |
Create a list. |
/wl delete <list> |
Delete a list |
/wl add <list|all> <player> |
Add a player to a list / all lists. |
/wl remove <list|all> <player> |
Remove a player from a list / all lists. |
/wl use <list> |
Change the active in-use list. |
/wl enforce [list] |
Kick online players not allowed by a list. |
/wl merge <a> <b> <new> |
Merge two lists into a new list. |
/wl addfromlist <source> <destination> |
Copy new entries between lists. |
/wl import <file.json> <list> |
Import a whitelist-style JSON file. |
/wl reload |
Reload the plugin. |
/wl help |
Show command help. |
Permissions
| Permission |
Purpose |
Default |
ultrawhitelist.admin |
Use whitelist-management commands. |
Operators |
ultrawhitelist.bypass |
Avoid /wl enforce kicks. |
Operators |
Developer API
1. Add the Dependency:
Maven
<repositories>
<repository>
<id>lolyay-releases</id>
<url>https://maven.lolyay.dev/releases</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>io.lolyay.mc</groupId>
<artifactId>WhitelistPlugin</artifactId>
<version>1.0.0</version>
<scope>provided</scope>
</dependency>
</dependencies>
Gradle (Kotlin DSL)
repositories {
maven("https://maven.lolyay.dev/releases")
}
dependencies {
compileOnly("io.lolyay.mc:WhitelistPlugin:1.0.0")
}
2. Depend on it:
depend: [UltraWhitelist]
3. Get the service
Everything goes through WhitelistService, reachable from the plugin instance:
import io.lolyay.mc.whitelistPlugin.WhitelistPlugin;
import io.lolyay.mc.whitelistPlugin.core.WhitelistService;
WhitelistPlugin wl = (WhitelistPlugin) Bukkit.getPluginManager().getPlugin("UltraWhitelist");
if (wl == null || wl.service() == null) return; // not installed / not enabled yet
WhitelistService service = wl.service();
3. WhitelistService API
Global state
| Method |
Description |
boolean isEnabled() |
Is whitelisting globally on? |
boolean setEnabled(boolean) |
Turn whitelisting on/off; returns false when unchanged. |
String activeListName() |
Name of the active (login-enforced) list, or null. |
WhitelistList activeList() |
The active list object, or null. |
boolean setActiveList(String name) |
Set the active list (null clears it); false when unchanged. |
Membership
| Method |
Description |
boolean isWhitelisted(UUID id, String name) |
The exact check used on login. true if whitelisting is off, no active list, or the identity is on the active list (by UUID or name). |
boolean allowed = service.isWhitelisted(event.getUniqueId(), event.getName());
Lists
| Method |
Description |
WhitelistList getList(String name) |
Case-insensitive lookup, or null. |
Collection<WhitelistList> lists() |
All lists. |
List<String> findLists(UUID id, String name) |
Sorted names of every matching list. |
boolean createList(String name) |
false if it already exists. |
boolean deleteList(String name) |
false if no such list. |
Entries
| Method |
Description |
boolean addUuid(String list, UUID id) |
Add an entry; false when unchanged or missing. |
boolean addName(String list, String name) |
Add a name entry; false when unchanged or missing. |
boolean removeUuid(String list, UUID id) |
Remove an entry; false when unchanged or missing. |
boolean removeName(String list, String name) |
Remove an entry; false when unchanged or missing. |
List<String> addUuidToAll(UUID) / addNameToAll(String) |
Add to every list and return changed list names. |
List<String> removeUuidFromAll(UUID) / removeNameFromAll(String) |
Remove from every list and return changed list names. |
MergeResult merge(String a, String b, String newName) |
Merge two lists into a new one. |
int addFromList(String src, String dest) |
Copy entries and return the number added (-1 if missing). |
Name cache (UUID <-> name)
Entries are stored UUID-first; a persistent cache maps UUIDs to last-known names
(fed by logins, imports, and playerdb.co lookups).
| Method |
Description |
void cacheName(UUID id, String name) |
Record/persist a UUID -> name mapping. |
String nameFor(UUID id) |
Last-known name for a UUID, or null. |
UUID uuidForName(String name) |
Cached UUID for a name (case-insensitive), or null. |
WhitelistList
| Method |
Description |
String name() |
Display name. |
boolean contains(UUID id, String name) |
Matches by UUID or name. |
Set<UUID> uuids() |
Live UUID entries. |
Map<String,String> names() |
lower-cased name -> display name. |
int size() |
Total entry count. |
MergeResult: { OK, MISSING_A, MISSING_B, TARGET_EXISTS }.
评论 0
登录后参与评分
还没有评论,来抢沙发吧