AnzhiZhang / MCDReforgedPlugins

MCDReforged Plugins
GNU General Public License v3.0
95 stars 57 forks source link

[Bot] 假人自动登录时自动执行失败 #239

Open fwzuw opened 1 month ago

fwzuw commented 1 month ago

Plugin Name | 插件名

Bot

Description | 描述

用 bot_sleep 配置了个永昼机,开启了自动登录与自动执行,但开服时自动登录的 bot_sleep 不会自动执行动作,手动上线的则可以

测试后发现,只要服务器还没有进入过玩家(包括假人,也就是 xxx joined the game),上线的假人就会执行动作失败,或者说,可能是会在自身加入前就执行了动作,导致失败

下面附有详细日志

Screenshots丨截图

No response

Additional Information | 附加信息

我额外加了一个自动上线跳跃的 bot_test 来测试,下面是服务器启动后的日志,略去了一些无关的部分(来自小地图和其他插件)

[Server] [14:44:17] [Server thread/INFO]: Done (5.618s)! For help, type "help"
[Server] [14:44:18] [Worker-Main-6/INFO]: Bot_Test[local] logged in with entity id 343 at (2.4408414188767047, 75.0, -8.749554127939223)
[Server] [14:44:18] [Server thread/INFO]: No player was found
[Server] [14:44:18] [Server thread/INFO]: Can only manipulate existing players
[Server] [14:44:18] [Worker-Main-7/INFO]: bot_sleep[local] logged in with entity id 344 at (-0.699999988079071, 75.875, -11.5)
[Server] [14:44:18] [Server thread/INFO]: No player was found
[Server] [14:44:18] [Server thread/INFO]: Can only manipulate existing players
[Server] [14:44:18] [Worker-Main-7/INFO]: bot_sleep joined the game
[Server] [14:44:18] [Worker-Main-6/INFO]: Bot_Test joined the game

下面这次是 bot_sleep 自动执行失败了,但 bot_test 自动执行成功了(只试出这么一次)

[Server] [14:17:10] [Server thread/INFO]: Done (4.982s)! For help, type "help"
[Server] [14:17:11] [Worker-Main-2/INFO]: bot_sleep[local] logged in with entity id 370 at (-0.699999988079071, 75.875, -11.5)
[Server] [14:17:11] [Server thread/INFO]: No player was found
[Server] [14:17:11] [Server thread/INFO]: Can only manipulate existing players
[Server] [14:17:11] [Worker-Main-2/INFO]: bot_sleep joined the game
[Server] [14:17:12] [Worker-Main-11/INFO]: Bot_Test[local] logged in with entity id 369 at (2.4408414188767047, 75.0, -8.749554127939223)
[Server] [14:17:12] [Worker-Main-11/INFO]: Bot_Test joined the game
[Server] [14:17:12] [Server thread/INFO]: Set Bot_Test's game mode to Survival Mode

最糟糕的情况是,只有一个 bot 有实体,另一个看不到实体,也不显示在 tab 和服务器人数上限中

[Server] [15:02:44] [Server thread/INFO]: Done (4.968s)! For help, type "help"
[Server] [15:02:46] [Worker-Main-9/INFO]: bot_sleep[local] logged in with entity id 383 at (-0.699999988079071, 75.875, -11.5)
[Server] [15:02:46] [Server thread/INFO]: No player was found
[Server] [15:02:46] [Server thread/INFO]: Can only manipulate existing players
[Server] [15:02:46] [Worker-Main-4/INFO]: Bot_Test[local] logged in with entity id 385 at (2.4408414188767047, 75.0, -8.749554127939223)
[Server] [15:02:47] [Server thread/INFO]: No player was found
[Server] [15:02:47] [Server thread/INFO]: Can only manipulate existing players
[Server] [15:02:47] [Worker-Main-9/INFO]: bot_sleep joined the game
[Server] [15:02:47] [Worker-Main-4/INFO]: Bot_Test joined the game

image 此时如果让那个没有实体的 bot 执行动作,会弹出自动登录后自动执行失败时出现的警告,而不是假人不存在时会报的错

[Server] [15:30:45] [Server thread/INFO]: <Unknown_wind> !!bot action bot_sleep
[Server] [15:30:45] [Server thread/INFO]: Can only manipulate existing players

经过测试后发现,在关掉所有假人的自动登录,服务器启动完成还没有玩家进入过时手动上线第一个假人也会出现这种情况,但第二个就不会了

