Judge blocks gun restrictions