public static bool MatchUserByPlayerName(string playerName, out TShockAPI.DB.UserAccount user, TSPlayer messagesReceiver = null) { user = null; TShockAPI.DB.UserAccount tsUser = TShock.UserAccounts.GetUserAccountByName(playerName); if (tsUser == null) { TSPlayer player; if (!TShockEx.MatchPlayerByName(playerName, out player, messagesReceiver)) { return(false); } user = TShock.UserAccounts.GetUserAccountByID(player.Account.ID); } else { user = tsUser; } return(true); }
public static bool MatchUserAccountNameByPlayerName(string playerName, out string exactName, TSPlayer messagesReceiver = null) { exactName = null; TShockAPI.DB.UserAccount tsUser = TShock.UserAccounts.GetUserAccountByName(playerName); if (tsUser == null) { TSPlayer player; if (!TShockEx.MatchPlayerByName(playerName, out player, messagesReceiver)) { return(false); } exactName = player.Account.Name; } else { exactName = tsUser.Name; } return(true); }