diff --git a/CHANGELOG.md b/CHANGELOG.md index 351d4650..e1a1b13e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix truePos pre calculation - Fix onProjectileHitBlock & onProjectileHitEntity #108 +- Fix mc.explode #111 ## [0.7.3] - 2024-05-01 diff --git a/mkdocs.yml b/mkdocs.yml index e0036481..92c755b8 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -43,11 +43,6 @@ nav: - GuiAPI: - apis/GuiAPI/Form.md - apis/GuiAPI/FormBuilder.md - - NativeAPI: - - apis/NativeAPI/NativeFunction.md - - apis/NativeAPI/NativePatch.md - - apis/NativeAPI/NativePointer.md - - apis/NativeAPI/Summary.md - NbtAPI: - apis/NbtAPI/NBT.md - apis/NbtAPI/NBTCompound.md @@ -65,9 +60,6 @@ nav: - apis/SystemAPI/SystemCall.md - apis/SystemAPI/SystemInfo.md -exclude_docs: | - api/native/ - theme: name: material features: diff --git a/src/legacy/api/CommandAPI.cpp b/src/legacy/api/CommandAPI.cpp index 771c909f..3cb24328 100644 --- a/src/legacy/api/CommandAPI.cpp +++ b/src/legacy/api/CommandAPI.cpp @@ -12,28 +12,21 @@ #include "engine/EngineOwnData.h" #include "engine/GlobalShareData.h" #include "engine/LocalShareData.h" -#include "ll/api/command/CommandRegistrar.h" #include "ll/api/event/EventBus.h" #include "ll/api/event/server/ServerStartedEvent.h" #include "ll/api/service/Bedrock.h" -#include "ll/api/service/ServerInfo.h" #include "lse/Plugin.h" #include "magic_enum.hpp" -#include "main/Configs.h" #include "mc/_HeaderOutputPredefine.h" -#include "mc/codebuilder/MCRESULT.h" #include "mc/common/wrapper/GenerateMessageResult.h" #include "mc/deps/json/JsonHelpers.h" #include "mc/enums/CurrentCmdVersion.h" #include "mc/locale/I18n.h" #include "mc/locale/Localization.h" #include "mc/server/ServerLevel.h" -#include "mc/server/commands/BlockStateCommandParam.h" #include "mc/server/commands/CommandBlockName.h" #include "mc/server/commands/CommandBlockNameResult.h" #include "mc/server/commands/CommandContext.h" -#include "mc/server/commands/CommandOriginLoader.h" -#include "mc/server/commands/CommandOutputParameter.h" #include "mc/server/commands/CommandOutputType.h" #include "mc/server/commands/CommandPermissionLevel.h" #include "mc/server/commands/CommandVersion.h" @@ -43,9 +36,7 @@ #include "mc/world/item/ItemInstance.h" #include "mc/world/item/registry/ItemStack.h" #include "mc/world/level/dimension/Dimension.h" -#include "utils/Utils.h" -#include #include #include diff --git a/src/legacy/api/CommandCompatibleAPI.cpp b/src/legacy/api/CommandCompatibleAPI.cpp index 25fdb0b7..bd4d5130 100644 --- a/src/legacy/api/CommandCompatibleAPI.cpp +++ b/src/legacy/api/CommandCompatibleAPI.cpp @@ -1,19 +1,14 @@ #include "api/APIHelp.h" -#include "api/CommandAPI.h" #include "api/McAPI.h" #include "api/PlayerAPI.h" #include "engine/EngineOwnData.h" #include "engine/GlobalShareData.h" #include "engine/LocalShareData.h" -#include "ll/api/event/EventBus.h" -#include "ll/api/event/server/ServerStartedEvent.h" -#include "ll/api/memory/Memory.h" #include "ll/api/service/Bedrock.h" #include "main/Configs.h" #include "main/Global.h" #include "utils/Utils.h" -#include #include #include #include diff --git a/src/lse/PluginManager.cpp b/src/lse/PluginManager.cpp index 09cfec0f..55ab6bd0 100644 --- a/src/lse/PluginManager.cpp +++ b/src/lse/PluginManager.cpp @@ -121,7 +121,7 @@ ll::Expected<> PluginManager::load(ll::plugin::Manifest manifest) { logger.info("loading plugin {}", manifest.name); if (hasPlugin(manifest.name)) { - throw std::runtime_error("plugin already loaded"); + return ll::makeStringError("plugin already loaded"); } auto& scriptEngine = *EngineManager::newEngine(manifest.name); @@ -166,7 +166,7 @@ ll::Expected<> PluginManager::load(ll::plugin::Manifest manifest) { auto baseLibPath = self.getPluginDir() / "baselib" / BaseLibFileName; auto baseLibContent = ll::file_utils::readFile(baseLibPath); if (!baseLibContent) { - throw std::runtime_error(fmt::format("failed to read BaseLib at {}", baseLibPath.string())); + return ll::makeStringError(fmt::format("failed to read BaseLib at {}", baseLibPath.string())); } scriptEngine.eval(baseLibContent.value()); #endif @@ -176,12 +176,12 @@ ll::Expected<> PluginManager::load(ll::plugin::Manifest manifest) { ENGINE_OWN_DATA()->pluginFileOrDirPath = entryPath.string(); #ifdef LEGACY_SCRIPT_ENGINE_BACKEND_PYTHON if (!PythonHelper::loadPluginCode(&scriptEngine, entryPath.string(), dirPath.string())) { - throw std::runtime_error(fmt::format("failed to load plugin code")); + return ll::makeStringError(fmt::format("failed to load plugin code")); } #endif #ifdef LEGACY_SCRIPT_ENGINE_BACKEND_NODEJS if (!NodeJsHelper::loadPluginCode(&scriptEngine, entryPath.string(), dirPath.string())) { - throw std::runtime_error(fmt::format("failed to load plugin code")); + return ll::makeStringError(fmt::format("failed to load plugin code")); } #endif #if (defined LEGACY_SCRIPT_ENGINE_BACKEND_QUICKJS) || (defined LEGACY_SCRIPT_ENGINE_BACKEND_LUA) @@ -192,7 +192,7 @@ ll::Expected<> PluginManager::load(ll::plugin::Manifest manifest) { // loadFile failed, try eval auto pluginEntryContent = ll::file_utils::readFile(entryPath); if (!pluginEntryContent) { - throw std::runtime_error(fmt::format("Failed to read plugin entry at {}", entryPath.string())); + return ll::makeStringError(fmt::format("Failed to read plugin entry at {}", entryPath.string())); } scriptEngine.eval(pluginEntryContent.value()); }