TotalFreedomMod/src/me/StevenLawson/TotalFreedomMod/TFM_ConfigEntry.java

142 lines
4.7 KiB
Java
Raw Normal View History

2013-08-17 22:24:40 +00:00
package me.StevenLawson.TotalFreedomMod;
import java.util.List;
public enum TFM_ConfigEntry
{
ADMIN_ONLY_MODE(Boolean.class, "admin_only_mode"),
ALLOW_EXPLOSIONS(Boolean.class, "allow_explosions"),
ALLOW_FIRE_PLACE(Boolean.class, "allow_fire_place"),
ALLOW_FIRE_SPREAD(Boolean.class, "allow_fire_spread"),
ALLOW_FLUID_SPREAD(Boolean.class, "allow_fluid_spread"),
2013-08-17 22:24:40 +00:00
ALLOW_LAVA_DAMAGE(Boolean.class, "allow_lava_damage"),
ALLOW_LAVA_PLACE(Boolean.class, "allow_lava_place"),
ALLOW_TNT_MINECARTS(Boolean.class, "allow_tnt_minecarts"),
ALLOW_WATER_PLACE(Boolean.class, "allow_water_place"),
AUTO_ENTITY_WIPE(Boolean.class, "auto_wipe"),
AUTO_PROTECT_SPAWNPOINTS(Boolean.class, "auto_protect_spawnpoints"),
DISABLE_NIGHT(Boolean.class, "disable_night"),
DISABLE_WEATHER(Boolean.class, "disable_weather"),
GENERATE_FLATLANDS(Boolean.class, "generate_flatlands"),
LANDMINES_ENABLED(Boolean.class, "landmines_enabled"),
MOB_LIMITER_DISABLE_DRAGON(Boolean.class, "mob_limiter_disable_dragon"),
MOB_LIMITER_DISABLE_GHAST(Boolean.class, "mob_limiter_disable_ghast"),
MOB_LIMITER_DISABLE_GIANT(Boolean.class, "mob_limiter_disable_giant"),
MOB_LIMITER_DISABLE_SLIME(Boolean.class, "mob_limiter_disable_slime"),
MOB_LIMITER_ENABLED(Boolean.class, "mob_limiter_enabled"),
MP44_ENABLED(Boolean.class, "mp44_enabled"),
NUKE_MONITOR(Boolean.class, "nuke_monitor"),
PET_PROTECT_ENABLED(Boolean.class, "pet_protect_enabled"),
PREPROCESS_LOG_ENABLED(Boolean.class, "preprocess_log"),
PROTECTED_AREAS_ENABLED(Boolean.class, "protected_areas_enabled"),
TOSSMOB_ENABLED(Boolean.class, "tossmob_enabled"),
TWITTERBOT_ENABLED(Boolean.class, "twitterbot_enabled"),
HTTPD_ENABLED(Boolean.class, "httpd_enabled"),
AUTOKICK_ENABLED(Boolean.class, "autokick_enabled"),
2013-08-17 22:24:40 +00:00
//
AUTO_PROTECT_RADIUS(Double.class, "auto_protect_radius"),
EXPLOSIVE_RADIUS(Double.class, "explosive_radius"),
2013-08-17 22:24:40 +00:00
NUKE_MONITOR_RANGE(Double.class, "nuke_monitor_range"),
AUTOKICK_THRESHOLD(Double.class, "autokick_threshold"),
2013-08-17 22:24:40 +00:00
//
FREECAM_TRIGGER_COUNT(Integer.class, "freecam_trigger_count"),
MOB_LIMITER_MAX(Integer.class, "mob_limiter_max"),
NUKE_MONITOR_COUNT_BREAK(Integer.class, "nuke_monitor_count_break"),
NUKE_MONITOR_COUNT_PLACE(Integer.class, "nuke_monitor_count_place"),
HTTPD_PORT(Integer.class, "httpd_port"),
AUTOKICK_TIME(Integer.class, "autokick_time"),
2013-08-17 22:24:40 +00:00
//
FLATLANDS_GENERATION_PARAMS(String.class, "flatlands_generation_params"),
LOGS_REGISTER_PASSWORD(String.class, "logs_register_password"),
LOGS_REGISTER_URL(String.class, "logs_register_url"),
SERVICE_CHECKER_URL(String.class, "service_checker_url"),
TWITTERBOT_SECRET(String.class, "twitterbot_secret"),
TWITTERBOT_URL(String.class, "twitterbot_url"),
HTTPD_PUBLIC_FOLDER(String.class, "httpd_public_folder"),
2013-08-17 22:24:40 +00:00
//
BLOCKED_COMMANDS(List.class, "blocked_commands"),
HOST_SENDER_NAMES(List.class, "host_sender_names"),
UNBANNABLE_USERNAMES(List.class, "unbannable_usernames");
2013-08-17 22:24:40 +00:00
//
private final Class<?> type;
private final String configName;
private TFM_ConfigEntry(Class<?> type, String configName)
{
this.type = type;
this.configName = configName;
}
public Class<?> getType()
{
return type;
}
public String getConfigName()
{
return configName;
}
public String getString()
{
return TFM_Config.getInstance().getString(this);
}
2013-08-18 18:52:46 +00:00
public String setString(String value)
2013-08-17 22:24:40 +00:00
{
TFM_Config.getInstance().setString(this, value);
2013-08-18 18:52:46 +00:00
return value;
2013-08-17 22:24:40 +00:00
}
public Double getDouble()
{
return TFM_Config.getInstance().getDouble(this);
}
2013-08-18 18:52:46 +00:00
public Double setDouble(Double value)
2013-08-17 22:24:40 +00:00
{
TFM_Config.getInstance().setDouble(this, value);
2013-08-18 18:52:46 +00:00
return value;
2013-08-17 22:24:40 +00:00
}
public Boolean getBoolean()
{
return TFM_Config.getInstance().getBoolean(this);
}
2013-08-18 18:52:46 +00:00
public Boolean setBoolean(Boolean value)
2013-08-17 22:24:40 +00:00
{
TFM_Config.getInstance().setBoolean(this, value);
2013-08-18 18:52:46 +00:00
return value;
2013-08-17 22:24:40 +00:00
}
public Integer getInteger()
{
return TFM_Config.getInstance().getInteger(this);
}
2013-08-18 18:52:46 +00:00
public Integer setInteger(Integer value)
2013-08-17 22:24:40 +00:00
{
TFM_Config.getInstance().setInteger(this, value);
2013-08-18 18:52:46 +00:00
return value;
2013-08-17 22:24:40 +00:00
}
2013-08-28 19:40:14 +00:00
2013-08-25 15:32:24 +00:00
public List getList()
2013-08-17 22:24:40 +00:00
{
2013-08-25 15:32:24 +00:00
return TFM_Config.getInstance().getList(this);
2013-08-17 22:24:40 +00:00
}
2013-09-08 02:10:05 +00:00
public static TFM_ConfigEntry findConfigEntry(String name)
{
name = name.toLowerCase().replace("_", "");
for (TFM_ConfigEntry entry : values())
{
if (entry.toString().toLowerCase().replace("_", "").equals(name))
{
return entry;
}
}
return null;
}
2013-08-17 22:24:40 +00:00
}