public void list(CommandSender sender, String[] args) {

		if(!sender.hasPermission(Permission.LIST.toString())) {
			sender.sendMessage(ChatColor.RED + "You don't have permission for the list command.");
			return;
		}
		
		int pageNumber;
		try {
			pageNumber = Integer.parseInt(args[0]);
		} catch(NullPointerException e) {
			// args is null
			pageNumber = 1;
		} catch(IndexOutOfBoundsException e) {
			// args is empty
			pageNumber = 1;
		} catch(NumberFormatException e) {
			// args[0] is not a number
			sender.sendMessage(ChatColor.RED + "Expected a page number.");
			return;
		}
		
		if(sender.hasPermission(Permission.ALLPAGES.toString())) {
			// sender has permission for all pages
			
			// send list of pages
			sendPageList(sender, pageNumber, config.getPageNames());
		}
		else {
			// sender has permission for some pages
			
			// only show the pages he has permission for
			Set<String> original = config.getPageNames();
			HashSet<String> pagesWithPermission = new HashSet<String>();
			for (String pageName : original) {
				String perm = Permission.convertPageNameToPermission(pageName);
				if(sender.hasPermission(perm)) {
					pagesWithPermission.add(pageName);
				}
			}
			
			// send list of pages
			sendPageList(sender, pageNumber, pagesWithPermission);
		}
	}