feat: add more api

This commit is contained in:
Tsubasa6848
2024-02-08 21:43:05 +08:00
Unverified
parent 97c0adbf6e
commit a4d568620d
5 changed files with 26 additions and 4 deletions
+16
View File
@@ -0,0 +1,16 @@
#include "Global.h"
void Export_Compatibility_API() {
RemoteCall::exportAs("GMLIB_API", "getServerMspt", []() -> float {
return GMLIB_Level::getLevel()->getServerMspt();
});
RemoteCall::exportAs("GMLIB_API", "getServerCurrentTps", []() -> float {
return GMLIB_Level::getLevel()->getServerCurrentTps();
});
RemoteCall::exportAs("GMLIB_API", "getServerAverageTps", []() -> float {
return GMLIB_Level::getLevel()->getServerAverageTps();
});
RemoteCall::exportAs("GMLIB_API", "getAllPlayerUuids", []() -> std::vector<std::string> {
return GMLIB_Player::getAllUuids();
});
}
+5 -1
View File
@@ -4,4 +4,8 @@
#define PLUGIN_NAME "GMLIB-LRCA"
extern ll::Logger logger;
extern ll::Logger logger;
extern void Export_Legacy_GMLib_ModAPI();
extern void Export_Legacy_GMLib_ServerAPI();
extern void Export_Compatibility_API();
+1 -1
View File
@@ -13,7 +13,7 @@ std::variant<std::string, std::vector<RecipeIngredient>> makeRecipeUnlockingKey(
return result;
}
void ExportGMLib_ModAPI() {
void Export_Legacy_GMLib_ModAPI() {
// 合成表部分
RemoteCall::exportAs(
"GMLib_ModAPI",
+1 -1
View File
@@ -1,6 +1,6 @@
#include "Global.h"
void ExportGMLib_ServerAPI() {
void Export_Legacy_GMLib_ServerAPI() {
RemoteCall::exportAs("GMLib_ServerAPI", "setEducationFeatureEnabled", []() -> void {
GMLIB_Level::addEducationEditionRequired();
});
+3 -1
View File
@@ -7,7 +7,9 @@ namespace plugin {
Plugin::Plugin(ll::plugin::NativePlugin& self) : mSelf(self) {
// Code for loading the plugin goes here.
Export_Legacy_GMLib_ModAPI();
Export_Legacy_GMLib_ServerAPI();
Export_Compatibility_API();
logger.info("GMLIB-LegacyRemoteCallApi Loaded!");
logger.info("Author: GroupMountain");
logger.info("Repository: https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi");