使用 pl.setNbt(nbt) 设置玩家的NBT即可。
代码:
let nbt = new NbtCompound({"definitions":new NbtList([new NbtString(+minecraft:villager)])});pl.setNbt(nbt);
有关的日志/输出
[Crashed!]
-- Unhandled Exception in -> ucrtbase.dll
-- Exception Code: 0xC0000409
-- C++ STL Exception detected!
[StackTrace] Function abort at 0x7FF91CF9CA50 [ucrtbase.dll<6.2.20348.1>]
-- At File (null) : Line 0
[StackTrace] Function ???????? at 0x7FF91CF9CA9E [ucrtbase.dll<6.2.20348.1>]
[StackTrace] Function purecall at 0x7FF914F36E30 [VCRUNTIME140.dll<14.32.31326.0>]
-- At File (null) : Line 0
[StackTrace] Function ???????? at 0x7FF914F36E4A [VCRUNTIME140.dll<14.32.31326.0>]
[StackTrace] Function Tag::toJson at 0x7FF8F1A50DD0 [LiteLoader.dll<2.6.2.44>]
-- At File E:\actions-runner\_work\LiteLoaderBDS\LiteLoaderBDS\LiteLoader\Kernel\NBT\TagAPI.cpp : Line 217
[StackTrace] Function ???????? at 0x7FF8F1A50E29 [LiteLoader.dll<2.6.2.44>]
[StackTrace] Function NbtStringClass::toString at 0x7FF8F11A3770 [LiteLoader.Js.dll<2.6.2.44>]
-- At File E:\actions-runner\_work\LiteLoaderBDS\LiteLoaderBDS\ScriptEngine\API\NbtAPI.cpp : Line 794
[StackTrace] Function ???????? at 0x7FF8F11A3B7B [LiteLoader.Js.dll<2.6.2.44>]
[StackTrace] Function std::_Func_impl_no_alloc<script::Local<script::Value> (__cdecl BlockClass::*)(script::Arguments const &),script::Local<script::Value>,BlockClass *,script::Arguments const &>::_Do_call at 0x7FF8F10BB150 [LiteLoader.Js.dll<2.6.2.44>]
-- At File E:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\functional : Line 831
[StackTrace] Function ???????? at 0x7FF8F10BB174 [LiteLoader.Js.dll<2.6.2.44>]
[StackTrace] Function `script::qjs_backend::QjsEngine::newPrototype<FloatPos>'::`6'::<lambda_1>::<lambda_invoker_cdecl> at 0x7FF8F129DCC0 [LiteLoader.Js.dll<2.6.2.44>]
-- At File E:\actions-runner\_work\LiteLoaderBDS\LiteLoaderBDS\ScriptEngine\third-party\ScriptX\backend\QuickJs\QjsEngine.hpp : Line 142
[StackTrace] Function ???????? at 0x7FF8F129DDC2 [LiteLoader.Js.dll<2.6.2.44>]
[StackTrace] Function script::String::newString at 0x7FF8F12BAAA0 [LiteLoader.Js.dll<2.6.2.44>]
-- At File (null) : Line 0
[StackTrace] Function ???????? at 0x7FF8F12BACAF [LiteLoader.Js.dll<2.6.2.44>]
[StackTrace] Function script::String::newString at 0x7FF8F12BAAA0 [LiteLoader.Js.dll<2.6.2.44>]
-- At File (null) : Line 0
[StackTrace] Function ???????? at 0x7FF8F12BAB63 [LiteLoader.Js.dll<2.6.2.44>]
[StackTrace] Function _JS_FreeValueRT at 0x7FF8F1307C70 [LiteLoader.Js.dll<2.6.2.44>]
-- At File (null) : Line 0
[StackTrace] Function ???????? at 0x7FF8F13158DB [LiteLoader.Js.dll<2.6.2.44>]
[StackTrace] Function JS_CallConstructor at 0x7FF8F12EF130 [LiteLoader.Js.dll<2.6.2.44>]
-- At File (null) : Line 0
[StackTrace] Function ???????? at 0x7FF8F12EF782 [LiteLoader.Js.dll<2.6.2.44>]
[StackTrace] Function JS_ToInt64Ext at 0x7FF8F1305BC0 [LiteLoader.Js.dll<2.6.2.44>]
-- At File (null) : Line 0
[StackTrace] Function ???????? at 0x7FF8F1306890 [LiteLoader.Js.dll<2.6.2.44>]
[StackTrace] Function _JS_FreeValueRT at 0x7FF8F1307C70 [LiteLoader.Js.dll<2.6.2.44>]
-- At File (null) : Line 0
[StackTrace] Function ???????? at 0x7FF8F1310EEF [LiteLoader.Js.dll<2.6.2.44>]
[StackTrace] Function JS_CallConstructor at 0x7FF8F12EF130 [LiteLoader.Js.dll<2.6.2.44>]
-- At File (null) : Line 0
[StackTrace] Function ???????? at 0x7FF8F12F3A6E [LiteLoader.Js.dll<2.6.2.44>]
[StackTrace] Function JS_Call at 0x7FF8F12EF0B0 [LiteLoader.Js.dll<2.6.2.44>]
-- At File (null) : Line 0
[StackTrace] Function ???????? at 0x7FF8F12EF116 [LiteLoader.Js.dll<2.6.2.44>]
[StackTrace] Function script::Local<script::Value>::operator== at 0x7FF8F12B7490 [LiteLoader.Js.dll<2.6.2.44>]
-- At File (null) : Line 0
[StackTrace] Function ???????? at 0x7FF8F12B772F [LiteLoader.Js.dll<2.6.2.44>]
[StackTrace] Function script::Local<script::Function>::call<script::Local<script::Value> const & __ptr64,script::Local<script::Value> const & __ptr64> at 0x7FF8F12B6DD0 [LiteLoader.Js.dll<2.6.2.44>]
-- At File (null) : Line 0
[StackTrace] Function ???????? at 0x7FF8F12B6F27 [LiteLoader.Js.dll<2.6.2.44>]
[StackTrace] Function script::Local<script::Function>::callImpl at 0x7FF8F12B8090 [LiteLoader.Js.dll<2.6.2.44>]
-- At File (null) : Line 0
[StackTrace] Function ???????? at 0x7FF8F12B8112 [LiteLoader.Js.dll<2.6.2.44>]
[StackTrace] Function script::Local<script::Function>::call<script::Local<script::Object>,script::Local<script::Value> > at 0x7FF8F1137880 [LiteLoader.Js.dll<2.6.2.44>]
-- At File E:\actions-runner\_work\LiteLoaderBDS\LiteLoaderBDS\ScriptEngine\third-party\ScriptX\src\Native.hpp : Line 586
[StackTrace] Function ???????? at 0x7FF8F11378E4 [LiteLoader.Js.dll<2.6.2.44>]
[StackTrace] Function `CustomFormClass::sendForm'::`2'::<lambda_1>::operator() at 0x7FF8F115C020 [LiteLoader.Js.dll<2.6.2.44>]
-- At File E:\actions-runner\_work\LiteLoaderBDS\LiteLoaderBDS\ScriptEngine\API\GuiAPI.cpp : Line 152
[StackTrace] Function ???????? at 0x7FF8F115C1B1 [LiteLoader.Js.dll<2.6.2.44>]
[StackTrace] Function std::_Func_impl_no_alloc<`CustomFormClass::sendForm'::`2'::<lambda_1>,void,Player *,std::basic_string<char,std::char_traits<char>,std::allocator<char> > >::_Do_call at 0x7FF8F11657C0 [LiteLoader.Js.dll<2.6.2.44>]
-- At File E:\Program Files\Microsoft Visual Studio\2022\Community\VC\Tools\MSVC\14.33.31629\include\functional : Line 832
[StackTrace] Function ???????? at 0x7FF8F1165806 [LiteLoader.Js.dll<2.6.2.44>]
[StackTrace] Function HandleFormPacket at 0x7FF8F1A02470 [LiteLoader.dll<2.6.2.44>]
-- At File E:\actions-runner\_work\LiteLoaderBDS\LiteLoaderBDS\LiteLoader\Kernel\FormPacketHelper.cpp : Line 164
[StackTrace] Function ???????? at 0x7FF8F1A034B2 [LiteLoader.dll<2.6.2.44>]
[StackTrace] Function THookTemplate<8093493766965877952,4938724510176191070>::_hook at 0x7FF8F19E08D0 [LiteLoader.dll<2.6.2.44>]
-- At File E:\actions-runner\_work\LiteLoaderBDS\LiteLoaderBDS\LiteLoader\Kernel\EventAPI.cpp : Line 2151
[StackTrace] Function ???????? at 0x7FF8F19E0BA3 [LiteLoader.dll<2.6.2.44>]
[StackTrace] Function NetworkHandler::_sortAndPacketizeEvents at 0x7FF724D212F0 [bedrock_server_mod.exe<1.19.22.01>]
-- At File (null) : Line 0
[StackTrace] Function ???????? at 0x7FF724D2187C [bedrock_server_mod.exe<1.19.22.01>]
[StackTrace] Function <lambda_73ccacd3b57abe4a401a123de243be11>::operator() at 0x7FF724D1FD70 [bedrock_server_mod.exe<1.19.22.01>]
-- At File (null) : Line 0
[StackTrace] Function ???????? at 0x7FF724D1FFD6 [bedrock_server_mod.exe<1.19.22.01>]
[StackTrace] Function NetworkHandler::runEvents at 0x7FF724D24240 [bedrock_server_mod.exe<1.19.22.01>]
-- At File (null) : Line 0
[StackTrace] Function ???????? at 0x7FF724D242FE [bedrock_server_mod.exe<1.19.22.01>]
[StackTrace] Function Minecraft::update at 0x7FF72523BF80 [bedrock_server_mod.exe<1.19.22.01>]
-- At File (null) : Line 0
[StackTrace] Function ???????? at 0x7FF72523D4FD [bedrock_server_mod.exe<1.19.22.01>]
[StackTrace] Function ServerInstance::_update at 0x7FF725258090 [bedrock_server_mod.exe<1.19.22.01>]
-- At File (null) : Line 0
[StackTrace] Function ???????? at 0x7FF72525818D [bedrock_server_mod.exe<1.19.22.01>]
[StackTrace] Function <lambda_09545ac3fb7d475932bfc25c15253480>::operator() at 0x7FF725256670 [bedrock_server_mod.exe<1.19.22.01>]
-- At File (null) : Line 0
[StackTrace] Function ???????? at 0x7FF725256AE2 [bedrock_server_mod.exe<1.19.22.01>]
[StackTrace] Function std::thread::_Invoke<std::tuple<<lambda_09545ac3fb7d475932bfc25c15253480> >,0> at 0x7FF7252539D0 [bedrock_server_mod.exe<1.19.22.01>]
-- At File (null) : Line 0
[StackTrace] Function ???????? at 0x7FF7252539DE [bedrock_server_mod.exe<1.19.22.01>]
[StackTrace] Function recalloc at 0x7FF91CF46AF0 [ucrtbase.dll<6.2.20348.1>]
-- At File (null) : Line 0
[StackTrace] Function ???????? at 0x7FF91CF46B4C [ucrtbase.dll<6.2.20348.1>]
[StackTrace] Function BaseThreadInitThunk at 0x7FF91EBD4EC0 [KERNEL32.DLL<6.2.20348.681>]
-- At File (null) : Line 0
[StackTrace] Function ???????? at 0x7FF91EBD4ED0 [KERNEL32.DLL<6.2.20348.681>]
[StackTrace] Function RtlUserThreadStart at 0x7FF91F46E370 [ntdll.dll<6.2.20348.681>]
-- At File (null) : Line 0
[StackTrace] Function ???????? at 0x7FF91F46E39B [ntdll.dll<6.2.20348.681>]
插件列表
12:45:29 INFO [Server] 插件列表 [6]
12:45:29 INFO [Server] - LLMoney [v2.5.1] (LLMoney.dll)
12:45:29 INFO [Server] EconomyCore for LiteLoaderBDS
12:45:29 INFO [Server] - ScriptEngine-Lua [v2.6.2] (LiteLoader.Lua.dll)
12:45:29 INFO [Server] Lua ScriptEngine for LiteLoaderBDS
12:45:29 INFO [Server] - PermissionAPI [v2.6.0] (PermissionAPI.dll)
12:45:29 INFO [Server] Builtin & Powerful permission API for LiteLoaderBDS
12:45:29 INFO [Server] - ScriptEngine-QuickJs [v2.6.2] (LiteLoader.Js.dll)
12:45:29 INFO [Server] Javascript ScriptEngine for LiteLoaderBDS
12:45:29 INFO [Server] - nbtTest [v1.0.0] (nbtTest.js)
12:45:29 INFO [Server] nbtTest
12:45:29 INFO [Server] - ScriptEngine-NodeJs [v2.6.2] (LiteLoader.NodeJs.dll)
12:45:29 INFO [Server] Node.js ScriptEngine for LiteLoaderBDS
异常模块
Core(核心)
操作系统
Windows Server 2022
LiteLoader版本
2.6.2
BDS版本
545
发生了什么?
将玩家NBT标签的“definitions”键修改为其它值(如:“horse”,"villager","player"等)会引起服务端崩溃。
复现此问题的步骤
pl.setNbt(nbt)
设置玩家的NBT即可。 代码:let nbt = new NbtCompound({
"definitions":new NbtList([
new NbtString(
+minecraft:villager)
])});
pl.setNbt(nbt);
有关的日志/输出
插件列表