Add fallback for finding players using tsi & tsn

This commit adds a fallback to address problems with FindByNameOrID
potentially returning ambiguous results. Now, in response to a multiple
match error, a player can specify tsi:[number] or tsn:[exact name] to
match a user ID or name exactly. This behaves analogous to the old
behavior of the search method.
This commit is contained in:
Lucas Nicodemus 2021-05-25 19:19:01 -07:00
parent 09fe254f17
commit e73ce17130
3 changed files with 38 additions and 10 deletions

View file

@ -2282,6 +2282,14 @@ namespace TShockAPI
args.Player.Kick("You have been Bounced.", true, true);
return true;
}
if (name.Trim().StartsWith("tsi:") || name.Trim().StartsWith("tsn:"))
{
TShock.Log.ConsoleDebug("GetDataHandlers / rejecting player for name prefix starting with tsi: or tsn:.");
args.Player.Kick("Illegal name: prefixes tsi: and tsn: are forbidden.", true, true);
return true;
}
if (args.Player.ReceivedInfo)
{
// Since Terraria 1.2.3 these character properties can change ingame.