Server: get rid of matchPlayer()

the functionality of this API method is too specialized to be of any practical use.
In addition, a search on Poggit reveals that the only uses of this API method are abuses or incorrect uses anyway.
This commit is contained in:
Dylan K. Taylor 2020-12-13 21:38:11 +00:00
parent c0438f1ddb
commit 9e11cc03de
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D

View File

@ -634,27 +634,6 @@ class Server{
return null;
}
/**
* Returns a list of online players whose names contain with the given string (case insensitive).
* If an exact match is found, only that match is returned.
*
* @return Player[]
*/
public function matchPlayer(string $partialName) : array{
$partialName = strtolower($partialName);
$matchedPlayers = [];
foreach($this->getOnlinePlayers() as $player){
if(strtolower($player->getName()) === $partialName){
$matchedPlayers = [$player];
break;
}elseif(stripos($player->getName(), $partialName) !== false){
$matchedPlayers[] = $player;
}
}
return $matchedPlayers;
}
/**
* Returns the player online with the specified raw UUID, or null if not found
*/