mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-07-03 08:39:53 +00:00
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:
parent
c0438f1ddb
commit
9e11cc03de
@ -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
|
||||
*/
|
||||
|
Loading…
x
Reference in New Issue
Block a user