View Javadoc

1   package cz.cuni.amis.pogamut.defcon.consts;
2   
3   import java.util.HashMap;
4   import java.util.Map;
5   
6   import javabot.JBot;
7   
8   /**
9    * List of available chat channels to be passed.
10   * Used in SendChatMessageCommand.
11   * 
12   * @author Radek 'Black_Hand' Pibil
13   *
14   */
15  public enum ChatChannel {
16  	
17  	PUBLIC(JBot.CHATCHANNEL_PUBLIC),
18  	ALLIANCE(JBot.CHATCHANNEL_ALLIANCE),
19  	SPECTATORS(JBot.CHATCHANNEL_SPECTATORS);
20  	
21  	private static Map<Integer, ChatChannel> enums = new HashMap<Integer, ChatChannel>();
22  	
23  	public static ChatChannel getEnum(int id) {
24  		return enums.get(id);
25  	}
26  	
27  	static {
28  		for (ChatChannel item : ChatChannel.values()) {
29  			enums.put(item.id, item);
30  		}
31  	}
32  	
33  	public final int id;
34  	
35  	private ChatChannel(int id) {
36  		this.id = id;
37  	}
38  
39  }