summaryrefslogtreecommitdiff
path: root/src/main/java/com/nemez/cmdmgr/util/Type.java
blob: f2fc37b1d94615c21c4b655ace92b66188e889a7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package com.nemez.cmdmgr.util;

public enum Type {

	BOTH, PLAYER, CONSOLE, NOBODY;
	
	public static Type parse(String string) {
		if (string.equals("both")) {
			return BOTH;
		}else if (string.equals("player")) {
			return PLAYER;
		}else if (string.equals("console")) {
			return CONSOLE;
		}else if (string.equals("nobody")) {
			return NOBODY;
		}else{
			return null;
		}
	}
	
	public static String get(Type t) {
		if (t == null) {
			return "null";
		}
		switch (t) {
		case BOTH:
			return "both";
		case PLAYER:
			return "player";
		case CONSOLE:
			return "console";
		case NOBODY:
			return "nobody";
		}
		return "null";
	}
}