GetOnlinePlayers() does not return an indexed array #2

已关闭
Ad50012018-07-16 11:42:08 +00:00创建 · 0 评论
管理员

Original issue #2 by Awzaw created at 2017-11-10T21:53:15Z

6a5ddcd42d/src/Ad5001/PlayerSelectors/selector/ClosestPlayer.php (L30)

This won't work because the array returned by GetOnlinePlayers() is not an indexed array, but an associative array with the players rawUUID as the key:

https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/Server.php#L2306

Also, your function needs to return an array with the name of the player, not the Player object.

Original issue [#2](https://github.com/Ad5001/PlayerSelectors/issues/2) by [Awzaw](https://github.com/Awzaw) created at 2017-11-10T21:53:15Z https://github.com/Ad5001/PlayerSelectors/blob/6a5ddcd42da3030fbe1e0356c3fbfea17e78657f/src/Ad5001/PlayerSelectors/selector/ClosestPlayer.php#L30 This won't work because the array returned by GetOnlinePlayers() is not an indexed array, but an associative array with the players rawUUID as the key: https://github.com/pmmp/PocketMine-MP/blob/master/src/pocketmine/Server.php#L2306 Also, your function needs to return an array with the name of the player, not the Player object.
Ad50012018-07-16 11:42:08 +00:00 指派给自己
Ad50012018-07-16 11:42:08 +00:00 关闭此工单
登录 并参与到对话中。
未选择标签
未选择里程碑
未指派成员
1 名参与者
通知
到期时间
到期日期无效或超出范围。请使用 'yyyy-mm-dd' 格式。

未设置到期时间。

依赖工单

没有设置依赖项。

参考:Ad5001/PlayerSelectors#2
没有提供说明。