feat: add more api
This commit is contained in:
@@ -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
@@ -4,4 +4,8 @@
|
|||||||
|
|
||||||
#define PLUGIN_NAME "GMLIB-LRCA"
|
#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();
|
||||||
@@ -13,7 +13,7 @@ std::variant<std::string, std::vector<RecipeIngredient>> makeRecipeUnlockingKey(
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExportGMLib_ModAPI() {
|
void Export_Legacy_GMLib_ModAPI() {
|
||||||
// 合成表部分
|
// 合成表部分
|
||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
"GMLib_ModAPI",
|
"GMLib_ModAPI",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "Global.h"
|
#include "Global.h"
|
||||||
|
|
||||||
void ExportGMLib_ServerAPI() {
|
void Export_Legacy_GMLib_ServerAPI() {
|
||||||
RemoteCall::exportAs("GMLib_ServerAPI", "setEducationFeatureEnabled", []() -> void {
|
RemoteCall::exportAs("GMLib_ServerAPI", "setEducationFeatureEnabled", []() -> void {
|
||||||
GMLIB_Level::addEducationEditionRequired();
|
GMLIB_Level::addEducationEditionRequired();
|
||||||
});
|
});
|
||||||
|
|||||||
+3
-1
@@ -7,7 +7,9 @@ namespace plugin {
|
|||||||
|
|
||||||
Plugin::Plugin(ll::plugin::NativePlugin& self) : mSelf(self) {
|
Plugin::Plugin(ll::plugin::NativePlugin& self) : mSelf(self) {
|
||||||
// Code for loading the plugin goes here.
|
// 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("GMLIB-LegacyRemoteCallApi Loaded!");
|
||||||
logger.info("Author: GroupMountain");
|
logger.info("Author: GroupMountain");
|
||||||
logger.info("Repository: https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi");
|
logger.info("Repository: https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi");
|
||||||
|
|||||||
Reference in New Issue
Block a user