LiteLDev / LeviLamina

A lightweight, modular and versatile mod loader for Minecraft Bedrock Edition, formerly known as LiteLoaderBDS
https://levimc.org/software/levilamina
GNU Lesser General Public License v3.0
1.14k stars 117 forks source link

Player对象的talkAs方法栈溢出,好像是递归了 #337

Closed JiaJinz21 closed 2 years ago

JiaJinz21 commented 2 years ago

Exceptions module 异常模块

ScriptEngine 脚本引擎

Operating System 操作系统

Windows 10

LiteLoader version LiteLoader版本

2.1.5

BDS version BDS版本

1.18.12.01

What happened? 发生了什么问题?

我监听onChat事件并拦截它,更改消息的内容再使用Player对象的talkAs方法发送,然后出现了错误,在控制台多次发送了消息但是客户端只显示了1次

Steps to reproduce? 复现此问题的步骤

(1)监听onChat事件 (2)拦截事件并将msg赋值给另一个变量msg2 (3)使用Player对象的talkAs对象将msg2发送

Relevant log output 有关的日志/输出

19:53:06 ERROR [LiteLoader] Event Callback Failed!
19:53:06 ERROR [LiteLoader] Uncaught RangeError: Maximum call stack size exceeded
    at <anonymous>:1:1
    at <anonymous>:1:1
    at <anonymous>:1:1
    at <anonymous>:1:1
    at <anonymous>:1:1
    at <anonymous>:1:1
    at <anonymous>:1:1
    at <anonymous>:1:1
    at <anonymous>:1:1
    at <anonymous>:1:1

19:53:06 ERROR [LiteLoader] In Event: onChat
19:53:06 ERROR [LiteLoader] In Plugin: ChatControl

Plugin list 插件列表

20:11:42 INFO [Server] Plugin Lists [4] 20:11:42 INFO [Server] - LLMoney [v2.1.1] (LLMoney.dll) 20:11:42 INFO [Server] EconomyCore for LiteLoaderBDS 20:11:42 INFO [Server] - ScriptEngine-Lua [v2.1.5] (LiteLoader.Lua.dll) 20:11:42 INFO [Server] Lua ScriptEngine for LiteLoaderBDS 20:11:42 INFO [Server] - ScriptEngine-Js [v2.1.5] (LiteLoader.Js.dll) 20:11:42 INFO [Server] Javascript ScriptEngine for LiteLoaderBDS 20:11:42 INFO [Server] - ChatControl [v1.0.1] (ChatControl.lxl.js) 20:11:42 INFO [Server] Manage chat. 20:11:42 INFO [Server] 20:11:42 INFO [Server] * Send command "ll list " for more information

xiaoqch commented 2 years ago

和ll无关的问题,talkAs会触发onChat事件,请自行过滤掉自己调用的api触发的事件