return function(g)local j=g.Server local D=g.Service local v=j.Settings local F,G,P,B,X,c,T,q,A,i,u local function t()F=j.Functions P=j.Admin B=j.Anti X=j.Core c=j.HTTP T=j.Logs q=j.Remote A=j.Process i=j.Variables G=j.Commands u=j.Deps setmetatable(G,{__index=function(g,j)local D=P.CommandCache[j:lower()]if D then return rawget(G,D)end end,__newindex=function(g,j,D)rawset(G,j,D)if D and(type(D)=="\116\097\098\108\101"and(D.Commands and D.Prefix))then for g,v in next,D.Commands do P.PrefixCache[D.Prefix]=true P.CommandCache[(D.Prefix..v):lower()]=j end end end})T:AddLog("\083\099\114\105\112\116","\076\111\097\100\105\110\103 \067\111\109\109\097\110\100 \077\111\100\117\108\101\115\046\046\046")if j.CommandModules then for j,D in next,j.CommandModules:GetChildren()do local v=require(D)local F,P=pcall(v,g,getfenv())if F and(P and type(P)=="\116\097\098\108\101")then for g,j in next,P do G[g]=j end T:AddLog("\083\099\114\105\112\116","\076\111\097\100\101\100 \067\111\109\109\097\110\100 \077\111\100\117\108\101\058 "..D.Name)elseif not F then warn("\067\077\068\077\079\068\085\076\069 "..(D.Name.." \102\097\105\108\101\100 \116\111 \108\111\097\100\058"))warn(tostring(P))T:AddLog("\083\099\114\105\112\116","\076\111\097\100\105\110\103 \067\111\109\109\097\110\100 \077\111\100\117\108\101 \070\097\105\108\101\100\058 "..D.Name)end end end P.CacheCommands()T:AddLog("\083\099\114\105\112\116","\067\111\109\109\097\110\100\115 \077\111\100\117\108\101 \073\110\105\116\105\097\108\105\122\101\100")end j.Commands={Init=t}end

return function(Vargs)
	local server = Vargs.Server;
	local service = Vargs.Service;
	local Settings = server.Settings
	local Functions, Commands, Admin, Anti, Core, HTTP, Logs, Remote, Process, Variables, Deps
	
	local function Init()
		Functions = server.Functions;
		Admin = server.Admin;
		Anti = server.Anti;
		Core = server.Core;
		HTTP = server.HTTP;
		Logs = server.Logs;
		Remote = server.Remote;
		Process = server.Process;
		Variables = server.Variables;
		Commands = server.Commands;
		Deps = server.Deps;

		--// Automatic New Command Caching and Ability to do server.Commands[":ff"]
		setmetatable(Commands, {
			__index = function(self, ind)
				local targInd = Admin.CommandCache[ind:lower()]
				if targInd then
					return rawget(Commands, targInd)
				end
			end;

			__newindex = function(self, ind, val)
				rawset(Commands, ind, val)
				if val and type(val) == "table" and val.Commands and val.Prefix then
					for i,cmd in next,val.Commands do
						Admin.PrefixCache[val.Prefix] = true;
						Admin.CommandCache[(val.Prefix..cmd):lower()] = ind;
					end
				end
			end;
		})
		
		Logs:AddLog("Script", "Loading Command Modules...")
		
		--// Load command modules
		if server.CommandModules then
			for i,module in next,server.CommandModules:GetChildren() do
				local func = require(module)
				local ran,tab = pcall(func, Vargs, getfenv())
				
				if ran and tab and type(tab) == "table" then
					for ind,cmd in next,tab do
						Commands[ind] = cmd;
					end
					
					Logs:AddLog("Script", "Loaded Command Module: ".. module.Name)
				elseif not ran then
					warn("CMDMODULE ".. module.Name .. " failed to load:")
					warn(tostring(tab))
					Logs:AddLog("Script", "Loading Command Module Failed: ".. module.Name)
				end
			end
		end
		
		--// Cache commands
		Admin.CacheCommands();
		
		Logs:AddLog("Script", "Commands Module Initialized")
	end;

	server.Commands = {
		Init = Init;
	};
end
