RefineryFriends
RefineryFriends 是一个用于 Paper 服务器的持久化、基于图形用户界面(GUI)的好友系统。它使用 RefineryCore 提供命令、消息、配置和数据库服务。
功能
- 持久化的好友关系及待处理请求
- 支持分页、在线排序和挚友标记的好友列表 GUI
- 接受、拒绝、移除好友以及查看好友请求
- 每位玩家可设置私有好友昵称
- 支持挚友标记,并可配置数量上限
- 加入/离开服务器通知,支持按玩家自定义设置
- 可配置请求冷却时间和请求过期时间
- 本地化消息及玩家可选的菜单语言
- 可选的网络级在线状态显示,适用于 Velocity 或 BungeeCord 网络
- 公开的非同步 API 及供其他插件使用的好友事件
要求
- Paper 1.21.11 或兼容的服务器实现
- Java 21 或更高版本
- RefineryCore 0.1.3 或更高版本
在安装 RefineryFriends 之前,必须先将 RefineryCore 安装到服务器的 plugins 目录中。
安装
- 下载
refineryfriends 插件 JAR 文件。
- 安装所需版本的 RefineryCore。
- 将两个 JAR 文件放入服务器的
plugins 目录。
- 启动服务器一次以生成配置文件。
- 检查
plugins/RefineryFriends/config.yml 和 gui.yml。
该插件将其 SQLite 数据库 friends.db 用于存储好友数据和玩家偏好设置。
命令
主要命令为 /friends;/friend 为其别名。
| 命令 |
描述 |
/friends |
打开好友菜单 |
/friends add <player> |
发送好友请求 |
/friends accept <player> |
接受好友请求 |
/friends decline <player> |
拒绝好友请求 |
/friends remove <player> |
移除好友 |
/friends requests |
列出收到的好友请求 |
/friends list |
列出好友及其当前所在服务器 |
/friends settings |
打开个人通知和显示设置 |
/friends bestfriend <player> |
切换挚友标记 |
/friends nickname <player> [nickname] |
设置或清除私有昵称 |
/friends language <locale> |
选择好友菜单语言 |
所有命令仅限玩家使用。空白的昵称会清除现有昵称。
权限
| 权限节点 |
默认值 |
描述 |
refineryfriends.limit.bypass |
Operator (OP) |
绕过好友、待处理请求和挚友的数量限制 |
refineryfriends.limit.<n> |
False |
将特定玩家的好友上限提升至 n |
refineryfriends.bestlimit.<n> |
False |
将特定玩家的挚友上限提升至 n |
动态限制权限支持任意正整数。当授予多个匹配的权限时,使用最高的等级。
配置
一般行为在 config.yml 中进行配置,包括:
- 默认区域设置及是否允许玩家覆盖
- 最大好友数和待处理请求数
- 请求冷却时间和自动请求过期
- 加入、离开及收到请求的通知
- 通知音效
- 挚友上限及排序行为
- 昵称格式化和最大昵称长度
- 代理网络中的在线状态显示及本地服务器名称
好友菜单的外观在 gui.yml 中单独配置。它控制标题、行数、在线排序、填充物品以及挚友槽位的高亮显示。当这些文件的架构发生变化时,两者会自动迁移。
区域设置
内置的区域标识符包括:
en_us, ar_sa, es_es, fr_fr, de_de, pt_br, ru_ru, zh_cn, ja_jp, ko_kr, tr_tr 和 it_it。
区域设置文件位于 plugins/RefineryFriends/lang/ 目录下。在 config.yml 中设置 DefaultLocale,或者允许玩家使用 /friends language <locale> 进行选择。
网络在线状态
当服务器是 Velocity 或 BungeeCord 网络的一部分,且在多个后端服务器上运行 RefineryFriends 时,请设置 NetworkEnabled: true。为每个后端服务器设置唯一的 ServerName,并确保代理服务器支持用于网络在线状态的插件消息通道。
API
其他插件可以通过 RefineryFriendsAPI 获取注册的服务:
RefineryFriendsAPI api = RefineryFriendsAPI.get();
if (api != null) {
api.areFriends(firstUuid, secondUuid).thenAccept(areFriends -> {
// 异步处理结果。
});
}
API 查询返回 CompletableFuture 值,并在非主服务器线程上完成。在回调中访问 Bukkit API 之前,请切换回 Bukkit 主线程。好友关系的变更也会通过 RefineryCore 的事件总线发布事件。
RefineryFriends
RefineryFriends is a persistent, GUI-driven friends system for Paper servers. It uses RefineryCore for commands, messages, configuration, and database services.
Features
- Persistent friend relationships and pending requests
- GUI friend list with pagination, online sorting, and best-friend pins
- Accept, decline, remove, and inspect friend requests
- Per-player private friend nicknames
- Best-friend marking with configurable limits
- Join and leave notifications with per-player settings
- Configurable request cooldowns and request expiry
- Localized messages and player-selectable menu languages
- Optional network-wide presence for Velocity or BungeeCord networks
- Public asynchronous API and friend events for other plugins
Requirements
- Paper 1.21.11 or a compatible server implementation
- Java 21 or newer
- RefineryCore 0.1.3 or newer
RefineryCore must be installed in the server's plugins directory before RefineryFriends.
Installation
- Download the
refineryfriends plugin JAR.
- Install the required RefineryCore version.
- Place both JARs in the server's
plugins directory.
- Start the server once to generate the configuration files.
- Review
plugins/RefineryFriends/config.yml and gui.yml.
The plugin stores friend data and player preferences in its SQLite database, friends.db.
Commands
The main command is /friends; /friend is an alias.
| Command |
Description |
/friends |
Open the friends menu |
/friends add <player> |
Send a friend request |
/friends accept <player> |
Accept a friend request |
/friends decline <player> |
Decline a friend request |
/friends remove <player> |
Remove a friend |
/friends requests |
List incoming friend requests |
/friends list |
List friends and their current server |
/friends settings |
Open personal notification and display settings |
/friends bestfriend <player> |
Toggle a best-friend pin |
/friends nickname <player> [nickname] |
Set or clear a private nickname |
/friends language <locale> |
Choose the friends menu language |
All commands are player-only. A blank nickname clears the existing nickname.
Permissions
| Permission |
Default |
Description |
refineryfriends.limit.bypass |
Operator |
Bypasses friend, pending-request, and best-friend limits |
refineryfriends.limit.<n> |
False |
Raises an individual player's friend limit to n |
refineryfriends.bestlimit.<n> |
False |
Raises an individual player's best-friend limit to n |
Dynamic limit permissions support any positive integer. When several matching permissions are granted, the highest tier is used.
Configuration
General behavior is configured in config.yml, including:
- Default locale and whether players may override it
- Maximum friends and pending requests
- Request cooldown and automatic request expiry
- Join, leave, and incoming-request notifications
- Notification sound
- Best-friend limit and sorting behavior
- Nickname formatting and maximum nickname length
- Proxy-network presence and the local server name
The appearance of the friends menus is configured separately in gui.yml. It controls titles, row counts, online sorting, filler items, and best-friend slot highlighting. Both files are migrated automatically when their schema changes.
Locales
The bundled locale identifiers are:
en_us, ar_sa, es_es, fr_fr, de_de, pt_br, ru_ru, zh_cn, ja_jp, ko_kr, tr_tr, and it_it.
Locale files are located in plugins/RefineryFriends/lang/. Set DefaultLocale in config.yml, or allow players to use /friends language <locale>.
Network presence
Set NetworkEnabled: true when the server is part of a Velocity or BungeeCord network running RefineryFriends on multiple backend servers. Set a distinct ServerName for each backend and ensure the proxy supports the plugin messaging channel used for network presence.
API
Other plugins can obtain the registered service with RefineryFriendsAPI:
RefineryFriendsAPI api = RefineryFriendsAPI.get();
if (api != null) {
api.areFriends(firstUuid, secondUuid).thenAccept(areFriends -> {
// Handle the result asynchronously.
});
}
API lookups return CompletableFuture values and complete off the main server thread. Switch back to the Bukkit main thread before accessing Bukkit APIs in a callback. Friend relationship changes also publish events through RefineryCore's event bus.
评论 0
登录后参与评分
还没有评论,来抢沙发吧