001 package org.bukkit;
002
003 import com.google.common.collect.Maps;
004 import java.util.Map;
005
006 /**
007 * Represents various types of worlds that may exist
008 */
009 public enum WorldType {
010 NORMAL("DEFAULT"),
011 FLAT("FLAT"),
012 VERSION_1_1("DEFAULT_1_1"),
013 LARGE_BIOMES("LARGEBIOMES"),
014 AMPLIFIED("AMPLIFIED");
015
016 private final static Map<String, WorldType> BY_NAME = Maps.newHashMap();
017 private final String name;
018
019 private WorldType(String name) {
020 this.name = name;
021 }
022
023 /**
024 * Gets the name of this WorldType
025 *
026 * @return Name of this type
027 */
028 public String getName() {
029 return name;
030 }
031
032 /**
033 * Gets a Worldtype by its name
034 *
035 * @param name Name of the WorldType to get
036 * @return Requested WorldType, or null if not found
037 */
038 public static WorldType getByName(String name) {
039 return BY_NAME.get(name.toUpperCase());
040 }
041
042 static {
043 for (WorldType type : values()) {
044 BY_NAME.put(type.name, type);
045 }
046 }
047 }