Skip to content

Commit 447df6e

Browse files
committed
fix: fix CommandAPI
1 parent 1e8e357 commit 447df6e

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

src/legacy/api/CommandAPI.cpp

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ Local<Value> convertResult(ParamStorageType const& result, CommandOrigin const&
9393
return String::newString(std::get<RuntimeSoftEnum>(result.value()));
9494
} else if (result.hold(ParamKind::Kind::BlockName)) {
9595
return BlockClass::newBlock(
96-
*std::get<CommandBlockName>(result.value()).resolveBlock(0).getBlock(),
96+
*std::get<CommandBlockName>(result.value()).resolveBlock(0).mBlock,
9797
BlockPos::MIN(),
9898
-1
9999
);
@@ -139,15 +139,17 @@ Local<Value> convertResult(ParamStorageType const& result, CommandOrigin const&
139139
.mMessage->c_str()
140140
);
141141
} else if (result.hold(ParamKind::Kind::RawText)) {
142-
return String::newString(std::get<CommandRawText>(result.value()).getText());
142+
return String::newString(std::get<CommandRawText>(result.value()).mText);
143143
} else if (result.hold(ParamKind::Kind::JsonValue)) {
144144
return String::newString(JsonHelpers::serialize(std::get<Json::Value>(result.value())));
145145
} else if (result.hold(ParamKind::Kind::Effect)) {
146-
return String::newString(std::get<MobEffect const*>(result.value())->getResourceName());
146+
return String::newString(std::get<MobEffect const*>(result.value())->mResourceName);
147147
} else if (result.hold(ParamKind::Kind::Command)) {
148148
return String::newString(std::get<std::unique_ptr<::Command>>(result.value())->getCommandName());
149149
} else if (result.hold(ParamKind::Kind::ActorType)) {
150-
return String::newString(std::get<ActorDefinitionIdentifier const*>(result.value())->getCanonicalName());
150+
return String::newString(
151+
std::get<ActorDefinitionIdentifier const*>(result.value())->mCanonicalName->getString()
152+
);
151153
} else if (result.hold(ParamKind::Kind::Bool)) {
152154
return Boolean::newBoolean(std::get<bool>(result.value()));
153155
} else if (result.hold(ParamKind::Kind::Int)) {
@@ -188,7 +190,7 @@ Local<Value> McClass::runcmd(const Arguments& args) {
188190
CommandVersion::CurrentVersion()
189191
);
190192
try {
191-
return Boolean::newBoolean(ll::service::getMinecraft()->getCommands().executeCommand(context, false).mSuccess);
193+
return Boolean::newBoolean(ll::service::getMinecraft()->mCommands->executeCommand(context, false).mSuccess);
192194
}
193195
CATCH("Fail in RunCmd!")
194196
}
@@ -200,7 +202,7 @@ Local<Value> McClass::runcmdEx(const Arguments& args) {
200202
std::string outputStr;
201203
auto origin =
202204
ServerCommandOrigin("Server", ll::service::getLevel()->asServer(), CommandPermissionLevel::Owner, 0);
203-
auto command = ll::service::getMinecraft()->getCommands().compileCommand(
205+
auto command = ll::service::getMinecraft()->mCommands->compileCommand(
204206
args[0].asString().toString(),
205207
origin,
206208
(CurrentCmdVersion)CommandVersion::CurrentVersion(),
@@ -211,14 +213,14 @@ Local<Value> McClass::runcmdEx(const Arguments& args) {
211213
CommandOutput output(CommandOutputType::AllOutput);
212214
command->run(origin, output);
213215
static std::shared_ptr<Localization> localization =
214-
getI18n().getLocaleFor(getI18n().getCurrentLanguage()->getFullLanguageCode());
215-
for (auto& msg : output.getMessages()) {
216-
outputStr += getI18n().get(msg.getMessageId(), msg.getParams(), localization).append("\n");
216+
getI18n().getLocaleFor(getI18n().getCurrentLanguage()->mCode);
217+
for (auto& msg : output.mMessages) {
218+
outputStr += getI18n().get(msg.mMessageId, msg.mParams, localization).append("\n");
217219
}
218220
if (outputStr.ends_with('\n')) {
219221
outputStr.pop_back();
220222
}
221-
resObj.set("success", output.getSuccessCount() ? true : false);
223+
resObj.set("success", output.mSuccessCount ? true : false);
222224
resObj.set("output", outputStr);
223225
return resObj;
224226
}

xmake.lua

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@ add_rules("mode.debug", "mode.release")
33
add_repositories("liteldev-repo https://github.com/LiteLDev/xmake-repo.git")
44

55
if is_config("target_type", "server") then
6-
add_requires("levilamina 1854f0518474ba4d01d9ecffa428565f10b3d26f", {configs = {target_type = "server"}})
6+
add_requires("levilamina db34cb99ac8f097bcafde355c1ee703fc8639d68", {configs = {target_type = "server"}})
77
else
8-
add_requires("levilamina 1854f0518474ba4d01d9ecffa428565f10b3d26f", {configs = {target_type = "client"}})
8+
add_requires("levilamina db34cb99ac8f097bcafde355c1ee703fc8639d68", {configs = {target_type = "client"}})
99
end
1010

1111
add_requires("levibuildscript")

0 commit comments

Comments
 (0)