Friends - 好友系统

汉化 Friends - 好友系统 3.1.3

除了用于添加/删除好友之外,该插件本身不提供其它额外功能。但它提供了API来供其他玩家使用,例如避免好友之间造成伤害等。

指令​

该插件指令可在控制台或聊天中使用,如果要在聊天中使用请在前面加上:/
  • friend <add/remove> <玩家名称/ID> - 添加/删除指定玩家为好友
  • friend list - 查看所有好友列表。

配置文件​

JSON:
{
  "Maximum number of friends per player (0 to disable)": 30,
  "Friend list cache time (0 to disable)": 0
}

开发者API​

要从本插件调用API,请在插件中添加引用:
C#:
[PluginReference]
private Plugin Friends;
添加引用后就可以在插件中调用对应的API方法:
C#:
Friends.Call<bool>("HasFriend", playerId, targetId)
上面的示例使用了HasFriend方法,其它方法见下方:

API​

C#:
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()

Hook​

要监听玩家的添加/删除好友事件请使用:
C#:
private void OnFriendAdded(string playerId, string friendId)

private void OnFriendRemoved(string playerId, string friendId)
作者
对味儿
下载
19
查看
481
文件类型
cs
文件大小
19.4 KB
文件Hash
9f132655444746a7a81088ef68a238e0
首次发布
最后更新
评分
0.00 星 0评价

来自对味儿的更多资源

分享资源

标签
api 好友