We-Friends
适用于 Minecraft 服务器的全面好友与组队管理系统,支持跨服务器交互,专为 Paper/Spigot 和 Folia 构建。
✨ 功能特性
? 好友系统
- 好友请求:发送、接受和拒绝好友请求
- 好友列表:查看在线/离线好友及状态指示器
- 好友聊天:与好友进行私聊和群聊
- 加入/离开通知:当好友加入或离开服务器时收到通知
- 请求开关:启用/禁用接收好友请求
- 跨服务器支持:好友可以在多个服务器之间互动
? 组队系统
- 队伍创建:与好友创建和管理队伍
- 队伍邀请:邀请好友加入你的队伍
- 队伍聊天:专用的队伍聊天频道
- 队伍角色:队长和队员角色及其权限
- 队伍管理:踢人、提升职位、转让领导权和解散队伍
- 跨服务器组队:队伍成员可以位于不同的服务器上
? 跨服务器支持
- 多服务器网络:通过 Redis 连接多个服务器
- 实时同步:跨服务器即时通知
- 服务器标识:查看好友/队伍成员所在的服务器
- 无缝体验:在整个网络中聊天和互动
? 高级功能
- 数据库支持:支持 SQLite 和 MySQL
- Redis 集成:用于跨服务器通信
- PlaceholderAPI:为其他插件提供自定义占位符
- Folia 支持:完全兼容 Folia 服务器
- 聊天监听:工作人员可以监控好友/队伍聊天
- 聊天模式:在普通、好友和队伍聊天之间切换
? 依赖要求
- Java:17 或更高版本
- 服务端软件:Paper 1.21.1+ 或 Folia
- 数据库:SQLite(包含)或 MySQL
- Redis:跨服务器功能必需(可选)
? 安装步骤
- 下载 Releases 中的最新版本
- 放置 JAR 文件到服务器的
plugins 文件夹中
- 启动 服务器以生成配置文件
- 配置 插件(参见配置部分)
- 重启 服务器
⚙️ 配置说明
基础设置(单服务器)
# config.yml
database:
type: sqlite # 单服务器使用 SQLite
server:
name: lobby # 你的服务器名称
cross-server:
enabled: false # 单服务器请禁用
redis:
enabled: false # 单服务器不需要
多服务器设置
# config.yml
database:
type: mysql # 多服务器必需
mysql:
host: localhost
port: 3306
database: wefriends
username: root
password: "your_password"
server:
name: lobby # 每个服务器唯一的名称
cross-server:
enabled: true # 启用跨服务器功能
sync-interval: 30
notification-timeout: 5
redis:
enabled: true # 跨服务器必需
host: localhost
port: 6379
password: ""
channel: wefriends:events
limits:
max-friends: 200
max-party-size: 8
数据库设置 (MySQL)
CREATE DATABASE wefriends;
CREATE USER 'wefriends'@'%' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON wefriends.* TO 'wefriends'@'%';
FLUSH PRIVILEGES;
? 命令
好友命令
/friend add <player> - 发送好友请求
/friend accept <player> - 接受好友请求
/friend deny <player> - 拒绝好友请求
/friend remove <player> - 移除好友
/friend list - 查看你的好友列表
/friend requests - 查看待处理的请求
/friend toggle - 开启/关闭好友请求
/fchat <message> - 向所有好友发送消息
/fmsg <friend> <message> - 向特定好友发送私聊消息
队伍命令
/party create - 创建新队伍
/party invite <player> - 邀请好友加入队伍
/party accept <player> - 接受队伍邀请
/party deny <player> - 拒绝队伍邀请
/party leave - 离开当前队伍
/party kick <player> - 将成员踢出队伍(仅限队长)
/party promote <player> - 将成员提升为队长(仅限队长)
/party transfer <player> - 转让领导权(仅限队长)
/party disband - 解散队伍(仅限队长)
/pc <message> - 向队伍成员发送消息
聊天模式命令
/fchatmode - 切换好友聊天模式
/pchatmode - 切换队伍聊天模式
/chatmode - 查看当前聊天模式
管理员命令
/fchatspy - 切换好友聊天监听(需要权限)
/partyspy - 切换队伍聊天监听(需要权限)
/wefriends reload - 重新加载插件配置
? 权限
玩家权限
wefriends.friend.use - 使用好友命令
wefriends.party.use - 使用队伍命令
wefriends.chat.friend - 使用好友聊天
wefriends.chat.party - 使用队伍聊天
管理员权限
wefriends.admin - 访问管理员命令
wefriends.spy.friend - 监听好友聊天
wefriends.spy.party - 监听队伍聊天
wefriends.reload - 重新加载插件配置
? PlaceholderAPI
该插件提供以下 PlaceholderAPI 占位符供使用:
%wefriends_friends_online% - 在线好友数量
%wefriends_friends_total% - 好友总数
%wefriends_party_size% - 当前队伍人数
%wefriends_party_leader% - 队长名称
%wefriends_in_party% - 玩家是否在队伍中(true/false)
? API 使用
Maven 依赖
<dependency>
<groupId>me.wethink</groupId>
<artifactId>wefriends</artifactId>
<version>1.0.0</version>
<scope>provided</scope>
</dependency>
基础 API 示例
// 获取插件实例
WeFriends plugin = WeFriends.getInstance();
// 检查两名玩家是否为好友
boolean areFriends = plugin.getFriendManager().areFriends(player1UUID, player2UUID);
// 获取玩家的好友列表
Set<UUID> friends = plugin.getFriendManager().getFriendUuidsPublic(playerUUID);
// 获取队伍信息
String partyId = plugin.getPartyManager().getPartyIdPublic(playerUUID);
List<UUID> partyMembers = plugin.getPartyManager().getPartyMembers(partyId);
? 跨服务器设置指南
步骤 1:数据库配置
设置所有服务器均可访问的共享 MySQL 数据库:
database:
type: mysql
mysql:
host: your-database-host
port: 3306
database: wefriends_network
username: wefriends_user
password: secure_password
步骤 2:Redis 配置
配置 Redis 以支持实时通信:
redis:
enabled: true
host: your-redis-host
port: 6379
password: redis_password
channel: wefriends:network
步骤 3:服务器标识
为每个服务器分配唯一的名称:
server:
name: lobby # 大厅服务器
name: survival # 生存服务器
name: creative # 创造服务器
步骤 4:启用跨服务器功能
cross-server:
enabled: true
sync-interval: 30
notification-timeout: 5
? 故障排除
常见问题
数据库连接失败
- 验证 MySQL 凭据和主机可访问性
- 检查防火墙设置
- 确保数据库存在且用户拥有适当的权限
Redis 连接失败
- 验证 Redis 服务器是否正在运行
- 检查 Redis 主机和端口配置
- 如果启用了身份验证,请验证 Redis 密码
跨服务器功能无法正常工作
- 确保所有服务器使用相同的 MySQL 数据库
- 验证各服务器上的 Redis 配置完全一致
- 检查服务器名称是否唯一
- 确认
cross-server.enabled 设置为 true
插件未加载
- 验证已安装 Java 17 或更高版本
- 检查服务器软件兼容性(Paper 1.21.1+)
- 查看服务器日志中的错误消息
? 贡献指南
我们欢迎贡献!请按照以下步骤操作:
- Fork 本仓库
- Create 功能分支 (
git checkout -b feature/amazing-feature)
- Commit 您的更改 (
git commit -m 'Add amazing feature')
- Push 到该分支 (
git push origin feature/amazing-feature)
- Open 一个 Pull Request
开发环境设置
- 克隆本仓库
- 导入到您的 IDE(推荐使用 IntelliJ IDEA)
- 运行
mvn clean install 进行构建
- 在 Paper 1.21.1+ 服务器上测试
? 许可证
本项目采用 MIT 许可证授权 - 详见 LICENSE 文件。
? 致谢
- Paper Team - 提供出色的服务器软件
- Folia Team - 提供多线程服务器支持
- PlaceholderAPI - 提供占位符集成
- HikariCP - 提供数据库连接池
- Jedis - 提供 Redis 连接支持
? 支持
由 WeThink 用 ❤️ 制作
We-Friends
A comprehensive friend and party management system for Minecraft servers with cross-server support, built for Paper/Spigot and Folia.
✨ Features
? Friend System
- Friend Requests: Send, accept, and deny friend requests
- Friend List: View online/offline friends with status indicators
- Friend Chat: Private messaging and group chat with friends
- Join/Quit Notifications: Get notified when friends join or leave
- Request Toggle: Enable/disable receiving friend requests
- Cross-Server Support: Friends can interact across multiple servers
? Party System
- Party Creation: Create and manage parties with friends
- Party Invites: Invite friends to join your party
- Party Chat: Dedicated party chat channel
- Party Roles: Leader and member roles with permissions
- Party Management: Kick, promote, transfer leadership, and disband
- Cross-Server Parties: Party members can be on different servers
? Cross-Server Support
- Multi-Server Network: Connect multiple servers with Redis
- Real-time Sync: Instant notifications across servers
- Server Identification: See which server friends/party members are on
- Seamless Experience: Chat and interact across the entire network
? Advanced Features
- Database Support: SQLite and MySQL support
- Redis Integration: For cross-server communication
- PlaceholderAPI: Custom placeholders for other plugins
- Folia Support: Full compatibility with Folia servers
- Chat Spy: Staff can monitor friend/party chats
- Chat Modes: Toggle between normal, friend, and party chat
? Requirements
- Java: 17 or higher
- Server Software: Paper 1.21.1+ or Folia
- Database: SQLite (included) or MySQL
- Redis: Required for cross-server functionality (optional)
? Installation
- Download the latest release from Releases
- Place the JAR file in your server's
plugins folder
- Start your server to generate the configuration files
- Configure the plugin (see Configuration section)
- Restart your server
⚙️ Configuration
Basic Setup (Single Server)
# config.yml
database:
type: sqlite # Use SQLite for single server
server:
name: lobby # Your server name
cross-server:
enabled: false # Disable for single server
redis:
enabled: false # Not needed for single server
Multi-Server Setup
# config.yml
database:
type: mysql # Required for multi-server
mysql:
host: localhost
port: 3306
database: wefriends
username: root
password: "your_password"
server:
name: lobby # Unique name for each server
cross-server:
enabled: true # Enable cross-server features
sync-interval: 30
notification-timeout: 5
redis:
enabled: true # Required for cross-server
host: localhost
port: 6379
password: ""
channel: wefriends:events
limits:
max-friends: 200
max-party-size: 8
Database Setup (MySQL)
CREATE DATABASE wefriends;
CREATE USER 'wefriends'@'%' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON wefriends.* TO 'wefriends'@'%';
FLUSH PRIVILEGES;
? Commands
Friend Commands
/friend add <player> - Send a friend request
/friend accept <player> - Accept a friend request
/friend deny <player> - Deny a friend request
/friend remove <player> - Remove a friend
/friend list - View your friends list
/friend requests - View pending requests
/friend toggle - Toggle friend requests on/off
/fchat <message> - Send a message to all friends
/fmsg <friend> <message> - Send a private message to a friend
Party Commands
/party create - Create a new party
/party invite <player> - Invite a friend to your party
/party accept <player> - Accept a party invite
/party deny <player> - Deny a party invite
/party leave - Leave your current party
/party kick <player> - Kick a member from the party (leader only)
/party promote <player> - Promote a member to leader (leader only)
/party transfer <player> - Transfer leadership (leader only)
/party disband - Disband the party (leader only)
/pc <message> - Send a message to party members
Chat Mode Commands
/fchatmode - Toggle friend chat mode
/pchatmode - Toggle party chat mode
/chatmode - View current chat mode
Admin Commands
/fchatspy - Toggle friend chat spy (permission required)
/partyspy - Toggle party chat spy (permission required)
/wefriends reload - Reload the plugin configuration
? Permissions
Player Permissions
wefriends.friend.use - Use friend commands
wefriends.party.use - Use party commands
wefriends.chat.friend - Use friend chat
wefriends.chat.party - Use party chat
Admin Permissions
wefriends.admin - Access admin commands
wefriends.spy.friend - Spy on friend chats
wefriends.spy.party - Spy on party chats
wefriends.reload - Reload plugin configuration
? PlaceholderAPI
The plugin provides placeholders for use with PlaceholderAPI:
%wefriends_friends_online% - Number of online friends
%wefriends_friends_total% - Total number of friends
%wefriends_party_size% - Current party size
%wefriends_party_leader% - Party leader name
%wefriends_in_party% - Whether player is in a party (true/false)
? API Usage
Maven Dependency
<dependency>
<groupId>me.wethink</groupId>
<artifactId>wefriends</artifactId>
<version>1.0.0</version>
<scope>provided</scope>
</dependency>
Basic API Examples
// Get the plugin instance
WeFriends plugin = WeFriends.getInstance();
// Check if two players are friends
boolean areFriends = plugin.getFriendManager().areFriends(player1UUID, player2UUID);
// Get a player's friends
Set<UUID> friends = plugin.getFriendManager().getFriendUuidsPublic(playerUUID);
// Get party information
String partyId = plugin.getPartyManager().getPartyIdPublic(playerUUID);
List<UUID> partyMembers = plugin.getPartyManager().getPartyMembers(partyId);
? Cross-Server Setup Guide
Step 1: Database Configuration
Set up a shared MySQL database accessible by all servers:
database:
type: mysql
mysql:
host: your-database-host
port: 3306
database: wefriends_network
username: wefriends_user
password: secure_password
Step 2: Redis Configuration
Configure Redis for real-time communication:
redis:
enabled: true
host: your-redis-host
port: 6379
password: redis_password
channel: wefriends:network
Step 3: Server Identification
Give each server a unique name:
server:
name: lobby # For lobby server
name: survival # For survival server
name: creative # For creative server
Step 4: Enable Cross-Server Features
cross-server:
enabled: true
sync-interval: 30
notification-timeout: 5
? Troubleshooting
Common Issues
Database Connection Failed
- Verify MySQL credentials and host accessibility
- Check firewall settings
- Ensure database exists and user has proper permissions
Redis Connection Failed
- Verify Redis server is running
- Check Redis host and port configuration
- Verify Redis password if authentication is enabled
Cross-Server Not Working
- Ensure all servers use the same MySQL database
- Verify Redis configuration is identical across servers
- Check that server names are unique
- Confirm
cross-server.enabled is true
Plugin Not Loading
- Verify Java 17+ is installed
- Check server software compatibility (Paper 1.21.1+)
- Review server logs for error messages
? Contributing
We welcome contributions! Please follow these steps:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature)
- Commit your changes (
git commit -m 'Add amazing feature')
- Push to the branch (
git push origin feature/amazing-feature)
- Open a Pull Request
Development Setup
- Clone the repository
- Import into your IDE (IntelliJ IDEA recommended)
- Run
mvn clean install to build
- Test on a Paper 1.21.1+ server
? License
This project is licensed under the MIT License - see the LICENSE file for details.
? Acknowledgments
- Paper Team - For the excellent server software
- Folia Team - For multi-threaded server support
- PlaceholderAPI - For placeholder integration
- HikariCP - For database connection pooling
- Jedis - For Redis connectivity
? Support
Made with ❤️ by WeThink
评论 0
登录后参与评分
还没有评论,来抢沙发吧