Closed WuHuiZhang6902 closed 3 months ago
在生物受伤造成伤害对象为非实体情况下会报错,例如火焰灼烧,已经写了判断条件包括使用受伤原因进行屏蔽仍然报错 报错内容如下 17:42:15.671 ERROR [legacy-script-engine-quickjs] Event Callback Failed! 17:42:15.671 ERROR [legacy-script-engine-quickjs] Uncaught Exception Detected! 17:42:15.671 ERROR [legacy-script-engine-quickjs] In Event: onMobHurt 17:42:15.717 ERROR [legacy-script-engine-quickjs] Error occurred in Engine Message Loop!
mc.listen("onMobHurt", (mob, source, damage, entityAttackType) => { if (entityAttackType === 0x02 && source?.isPlayer()) { const player = source.toPlayer(); if (player) { if (damage > 5) { player.tell('检测到非法伤害值!'); logger.warn(`玩家 ${player.realName} 检测到非法伤害值!伤害值: ${damage}`); // 进行拦截,返回 false return false; } } } });
修复问题
No response
Windows 10
1.21.3
0.13.5
0.8.18
无法复现,确认使用的是0.8.18吗
十分抱歉,是0.8.15
Describe the bug
在生物受伤造成伤害对象为非实体情况下会报错,例如火焰灼烧,已经写了判断条件包括使用受伤原因进行屏蔽仍然报错 报错内容如下 17:42:15.671 ERROR [legacy-script-engine-quickjs] Event Callback Failed! 17:42:15.671 ERROR [legacy-script-engine-quickjs] Uncaught Exception Detected! 17:42:15.671 ERROR [legacy-script-engine-quickjs] In Event: onMobHurt 17:42:15.717 ERROR [legacy-script-engine-quickjs] Error occurred in Engine Message Loop!
To Reproduce
Expected behavior
修复问题
Screenshots
No response
Platform
Windows 10
BDS Version
1.21.3
LeviLamina Version
0.13.5
LegacyScriptEngine Version
0.8.18
Additional context
No response