feat: add more info for UserCache
This commit is contained in:
+8
-5
@@ -216,7 +216,9 @@ const GMLIB_API = {
|
||||
getXuidByName: ll.imports("GMLIB_API", "getXuidByName"),
|
||||
/** 根据名字获取uuid @type {function(string):string} */
|
||||
getUuidByName: ll.imports("GMLIB_API", "getUuidByName"),
|
||||
/** 获取所有已记录的玩家信息 @type {function():Array.<{"Uuid":string,"Xuid":string,"Name":string}>} */
|
||||
/** 根据信息获取玩家信息 @type {function():{"Uuid":string,"Xuid":string,"Name":string,"ServerId":string,"ActorUniqueID":string}} */
|
||||
getPlayerInfo: ll.imports("GMLIB_API", "getPlayerInfo"),
|
||||
/** 获取所有已记录的玩家信息 @type {function():Array.<{"Uuid":string,"Xuid":string,"Name":string,"ServerId":string,"ActorUniqueID":string}>} */
|
||||
getAllPlayerInfo: ll.imports("GMLIB_API", "getAllPlayerInfo"),
|
||||
/** 获取方块RuntimeId @type {function(string,number):number} */
|
||||
getBlockRuntimeId: ll.imports("GMLIB_API", "getBlockRuntimeId"),
|
||||
@@ -2107,16 +2109,17 @@ class UserCache {
|
||||
|
||||
/**
|
||||
* 获取玩家信息
|
||||
* @param {string} playerIdentifier 玩家的 xuid 或 uuid 或 名称
|
||||
* @returns {{Xuid: String, Uuid: string, Name: string}?} 玩家信息
|
||||
* @param {string} playerIdentifier 玩家的 xuid 或 uuid 或 realName 或 serverId 或 uniqueId
|
||||
* @returns {{Xuid: string, Uuid: string, Name: string, ServerId: string, ActorUniqueID: string}?} 玩家信息
|
||||
*/
|
||||
static getPlayerInfo(playerIdentifier) {
|
||||
return GMLIB_API.getAllPlayerInfo().find(Info => Object.keys(Info).some(InfoKey => Info[InfoKey] === playerIdentifier));
|
||||
const result = GMLIB_API.getPlayerInfo(playerIdentifier)
|
||||
return Object.keys(result).length === 0 ? null : result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取所有玩家信息
|
||||
* @returns {Array.<{Xuid: String, Uuid: string, Name: string}>} 包含所有玩家信息的数组
|
||||
* @returns {Array.<{Xuid: string, Uuid: string, Name: string, ServerId: string, ActorUniqueID: string}>} 包含所有玩家信息的数组
|
||||
*/
|
||||
static getAllPlayerInfo() {
|
||||
return GMLIB_API.getAllPlayerInfo();
|
||||
|
||||
Reference in New Issue
Block a user