Change TSPlayer.FindByNameOrID to keep searching
Currently, the TSPlayer FindbyNameOrID method aborts if it finds an "exact match" based on this criteria: 1. If the player ID is on the server, it must be the thing we're looking for. Therefore, return that. 2. If the case sensitive "exact match" is on the server that isn't an ID, that must be what we're looking for. Therefore, return that. 3. Just yolo and downcase everything and return any number of matching players next. This commit changes the behavior because some players have been joining servers with ambiguous names, like `1`. In the current system, this player is difficult to query because they're an "ID" and therefore an exact match will be returned even if a player name exists that matches the criteria. This also alleviates the issue of a case exact match falling down the same trap. It's ambiguous enough in all of these situations that an admin should just be using a player ID instead.`
This commit is contained in:
parent
00f10fed06
commit
09fe254f17
2 changed files with 2 additions and 4 deletions
|
|
@ -92,7 +92,7 @@ namespace TShockAPI
|
|||
TSPlayer player = TShock.Players[plrID];
|
||||
if (player != null && player.Active)
|
||||
{
|
||||
return new List<TSPlayer> { player };
|
||||
found.Add(player);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -101,9 +101,6 @@ namespace TShockAPI
|
|||
{
|
||||
if (player != null)
|
||||
{
|
||||
// Must be an EXACT match
|
||||
if (player.Name == plr)
|
||||
return new List<TSPlayer> { player };
|
||||
if (player.Name.ToLower().StartsWith(plrLower))
|
||||
found.Add(player);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue