View Javadoc

1   package org.dfdaemon.il2.api.command.request;
2   
3   import org.dfdaemon.il2.api.command.Command;
4   import org.dfdaemon.il2.api.command.reply.NoReply;
5   
6   /**
7    * @author aka50
8    */
9   public class ChatCmd extends Command<NoReply> {
10      public String toWho;
11      public String what;
12      public Type type;
13  
14      public enum Type {
15          ALL,
16          ARMY,
17          PLAYER
18      }
19  
20  
21      public ChatCmd() {
22      }
23  
24  
25      public ChatCmd(String toWho, String what, Type type) {
26          this.toWho = toWho;
27          this.what = what;
28          this.type = type;
29      }
30  
31  
32      public boolean equals(Object o) {
33          if (this == o) return true;
34          if (o == null || getClass() != o.getClass()) return false;
35  
36          ChatCmd chatCmd = (ChatCmd) o;
37  
38          if (toWho != null ? !toWho.equals(chatCmd.toWho) : chatCmd.toWho != null) return false;
39          if (type != chatCmd.type) return false;
40          return !(what != null ? !what.equals(chatCmd.what) : chatCmd.what != null);
41  
42      }
43  
44      public int hashCode() {
45          int result;
46          result = (toWho != null ? toWho.hashCode() : 0);
47          result = 31 * result + (what != null ? what.hashCode() : 0);
48          result = 31 * result + (type != null ? type.hashCode() : 0);
49          return result;
50      }
51  
52      public String toString() {
53          final StringBuilder sb = new StringBuilder();
54          sb.append("ChatCmd");
55          sb.append("{");
56          sb.append("toWho='").append(toWho).append('\'');
57          sb.append(", what='").append(what).append('\'');
58          sb.append('}');
59          return sb.toString();
60      }
61  }