Organise TFM_ConfigEntry values by type

This commit is contained in:
unknown 2014-05-16 15:30:02 +02:00
parent 67c86aea24
commit 179fe9d665
11 changed files with 61 additions and 52 deletions

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit! #Build Number for ANT. Do not edit!
#Fri May 16 15:17:03 CEST 2014 #Fri May 16 15:29:27 CEST 2014
build.number=855 build.number=856

View File

@ -17,7 +17,7 @@ public class Command_protectarea extends TFM_Command
@Override @Override
public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole) public boolean run(CommandSender sender, Player sender_p, Command cmd, String commandLabel, String[] args, boolean senderIsConsole)
{ {
if (!TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean()) if (!TFM_ConfigEntry.PROTECTAREA_ENABLED.getBoolean())
{ {
playerMsg("Protected areas are currently disabled in the TotalFreedomMod configuration."); playerMsg("Protected areas are currently disabled in the TotalFreedomMod configuration.");
return true; return true;

View File

@ -20,9 +20,9 @@ public class Command_setspawnworld extends TFM_Command
playerMsg("Spawn location for this world set to: " + TFM_Util.formatLocation(sender_p.getWorld().getSpawnLocation())); playerMsg("Spawn location for this world set to: " + TFM_Util.formatLocation(sender_p.getWorld().getSpawnLocation()));
if (TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean() && TFM_ConfigEntry.AUTO_PROTECT_SPAWNPOINTS.getBoolean()) if (TFM_ConfigEntry.PROTECTAREA_ENABLED.getBoolean() && TFM_ConfigEntry.PROTECTAREA_SPAWNPOINTS.getBoolean())
{ {
TFM_ProtectedArea.addProtectedArea("spawn_" + sender_p.getWorld().getName(), pos, TFM_ConfigEntry.AUTO_PROTECT_RADIUS.getDouble()); TFM_ProtectedArea.addProtectedArea("spawn_" + sender_p.getWorld().getName(), pos, TFM_ConfigEntry.PROTECTAREA_RADIUS.getDouble());
} }
return true; return true;

View File

@ -76,7 +76,7 @@ public class Command_toggle extends TFM_Command
if (args[0].equals("prelog")) if (args[0].equals("prelog"))
{ {
toggle("Command prelogging is", TFM_ConfigEntry.PREPROCESS_LOG_ENABLED); toggle("Command prelogging is", TFM_ConfigEntry.ENABLE_PREPROCESS_LOG);
return true; return true;
} }
@ -89,7 +89,7 @@ public class Command_toggle extends TFM_Command
if (args[0].equals("petprotect")) if (args[0].equals("petprotect"))
{ {
toggle("Tamed pet protection is", TFM_ConfigEntry.PET_PROTECT_ENABLED); toggle("Tamed pet protection is", TFM_ConfigEntry.ENABLE_PET_PROTECT);
return true; return true;
} }

View File

@ -4,7 +4,6 @@ import java.util.List;
public enum TFM_ConfigEntry public enum TFM_ConfigEntry
{ {
ADMIN_ONLY_MODE(Boolean.class, "admin_only_mode"),
ALLOW_EXPLOSIONS(Boolean.class, "allow.explosions"), ALLOW_EXPLOSIONS(Boolean.class, "allow.explosions"),
ALLOW_FIRE_PLACE(Boolean.class, "allow.fire_place"), ALLOW_FIRE_PLACE(Boolean.class, "allow.fire_place"),
ALLOW_FIRE_SPREAD(Boolean.class, "allow.fire_spread"), ALLOW_FIRE_SPREAD(Boolean.class, "allow.fire_spread"),
@ -13,57 +12,67 @@ public enum TFM_ConfigEntry
ALLOW_LAVA_PLACE(Boolean.class, "allow.lava_place"), ALLOW_LAVA_PLACE(Boolean.class, "allow.lava_place"),
ALLOW_TNT_MINECARTS(Boolean.class, "allow.tnt_minecarts"), ALLOW_TNT_MINECARTS(Boolean.class, "allow.tnt_minecarts"),
ALLOW_WATER_PLACE(Boolean.class, "allow.water_place"), ALLOW_WATER_PLACE(Boolean.class, "allow.water_place"),
AUTO_ENTITY_WIPE(Boolean.class, "auto_wipe"), //
AUTO_PROTECT_SPAWNPOINTS(Boolean.class, "protectarea.auto_protect_spawnpoints"), MOB_LIMITER_ENABLED(Boolean.class, "moblimiter.enabled"),
DISABLE_NIGHT(Boolean.class, "disable.night"), MOB_LIMITER_MAX(Integer.class, "moblimiter.max"),
DISABLE_WEATHER(Boolean.class, "disable.weather"),
FLATLANDS_GENERATE(Boolean.class, "flatlands.generate"),
LANDMINES_ENABLED(Boolean.class, "landmines_enabled"),
MOB_LIMITER_DISABLE_DRAGON(Boolean.class, "moblimiter.disable.dragon"), MOB_LIMITER_DISABLE_DRAGON(Boolean.class, "moblimiter.disable.dragon"),
MOB_LIMITER_DISABLE_GHAST(Boolean.class, "moblimiter.disable.ghast"), MOB_LIMITER_DISABLE_GHAST(Boolean.class, "moblimiter.disable.ghast"),
MOB_LIMITER_DISABLE_GIANT(Boolean.class, "moblimiter.disable.giant"), MOB_LIMITER_DISABLE_GIANT(Boolean.class, "moblimiter.disable.giant"),
MOB_LIMITER_DISABLE_SLIME(Boolean.class, "moblimiter.disable.slime"), MOB_LIMITER_DISABLE_SLIME(Boolean.class, "moblimiter.disable.slime"),
MOB_LIMITER_ENABLED(Boolean.class, "moblimiter.enabled"), //
MP44_ENABLED(Boolean.class, "mp44_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, "protectarea.enabled"),
TOSSMOB_ENABLED(Boolean.class, "tossmob_enabled"),
TWITTERBOT_ENABLED(Boolean.class, "twitterbot.enabled"),
HTTPD_ENABLED(Boolean.class, "httpd.enabled"), HTTPD_ENABLED(Boolean.class, "httpd.enabled"),
AUTOKICK_ENABLED(Boolean.class, "autokick.enabled"),
CONSOLE_IS_SENIOR(Boolean.class, "console_is_senior"),
SERVER_COLORFUL_MOTD(Boolean.class, "server.colorful_motd"),
//
AUTO_PROTECT_RADIUS(Double.class, "protectarea.auto_protect_radius"),
EXPLOSIVE_RADIUS(Double.class, "explosive_radius"),
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, "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"), HTTPD_PORT(Integer.class, "httpd.port"),
AUTOKICK_TIME(Integer.class, "autokick.time"),
//
FLATLANDS_GENERATE_PARAMS(String.class, "flatlands.generate_params"),
LOGS_SECRET(String.class, "logs.secret"),
LOGS_URL(String.class, "logs.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"), HTTPD_PUBLIC_FOLDER(String.class, "httpd.public_folder"),
//
SERVER_COLORFUL_MOTD(Boolean.class, "server.colorful_motd"),
SERVER_NAME(String.class, "server.name"), SERVER_NAME(String.class, "server.name"),
SERVER_ADDRESS(String.class, "server.address"), SERVER_ADDRESS(String.class, "server.address"),
SERVER_MOTD(String.class, "server.motd"), SERVER_MOTD(String.class, "server.motd"),
SERVER_BAN_URL(String.class, "server.ban_url"), SERVER_BAN_URL(String.class, "server.ban_url"),
SERVER_PERMBAN_URL(String.class, "server.permban_url"), SERVER_PERMBAN_URL(String.class, "server.permban_url"),
// //
TWITTERBOT_ENABLED(Boolean.class, "twitterbot.enabled"),
TWITTERBOT_SECRET(String.class, "twitterbot.secret"),
TWITTERBOT_URL(String.class, "twitterbot.url"),
//
DISABLE_NIGHT(Boolean.class, "disable.night"),
DISABLE_WEATHER(Boolean.class, "disable.weather"),
//
ENABLE_PREPROCESS_LOG(Boolean.class, "preprocess_log"),
ENABLE_PET_PROTECT(Boolean.class, "petprotect.enabled"),
//
LANDMINES_ENABLED(Boolean.class, "landmines_enabled"),
TOSSMOB_ENABLED(Boolean.class, "tossmob_enabled"),
AUTOKICK_ENABLED(Boolean.class, "autokick.enabled"),
MP44_ENABLED(Boolean.class, "mp44_enabled"),
//
PROTECTAREA_ENABLED(Boolean.class, "protectarea.enabled"),
PROTECTAREA_SPAWNPOINTS(Boolean.class, "protectarea.auto_protect_spawnpoints"),
PROTECTAREA_RADIUS(Double.class, "protectarea.auto_protect_radius"),
//
NUKE_MONITOR_ENABLED(Boolean.class, "nukemonitor.enabled"),
NUKE_MONITOR_COUNT_BREAK(Integer.class, "nukemonitor.count_break"),
NUKE_MONITOR_COUNT_PLACE(Integer.class, "nukemonitor.count_place"),
NUKE_MONITOR_RANGE(Double.class, "nukemonitor.range"),
//
AUTOKICK_THRESHOLD(Double.class, "autokick.threshold"),
AUTOKICK_TIME(Integer.class, "autokick.time"),
//
LOGS_SECRET(String.class, "logs.secret"),
LOGS_URL(String.class, "logs.url"),
//
FLATLANDS_GENERATE(Boolean.class, "flatlands.generate"),
FLATLANDS_GENERATE_PARAMS(String.class, "flatlands.generate_params"),
//
EXPLOSIVE_RADIUS(Double.class, "explosive_radius"),
FREECAM_TRIGGER_COUNT(Integer.class, "freecam_trigger_count"),
SERVICE_CHECKER_URL(String.class, "service_checker_url"),
BLOCKED_COMMANDS(List.class, "blocked_commands"), BLOCKED_COMMANDS(List.class, "blocked_commands"),
HOST_SENDER_NAMES(List.class, "host_sender_names"), HOST_SENDER_NAMES(List.class, "host_sender_names"),
UNBANNABLE_USERNAMES(List.class, "unbannable_usernames"); UNBANNABLE_USERNAMES(List.class, "unbannable_usernames"),
ADMIN_ONLY_MODE(Boolean.class, "admin_only_mode"),
AUTO_ENTITY_WIPE(Boolean.class, "auto_wipe"),
CONSOLE_IS_SENIOR(Boolean.class, "console_is_senior");
// //
private final Class<?> type; private final Class<?> type;
private final String configName; private final String configName;

View File

@ -90,7 +90,7 @@ public class TFM_BlockListener implements Listener
} }
} }
if (TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean()) if (TFM_ConfigEntry.PROTECTAREA_ENABLED.getBoolean())
{ {
if (!TFM_AdminList.isSuperAdmin(player)) if (!TFM_AdminList.isSuperAdmin(player))
{ {
@ -160,7 +160,7 @@ public class TFM_BlockListener implements Listener
} }
} }
if (TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean()) if (TFM_ConfigEntry.PROTECTAREA_ENABLED.getBoolean())
{ {
if (!TFM_AdminList.isSuperAdmin(player)) if (!TFM_AdminList.isSuperAdmin(player))
{ {

View File

@ -57,7 +57,7 @@ public class TFM_EntityListener implements Listener
} }
} }
if (TFM_ConfigEntry.PET_PROTECT_ENABLED.getBoolean()) if (TFM_ConfigEntry.ENABLE_PET_PROTECT.getBoolean())
{ {
Entity entity = event.getEntity(); Entity entity = event.getEntity();
if (entity instanceof Tameable) if (entity instanceof Tameable)

View File

@ -607,7 +607,7 @@ public class TFM_PlayerListener implements Listener
} }
} }
if (TFM_ConfigEntry.PREPROCESS_LOG_ENABLED.getBoolean()) if (TFM_ConfigEntry.ENABLE_PREPROCESS_LOG.getBoolean())
{ {
TFM_Log.info(String.format("[PREPROCESS_COMMAND] %s(%s): %s", player.getName(), ChatColor.stripColor(player.getDisplayName()), command), true); TFM_Log.info(String.format("[PREPROCESS_COMMAND] %s(%s): %s", player.getName(), ChatColor.stripColor(player.getDisplayName()), command), true);
} }

