001 /** 002 * Implementation of the 'quit' user command. 003 * 004 * @author Michael Kolling and David J. Barnes 005 * @version 2011.07.31 006 */ 007 public class QuitCommand extends Command 008 { 009 /** 010 * Constructor for objects of class QuitCommand 011 */ 012 public QuitCommand() 013 { 014 } 015 016 /** 017 * "Quit" was entered. Check the argument to see whether 018 * we really quit the game. Return true, if we should quit, false 019 * otherwise. 020 */ 021 public boolean execute(Player player) 022 { 023 if(getSecondWord() == null) { 024 return true; 025 } 026 else { 027 System.out.println("I cannot quit that..."); 028 return false; 029 } 030 } 031 032 }