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
|
|
@ -17,6 +17,7 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
|
|||
* Fixed torchgod settings to include whether or not torchgod has been fought by the player before and respect `usingBiomeTorches` setting. (@Quinci135)
|
||||
* Fixed /worldmode not synchronising data to players after updating the world state (@bartico6, @Arthri)
|
||||
* Added `OnSendNetData` hook to TSAPI, which enables developers to intercept traffic being sent from the server to clients. (@Stealownz)
|
||||
* Changed `TSPlayer.FindByNameOrID` so that it will continue searching for players and return a list of many players whem ambiguous matches exist in all cases. Specifically, this avoids a scenario where a griefer names themselves `1` and is difficult to enact justice on, because their name will not be found by the matching system used to kick players. (@hakusaro, @Onusai)
|
||||
|
||||
## TShock 4.5.3
|
||||
* Added permissions for using Teleportation Potions, Magic Conch, and Demon Conch. (@drunderscore)
|
||||
|
|
|
|||
|
|
@ -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