Example #1
0
        private void replyCommand(BasePlayer player, string command, string[] args)
        {
            if (!hasPermission(player, permissions.use))
            {
                PrintToChat(player, lang.GetMessage("noPermission", this, player.UserIDString));
                return;
            }

            Profile profile = ProfileData.getProfile(player.userID);

            if (profile == null)
            {
                return;
            }
            Conversation conversation = ConversationData.getConversation(profile.lastConversation);

            if (conversation == null)
            {
                PrintToChat(player, lang.GetMessage(msg.noRecentMessages.ToString(), this, player.UserIDString));
                return;
            }

            StringBuilder sb = new StringBuilder();

            foreach (string s in args)
            {
                sb.Append($" {s}");
            }
            string text = sb.ToString().Trim();

            Message message = new Message(player, text, conversation);

            conversation.Messages.Add(message);
            ConversationData.save();

            message.deliver();
        }