GetOnlinePlayers() does not return an indexed array #2

已關閉
Ad50012018-07-16 11:42:08 +00:00建立 · 0 comment
管理員

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 指派給自己
登入 才能加入這對話。
未選擇標籤
未選擇里程碑
No project
No assignees
1 participant
訊息
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Ad5001/PlayerSelectors#2
No description provided.