Compare commits
17 Commits
+87
-40
@@ -115,10 +115,23 @@ const GMLIB_API = {
|
|||||||
getItemTranslateKey: ll.import("GMLIB_API", "getItemTranslateKey"),
|
getItemTranslateKey: ll.import("GMLIB_API", "getItemTranslateKey"),
|
||||||
getEntityTranslateKey: ll.import("GMLIB_API", "getEntityTranslateKey"),
|
getEntityTranslateKey: ll.import("GMLIB_API", "getEntityTranslateKey"),
|
||||||
readNbtFromFile: ll.import("GMLIB_API", "readNbtFromFile"),
|
readNbtFromFile: ll.import("GMLIB_API", "readNbtFromFile"),
|
||||||
saveNbtToFile: ll.import("GMLIB_API", "saveNbtToFile")
|
saveNbtToFile: ll.import("GMLIB_API", "saveNbtToFile"),
|
||||||
|
getBlockDestroySpeed: ll.import("GMLIB_API", "getBlockDestroySpeed"),
|
||||||
|
getDestroyBlockSpeed: ll.import("GMLIB_API", "getDestroyBlockSpeed"),
|
||||||
|
playerDestroyBlock: ll.import("GMLIB_API", "playerDestroyBlock"),
|
||||||
|
itemCanDestroyBlock: ll.import("GMLIB_API", "itemCanDestroyBlock"),
|
||||||
|
itemCanDestroyInCreative: ll.import("GMLIB_API", "itemCanDestroyInCreative"),
|
||||||
|
itemCanDestroySpecial: ll.import("GMLIB_API", "itemCanDestroySpecial"),
|
||||||
|
blockCanDropWithAnyTool: ll.import("GMLIB_API", "blockCanDropWithAnyTool"),
|
||||||
|
blockIsAlwaysDestroyable: ll.import("GMLIB_API", "blockIsAlwaysDestroyable"),
|
||||||
|
blockPlayerWillDestroy: ll.import("GMLIB_API", "blockPlayerWillDestroy"),
|
||||||
|
playerAttack: ll.import("GMLIB_API", "playerAttack"),
|
||||||
|
playerPullInEntity: ll.import("GMLIB_API", "playerPullInEntity"),
|
||||||
|
getBlockTranslateKeyFromName: ll.import("GMLIB_API", "getBlockTranslateKeyFromName")
|
||||||
}
|
}
|
||||||
|
|
||||||
const FloatingTextList = [];
|
const mStaticFloatingTextMap = new Map();
|
||||||
|
const mDynamicFloatingTextMap = new Map();
|
||||||
|
|
||||||
class StaticFloatingText {
|
class StaticFloatingText {
|
||||||
constructor(pos, text, papi = true) {
|
constructor(pos, text, papi = true) {
|
||||||
@@ -126,7 +139,7 @@ class StaticFloatingText {
|
|||||||
this.mText = text;
|
this.mText = text;
|
||||||
this.mPlaceholderAPI = papi;
|
this.mPlaceholderAPI = papi;
|
||||||
this.mRuntimeId = GMLIB_API.createFloatingText(this.mPosition, this.mText, this.mPlaceholderAPI);
|
this.mRuntimeId = GMLIB_API.createFloatingText(this.mPosition, this.mText, this.mPlaceholderAPI);
|
||||||
FloatingTextList.push(this);
|
mStaticFloatingTextMap.set(this.mRuntimeId, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
sendToClient(player) {
|
sendToClient(player) {
|
||||||
@@ -180,32 +193,21 @@ class StaticFloatingText {
|
|||||||
}
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
let size_t = FloatingTextList.indexOf(this);
|
mStaticFloatingTextMap.delete(this.mRuntimeId);
|
||||||
FloatingTextList.splice(size_t, 1);
|
|
||||||
return GMLIB_API.deleteFloatingText(this.mRuntimeId);
|
return GMLIB_API.deleteFloatingText(this.mRuntimeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
isDynamic() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
static getFloatingText(runtimeId) {
|
static getFloatingText(runtimeId) {
|
||||||
for (const ft of FloatingTextList) {
|
if (mStaticFloatingTextMap.has(runtimeId)) {
|
||||||
if (ft.getRuntimeId() == runtimeId) {
|
return mStaticFloatingTextMap.get(runtimeId);
|
||||||
if (!ft.isDynamic()) {
|
|
||||||
return ft;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static getAllFloatingTexts() {
|
static getAllFloatingTexts() {
|
||||||
let result = [];
|
let result = [];
|
||||||
FloatingTextList.forEach((ft) => {
|
mStaticFloatingTextMap.forEach((ft) => {
|
||||||
if (!ft.isDynamic()) {
|
|
||||||
result.push(ft);
|
result.push(ft);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -213,9 +215,13 @@ class StaticFloatingText {
|
|||||||
|
|
||||||
class DynamicFloatingText extends StaticFloatingText {
|
class DynamicFloatingText extends StaticFloatingText {
|
||||||
constructor(pos, text, updateRate = 1, papi = true) {
|
constructor(pos, text, updateRate = 1, papi = true) {
|
||||||
super(pos, text, papi);
|
this.mPosition = pos;
|
||||||
|
this.mText = text;
|
||||||
|
this.mPlaceholderAPI = papi;
|
||||||
|
this.mRuntimeId = GMLIB_API.createFloatingText(this.mPosition, this.mText, this.mPlaceholderAPI);
|
||||||
this.mUpdateRate = updateRate;
|
this.mUpdateRate = updateRate;
|
||||||
this.mTaskId = null;
|
this.mTaskId = null;
|
||||||
|
mDynamicFloatingTextMap.set(this.mRuntimeId, this);
|
||||||
this.startUpdate();
|
this.startUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -240,7 +246,7 @@ class DynamicFloatingText extends StaticFloatingText {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stopUpdate() {
|
stopUpdate() {
|
||||||
if (this.mTaskId != null) {
|
if (this.mTaskId) {
|
||||||
clearInterval(this.mTaskId);
|
clearInterval(this.mTaskId);
|
||||||
this.mTaskId = null;
|
this.mTaskId = null;
|
||||||
return true;
|
return true;
|
||||||
@@ -249,32 +255,21 @@ class DynamicFloatingText extends StaticFloatingText {
|
|||||||
}
|
}
|
||||||
|
|
||||||
destroy() {
|
destroy() {
|
||||||
let size_t = FloatingTextList.indexOf(this);
|
mDynamicFloatingTextMap.delete(this.mRuntimeId);
|
||||||
FloatingTextList.splice(size_t, 1);
|
|
||||||
return GMLIB_API.deleteFloatingText(this.mRuntimeId);
|
return GMLIB_API.deleteFloatingText(this.mRuntimeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
isDynamic() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
static getFloatingText(runtimeId) {
|
static getFloatingText(runtimeId) {
|
||||||
for (const ft of FloatingTextList) {
|
if (mDynamicFloatingTextMap.has(runtimeId)) {
|
||||||
if (ft.getRuntimeId() == runtimeId) {
|
return mDynamicFloatingTextMap.get(runtimeId);
|
||||||
if (ft.isDynamic()) {
|
|
||||||
return ft;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
static getAllFloatingTexts() {
|
static getAllFloatingTexts() {
|
||||||
let result = [];
|
let result = [];
|
||||||
FloatingTextList.forEach((ft) => {
|
mDynamicFloatingTextMap.forEach((ft) => {
|
||||||
if (ft.isDynamic()) {
|
|
||||||
result.push(ft);
|
result.push(ft);
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -418,7 +413,7 @@ class Minecraft {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static addFakeList(name, xuid) {
|
static addFakeList(name, xuid) {
|
||||||
return GMLIB_API.addFakeList(xuid, name);
|
return GMLIB_API.addFakeList(name, xuid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static removeFakeList(nameOrXuid) {
|
static removeFakeList(nameOrXuid) {
|
||||||
@@ -440,6 +435,10 @@ class Minecraft {
|
|||||||
static readNbtFromFile(path, isBinary = true) {
|
static readNbtFromFile(path, isBinary = true) {
|
||||||
return GMLIB_API.readNbtFromFile(path, isBinary);
|
return GMLIB_API.readNbtFromFile(path, isBinary);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static getBlockTranslateKeyFromName(name) {
|
||||||
|
return GMLIB_API.getBlockTranslateKeyFromName(name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class Recipes {
|
class Recipes {
|
||||||
@@ -836,14 +835,18 @@ class I18nAPI {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static get(key, params = [], langCode = undefined) {
|
static get(key, params = [], langCode = undefined) {
|
||||||
|
let data = [];
|
||||||
|
params.forEach((param) => {
|
||||||
|
data.push(param);
|
||||||
|
});
|
||||||
if (langCode) {
|
if (langCode) {
|
||||||
return GMLIB_API.resourcePackTranslate(key, params, langCode);
|
return GMLIB_API.resourcePackTranslate(key, data, langCode);
|
||||||
}
|
}
|
||||||
return GMLIB_API.resourcePackDefaultTranslate(key, params);
|
return GMLIB_API.resourcePackDefaultTranslate(key, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static translate(key, params = []) {
|
static translate(key, params = [], langCode = undefined) {
|
||||||
return I18nAPI.get(key, params);
|
return I18nAPI.get(key, params, langCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
static getSupportedLanguages() {
|
static getSupportedLanguages() {
|
||||||
@@ -963,6 +966,50 @@ LLSE_Item.prototype.getTranslateName = function (language) {
|
|||||||
return I18nAPI.get(this.getTranslateKey(), [], language);
|
return I18nAPI.get(this.getTranslateKey(), [], language);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LLSE_Block.prototype.getBlockDestroySpeed = function () {
|
||||||
|
return GMLIB_API.getBlockDestroySpeed(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
LLSE_Item.prototype.getDestroyBlockSpeed = function (block) {
|
||||||
|
return GMLIB_API.getDestroyBlockSpeed(this, block);
|
||||||
|
}
|
||||||
|
|
||||||
|
LLSE_Block.prototype.playerDestroy = function (player) {
|
||||||
|
GMLIB_API.playerDestroyBlock(this, this.pos, player);
|
||||||
|
}
|
||||||
|
|
||||||
|
LLSE_Item.prototype.canDestroy = function (block) {
|
||||||
|
return GMLIB_API.itemCanDestroyBlock(this, block);
|
||||||
|
}
|
||||||
|
|
||||||
|
LLSE_Item.prototype.canDestroyInCreative = function () {
|
||||||
|
return GMLIB_API.itemCanDestroyInCreative(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
LLSE_Item.prototype.canDestroySpecial = function (block) {
|
||||||
|
return GMLIB_API.itemCanDestroySpecial(this, block);
|
||||||
|
}
|
||||||
|
|
||||||
|
LLSE_Block.prototype.canDropWithAnyTool = function () {
|
||||||
|
return GMLIB_API.blockCanDropWithAnyTool(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
LLSE_Block.prototype.isAlwaysDestroyable = function () {
|
||||||
|
return GMLIB_API.blockIsAlwaysDestroyable(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
LLSE_Block.prototype.playerWillDestroy = function (player) {
|
||||||
|
return GMLIB_API.blockPlayerWillDestroy(this, player, this.pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
LLSE_Player.prototype.attack = function (entity) {
|
||||||
|
return GMLIB_API.playerAttack(this, entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
LLSE_Player.prototype.pullInEntity = function (entity) {
|
||||||
|
return GMLIB_API.playerPullInEntity(this, entity);
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
StaticFloatingText,
|
StaticFloatingText,
|
||||||
DynamicFloatingText,
|
DynamicFloatingText,
|
||||||
|
|||||||
+1
-1
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "${pluginName}",
|
"name": "${pluginName}",
|
||||||
"entry": "${pluginFile}",
|
"entry": "${pluginFile}",
|
||||||
"version": "0.12.7",
|
"version": "0.12.8",
|
||||||
"author": "GroupMountain",
|
"author": "GroupMountain",
|
||||||
"type": "native",
|
"type": "native",
|
||||||
"dependencies": [
|
"dependencies": [
|
||||||
|
|||||||
+70
-22
@@ -19,10 +19,10 @@ void Export_Compatibility_API() {
|
|||||||
if (!level) {
|
if (!level) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return GMLIB::Mod::CustomRecipe::unregisterRecipe(id);
|
return CustomRecipe::unregisterRecipe(id);
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "setCustomPackPath", [](std::string const& path) -> void {
|
RemoteCall::exportAs("GMLIB_API", "setCustomPackPath", [](std::string const& path) -> void {
|
||||||
GMLIB::Mod::CustomPacks::addCustomPackPath(path);
|
CustomPacks::addCustomPackPath(path);
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getServerMspt", []() -> float {
|
RemoteCall::exportAs("GMLIB_API", "getServerMspt", []() -> float {
|
||||||
auto level = GMLIB_Level::getInstance();
|
auto level = GMLIB_Level::getInstance();
|
||||||
@@ -96,70 +96,71 @@ void Export_Compatibility_API() {
|
|||||||
"GMLIB_API",
|
"GMLIB_API",
|
||||||
"createFloatingText",
|
"createFloatingText",
|
||||||
[](std::pair<Vec3, int> pos, std::string const& text, bool papi) -> int {
|
[](std::pair<Vec3, int> pos, std::string const& text, bool papi) -> int {
|
||||||
auto ft = std::make_shared<GMLIB::Server::StaticFloatingText>(text, pos.first, pos.second, papi);
|
auto& manager = FloatingTextManager::getInstance();
|
||||||
GMLIB::Server::FloatingTextManager::getInstance().add(ft);
|
auto ft = manager.createStatic(text, pos.first, pos.second, papi);
|
||||||
|
manager.add(ft);
|
||||||
return ft->getRuntimeID();
|
return ft->getRuntimeID();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
RemoteCall::exportAs("GMLIB_API", "setFloatingTextData", [](int id, std::string const& text) -> bool {
|
RemoteCall::exportAs("GMLIB_API", "setFloatingTextData", [](int id, std::string const& text) -> bool {
|
||||||
if (auto ft = GMLIB::Server::FloatingTextManager::getInstance().getFloatingText(id)) {
|
if (auto ft = FloatingTextManager::getInstance().getFloatingText(id)) {
|
||||||
ft->setText(text);
|
ft->setText(text);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "deleteFloatingText", [](int id) -> bool {
|
RemoteCall::exportAs("GMLIB_API", "deleteFloatingText", [](int id) -> bool {
|
||||||
return GMLIB::Server::FloatingTextManager::getInstance().remove(id);
|
return FloatingTextManager::getInstance().remove(id);
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "sendFloatingTextToPlayer", [](int id, Player* pl) -> bool {
|
RemoteCall::exportAs("GMLIB_API", "sendFloatingTextToPlayer", [](int id, Player* pl) -> bool {
|
||||||
if (auto ft = GMLIB::Server::FloatingTextManager::getInstance().getFloatingText(id)) {
|
if (auto ft = FloatingTextManager::getInstance().getFloatingText(id)) {
|
||||||
ft->sendTo(*pl);
|
ft->sendTo(*pl);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "sendFloatingText", [](int id) -> bool {
|
RemoteCall::exportAs("GMLIB_API", "sendFloatingText", [](int id) -> bool {
|
||||||
if (auto ft = GMLIB::Server::FloatingTextManager::getInstance().getFloatingText(id)) {
|
if (auto ft = FloatingTextManager::getInstance().getFloatingText(id)) {
|
||||||
ft->sendToClients();
|
ft->sendToClients();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "removeFloatingTextFromPlayer", [](int id, Player* pl) -> bool {
|
RemoteCall::exportAs("GMLIB_API", "removeFloatingTextFromPlayer", [](int id, Player* pl) -> bool {
|
||||||
if (auto ft = GMLIB::Server::FloatingTextManager::getInstance().getFloatingText(id)) {
|
if (auto ft = FloatingTextManager::getInstance().getFloatingText(id)) {
|
||||||
ft->removeFrom(*pl);
|
ft->removeFrom(*pl);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "removeFloatingText", [](int id) -> bool {
|
RemoteCall::exportAs("GMLIB_API", "removeFloatingText", [](int id) -> bool {
|
||||||
if (auto ft = GMLIB::Server::FloatingTextManager::getInstance().getFloatingText(id)) {
|
if (auto ft = FloatingTextManager::getInstance().getFloatingText(id)) {
|
||||||
ft->removeFromClients();
|
ft->removeFromClients();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "updateClientFloatingTextData", [](int id, Player* pl) -> bool {
|
RemoteCall::exportAs("GMLIB_API", "updateClientFloatingTextData", [](int id, Player* pl) -> bool {
|
||||||
if (auto ft = GMLIB::Server::FloatingTextManager::getInstance().getFloatingText(id)) {
|
if (auto ft = FloatingTextManager::getInstance().getFloatingText(id)) {
|
||||||
ft->update(*pl);
|
ft->update(*pl);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "updateAllClientsFloatingTextData", [](int id) -> bool {
|
RemoteCall::exportAs("GMLIB_API", "updateAllClientsFloatingTextData", [](int id) -> bool {
|
||||||
if (auto ft = GMLIB::Server::FloatingTextManager::getInstance().getFloatingText(id)) {
|
if (auto ft = FloatingTextManager::getInstance().getFloatingText(id)) {
|
||||||
ft->updateClients();
|
ft->updateClients();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "isVersionMatched", [](int a, int b, int c) -> bool {
|
RemoteCall::exportAs("GMLIB_API", "isVersionMatched", [](int a, int b, int c) -> bool {
|
||||||
auto version = GMLIB::Version(a, b, c, "", "");
|
auto version = Version(a, b, c, "", "");
|
||||||
return LIB_VERSION >= version;
|
return LIB_VERSION >= version;
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getVersion_LRCA", []() -> std::string { return LIB_VERSION.asString(); });
|
RemoteCall::exportAs("GMLIB_API", "getVersion_LRCA", []() -> std::string { return LIB_VERSION.asString(); });
|
||||||
RemoteCall::exportAs("GMLIB_API", "getVersion_GMLIB", []() -> std::string {
|
RemoteCall::exportAs("GMLIB_API", "getVersion_GMLIB", []() -> std::string {
|
||||||
return GMLIB::Version::getLibVersionString();
|
return Version::getLibVersionString();
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
"GMLIB_API",
|
"GMLIB_API",
|
||||||
@@ -555,32 +556,32 @@ void Export_Compatibility_API() {
|
|||||||
);
|
);
|
||||||
RemoteCall::exportAs("GMLIB_API", "getXuidByUuid", [](std::string const& uuid) -> std::string {
|
RemoteCall::exportAs("GMLIB_API", "getXuidByUuid", [](std::string const& uuid) -> std::string {
|
||||||
auto uid = mce::UUID::fromString(uuid);
|
auto uid = mce::UUID::fromString(uuid);
|
||||||
auto result = GMLIB::UserCache::getXuidByUuid(uid);
|
auto result = UserCache::getXuidByUuid(uid);
|
||||||
return result ? result.value() : "";
|
return result ? result.value() : "";
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getNameByUuid", [](std::string const& uuid) -> std::string {
|
RemoteCall::exportAs("GMLIB_API", "getNameByUuid", [](std::string const& uuid) -> std::string {
|
||||||
auto uid = mce::UUID::fromString(uuid);
|
auto uid = mce::UUID::fromString(uuid);
|
||||||
auto result = GMLIB::UserCache::getNameByUuid(uid);
|
auto result = UserCache::getNameByUuid(uid);
|
||||||
return result ? result.value() : "";
|
return result ? result.value() : "";
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getUuidByXuid", [](std::string const& xuid) -> std::string {
|
RemoteCall::exportAs("GMLIB_API", "getUuidByXuid", [](std::string const& xuid) -> std::string {
|
||||||
auto result = GMLIB::UserCache::getUuidByXuid(xuid);
|
auto result = UserCache::getUuidByXuid(xuid);
|
||||||
return result ? result.value().asString() : "";
|
return result ? result.value().asString() : "";
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getNameByXuid", [](std::string const& xuid) -> std::string {
|
RemoteCall::exportAs("GMLIB_API", "getNameByXuid", [](std::string const& xuid) -> std::string {
|
||||||
auto result = GMLIB::UserCache::getNameByXuid(xuid);
|
auto result = UserCache::getNameByXuid(xuid);
|
||||||
return result ? result.value() : "";
|
return result ? result.value() : "";
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getXuidByName", [](std::string const& name) -> std::string {
|
RemoteCall::exportAs("GMLIB_API", "getXuidByName", [](std::string const& name) -> std::string {
|
||||||
auto result = GMLIB::UserCache::getXuidByName(name);
|
auto result = UserCache::getXuidByName(name);
|
||||||
return result ? result.value() : "";
|
return result ? result.value() : "";
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getUuidByName", [](std::string const& name) -> std::string {
|
RemoteCall::exportAs("GMLIB_API", "getUuidByName", [](std::string const& name) -> std::string {
|
||||||
auto result = GMLIB::UserCache::getUuidByName(name);
|
auto result = UserCache::getUuidByName(name);
|
||||||
return result ? result.value().asString() : "";
|
return result ? result.value().asString() : "";
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLIB_API", "getUuidByName", [](std::string const& name) -> std::string {
|
RemoteCall::exportAs("GMLIB_API", "getUuidByName", [](std::string const& name) -> std::string {
|
||||||
auto result = GMLIB::UserCache::getUuidByName(name);
|
auto result = UserCache::getUuidByName(name);
|
||||||
return result ? result.value().asString() : "";
|
return result ? result.value().asString() : "";
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
@@ -588,7 +589,7 @@ void Export_Compatibility_API() {
|
|||||||
"getAllPlayerInfo",
|
"getAllPlayerInfo",
|
||||||
[]() -> std::vector<std::unordered_map<std::string, std::string>> {
|
[]() -> std::vector<std::unordered_map<std::string, std::string>> {
|
||||||
std::vector<std::unordered_map<std::string, std::string>> result;
|
std::vector<std::unordered_map<std::string, std::string>> result;
|
||||||
GMLIB::UserCache::forEach([&result](const GMLIB::UserCache::UserCacheEntry& entry) {
|
UserCache::forEach([&result](const UserCache::UserCacheEntry& entry) {
|
||||||
std::unordered_map<std::string, std::string> info;
|
std::unordered_map<std::string, std::string> info;
|
||||||
info["Name"] = entry.mName;
|
info["Name"] = entry.mName;
|
||||||
info["Xuid"] = entry.mXuid;
|
info["Xuid"] = entry.mXuid;
|
||||||
@@ -630,4 +631,51 @@ void Export_Compatibility_API() {
|
|||||||
return GMLIB_CompoundTag::saveToFile(path, *nbt, isBinary);
|
return GMLIB_CompoundTag::saveToFile(path, *nbt, isBinary);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "getBlockDestroySpeed", [](Block const* block) -> float {
|
||||||
|
return block->getDestroySpeed();
|
||||||
|
});
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "getDestroyBlockSpeed", [](ItemStack const* item, Block const* block) -> float {
|
||||||
|
return item->getDestroySpeed(*block);
|
||||||
|
});
|
||||||
|
RemoteCall::exportAs(
|
||||||
|
"GMLIB_API",
|
||||||
|
"playerDestroyBlock",
|
||||||
|
[](Block const* block, std::pair<BlockPos, int> pos, Player* player) -> void {
|
||||||
|
return block->playerDestroy(*player, pos.first);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "itemCanDestroyBlock", [](ItemStack const* item, Block const* block) -> bool {
|
||||||
|
return item->canDestroy(block);
|
||||||
|
});
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "itemCanDestroyInCreative", [](ItemStack const* item) -> bool {
|
||||||
|
return item->getItem()->canDestroyInCreative();
|
||||||
|
});
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "itemCanDestroySpecial", [](ItemStack const* item, Block const* block) -> bool {
|
||||||
|
return item->canDestroySpecial(*block);
|
||||||
|
});
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "blockCanDropWithAnyTool", [](Block const* block) -> bool {
|
||||||
|
return block->canDropWithAnyTool();
|
||||||
|
});
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "blockIsAlwaysDestroyable", [](Block const* block) -> bool {
|
||||||
|
return block->getMaterial().isAlwaysDestroyable();
|
||||||
|
});
|
||||||
|
RemoteCall::exportAs(
|
||||||
|
"GMLIB_API",
|
||||||
|
"blockPlayerWillDestroy",
|
||||||
|
[](Block const* block, Player* player, std::pair<BlockPos, int> pos) -> bool {
|
||||||
|
return block->playerWillDestroy(*player, pos.first);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "playerAttack", [](Player* player, Actor* entity) -> bool {
|
||||||
|
return player->attack(*entity, ActorDamageCause::EntityAttack);
|
||||||
|
});
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "playerPullInEntity", [](Player* player, Actor* entity) -> bool {
|
||||||
|
return player->pullInEntity(*entity);
|
||||||
|
});
|
||||||
|
RemoteCall::exportAs("GMLIB_API", "getBlockTranslateKeyFromName", [](std::string const& blockName) -> std::string {
|
||||||
|
if (auto block = Block::tryGetFromRegistry(blockName)) {
|
||||||
|
return block->buildDescriptionId();
|
||||||
|
}
|
||||||
|
return "tile.unknown.name";
|
||||||
|
});
|
||||||
}
|
}
|
||||||
+2
-2
@@ -19,7 +19,7 @@ bool LegacyRemoteCallApi::load() {
|
|||||||
logger.info("GMLIB-LegacyRemoteCallApi Loaded!");
|
logger.info("GMLIB-LegacyRemoteCallApi Loaded!");
|
||||||
logger.info(
|
logger.info(
|
||||||
"Loaded Version: {} with {}",
|
"Loaded Version: {} with {}",
|
||||||
fmt::format(fg(fmt::color::pink), "GMLIB-" + GMLIB::Version::getLibVersionString()),
|
fmt::format(fg(fmt::color::pink), "GMLIB-" + Version::getLibVersionString()),
|
||||||
fmt::format(fg(fmt::color::light_green), "GMLIB-LegacyRemoteCallApi-" + LIB_VERSION.asString())
|
fmt::format(fg(fmt::color::light_green), "GMLIB-LegacyRemoteCallApi-" + LIB_VERSION.asString())
|
||||||
);
|
);
|
||||||
logger.info("Author: GroupMountain");
|
logger.info("Author: GroupMountain");
|
||||||
@@ -33,4 +33,4 @@ bool LegacyRemoteCallApi::disable() { return true; }
|
|||||||
|
|
||||||
} // namespace GMLIB
|
} // namespace GMLIB
|
||||||
|
|
||||||
LL_REGISTER_PLUGIN(GMLIB::LegacyRemoteCallApi, GMLIB::LegacyRemoteCallApi::getInstance());
|
LL_REGISTER_PLUGIN(LegacyRemoteCallApi, LegacyRemoteCallApi::getInstance());
|
||||||
|
|||||||
+20
-20
@@ -16,8 +16,8 @@ void Export_Event_API() {
|
|||||||
std::string const& serverXuid,
|
std::string const& serverXuid,
|
||||||
std::string const& clientXuid
|
std::string const& clientXuid
|
||||||
)>(eventName, eventId);
|
)>(eventName, eventId);
|
||||||
eventBus->emplaceListener<GMLIB::Event::PacketEvent::ClientLoginAfterEvent>(
|
eventBus->emplaceListener<Event::PacketEvent::ClientLoginAfterEvent>(
|
||||||
[Call](GMLIB::Event::PacketEvent::ClientLoginAfterEvent& ev) {
|
[Call](Event::PacketEvent::ClientLoginAfterEvent& ev) {
|
||||||
try {
|
try {
|
||||||
Call(
|
Call(
|
||||||
ev.getRealName(),
|
ev.getRealName(),
|
||||||
@@ -36,8 +36,8 @@ void Export_Event_API() {
|
|||||||
eventName,
|
eventName,
|
||||||
eventId
|
eventId
|
||||||
);
|
);
|
||||||
eventBus->emplaceListener<GMLIB::Event::LevelEvent::WeatherUpdateBeforeEvent>(
|
eventBus->emplaceListener<Event::LevelEvent::WeatherUpdateBeforeEvent>(
|
||||||
[Call](GMLIB::Event::LevelEvent::WeatherUpdateBeforeEvent& ev) {
|
[Call](Event::LevelEvent::WeatherUpdateBeforeEvent& ev) {
|
||||||
bool result = true;
|
bool result = true;
|
||||||
try {
|
try {
|
||||||
result = Call(
|
result = Call(
|
||||||
@@ -56,8 +56,8 @@ void Export_Event_API() {
|
|||||||
}
|
}
|
||||||
case doHash("onMobPick"): {
|
case doHash("onMobPick"): {
|
||||||
auto Call = RemoteCall::importAs<bool(Actor * mob, Actor * item)>(eventName, eventId);
|
auto Call = RemoteCall::importAs<bool(Actor * mob, Actor * item)>(eventName, eventId);
|
||||||
eventBus->emplaceListener<GMLIB::Event::EntityEvent::MobPickupItemBeforeEvent>(
|
eventBus->emplaceListener<Event::EntityEvent::MobPickupItemBeforeEvent>(
|
||||||
[Call](GMLIB::Event::EntityEvent::MobPickupItemBeforeEvent& ev) {
|
[Call](Event::EntityEvent::MobPickupItemBeforeEvent& ev) {
|
||||||
bool result = true;
|
bool result = true;
|
||||||
try {
|
try {
|
||||||
result = Call(&ev.self(), (Actor*)&ev.getItemActor());
|
result = Call(&ev.self(), (Actor*)&ev.getItemActor());
|
||||||
@@ -72,8 +72,8 @@ void Export_Event_API() {
|
|||||||
case doHash("onItemTrySpawn"): {
|
case doHash("onItemTrySpawn"): {
|
||||||
auto Call = RemoteCall::importAs<
|
auto Call = RemoteCall::importAs<
|
||||||
bool(const ItemStack* item, std::pair<Vec3, int> position, Actor* spawner)>(eventName, eventId);
|
bool(const ItemStack* item, std::pair<Vec3, int> position, Actor* spawner)>(eventName, eventId);
|
||||||
eventBus->emplaceListener<GMLIB::Event::EntityEvent::ItemActorSpawnBeforeEvent>(
|
eventBus->emplaceListener<Event::EntityEvent::ItemActorSpawnBeforeEvent>(
|
||||||
[Call](GMLIB::Event::EntityEvent::ItemActorSpawnBeforeEvent& ev) {
|
[Call](Event::EntityEvent::ItemActorSpawnBeforeEvent& ev) {
|
||||||
auto pos = ev.getPosition();
|
auto pos = ev.getPosition();
|
||||||
auto dimid = ev.getBlockSource().getDimensionId().id;
|
auto dimid = ev.getBlockSource().getDimensionId().id;
|
||||||
std::pair<Vec3, int> lsePos = {pos, dimid};
|
std::pair<Vec3, int> lsePos = {pos, dimid};
|
||||||
@@ -94,8 +94,8 @@ void Export_Event_API() {
|
|||||||
eventName,
|
eventName,
|
||||||
eventId
|
eventId
|
||||||
);
|
);
|
||||||
eventBus->emplaceListener<GMLIB::Event::EntityEvent::ItemActorSpawnAfterEvent>(
|
eventBus->emplaceListener<Event::EntityEvent::ItemActorSpawnAfterEvent>(
|
||||||
[Call](GMLIB::Event::EntityEvent::ItemActorSpawnAfterEvent& ev) {
|
[Call](Event::EntityEvent::ItemActorSpawnAfterEvent& ev) {
|
||||||
auto pos = ev.getPosition();
|
auto pos = ev.getPosition();
|
||||||
auto dimid = ev.getBlockSource().getDimensionId().id;
|
auto dimid = ev.getBlockSource().getDimensionId().id;
|
||||||
std::pair<Vec3, int> lsePos = {pos, dimid};
|
std::pair<Vec3, int> lsePos = {pos, dimid};
|
||||||
@@ -108,8 +108,8 @@ void Export_Event_API() {
|
|||||||
}
|
}
|
||||||
case doHash("onEntityChangeDim"): {
|
case doHash("onEntityChangeDim"): {
|
||||||
auto Call = RemoteCall::importAs<bool(Actor * entity, int toDimId)>(eventName, eventId);
|
auto Call = RemoteCall::importAs<bool(Actor * entity, int toDimId)>(eventName, eventId);
|
||||||
eventBus->emplaceListener<GMLIB::Event::EntityEvent::ActorChangeDimensionBeforeEvent>(
|
eventBus->emplaceListener<Event::EntityEvent::ActorChangeDimensionBeforeEvent>(
|
||||||
[Call](GMLIB::Event::EntityEvent::ActorChangeDimensionBeforeEvent& ev) {
|
[Call](Event::EntityEvent::ActorChangeDimensionBeforeEvent& ev) {
|
||||||
bool result = true;
|
bool result = true;
|
||||||
try {
|
try {
|
||||||
result = Call(&ev.self(), ev.getToDimensionId());
|
result = Call(&ev.self(), ev.getToDimensionId());
|
||||||
@@ -123,8 +123,8 @@ void Export_Event_API() {
|
|||||||
}
|
}
|
||||||
case doHash("onLeaveBed"): {
|
case doHash("onLeaveBed"): {
|
||||||
auto Call = RemoteCall::importAs<bool(Player * pl)>(eventName, eventId);
|
auto Call = RemoteCall::importAs<bool(Player * pl)>(eventName, eventId);
|
||||||
eventBus->emplaceListener<GMLIB::Event::PlayerEvent::PlayerStopSleepBeforeEvent>(
|
eventBus->emplaceListener<Event::PlayerEvent::PlayerStopSleepBeforeEvent>(
|
||||||
[Call](GMLIB::Event::PlayerEvent::PlayerStopSleepBeforeEvent& ev) {
|
[Call](Event::PlayerEvent::PlayerStopSleepBeforeEvent& ev) {
|
||||||
bool result = true;
|
bool result = true;
|
||||||
try {
|
try {
|
||||||
result = Call(&ev.self());
|
result = Call(&ev.self());
|
||||||
@@ -142,8 +142,8 @@ void Export_Event_API() {
|
|||||||
eventName,
|
eventName,
|
||||||
eventId
|
eventId
|
||||||
);
|
);
|
||||||
eventBus->emplaceListener<GMLIB::Event::EntityEvent::DeathMessageAfterEvent>(
|
eventBus->emplaceListener<Event::EntityEvent::DeathMessageAfterEvent>(
|
||||||
[Call](GMLIB::Event::EntityEvent::DeathMessageAfterEvent& ev) {
|
[Call](Event::EntityEvent::DeathMessageAfterEvent& ev) {
|
||||||
auto msg = ev.getDeathMessage();
|
auto msg = ev.getDeathMessage();
|
||||||
auto source = ev.getDamageSource();
|
auto source = ev.getDamageSource();
|
||||||
try {
|
try {
|
||||||
@@ -158,8 +158,8 @@ void Export_Event_API() {
|
|||||||
eventName,
|
eventName,
|
||||||
eventId
|
eventId
|
||||||
);
|
);
|
||||||
eventBus->emplaceListener<GMLIB::Event::EntityEvent::MobHurtAfterEvent>(
|
eventBus->emplaceListener<Event::EntityEvent::MobHurtAfterEvent>(
|
||||||
[Call](GMLIB::Event::EntityEvent::MobHurtAfterEvent& ev) {
|
[Call](Event::EntityEvent::MobHurtAfterEvent& ev) {
|
||||||
auto& damageSource = ev.getSource();
|
auto& damageSource = ev.getSource();
|
||||||
Actor* source = nullptr;
|
Actor* source = nullptr;
|
||||||
if (damageSource.isEntitySource()) {
|
if (damageSource.isEntitySource()) {
|
||||||
@@ -178,8 +178,8 @@ void Export_Event_API() {
|
|||||||
}
|
}
|
||||||
case doHash("onEndermanTake"): {
|
case doHash("onEndermanTake"): {
|
||||||
auto Call = RemoteCall::importAs<bool(Actor * mob)>(eventName, eventId);
|
auto Call = RemoteCall::importAs<bool(Actor * mob)>(eventName, eventId);
|
||||||
eventBus->emplaceListener<GMLIB::Event::EntityEvent::EndermanTakeBlockBeforeEvent>(
|
eventBus->emplaceListener<Event::EntityEvent::EndermanTakeBlockBeforeEvent>(
|
||||||
[Call](GMLIB::Event::EntityEvent::EndermanTakeBlockBeforeEvent& ev) {
|
[Call](Event::EntityEvent::EndermanTakeBlockBeforeEvent& ev) {
|
||||||
bool result = true;
|
bool result = true;
|
||||||
try {
|
try {
|
||||||
result = Call(&ev.self());
|
result = Call(&ev.self());
|
||||||
|
|||||||
+6
-2
@@ -3,13 +3,17 @@
|
|||||||
|
|
||||||
#include <RemoteCallAPI.h>
|
#include <RemoteCallAPI.h>
|
||||||
|
|
||||||
|
using namespace GMLIB;
|
||||||
|
using namespace Server;
|
||||||
|
using namespace Mod;
|
||||||
|
|
||||||
#define PLUGIN_NAME fmt::format(fg(fmt::color::light_green), "GMLIB-LRCA")
|
#define PLUGIN_NAME fmt::format(fg(fmt::color::light_green), "GMLIB-LRCA")
|
||||||
|
|
||||||
#define LIB_VERSION_MAJOR 0
|
#define LIB_VERSION_MAJOR 0
|
||||||
#define LIB_VERSION_MINOR 12
|
#define LIB_VERSION_MINOR 12
|
||||||
#define LIB_VERSION_PATCH 7
|
#define LIB_VERSION_PATCH 8
|
||||||
|
|
||||||
#define LIB_VERSION GMLIB::Version(LIB_VERSION_MAJOR, LIB_VERSION_MINOR, LIB_VERSION_PATCH)
|
#define LIB_VERSION Version(LIB_VERSION_MAJOR, LIB_VERSION_MINOR, LIB_VERSION_PATCH)
|
||||||
|
|
||||||
extern ll::Logger logger;
|
extern ll::Logger logger;
|
||||||
|
|
||||||
|
|||||||
+10
-10
@@ -33,7 +33,7 @@ void Export_Legacy_GMLib_ModAPI() {
|
|||||||
}
|
}
|
||||||
auto res = RecipeIngredient(result, 0, count);
|
auto res = RecipeIngredient(result, 0, count);
|
||||||
auto unl = makeRecipeUnlockingKey(unlock);
|
auto unl = makeRecipeUnlockingKey(unlock);
|
||||||
GMLIB::Mod::JsonRecipe::registerShapelessCraftingTableRecipe(recipe_id, types, res, unl);
|
JsonRecipe::registerShapelessCraftingTableRecipe(recipe_id, types, res, unl);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
@@ -56,7 +56,7 @@ void Export_Legacy_GMLib_ModAPI() {
|
|||||||
}
|
}
|
||||||
auto res = RecipeIngredient(result, 0, count);
|
auto res = RecipeIngredient(result, 0, count);
|
||||||
auto unl = makeRecipeUnlockingKey(unlock);
|
auto unl = makeRecipeUnlockingKey(unlock);
|
||||||
GMLIB::Mod::JsonRecipe::registerShapedCraftingTableRecipe(recipe_id, shape, types, res, unl);
|
JsonRecipe::registerShapedCraftingTableRecipe(recipe_id, shape, types, res, unl);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
@@ -72,7 +72,7 @@ void Export_Legacy_GMLib_ModAPI() {
|
|||||||
}
|
}
|
||||||
auto inp = RecipeIngredient(input, 0, 1);
|
auto inp = RecipeIngredient(input, 0, 1);
|
||||||
auto outp = RecipeIngredient(output, 0, 1);
|
auto outp = RecipeIngredient(output, 0, 1);
|
||||||
GMLIB::Mod::JsonRecipe::registerFurnaceRecipe(recipe_id, inp, outp, tags);
|
JsonRecipe::registerFurnaceRecipe(recipe_id, inp, outp, tags);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
@@ -85,7 +85,7 @@ void Export_Legacy_GMLib_ModAPI() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto rea = RecipeIngredient(reagent, 0, 1);
|
auto rea = RecipeIngredient(reagent, 0, 1);
|
||||||
GMLIB::Mod::JsonRecipe::registerBrewingMixRecipe(recipe_id, input, output, rea);
|
JsonRecipe::registerBrewingMixRecipe(recipe_id, input, output, rea);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
@@ -100,7 +100,7 @@ void Export_Legacy_GMLib_ModAPI() {
|
|||||||
auto inp = RecipeIngredient(input, 0, 1);
|
auto inp = RecipeIngredient(input, 0, 1);
|
||||||
auto outp = RecipeIngredient(output, 0, 1);
|
auto outp = RecipeIngredient(output, 0, 1);
|
||||||
auto rea = RecipeIngredient(reagent, 0, 1);
|
auto rea = RecipeIngredient(reagent, 0, 1);
|
||||||
GMLIB::Mod::JsonRecipe::registerBrewingContainerRecipe(recipe_id, inp, outp, rea);
|
JsonRecipe::registerBrewingContainerRecipe(recipe_id, inp, outp, rea);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
@@ -115,7 +115,7 @@ void Export_Legacy_GMLib_ModAPI() {
|
|||||||
if (!level) {
|
if (!level) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GMLIB::Mod::JsonRecipe::registerSmithingTransformRecipe(
|
JsonRecipe::registerSmithingTransformRecipe(
|
||||||
recipe_id,
|
recipe_id,
|
||||||
smithing_template,
|
smithing_template,
|
||||||
base,
|
base,
|
||||||
@@ -135,7 +135,7 @@ void Export_Legacy_GMLib_ModAPI() {
|
|||||||
if (!level) {
|
if (!level) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
GMLIB::Mod::JsonRecipe::registerSmithingTrimRecipe(recipe_id, smithing_template, base, addition);
|
JsonRecipe::registerSmithingTrimRecipe(recipe_id, smithing_template, base, addition);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
RemoteCall::exportAs(
|
RemoteCall::exportAs(
|
||||||
@@ -153,12 +153,12 @@ void Export_Legacy_GMLib_ModAPI() {
|
|||||||
}
|
}
|
||||||
auto inp = RecipeIngredient(input, 0, 1);
|
auto inp = RecipeIngredient(input, 0, 1);
|
||||||
auto outp = RecipeIngredient(output, 0, 1);
|
auto outp = RecipeIngredient(output, 0, 1);
|
||||||
GMLIB::Mod::JsonRecipe::registerStoneCutterRecipe(recipe_id, inp, outp);
|
JsonRecipe::registerStoneCutterRecipe(recipe_id, inp, outp);
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
// 错误方块清理
|
// 错误方块清理
|
||||||
RemoteCall::exportAs("GMLib_ModAPI", "setUnknownBlockCleaner", []() -> void {
|
RemoteCall::exportAs("GMLib_ModAPI", "setUnknownBlockCleaner", []() -> void {
|
||||||
GMLIB::Mod::VanillaFix::setAutoCleanUnknownBlockEnabled();
|
VanillaFix::setAutoCleanUnknownBlockEnabled();
|
||||||
});
|
});
|
||||||
// 实验性
|
// 实验性
|
||||||
RemoteCall::exportAs("GMLib_ModAPI", "registerExperimentsRequire", [](int experiment_id) -> void {
|
RemoteCall::exportAs("GMLib_ModAPI", "registerExperimentsRequire", [](int experiment_id) -> void {
|
||||||
@@ -193,6 +193,6 @@ void Export_Legacy_GMLib_ModAPI() {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLib_ModAPI", "setFixI18nEnabled", []() -> void {
|
RemoteCall::exportAs("GMLib_ModAPI", "setFixI18nEnabled", []() -> void {
|
||||||
GMLIB::Mod::VanillaFix::setFixI18nEnabled();
|
VanillaFix::setFixI18nEnabled();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -64,13 +64,13 @@ void Export_Legacy_GMLib_ServerAPI() {
|
|||||||
"GMLib_ServerAPI",
|
"GMLib_ServerAPI",
|
||||||
"addFakeList",
|
"addFakeList",
|
||||||
[](const std::string& name, const std::string& xuid) -> bool {
|
[](const std::string& name, const std::string& xuid) -> bool {
|
||||||
return GMLIB::Server::FakeList::addFakeList(name, xuid, ActorUniqueID(-1));
|
return FakeList::addFakeList(name, xuid, ActorUniqueID(-1));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
RemoteCall::exportAs("GMLib_ServerAPI", "removeFakeList", [](const std::string& nameOrXuid) -> bool {
|
RemoteCall::exportAs("GMLib_ServerAPI", "removeFakeList", [](const std::string& nameOrXuid) -> bool {
|
||||||
return GMLIB::Server::FakeList::removeFakeList(nameOrXuid);
|
return FakeList::removeFakeList(nameOrXuid);
|
||||||
});
|
});
|
||||||
RemoteCall::exportAs("GMLib_ServerAPI", "removeAllFakeList", []() -> void {
|
RemoteCall::exportAs("GMLib_ServerAPI", "removeAllFakeList", []() -> void {
|
||||||
return GMLIB::Server::FakeList::removeAllFakeLists();
|
return FakeList::removeAllFakeLists();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
+12
-12
@@ -13,10 +13,10 @@ bool isParameters(std::string const& str) {
|
|||||||
return std::regex_search(removeBrackets(str), reg);
|
return std::regex_search(removeBrackets(str), reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string GetValue(std::string const& from) { return GMLIB::Server::PlaceholderAPI::getValue(from); }
|
std::string GetValue(std::string const& from) { return PlaceholderAPI::getValue(from); }
|
||||||
|
|
||||||
std::string GetValueWithPlayer(std::string const& a1, std::string const& a2) {
|
std::string GetValueWithPlayer(std::string const& a1, std::string const& a2) {
|
||||||
return GMLIB::Server::PlaceholderAPI::getValue(a1, ll::service::bedrock::getLevel()->getPlayer(a2));
|
return PlaceholderAPI::getValue(a1, ll::service::bedrock::getLevel()->getPlayer(a2));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool registerPlayerPlaceholder(
|
bool registerPlayerPlaceholder(
|
||||||
@@ -30,14 +30,14 @@ bool registerPlayerPlaceholder(
|
|||||||
PluginName,
|
PluginName,
|
||||||
FuncName
|
FuncName
|
||||||
);
|
);
|
||||||
GMLIB::Server::PlaceholderAPI::registerPlayerPlaceholder(
|
PlaceholderAPI::registerPlayerPlaceholder(
|
||||||
PAPIName,
|
PAPIName,
|
||||||
[Call](Player* sp, std::unordered_map<std::string, std::string> map) { return Call(sp, map); },
|
[Call](Player* sp, std::unordered_map<std::string, std::string> map) { return Call(sp, map); },
|
||||||
PluginName
|
PluginName
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
auto Call = RemoteCall::importAs<std::string(Player * pl)>(PluginName, FuncName);
|
auto Call = RemoteCall::importAs<std::string(Player * pl)>(PluginName, FuncName);
|
||||||
GMLIB::Server::PlaceholderAPI::registerPlayerPlaceholder(
|
PlaceholderAPI::registerPlayerPlaceholder(
|
||||||
PAPIName,
|
PAPIName,
|
||||||
[Call](Player* sp) { return Call(sp); },
|
[Call](Player* sp) { return Call(sp); },
|
||||||
PluginName
|
PluginName
|
||||||
@@ -57,14 +57,14 @@ bool registerServerPlaceholder(
|
|||||||
if (isParameters(PAPIName)) {
|
if (isParameters(PAPIName)) {
|
||||||
auto Call =
|
auto Call =
|
||||||
RemoteCall::importAs<std::string(std::unordered_map<std::string, std::string>)>(PluginName, FuncName);
|
RemoteCall::importAs<std::string(std::unordered_map<std::string, std::string>)>(PluginName, FuncName);
|
||||||
GMLIB::Server::PlaceholderAPI::registerServerPlaceholder(
|
PlaceholderAPI::registerServerPlaceholder(
|
||||||
PAPIName,
|
PAPIName,
|
||||||
[Call](std::unordered_map<std::string, std::string> map) { return Call(map); },
|
[Call](std::unordered_map<std::string, std::string> map) { return Call(map); },
|
||||||
PluginName
|
PluginName
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
auto Call = RemoteCall::importAs<std::string()>(PluginName, FuncName);
|
auto Call = RemoteCall::importAs<std::string()>(PluginName, FuncName);
|
||||||
GMLIB::Server::PlaceholderAPI::registerServerPlaceholder(PAPIName, [Call]() { return Call(); }, PluginName);
|
PlaceholderAPI::registerServerPlaceholder(PAPIName, [Call]() { return Call(); }, PluginName);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -81,13 +81,13 @@ bool registerStaticPlaceholder(
|
|||||||
if (isParameters(PAPIName)) {
|
if (isParameters(PAPIName)) {
|
||||||
auto Call = RemoteCall::importAs<std::string()>(PluginName, FuncName);
|
auto Call = RemoteCall::importAs<std::string()>(PluginName, FuncName);
|
||||||
if (num == -1) {
|
if (num == -1) {
|
||||||
GMLIB::Server::PlaceholderAPI::registerStaticPlaceholder(
|
PlaceholderAPI::registerStaticPlaceholder(
|
||||||
PAPIName,
|
PAPIName,
|
||||||
[Call] { return Call(); },
|
[Call] { return Call(); },
|
||||||
PluginName
|
PluginName
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
GMLIB::Server::PlaceholderAPI::registerStaticPlaceholder(
|
PlaceholderAPI::registerStaticPlaceholder(
|
||||||
PAPIName,
|
PAPIName,
|
||||||
num,
|
num,
|
||||||
[Call] { return Call(); },
|
[Call] { return Call(); },
|
||||||
@@ -101,14 +101,14 @@ bool registerStaticPlaceholder(
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string translateStringWithPlayer(std::string const& str, Player* pl) {
|
std::string translateStringWithPlayer(std::string const& str, Player* pl) {
|
||||||
return GMLIB::Server::PlaceholderAPI::translateString(str, pl);
|
return PlaceholderAPI::translateString(str, pl);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string translateString(std::string const& str) { return GMLIB::Server::PlaceholderAPI::translateString(str); }
|
std::string translateString(std::string const& str) { return PlaceholderAPI::translateString(str); }
|
||||||
|
|
||||||
bool unRegisterPlaceholder(std::string const& str) { return GMLIB::Server::PlaceholderAPI::unregisterPlaceholder(str); }
|
bool unRegisterPlaceholder(std::string const& str) { return PlaceholderAPI::unregisterPlaceholder(str); }
|
||||||
|
|
||||||
std::vector<std::string> getAllPAPI() { return GMLIB::Server::PlaceholderAPI::getAllPAPI(); }
|
std::vector<std::string> getAllPAPI() { return PlaceholderAPI::getAllPAPI(); }
|
||||||
|
|
||||||
} // namespace PAPIRemoteCall
|
} // namespace PAPIRemoteCall
|
||||||
|
|
||||||
|
|||||||
+3
-3
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"format_version": 2,
|
"format_version": 2,
|
||||||
"tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi",
|
"tooth": "github.com/GroupMountain/GMLIB-LegacyRemoteCallApi",
|
||||||
"version": "0.12.7",
|
"version": "0.12.8",
|
||||||
"info": {
|
"info": {
|
||||||
"name": "GMLIB-LegacyRemoteCallApi",
|
"name": "GMLIB-LegacyRemoteCallApi",
|
||||||
"description": "Legacy RemoteCall API for GMLIB",
|
"description": "Legacy RemoteCall API for GMLIB",
|
||||||
@@ -14,9 +14,9 @@
|
|||||||
"library"
|
"library"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.12.7/GMLIB-LegacyRemoteCallApi-windows-x64.zip",
|
"asset_url": "https://github.com/GroupMountain/GMLIB-LegacyRemoteCallApi/releases/download/v0.12.8/GMLIB-LegacyRemoteCallApi-windows-x64.zip",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"github.com/GroupMountain/GMLIB": ">=0.12.7"
|
"github.com/GroupMountain/GMLIB": ">=0.12.8"
|
||||||
},
|
},
|
||||||
"files": {
|
"files": {
|
||||||
"place": [
|
"place": [
|
||||||
|
|||||||
Reference in New Issue
Block a user