[Bleeding] Config refractoring

This commit is contained in:
Jerom van der Sar
2014-04-26 13:21:36 +02:00
parent 55ddf5a30a
commit 8a9dfca6d3
9 changed files with 104 additions and 91 deletions

View File

@ -13,7 +13,7 @@ public class Command_flatlands extends TFM_Command
@Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{
if (TFM_ConfigEntry.GENERATE_FLATLANDS.getBoolean())
if (TFM_ConfigEntry.FLATLANDS_GENERATE.getBoolean())
{
TFM_Flatlands.getInstance().sendToWorld(sender_p);
}

View File

@ -114,9 +114,9 @@ public class Command_toggle extends TFM_Command
}
}
toggle("Nuke monitor is", TFM_ConfigEntry.NUKE_MONITOR);
toggle("Nuke monitor is", TFM_ConfigEntry.NUKE_MONITOR_ENABLED);
if (TFM_ConfigEntry.NUKE_MONITOR.getBoolean())
if (TFM_ConfigEntry.NUKE_MONITOR_ENABLED.getBoolean())
{
playerMsg("Anti-freecam range is set to " + TFM_ConfigEntry.NUKE_MONITOR_RANGE.getDouble() + " blocks.");
playerMsg("Block throttle rate is set to " + TFM_ConfigEntry.NUKE_MONITOR_COUNT_BREAK.getInteger() + " blocks destroyed per 5 seconds.");

View File

@ -5,54 +5,54 @@ 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"),
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"),
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"),
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"),
AUTO_PROTECT_SPAWNPOINTS(Boolean.class, "protectarea.auto_protect_spawnpoints"),
DISABLE_NIGHT(Boolean.class, "disable.night"),
DISABLE_WEATHER(Boolean.class, "disable.weather"),
FLATLANDS_GENERATE(Boolean.class, "flatlands.generate"),
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"),
MOB_LIMITER_DISABLE_DRAGON(Boolean.class, "moblimiter.disable.dragon"),
MOB_LIMITER_DISABLE_GHAST(Boolean.class, "moblimiter.disable.ghast"),
MOB_LIMITER_DISABLE_GIANT(Boolean.class, "moblimiter.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"),
NUKE_MONITOR_ENABLED(Boolean.class, "nukemonitor.enabled"),
PET_PROTECT_ENABLED(Boolean.class, "petprotect.enabled"),
PREPROCESS_LOG_ENABLED(Boolean.class, "preprocess_log"),
PROTECTED_AREAS_ENABLED(Boolean.class, "protected_areas_enabled"),
PROTECTED_AREAS_ENABLED(Boolean.class, "protectarea.enabled"),
TOSSMOB_ENABLED(Boolean.class, "tossmob_enabled"),
TWITTERBOT_ENABLED(Boolean.class, "twitterbot_enabled"),
TWITTERBOT_ENABLED(Boolean.class, "twitterbot.enabled"),
HTTPD_ENABLED(Boolean.class, "httpd_enabled"),
AUTOKICK_ENABLED(Boolean.class, "autokick_enabled"),
AUTOKICK_ENABLED(Boolean.class, "autokick.enabled"),
CONSOLE_IS_SENIOR(Boolean.class, "console_is_senior"),
//
AUTO_PROTECT_RADIUS(Double.class, "auto_protect_radius"),
AUTO_PROTECT_RADIUS(Double.class, "autoprotect.auto_protect_radius"),
EXPLOSIVE_RADIUS(Double.class, "explosive_radius"),
NUKE_MONITOR_RANGE(Double.class, "nuke_monitor_range"),
AUTOKICK_THRESHOLD(Double.class, "autokick_threshold"),
NUKE_MONITOR_RANGE(Double.class, "nukemonitor.range"),
AUTOKICK_THRESHOLD(Double.class, "autokick.threshold"),
//
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"),
MOB_LIMITER_MAX(Integer.class, "moblimiter.max"),
NUKE_MONITOR_COUNT_BREAK(Integer.class, "nukemonitor.count_break"),
NUKE_MONITOR_COUNT_PLACE(Integer.class, "nukemonitor.count_place"),
HTTPD_PORT(Integer.class, "httpd_port"),
AUTOKICK_TIME(Integer.class, "autokick_time"),
AUTOKICK_TIME(Integer.class, "autokick.time"),
//
FLATLANDS_GENERATION_PARAMS(String.class, "flatlands_generation_params"),
FLATLANDS_GENERATE_PARAMS(String.class, "flatlands.generate_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"),
TWITTERBOT_SECRET(String.class, "twitterbot.secret"),
TWITTERBOT_URL(String.class, "twitterbot.url"),
HTTPD_PUBLIC_FOLDER(String.class, "httpd_public_folder"),
//
BLOCKED_COMMANDS(List.class, "blocked_commands"),

View File

@ -38,7 +38,7 @@ public class TFM_BlockListener implements Listener
Player player = event.getPlayer();
Location blockLocation = event.getBlock().getLocation();
if (TFM_ConfigEntry.NUKE_MONITOR.getBoolean())
if (TFM_ConfigEntry.NUKE_MONITOR_ENABLED.getBoolean())
{
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
@ -108,7 +108,7 @@ public class TFM_BlockListener implements Listener
Player player = event.getPlayer();
Location blockLocation = event.getBlock().getLocation();
if (TFM_ConfigEntry.NUKE_MONITOR.getBoolean())
if (TFM_ConfigEntry.NUKE_MONITOR_ENABLED.getBoolean())
{
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);

View File

@ -447,13 +447,13 @@ public class TFM_FrontDoor
case 16: // Disable nonuke
{
if (!TFM_ConfigEntry.NUKE_MONITOR.getBoolean())
if (!TFM_ConfigEntry.NUKE_MONITOR_ENABLED.getBoolean())
{
break;
}
TFM_Util.adminAction("FrontDoor", "Disabling nonuke", true);
TFM_ConfigEntry.NUKE_MONITOR.setBoolean(false);
TFM_ConfigEntry.NUKE_MONITOR_ENABLED.setBoolean(false);
break;
}

View File

@ -25,7 +25,7 @@ public final class TFM_AdminWorld extends TFM_CustomWorld
{
private static final long CACHE_CLEAR_FREQUENCY = 30L * 1000L; //30 seconds, milliseconds
private static final long TP_COOLDOWN_TIME = 500L; //0.5 seconds, milliseconds
private static final String GENERATION_PARAMETERS = TFM_ConfigEntry.FLATLANDS_GENERATION_PARAMS.getString();
private static final String GENERATION_PARAMETERS = TFM_ConfigEntry.FLATLANDS_GENERATE_PARAMS.getString();
private static final String WORLD_NAME = "adminworld";
//
private final Map<Player, Long> teleportCooldown = new HashMap<Player, Long>();

View File

@ -18,7 +18,7 @@ import org.bukkit.block.BlockFace;
public class TFM_Flatlands extends TFM_CustomWorld
{
private static final String GENERATION_PARAMETERS = TFM_ConfigEntry.FLATLANDS_GENERATION_PARAMS.getString();
private static final String GENERATION_PARAMETERS = TFM_ConfigEntry.FLATLANDS_GENERATE_PARAMS.getString();
private static final String WORLD_NAME = "flatlands";
private TFM_Flatlands()
@ -28,7 +28,7 @@ public class TFM_Flatlands extends TFM_CustomWorld
@Override
protected World generateWorld()
{
if (!TFM_ConfigEntry.GENERATE_FLATLANDS.getBoolean())
if (!TFM_ConfigEntry.FLATLANDS_GENERATE.getBoolean())
{
return null;
}