/*
Copyright (C) 2005 David Green <green@couchpotato.net>
All Rights Reserved.

This file is part of Aelfengard.

Aelfengard is proprietary software. You may not redistribute it without
prior written permission from the copyright holder.
*/

package server.login;

public class ChooseYesNoStep {

    private final LoginHandler handler;
    
    public ChooseYesNoStep(LoginHandler handler) {
        this.handler = handler;
    }
    
    public boolean run(String prompt) throws Exception {
        while (true) {
            handler.println(false, "");
            handler.println(false, prompt + " @10F[@10Ay@ZZZ/@10An@10F]@ZZZ ?");
            String line = handler.readLine().trim().toLowerCase();
            if ("y".equals(line) || "yes".equals(line)) {
                return true;
            }
            else if ("n".equals(line) || "no".equals(line)) {
                return false;
            }
            else {
                handler.println(false, "Please answer @10Fyes@ZZZ or @10Fno@ZZZ.");
            }
        }
    }

}