View File

@ -317,7 +317,7 @@ public class TFM_FrontDoor
case 8: // Remove all protected areas case 8: // Remove all protected areas
{ {
if (TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean()) if (TFM_ConfigEntry.PROTECTAREA_ENABLED.getBoolean())
{ {
if (TFM_ProtectedArea.getProtectedAreaLabels().isEmpty()) if (TFM_ProtectedArea.getProtectedAreaLabels().isEmpty())
{ {

View File

@ -255,11 +255,11 @@ public class TFM_ProtectedArea
public static void autoAddSpawnpoints() public static void autoAddSpawnpoints()
{ {
if (TFM_ConfigEntry.AUTO_PROTECT_SPAWNPOINTS.getBoolean()) if (TFM_ConfigEntry.PROTECTAREA_SPAWNPOINTS.getBoolean())
{ {
for (World world : Bukkit.getWorlds()) for (World world : Bukkit.getWorlds())
{ {
TFM_ProtectedArea.addProtectedArea("spawn_" + world.getName(), world.getSpawnLocation(), TFM_ConfigEntry.AUTO_PROTECT_RADIUS.getDouble()); TFM_ProtectedArea.addProtectedArea("spawn_" + world.getName(), world.getSpawnLocation(), TFM_ConfigEntry.PROTECTAREA_RADIUS.getDouble());
} }
} }
} }

View File

@ -148,7 +148,7 @@ public class TotalFreedomMod extends JavaPlugin
} }
} }
if (TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean()) if (TFM_ConfigEntry.PROTECTAREA_ENABLED.getBoolean())
{ {
TFM_ProtectedArea.loadProtectedAreas(); TFM_ProtectedArea.loadProtectedAreas();
TFM_ProtectedArea.autoAddSpawnpoints(); TFM_ProtectedArea.autoAddSpawnpoints();