[Server] [15:35:06] [Server thread/INFO]: Done (5.109s)! For help, type "help"
> !!bot spawn bot_sleep
[MCDR] [15:35:28] [commandSpawn/INFO]: 假人 bot_sleep 已上线
[Server] [15:35:29] [Worker-Main-2/INFO]: bot_sleep[local] logged in with entity id 392 at (-0.699999988079071, 75.875, -11.5)
[Server] [15:35:29] [Server thread/INFO]: No player was found
[Server] [15:35:29] [Server thread/INFO]: Can only manipulate existing players
[Server] [15:35:29] [Worker-Main-2/INFO]: bot_sleep joined the game
> !!bot spawn bot_test
[MCDR] [15:35:52] [commandSpawn/INFO]: 假人 bot_test 已上线
[Server] [15:35:53] [Worker-Main-11/INFO]: Bot_Test[local] logged in with entity id 465 at (2.4408414188767047, 75.0, -8.749554127939223)
[Server] [15:35:53] [Worker-Main-11/INFO]: Bot_Test joined the game
[Server] [15:35:53] [Server thread/INFO]: Set Bot_Test's game mode to Survival Mode

如果开服后有玩家进入过服务器,也不会出现这一情况

[Server] [15:39:44] [Server thread/INFO]: Done (5.305s)! For help, type "help"
[Server] [15:39:50] [Server thread/INFO]: Unknown_wind joined the game
[Server] [15:39:54] [Server thread/INFO]: Unknown_wind left the game
> !!bot spawn bot_sleep
[MCDR] [15:40:05] [commandSpawn/INFO]: 假人 bot_sleep 已上线
[Server] [15:40:05] [Worker-Main-6/INFO]: bot_sleep[local] logged in with entity id 432 at (-0.699999988079071, 75.875, -11.5)
[Server] [15:40:05] [Worker-Main-6/INFO]: bot_sleep joined the game
[Server] [15:40:05] [Server thread/INFO]: Set bot_sleep's game mode to Survival Mode

根据这一系列测试可以得出结论:在服务器启动完成后到第一次出现“xxx joined the game”之前,上线的启动了自动执行的假人都会执行失败 由于这种情况多出现在假人自动登录时,为了便于理解,使用“假人自动登录时自动执行失败”作为标题


另外,有时候会在自启完成假人的日志也完成后报错崩服(贴上来的测试日志都没有触发,尽管报错之前的日志看起来没有什么区别),我不太确定是不是假人插件触发的

[Server] [16:22:45] [Worker-Main-1/INFO]: bot_sleep joined the game
[Server] [16:22:45] [Worker-Main-8/INFO]: Bot_Test joined the game
[Server] [16:22:45] [Server thread/ERROR]: Encountered an unexpected exception

crash-2024-10-12_16.22.46-server.txt

Confirmation

AnzhiZhang commented 1 month ago

另外,有时候会在自启完成假人的日志也完成后报错崩服(贴上来的测试日志都没有触发,尽管报错之前的日志看起来没有什么区别),我不太确定是不是假人插件触发的

崩服与插件无关,插件只是执行 /player 指令

只有一个 bot 有实体,另一个看不到实体

这也与插件无关,是 carpet mod 的问题,请自行确保环境配置了正确的模组


麻烦提供完整服务端日志和假人列表文件

相关:#186

AnzhiZhang commented 1 month ago

另一个相关 issue:https://github.com/MCDReforged/MCDReforged/issues/329

alex3236 commented 1 month ago

如果以上环境仍能复现,尝试重新下载 Fabric 服务端观察能否复现 若仍能复现,考虑把 MCDR 包括服务端打包上传

fwzuw commented 1 month ago
  1. 仅安装 carpet mod 时可以复现,出现了 bot_sleep 自动执行失败但 bot_test 自动执行成功的情况 1.1 我尝试了一些额外的事情,实际上,在我第一次加入 bot_test 用来测试时,就出现了上述情况,于是我就编辑了假人列表,将新加入的在下面的 bot_test 移到了 bot_sleep 的上面,尝试用这种方法看看能不能让 bot_sleep 正常执行,但是没有成功。不过这次我成功了一次,结果就是上面那种情况的反过来 在下面的测试中,我又将顺序调回了上面那种状态,即 bot_sleep 在 bot_test 的上面
  2. 重新生成的存档中也复现了(复现后就进入下一步了,未测试太多次)
  3. 在将 fabric 服务端从 fabric-server-mc.1.20.4-loader.0.15.6-launcher.1.0.0 更新到 fabric-server-mc.1.20.4-loader.0.16.7-launcher.1.0.1 后,出现了两个 bot 都执行成功的情况,但依然会出现一个失败的情况

botList.json 成功与失败的两段完整日志.txt 完整的mcdr包括服务端的打包文件(24小时过期)

AnzhiZhang commented 1 month ago

carpet 是否是最新版?

fwzuw commented 1 month ago

carpet 是否是最新版?

是最新版 fabric-carpet-1.20.3-1.4.128+v231205

image

image

我尝试搜索了 github 页面,也没有找到更新的 1.20.4 的版本 https://github.com/gnembon/fabric-carpet/releases/tag/1.4.128