Ejemplo n.º 1
0
        public static bool MatchUserByPlayerName(string playerName, out TShockAPI.DB.User user, TSPlayer messagesReceiver = null)
        {
            user = null;
            TShockAPI.DB.User tsUser = TShock.Users.GetUserByName(playerName);
            if (tsUser == null)
            {
                TSPlayer player;
                if (!TShockEx.MatchPlayerByName(playerName, out player, messagesReceiver))
                {
                    return(false);
                }

                user = TShock.Users.GetUserByID(player.UserID);
            }
            else
            {
                user = tsUser;
            }

            return(true);
        }
Ejemplo n.º 2
0
        public static bool MatchUserAccountNameByPlayerName(string playerName, out string exactName, TSPlayer messagesReceiver = null)
        {
            exactName = null;
            TShockAPI.DB.User tsUser = TShock.Users.GetUserByName(playerName);
            if (tsUser == null)
            {
                TSPlayer player;
                if (!TShockEx.MatchPlayerByName(playerName, out player, messagesReceiver))
                {
                    return(false);
                }

                exactName = player.UserAccountName;
            }
            else
            {
                exactName = tsUser.Name;
            }

            return(true);
        }
Ejemplo n.º 3
0
        public static bool MatchUserIdByPlayerName(string playerName, out int userId, TSPlayer messagesReceiver = null)
        {
            userId = -1;
            TShockAPI.DB.UserAccount tsUser = TShock.UserAccounts.GetUserAccountByName(playerName);
            if (tsUser == null)
            {
                TSPlayer player;
                if (!TShockEx.MatchPlayerByName(playerName, out player, messagesReceiver))
                {
                    return(false);
                }

                userId = player.Account.ID;
            }
            else
            {
                userId = tsUser.ID;
            }

            return(true);
        }
Ejemplo n.º 4
0
 public static void SendTileSquareEx(this TSPlayer player, DPoint location, int size = 10)
 {
     TShockEx.SendTileSquareEx(player, location.X, location.Y, size);
 }