function methods.InternalSendFilteredMessageWithFilterResult(J,S,z)local U=ShallowCopy(S)local K=U.FilterResult local t=J:GetPlayer()local v=""pcall(function()if U.IsFilterResult then if t then v=K:GetChatForUserAsync(t.UserId)else v=K:GetNonChatStringForBroadcastAsync()end else v=K end end)if UserFlagRemoveMessageOnTextFilterFailures then U.Message=v U.FilterResult=nil J:InternalSendFilteredMessage(U,z)else if#v>0 then U.Message=v U.FilterResult=nil J:InternalSendFilteredMessage(U,z)end end end function methods.InternalSendSystemMessage(J,S,z)local U,K=pcall(function()J:LazyFire("\101\082\101\099\101\105\118\101\100\083\121\115\116\101\109\077\101\115\115\097\103\101",S,z)if J.PlayerObj then J.EventFolder.OnNewSystemMessage:FireClient(J.PlayerObj,S,z)end end)if not U and K then print("\069\114\114\111\114 \115\101\110\100\105\110\103 \105\110\116\101\114\110\097\108 \115\121\115\116\101\109 \109\101\115\115\097\103\101\058 "..K)end end function methods.UpdateChannelNameColor(J,S,z)J:LazyFire("\101\067\104\097\110\110\101\108\078\097\109\101\067\111\108\111\114\085\112\100\097\116\101\100",S,z)if J.PlayerObj then J.EventFolder.ChannelNameColorUpdated:FireClient(J.PlayerObj,S,z)end end
--// This method is to be used with the new filter API. This method takes the
--// TextFilterResult objects and converts them into the appropriate string
--// messages for each player.
function methods:InternalSendFilteredMessageWithFilterResult(inMessageObj, channelName)
	local messageObj = ShallowCopy(inMessageObj)

	local oldFilterResult = messageObj.FilterResult
	local player = self:GetPlayer()

	local msg = ""
	pcall(function()
		if messageObj.IsFilterResult then
			if player then
				msg = oldFilterResult:GetChatForUserAsync(player.UserId)
			else
				msg = oldFilterResult:GetNonChatStringForBroadcastAsync()
			end
		else
			msg = oldFilterResult
		end
	end)

	--// Messages of 0 length are the result of two users not being allowed
	--// to chat, or GetChatForUserAsync() failing. In both of these situations,
	--// messages with length of 0 should not be sent.

	if UserFlagRemoveMessageOnTextFilterFailures then
		messageObj.Message = msg
		messageObj.FilterResult = nil
		self:InternalSendFilteredMessage(messageObj, channelName)
	else
		if #msg > 0 then
			messageObj.Message = msg
			messageObj.FilterResult = nil
			self:InternalSendFilteredMessage(messageObj, channelName)
		end
	end
end

function methods:InternalSendSystemMessage(messageObj, channelName)
	local success, err = pcall(function()
		self:LazyFire("eReceivedSystemMessage", messageObj, channelName)
		if self.PlayerObj then
			self.EventFolder.OnNewSystemMessage:FireClient(self.PlayerObj, messageObj, channelName)
		end
	end)
	if not success and err then
		print("Error sending internal system message: " .. err)
	end
end

function methods:UpdateChannelNameColor(channelName, channelNameColor)
	self:LazyFire("eChannelNameColorUpdated", channelName, channelNameColor)
	if self.PlayerObj then
		self.EventFolder.ChannelNameColorUpdated:FireClient(self.PlayerObj, channelName, channelNameColor)
	end
end
