命令
此插件使用相同的语法提供聊天和控制台命令。在聊天中使用命令时,请为其添加正斜杠前缀: '/'。此插件提供聊天和控制台命令。使用命令聊天时,请以正斜杠为前缀: 。/
- friend <add/remove> <player name or id>-- 将玩家添加或移除为好友
- friend list-- 列出您当前的所有朋友
配置
设置和选项可以在目录下的文件中进行配置。建议使用编辑器和验证器,以避免格式问题和语法错误。
代码:
{
"Maximum number of friends per player (0 to disable)": 30,
"Friend list cache time (0 to disable)": 0
}
地方化
默认消息位于目录下的文件中。要添加对其他语言的支持,请创建一个新的语言文件夹(例如 对于德语),请将默认语言文件复制到新文件夹,然后自定义消息。开发人员 API
要从此 API 调用函数,您首先需要获取插件引用:
代码:
[PluginReference]
private Plugin Friends;
代码:
Friends.Call<bool>("HasFriend", playerId, targetId)
API 方法
代码:
bool AddFriend(string playerId, string friendId)
bool AddFriend(ulong playerId, ulong friendId)
bool RemoveFriend(string playerId, string friendId)
bool RemoveFriend(ulong playerId, ulong friendId)
bool HasFriend(string playerId, string friendId)
bool HasFriend(ulong playerId, ulong friendId)
bool AreFriends(string playerId, string friendId)
bool AreFriends(ulong playerId, ulong friendId)
bool IsFriend(string playerId, string friendId)
bool IsFriend(ulong playerId, ulong friendId)
string[] GetFriendList(string playerId)
ulong[] GetFriendList(ulong playerId)
string[] IsFriendOf(string playerId)
ulong[] IsFriendOf(ulong playerId)
bool HadFriend(string playerId, string friendId)
bool HadFriend(ulong playerId, ulong friendId)
bool WereFriends(string playerId, string friendId)
bool WereFriends(ulong playerId, ulong friendId)
bool WasFriend(string playerId, string friendId)
bool WasFriend(ulong playerId, ulong friendId)
string[] GetFriends(string playerId)
ulong[] GetFriends(ulong playerId)
int GetMaxFriends()
钩
要监听好友的添加或移除时间,请使用以下钩子:
代码:
private void OnFriendAdded(string playerId, string friendId)