Beispiel #1
0
    public void TryRemoveMentor(string userID)
    {
        if (IsMentor(userID) == false)
        {
            return;
        }

        mentorUsers.Remove(userID);

        var player = GetByUserID(userID);

        if (player != null)
        {
            MentorEnableMessage.Send(player.Connection, string.Empty, false);

            CheckForLoggedOffMentor(userID, player.Username);
        }

        //Read file to see if already in file
        var fileContents = File.ReadAllLines(mentorsPath);

        if (fileContents.Contains(userID) == false)
        {
            return;
        }

        //Remove from file if they are in there
        var newContents = fileContents.Where(line => line != userID);

        File.WriteAllLines(mentorsPath, newContents);
    }
Beispiel #2
0
    public static MentorEnableMessage Send(NetworkConnection player, string mentorToken)
    {
        UIManager.Instance.mentorChatButtons.ServerUpdateAdminNotifications(player);
        MentorEnableMessage msg = new MentorEnableMessage {
            MentorToken = mentorToken
        };

        msg.SendTo(player);

        return(msg);
    }