function Registry.RegisterCommandObject(X,v,u)for u in pairs(v)do if X.CommandMethods[u]==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 "..((v.Name or"\117\110\107\110\111\119\110 \099\111\109\109\097\110\100")..("\058 "..u)))end end if v.Args then for u,x in pairs(v.Args)do if type(x)=="\116\097\098\108\101"then for x in pairs(x)do if X.CommandArgProps[x]==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(v.Name or"\117\110\107\110\111\119\110",u,x))end end end end end if v.AutoExec and RunService:IsClient()then table.insert(X.AutoExecBuffer,v.AutoExec)X:FlushAutoExecBufferDeferred()end local x=X.Commands[v.Name:lower()]if x and x.Aliases then for v,u in pairs(x.Aliases)do X.Commands[u:lower()]=nil end elseif not x then X.CommandsArray[#X.CommandsArray+1]=v end X.Commands[v.Name:lower()]=v if v.Aliases then for u,x in pairs(v.Aliases)do X.Commands[x:lower()]=v end end end

function Registry:RegisterCommandObject (commandObject, fromCmdr)
	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
			if type(arg) == "table" then
				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
	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
