@@ -16,17 +16,36 @@ public class KnockKnockProtocol {
16
16
public String processInput (String theInput ) {
17
17
String theOutput = "" ;
18
18
19
+ //only first time --> protocol
19
20
if (theInput == null ){
20
21
theOutput = "------------------------------\n "
21
22
+ "------------------------------\n "
22
23
+ "------------------------------\n "
23
- + "---------W e l c o m e--------\n "
24
+ + "---------" + ANSI_GREEN + " W e l c o m e" + ANSI_RESET + " --------\n "
24
25
+ "------------------------------\n "
25
26
+ "------------------------------\n "
26
27
+ "------------------------------\n " ;
27
28
theOutput += this .getCommandsAvailable ();
28
29
}else {
29
30
switch (theInput ) {
31
+ case "0" :
32
+ theOutput = "Hello ma' friend!" ;
33
+ break ;
34
+ case "1" :
35
+ theOutput = "John Tell me that today is raining" ;
36
+ break ;
37
+ case "2" :
38
+ theOutput = "HAHHAA!" ;
39
+ break ;
40
+ case "3" :
41
+ theOutput = "¡Good Jaming!" ;
42
+ break ;
43
+ case "4" :
44
+ theOutput = this .getCommandsAvailable ();
45
+ break ;
46
+ case "5" :
47
+ theOutput = "Bye ma' friend!" ;
48
+ break ;
30
49
default :
31
50
theOutput += this .getCommandsAvailable ();
32
51
break ;
@@ -39,10 +58,12 @@ public String processInput(String theInput) {
39
58
private String getCommandsAvailable (){
40
59
String outString = "" ;
41
60
outString = ANSI_YELLOW + "Comandos disponibles:" + ANSI_RESET + "\n " ;
42
- outString += "[0] \n "
43
- + "[1] \n "
44
- + "[2] \n "
45
- + "[3] \n " ;
61
+ outString += ANSI_PURPLE +"[0]" +ANSI_RESET +" Say Hello Server\n "
62
+ + ANSI_PURPLE +"[1]" +ANSI_RESET +" Call to John Doe\n "
63
+ + ANSI_PURPLE +"[2]" +ANSI_RESET +" Make a laugh man\n "
64
+ + ANSI_PURPLE +"[3]" +ANSI_RESET +" Play some good..\n "
65
+ + ANSI_PURPLE +"[4]" +ANSI_RESET +" Show commands..\n "
66
+ + ANSI_PURPLE +"[5]" +ANSI_RESET +" Exit...\n " ;
46
67
return outString ;
47
68
}
48
69
}
0 commit comments