feat: add getAllPlayerInfo
This commit is contained in:
+8
-3
@@ -1,6 +1,3 @@
|
||||
// LiteLoader-AIDS automatic generated
|
||||
/// <reference path="d:\dts/dts/helperlib/src/index.d.ts"/>
|
||||
|
||||
const GMLIB_API = {
|
||||
createFloatingText: ll.import("GMLIB_API", "createFloatingText"),
|
||||
deleteFloatingText: ll.import("GMLIB_API", "deleteFloatingText"),
|
||||
@@ -85,6 +82,9 @@ const GMLIB_API = {
|
||||
clearDisplayObjective: ll.import("GMLIB_API", "clearDisplayObjective"),
|
||||
getAllObjectives: ll.import("GMLIB_API", "getAllObjectives"),
|
||||
getAllTrackedTargets: ll.import("GMLIB_API", "getAllTrackedTargets"),
|
||||
getAllScoreboardPlayers: ll.import("GMLIB_API", "getAllScoreboardPlayers"),
|
||||
getAllScoreboardFakePlayers: ll.import("GMLIB_API", "getAllScoreboardFakePlayers"),
|
||||
getAllScoreboardEntities: ll.import("GMLIB_API", "getAllScoreboardEntities"),
|
||||
getPlayerFromUuid: ll.import("GMLIB_API", "getPlayerFromUuid"),
|
||||
getPlayerFromUniqueId: ll.import("GMLIB_API", "getPlayerFromUniqueId"),
|
||||
getEntityFromUniqueId: ll.import("GMLIB_API", "getEntityFromUniqueId"),
|
||||
@@ -105,6 +105,7 @@ const GMLIB_API = {
|
||||
getNameByXuid: ll.import("GMLIB_API", "getNameByXuid"),
|
||||
getXuidByName: ll.import("GMLIB_API", "getXuidByName"),
|
||||
getUuidByName: ll.import("GMLIB_API", "getUuidByName"),
|
||||
getAllPlayerInfo: ll.import("GMLIB_API", "getAllPlayerInfo")
|
||||
}
|
||||
|
||||
const FloatingTextList = [];
|
||||
@@ -866,6 +867,10 @@ class UserCache {
|
||||
let result = GMLIB_API.getUuidByName(name);
|
||||
return result == "" ? null : result;
|
||||
}
|
||||
|
||||
static getAllPlayerInfo() {
|
||||
return GMLIB_API.getAllPlayerInfo();
|
||||
}
|
||||
};
|
||||
|
||||
LLSE_Player.prototype.toEntity = function () {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "${pluginName}",
|
||||
"entry": "${pluginFile}",
|
||||
"version": "0.12.5",
|
||||
"version": "0.12.6",
|
||||
"author": "GroupMountain",
|
||||
"type": "native",
|
||||
"dependencies": [
|
||||
|
||||
@@ -395,32 +395,56 @@ void Export_Compatibility_API() {
|
||||
RemoteCall::exportAs("GMLIB_API", "getAllObjectives", []() -> std::vector<std::string> {
|
||||
auto objs = GMLIB_Scoreboard::getInstance()->getObjectives();
|
||||
std::vector<std::string> result;
|
||||
for (auto obj : objs) {
|
||||
for (auto& obj : objs) {
|
||||
result.push_back(obj->getName());
|
||||
}
|
||||
return result;
|
||||
});
|
||||
RemoteCall::exportAs("GMLIB_API", "getAllScoreboardPlayers", []() -> std::vector<std::string> {
|
||||
auto uuids = GMLIB_Scoreboard::getInstance()->getAllPlayerUuids();
|
||||
std::vector<std::string> result;
|
||||
for (auto& uuid : uuids) {
|
||||
result.push_back(uuid.asString());
|
||||
}
|
||||
return result;
|
||||
});
|
||||
RemoteCall::exportAs("GMLIB_API", "getAllScoreboardFakePlayers", []() -> std::vector<std::string> {
|
||||
auto names = GMLIB_Scoreboard::getInstance()->getAllFakePlayers();
|
||||
std::vector<std::string> result;
|
||||
for (auto& name : names) {
|
||||
result.push_back(name);
|
||||
}
|
||||
return result;
|
||||
});
|
||||
RemoteCall::exportAs("GMLIB_API", "getAllScoreboardEntities", []() -> std::vector<std::string> {
|
||||
auto uniqueIds = GMLIB_Scoreboard::getInstance()->getAllEntities();
|
||||
std::vector<std::string> result;
|
||||
for (auto& uniqueId : uniqueIds) {
|
||||
result.push_back(std::to_string(uniqueId.id));
|
||||
}
|
||||
return result;
|
||||
});
|
||||
RemoteCall::exportAs(
|
||||
"GMLIB_API",
|
||||
"getAllTrackedTargets",
|
||||
[]() -> std::vector<std::unordered_map<std::string, std::string>> {
|
||||
std::vector<std::unordered_map<std::string, std::string>> result;
|
||||
auto uuids = GMLIB_Scoreboard::getInstance()->getAllPlayerUuids();
|
||||
for (auto uuid : uuids) {
|
||||
for (auto& uuid : uuids) {
|
||||
std::unordered_map<std::string, std::string> data;
|
||||
data["Type"] = "Player";
|
||||
data["Uuid"] = uuid.asString();
|
||||
result.push_back(data);
|
||||
}
|
||||
auto names = GMLIB_Scoreboard::getInstance()->getAllFakePlayers();
|
||||
for (auto name : names) {
|
||||
for (auto& name : names) {
|
||||
std::unordered_map<std::string, std::string> data;
|
||||
data["Type"] = "FakePlayer";
|
||||
data["Name"] = name;
|
||||
result.push_back(data);
|
||||
}
|
||||
auto uniqueIds = GMLIB_Scoreboard::getInstance()->getAllEntities();
|
||||
for (auto uniqueId : uniqueIds) {
|
||||
for (auto& uniqueId : uniqueIds) {
|
||||
std::unordered_map<std::string, std::string> data;
|
||||
data["Type"] = "Entity";
|
||||
data["UniqueId"] = std::to_string(uniqueId.id);
|
||||
@@ -500,4 +524,19 @@ void Export_Compatibility_API() {
|
||||
auto result = GMLIB::UserCache::getUuidByName(name);
|
||||
return result ? result.value().asString() : "";
|
||||
});
|
||||
RemoteCall::exportAs(
|
||||
"GMLIB_API",
|
||||
"getAllPlayerInfo",
|
||||
[]() -> std::vector<std::unordered_map<std::string, std::string>> {
|
||||
std::vector<std::unordered_map<std::string, std::string>> result;
|
||||
GMLIB::UserCache::forEach([&result](const GMLIB::UserCache::UserCacheEntry& entry) {
|
||||
std::unordered_map<std::string, std::string> info;
|
||||
info["Name"] = entry.mName;
|
||||
info["Xuid"] = entry.mXuid;
|
||||
info["Uuid"] = entry.mUuid.asString();
|
||||
result.push_back(info);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
);
|
||||
}
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
|
||||
#define PLUGIN_NAME fmt::format(fg(fmt::color::light_green), "GMLIB-LRCA")
|
||||
|
||||
#define LIB_VERSION GMLIB::Version(0, 12, 5)
|
||||
#define LIB_VERSION GMLIB::Version(0, 12, 6)
|
||||
|
||||
extern ll::Logger logger;
|
||||
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"format_version": 2,
|
||||
"tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi",
|
||||
"version": "0.12.5",
|
||||
"version": "0.12.6",
|
||||
"info": {
|
||||
"name": "GMLIB-LegacyRemoteCallApi",
|
||||
"description": "Legacy RemoteCall API for GMLIB",
|
||||
@@ -14,7 +14,7 @@
|
||||
"library"
|
||||
]
|
||||
},
|
||||
"asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.12.5/GMLIB-LegacyRemoteCallApi-windows-x64.zip",
|
||||
"asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.12.6/GMLIB-LegacyRemoteCallApi-windows-x64.zip",
|
||||
"dependencies": {
|
||||
"github.com/GroupMountain/GMLIB": ">=0.12.4"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user