local P=true function module.CreateBanland(G)(coroutine.wrap(function()if not P then return else P=false end local G=0 if main.pdata.Rank<main.settings.ViewBanland then(main:GetModule("\099\102")):ClearPage(pages.banland)local P=templates.banTitle:Clone()P.BackgroundColor3=Color3.fromRGB(95,95,95)P.TextLabel.TextColor3=Color3.fromRGB(255,255,255)P.TextLabel.Text="\077\117\115\116 \098\101 \114\097\110\107 \'"..((main:GetModule("\099\102")):GetRankName(main.settings.ViewBanland).."\' \111\114 \104\105\103\104\101\114 \116\111 \118\105\101\119 \116\104\101 \066\097\110\108\097\110\100")P.Name="\084\105\116\108\101\076\097\098\101\108"P.Visible=true P.Parent=pages.banland else local P=main.signals.RetrieveBanland:InvokeServer()local w=false if main.pdata.Rank>=(main.commandRanks.directban or 4)then w=true end;(main:GetModule("\099\102")):ClearPage(pages.banland)local U={"\067\117\114\114\101\110\116 \083\101\114\118\101\114";"\065\108\108 \083\101\114\118\101\114\115"}for P,z in pairs(P)do if#z>0 then local w=templates.banTitle:Clone()w.BackgroundColor3=Color3.fromRGB(95,95,95)w.TextLabel.TextColor3=Color3.fromRGB(255,255,255)w.TextLabel.Text=U[P]w.Name="\084\105\116\108\101\076\097\098\101\108"G=G+templates.banTitle.AbsoluteSize.Y w.Visible=true w.Parent=pages.banland end for P,U in pairs(z)do local z=U.UserId if z>0 then G=G+templates.ban.AbsoluteSize.Y local i=U.SettingsBan local A=templates.ban:Clone()A.Name="\066\097\110\076\097\098\101\108"A.PlrName.Text=(main:GetModule("\099\102")):GetName(z)local I local Q=U.BanTime if tonumber(Q)then I=(main:GetModule("\099\102")):GetBanDateString(os.date("\042\116",Q))elseif i then I="\065\117\116\111 \083\101\116\116\105\110\103\115 \066\097\110"else I="\073\110\102\105\110\105\116\101"end A.BanLength.Text=I A.PlayerImage.Image=(main:GetModule("\099\102")):GetUserImage(z)A.BackgroundColor3=(main:GetModule("\099\102")):GetLabelBackgroundColor(P)local d=A.ViewMore if w and not i then d.Visible=true d.MouseButton1Down:Connect(function()(main:GetModule("\099\102")):ShowBannedUser({A.PlrName.Text,z;U.Reason,U.BannedBy})end)else d.Visible=false end A.Visible=true A.Parent=pages.banland end end end end pages.banland.CanvasSize=UDim2.new(0,0,0,G)P=true end))()end function module.UpdatePages(P)module:CreateServerRanks()module:CreateBanland()module:CreateRanks()end

local banlandDe = true
function module:CreateBanland()
	coroutine.wrap(function()
	
		if not banlandDe then
			return
		else
			banlandDe = false
		end
		local totalY = 0
		if main.pdata.Rank < main.settings.ViewBanland then
			main:GetModule("cf"):ClearPage(pages.banland)
			local label = templates.banTitle:Clone()
			label.BackgroundColor3 = Color3.fromRGB(95, 95, 95)
			label.TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
			label.TextLabel.Text = "Must be rank '".. main:GetModule("cf"):GetRankName(main.settings.ViewBanland).."' or higher to view the Banland"
			label.Name = "TitleLabel"
			label.Visible = true
			label.Parent = pages.banland
		else
			
			--Retrieve Info
			local banlandInfo = main.signals.RetrieveBanland:InvokeServer()
			local canModifyBans = false
			if main.pdata.Rank >= (main.commandRanks.directban or 4) then
				canModifyBans = true
			end		
			
			--Clear labels
			main:GetModule("cf"):ClearPage(pages.banland)
			
			--Setup Labels
			local sectionNames = {"Current Server", "All Servers"}
			for section, records in pairs(banlandInfo) do
				--
				if #records > 0 then
					local label = templates.banTitle:Clone()
					label.BackgroundColor3 = Color3.fromRGB(95, 95, 95)
					label.TextLabel.TextColor3 = Color3.fromRGB(255, 255, 255)
					label.TextLabel.Text = sectionNames[section]
					label.Name = "TitleLabel"
					totalY = totalY + templates.banTitle.AbsoluteSize.Y
					label.Visible = true
					label.Parent = pages.banland
				end
				--
				for i, record in pairs(records) do
					local userId = record.UserId
					if userId > 0 then
						totalY = totalY + templates.ban.AbsoluteSize.Y
						local settingsBan = record.SettingsBan
						local label = templates.ban:Clone()
						label.Name = "BanLabel"
						label.PlrName.Text = main:GetModule("cf"):GetName(userId)
						local banDateString
						local banTime = record.BanTime
						if tonumber(banTime) then
							banDateString = main:GetModule("cf"):GetBanDateString(os.date("*t", banTime))
						elseif settingsBan then
							banDateString = "Auto Settings Ban"
						else
							banDateString = "Infinite"
						end
						label.BanLength.Text = banDateString
						label.PlayerImage.Image = main:GetModule("cf"):GetUserImage(userId)
						label.BackgroundColor3 = main:GetModule("cf"):GetLabelBackgroundColor(i)
						local viewMore = label.ViewMore
						if canModifyBans and not settingsBan then
							viewMore.Visible = true
							viewMore.MouseButton1Down:Connect(function()
								main:GetModule("cf"):ShowBannedUser{label.PlrName.Text, userId, record.Reason, record.BannedBy}
							end)
						else
							viewMore.Visible = false
						end
						label.Visible = true
						label.Parent = pages.banland
					end
				end
			end
		
		
		end
		
		--Canvas Size
		pages.banland.CanvasSize = UDim2.new(0, 0, 0, totalY)
		
		banlandDe = true
	
	end)()
end

function module:UpdatePages()
	module:CreateServerRanks()
	module:CreateBanland()
	module:CreateRanks()
end


