Wyświetl nazwy wszystkich dokumentów .txt w bieżącym (lub określonym) katalogu

Mam więc następujący kod (który został bezwstydnie skopiowany z samouczka, aby móc posortować podstawy), w którym prosi on gracza o załadowanie ich gry (tekstowej gry przygodowej), ale potrzebuję sposobu na wyświetlenie wszystkich zapisane gry w katalogu. Nie mogę martwić się o bieżący katalog. Oto mój kod:

public void load(Player p){
        Sleep s = new Sleep();
        long l = 3000;

        Scanner i = new Scanner(System.in);
        System.out.println("Enter the name of the file you wish to load: ");
        String username = i.next();
        File f = new File(username +".txt");
        if(f.exists()) {
            System.out.println("File found! Loading game....");
            try {
                //information to be read and stored
                String name;
                String pet;
                boolean haspet;

                //Read information that's in text file
                BufferedReader reader = new BufferedReader(new FileReader(f));
                name = reader.readLine();
                pet = reader.readLine();
                haspet = Boolean.parseBoolean(reader.readLine());
                reader.close();

                //Set info
                Player.setUsername(name);
                Player.setPetName(pet);
                Player.setHasPet(haspet);

                //Read the info to player
                System.out.println("Username: "+ p.getUsername());
                s.Delay(l);
                System.out.println("Pet name: "+ p.getPetName());
                s.Delay(l);
                System.out.println("Has a pet: "+ p.isHasPet());

            } catch(Exception e){
                e.printStackTrace();
            }
            }
    }

questionAnswers(3)

yourAnswerToTheQuestion