Represents various types of worlds that may exist
| 10 | * Represents various types of worlds that may exist |
| 11 | */ |
| 12 | public enum WorldType { |
| 13 | NORMAL("DEFAULT"), |
| 14 | FLAT("FLAT"), |
| 15 | LARGE_BIOMES("LARGEBIOMES"), |
| 16 | AMPLIFIED("AMPLIFIED"); |
| 17 | |
| 18 | private static final Map<String, WorldType> BY_NAME = Maps.newHashMap(); |
| 19 | private final String name; |
| 20 | |
| 21 | private WorldType(/*@NotNull*/ String name) { |
| 22 | this.name = name; |
| 23 | } |
| 24 | |
| 25 | /** |
| 26 | * Gets the name of this WorldType |
| 27 | * |
| 28 | * @return Name of this type |
| 29 | */ |
| 30 | @NotNull |
| 31 | public String getName() { |
| 32 | return name; |
| 33 | } |
| 34 | |
| 35 | /** |
| 36 | * Gets a WorldType by its name |
| 37 | * |
| 38 | * @param name Name of the WorldType to get |
| 39 | * @return Requested WorldType, or null if not found |
| 40 | */ |
| 41 | @Nullable |
| 42 | public static WorldType getByName(@NotNull String name) { |
| 43 | return BY_NAME.get(name.toUpperCase(Locale.ROOT)); |
| 44 | } |
| 45 | |
| 46 | static { |
| 47 | for (WorldType type : values()) { |
| 48 | BY_NAME.put(type.name, type); |
| 49 | } |
| 50 | } |
| 51 | } |
nothing calls this directly
no test coverage detected