GetOnlinePlayers() does not return an indexed array #2
Etiketter
Ingen Etikett
Ingen Milsten
Ingen tilldelad
1 Deltagare
Notiser
Förfallodatum
Inget förfallodatum satt.
Beroenden
No dependencies set.
Reference: Ad5001/PlayerSelectors#2
Laddar…
Referens i nytt ärende
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
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.