LiteLDev / LegacyScriptEngine

A plugin engine for running LLSE plugins on LeviLamina
GNU General Public License v3.0
48 stars 8 forks source link

[Bug]: 通过 data.getAllPlayerInfo() 获取所有的玩家信息时报错 #40

Closed TRDSCSH closed 8 months ago

TRDSCSH commented 8 months ago

Describe the bug

只要在代码中使用 data.getAllPlayerInfo() 则报错。

具体报错内容如下

16:45:15.183 INFO [legacy-script-engine-quickjs] loading plugin getAllPlayerInfoTest
16:45:15.199 ERROR [legacy-script-engine-quickjs] Fail in getAllPlayerInfo!
16:45:15.199 ERROR [legacy-script-engine-quickjs] C++ Exception: std::runtime_error, from <legacy-script-engine-quickjs>:
16:45:15.199 ERROR [legacy-script-engine-quickjs] bad optional_ref access
16:45:15.199 ERROR [legacy-script-engine-quickjs]
16:45:15.199 ERROR [legacy-script-engine-quickjs] In API: DataClass::getAllPlayerInfo
16:45:15.199 ERROR [legacy-script-engine-quickjs] In Plugin: getAllPlayerInfoTest
16:45:15.199 INFO [legacy-script-engine-quickjs] Js 插件 <getAllPlayerInfoTest> 已加载。

To Reproduce

新建一个 Javascript 插件,其内容为:

const allPlayerInfo = data.getAllPlayerInfo();

然后运行服务端即可复现报错。

Expected behavior

使用 data.getAllPlayerInfo() 时不出现报错,并且可以正常获取所有的玩家信息。

Screenshots

No response

Platform

Windows 11 专业版

BDS Version

1.20.61.01

LeviLamina Version

0.8.3

LegacyScriptEngine Version

0.3.1

Additional context

No response