Improve handling of offline players during events
还没有人认领这个 Issue。
评估
调研方向
先阅读 AbstractEvent、MCPlayerEvent、Static.GetPlayer() 和 Static.GetCommandSender(),然后比较 player_login 和 player_spawn 的处理方式。明确 offline 玩家和 missing-byName 玩家的预期行为,考虑扩展,并添加全面的覆盖;完成的标准是明确地定义并验证事件上下文中的查找以及 bind-environment 行为。
由索引模型根据 Issue 内容生成。
描述
Some events pass a player object for players that are missing from the player list during the event. This causes a CREPlayerOfflineException when getting these players from Static.GetPlayer() or Static.GetCommandSender(), as well as made it tricky to pass the player to the bind environment. This was originally solved by hijacking the player injection system used for capture_runas(), but it wasn't designed for this.
Now, after some changes, the player is added to the environment from MCPlayerEvent instead, but injection is still used for getting players by name (and as a fallback for environment adding). But this happens in AbstractEvent, and this is undesirable as it mixes MC and MethodScript stuff. This will need to be changed some day in the future, but extensions would need to be considered.
Two events use injection still: player_login, where the player is not yet added to the player list at all; and player_spawn where the player is missing from the byName player map but not the byUUID player map (byUUID determines whether the player is "online" or not), which means they're technically online but Static.GetPlayer() can't find them without injection. I consider the player_spawn situation a bug, so it might be better to move the workaround for this to the bukkit abstraction layer.
As for player_login, the player is technically offline, so I'm not sure what the expectation should be here. Due to this, currently you can run functions from player context but not by name, except functions that take a CommandSender instead. (e.g. has_permission(<playerName>, <permissionNode>)) We could change Static.GetPlayer() to take an environment object for situations like this (is player_login the only one?), but that'll affect a lot of functions and some will malfunction in unknown ways for truly offline players. I haven't done a comprehensive test.
- 主要语言
- Java
- 星标
- 128
- 派生
- 70
- PR 合并指标
- 30 天内没有已合并 PR
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
EngineHub/CommandHelper 的其他 Issue
-
discussion wanted documentation
难度 5/5 一周以上 新手友好度 25/100
EngineHub/CommandHelper#1403 ·
-
bug
难度 4/5 3-5 天 新手友好度 35/100
EngineHub/CommandHelper#1354 ·
-
bug
难度 4/5 3-5 天 新手友好度 45/100
EngineHub/CommandHelper#1349 · 3 条评论 ·
-
bug
难度 5/5 一周以上 新手友好度 25/100
EngineHub/CommandHelper#1341 · 2 条评论 ·
-
bug discussion wanted
难度 4/5 3-5 天 新手友好度 42/100
EngineHub/CommandHelper#1338 · 2 条评论 ·
查看 EngineHub/CommandHelper 的全部 Issue
相似的 Issue
-
documentation
难度 2/5 1-3 小时 新手友好度 65/100
inu-appcenter/memorIN-backend#288 ·
-
难度 2/5 1-3 小时 新手友好度 65/100
-
frontend maui-pilot pilot-ask question
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100
-
area/plugin
难度 2/5 1-3 小时 新手友好度 75/100
kestra-io/plugin-kestra#190 ·