document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1.  
  2. /**
  3. * Kelas ini adalah kelas utama dari aplikasi "World of Zuul".
  4.  * "World of Zuul" adalah game petualangan berbasis teks yang sangat sederhana.
  5.  *
  6.  * Class ini mengadakan pencacahan semua kata perintah yang dikenal dalam game.
  7.  * Digunakan untuk mengenali perintah saat diketik.
  8.  *
  9.  * @author  Muhammad Bagus Istighfar
  10.  * @version 0.1 - 17 November 2020
  11.  */
  12. public class CommandWords
  13. {
  14.     // a constant array that holds all valid command words
  15.     private static final String[] validCommands = {
  16.         "go", "quit", "help", "look"
  17.     };
  18.  
  19.     /**
  20.      * Constructor - initialise the command words.
  21.      */
  22.     public CommandWords()
  23.     {
  24.         // nothing to do at the moment...
  25.     }
  26.  
  27.     /**
  28.      * Check whether a given String is a valid command word.
  29.      * Return true if it is, false if it isn\'t.
  30.      * @return bool
  31.      */
  32.     public boolean isCommand(String aString)
  33.     {
  34.         for(int i = 0; i < validCommands.length; i++) {
  35.             if(validCommands[i].equals(aString))
  36.                 return true;
  37.         }
  38.         //if we get here, the string was not found in the commands
  39.         return false;
  40.     }
  41. }
');