function Registry.RegisterCommandObject(G,l)for M in pairs(l)do if G.CommandMethods[M]==nil then error("\085\110\107\110\111\119\110 \107\101\121\047\109\101\116\104\111\100 \105\110 \099\111\109\109\097\110\100 "..((l.Name or"\117\110\107\110\111\119\110 \099\111\109\109\097\110\100")..("\058 "..M)))end end if l.Args then for M,C in pairs(l.Args)do for C in pairs(C)do if G.CommandArgProps[C]==nil then error(("\085\110\107\110\111\119\110 \112\114\111\112\101\114\121 \105\110 \099\111\109\109\097\110\100 \"\037\115\" \097\114\103\117\109\101\110\116 \035\037\100\058 \037\115"):format(l.Name or"\117\110\107\110\111\119\110",M,C))end end end end if RunService:IsClient()and(l.Data and l.Run)then error(("\073\110\118\097\108\105\100 \099\111\109\109\097\110\100 \105\109\112\108\101\109\101\110\116\097\116\105\111\110 \112\114\111\118\105\100\101\100 \102\111\114 \"\037\115\"\058 \"\068\097\116\097\" \097\110\100 \"\082\117\110\" \115\101\099\116\105\111\110\115 \097\114\101 \109\117\116\117\097\108\108\121 \101\120\099\108\117\115\105\118\101"):format(l.Name or"\117\110\107\110\111\119\110"))end if l.AutoExec and RunService:IsClient()then table.insert(G.AutoExecBuffer,l.AutoExec)G:FlushAutoExecBufferDeferred()end local M=G.Commands[l.Name:lower()]if M and M.Aliases then for l,M in pairs(M.Aliases)do G.Commands[M:lower()]=nil end elseif not M then G.CommandsArray[#G.CommandsArray+1]=l end G.Commands[l.Name:lower()]=l if l.Aliases then for M,C in pairs(l.Aliases)do G.Commands[C:lower()]=l end end end

function Registry:RegisterCommandObject (commandObject)
	for key in pairs(commandObject) do
		if self.CommandMethods[key] == nil then
			error("Unknown key/method in command " .. (commandObject.Name or "unknown command") .. ": " .. key)
		end
	end

	if commandObject.Args then
		for i, arg in pairs(commandObject.Args) do
			for key in pairs(arg) do
				if self.CommandArgProps[key] == nil then
					error(('Unknown propery in command "%s" argument #%d: %s'):format(commandObject.Name or "unknown", i, key))
				end
			end
		end
	end

	if RunService:IsClient() and commandObject.Data and commandObject.Run then
		error(('Invalid command implementation provided for "%s": "Data" and "Run" sections are mutually exclusive'):format(commandObject.Name or "unknown"))
	end

	if commandObject.AutoExec and RunService:IsClient() then
		table.insert(self.AutoExecBuffer, commandObject.AutoExec)
		self:FlushAutoExecBufferDeferred()
	end

	-- Unregister the old command if it exists...
	local oldCommand = self.Commands[commandObject.Name:lower()]
	if oldCommand and oldCommand.Aliases then
		for _, alias in pairs(oldCommand.Aliases) do
			self.Commands[alias:lower()] = nil
		end
	elseif not oldCommand then
		self.CommandsArray[#self.CommandsArray + 1] = commandObject
	end

	self.Commands[commandObject.Name:lower()] = commandObject

	if commandObject.Aliases then
		for _, alias in pairs(commandObject.Aliases) do
			self.Commands[alias:lower()] = commandObject
		end
	end
end
