Config migration, stage 2

This commit is contained in:
Steven Lawson 2013-08-18 15:27:17 -04:00
parent 2827ca98a7
commit f53b67abf1
16 changed files with 74 additions and 117 deletions

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -13,7 +13,7 @@ public class Command_flatlands 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 (TotalFreedomMod.generateFlatlands) if (TFM_ConfigEntry.GENERATE_FLATLANDS.getBoolean())
{ {
TFM_Util.gotoWorld(sender, "flatlands"); TFM_Util.gotoWorld(sender, "flatlands");
} }

View File

@ -2,7 +2,6 @@ package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry; import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_LandmineData; import me.StevenLawson.TotalFreedomMod.TFM_LandmineData;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.block.Block; import org.bukkit.block.Block;
@ -18,7 +17,7 @@ public class Command_landmine 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 (!TotalFreedomMod.landminesEnabled) if (!TFM_ConfigEntry.LANDMINES_ENABLED.getBoolean())
{ {
playerMsg("The landmine is currently disabled.", ChatColor.GREEN); playerMsg("The landmine is currently disabled.", ChatColor.GREEN);
} }

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_GameRuleHandler; import me.StevenLawson.TotalFreedomMod.TFM_GameRuleHandler;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -20,27 +20,27 @@ public class Command_moblimiter extends TFM_Command
if (args[0].equalsIgnoreCase("on")) if (args[0].equalsIgnoreCase("on"))
{ {
TotalFreedomMod.mobLimiterEnabled = true; TFM_ConfigEntry.MOB_LIMITER_ENABLED.setBoolean(true);
} }
else if (args[0].equalsIgnoreCase("off")) else if (args[0].equalsIgnoreCase("off"))
{ {
TotalFreedomMod.mobLimiterEnabled = false; TFM_ConfigEntry.MOB_LIMITER_ENABLED.setBoolean(false);
} }
else if (args[0].equalsIgnoreCase("dragon")) else if (args[0].equalsIgnoreCase("dragon"))
{ {
TotalFreedomMod.mobLimiterDisableDragon = !TotalFreedomMod.mobLimiterDisableDragon; TFM_ConfigEntry.MOB_LIMITER_DISABLE_DRAGON.setBoolean(!TFM_ConfigEntry.MOB_LIMITER_DISABLE_DRAGON.getBoolean());
} }
else if (args[0].equalsIgnoreCase("giant")) else if (args[0].equalsIgnoreCase("giant"))
{ {
TotalFreedomMod.mobLimiterDisableGiant = !TotalFreedomMod.mobLimiterDisableGiant; TFM_ConfigEntry.MOB_LIMITER_DISABLE_GIANT.setBoolean(!TFM_ConfigEntry.MOB_LIMITER_DISABLE_GIANT.getBoolean());
} }
else if (args[0].equalsIgnoreCase("slime")) else if (args[0].equalsIgnoreCase("slime"))
{ {
TotalFreedomMod.mobLimiterDisableSlime = !TotalFreedomMod.mobLimiterDisableSlime; TFM_ConfigEntry.MOB_LIMITER_DISABLE_SLIME.setBoolean(!TFM_ConfigEntry.MOB_LIMITER_DISABLE_SLIME.getBoolean());
} }
else if (args[0].equalsIgnoreCase("ghast")) else if (args[0].equalsIgnoreCase("ghast"))
{ {
TotalFreedomMod.mobLimiterDisableGhast = !TotalFreedomMod.mobLimiterDisableGhast; TFM_ConfigEntry.MOB_LIMITER_DISABLE_GHAST.setBoolean(!TFM_ConfigEntry.MOB_LIMITER_DISABLE_GHAST.getBoolean());
} }
else else
{ {
@ -53,7 +53,7 @@ public class Command_moblimiter extends TFM_Command
{ {
try try
{ {
TotalFreedomMod.mobLimiterMax = Math.max(0, Math.min(2000, Integer.parseInt(args[1]))); TFM_ConfigEntry.MOB_LIMITER_MAX.setInteger(Math.max(0, Math.min(2000, Integer.parseInt(args[1]))));
} }
catch (NumberFormatException nfex) catch (NumberFormatException nfex)
{ {
@ -61,21 +61,21 @@ public class Command_moblimiter extends TFM_Command
} }
} }
if (TotalFreedomMod.mobLimiterEnabled) if (TFM_ConfigEntry.MOB_LIMITER_ENABLED.getBoolean())
{ {
sender.sendMessage("Moblimiter enabled. Maximum mobcount set to: " + TotalFreedomMod.mobLimiterMax + "."); sender.sendMessage("Moblimiter enabled. Maximum mobcount set to: " + TFM_ConfigEntry.MOB_LIMITER_MAX.getInteger() + ".");
playerMsg("Dragon: " + (TotalFreedomMod.mobLimiterDisableDragon ? "disabled" : "enabled") + "."); playerMsg("Dragon: " + (TFM_ConfigEntry.MOB_LIMITER_DISABLE_DRAGON.getBoolean() ? "disabled" : "enabled") + ".");
playerMsg("Giant: " + (TotalFreedomMod.mobLimiterDisableGiant ? "disabled" : "enabled") + "."); playerMsg("Giant: " + (TFM_ConfigEntry.MOB_LIMITER_DISABLE_GIANT.getBoolean() ? "disabled" : "enabled") + ".");
playerMsg("Slime: " + (TotalFreedomMod.mobLimiterDisableSlime ? "disabled" : "enabled") + "."); playerMsg("Slime: " + (TFM_ConfigEntry.MOB_LIMITER_DISABLE_SLIME.getBoolean() ? "disabled" : "enabled") + ".");
playerMsg("Ghast: " + (TotalFreedomMod.mobLimiterDisableGhast ? "disabled" : "enabled") + "."); playerMsg("Ghast: " + (TFM_ConfigEntry.MOB_LIMITER_DISABLE_GHAST.getBoolean() ? "disabled" : "enabled") + ".");
} }
else else
{ {
playerMsg("Moblimiter is disabled. No mob restrictions are in effect."); playerMsg("Moblimiter is disabled. No mob restrictions are in effect.");
} }
TFM_GameRuleHandler.setGameRule(TFM_GameRuleHandler.TFM_GameRule.DO_MOB_SPAWNING, !TotalFreedomMod.mobLimiterEnabled); TFM_GameRuleHandler.setGameRule(TFM_GameRuleHandler.TFM_GameRule.DO_MOB_SPAWNING, !TFM_ConfigEntry.MOB_LIMITER_ENABLED.getBoolean());
return true; return true;
} }

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData; import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Material; import org.bukkit.Material;
import org.bukkit.command.Command; import org.bukkit.command.Command;
@ -16,7 +16,7 @@ public class Command_mp44 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 (!TotalFreedomMod.mp44Enabled) if (!TFM_ConfigEntry.MP44_ENABLED.getBoolean())
{ {
playerMsg("The mp44 is currently disabled.", ChatColor.GREEN); playerMsg("The mp44 is currently disabled.", ChatColor.GREEN);
return true; return true;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -21,7 +21,7 @@ public class Command_nonuke extends TFM_Command
{ {
try try
{ {
TotalFreedomMod.nukeMonitorRange = Math.max(1.0, Math.min(500.0, Double.parseDouble(args[1]))); TFM_ConfigEntry.NUKE_MONITOR_RANGE.setDouble(Math.max(1.0, Math.min(500.0, Double.parseDouble(args[1]))));
} }
catch (NumberFormatException nfex) catch (NumberFormatException nfex)
{ {
@ -32,7 +32,7 @@ public class Command_nonuke extends TFM_Command
{ {
try try
{ {
TotalFreedomMod.nukeMonitorCountBreak = Math.max(1, Math.min(500, Integer.parseInt(args[2]))); TFM_ConfigEntry.NUKE_MONITOR_COUNT_BREAK.setInteger(Math.max(1, Math.min(500, Integer.parseInt(args[2]))));
} }
catch (NumberFormatException nfex) catch (NumberFormatException nfex)
{ {
@ -41,14 +41,14 @@ public class Command_nonuke extends TFM_Command
if (args[0].equalsIgnoreCase("on")) if (args[0].equalsIgnoreCase("on"))
{ {
TotalFreedomMod.nukeMonitor = true; TFM_ConfigEntry.NUKE_MONITOR.setBoolean(true);
playerMsg("Nuke monitor is enabled."); playerMsg("Nuke monitor is enabled.");
playerMsg("Anti-freecam range is set to " + TotalFreedomMod.nukeMonitorRange + " blocks."); playerMsg("Anti-freecam range is set to " + TFM_ConfigEntry.NUKE_MONITOR_RANGE.getDouble() + " blocks.");
playerMsg("Block throttle rate is set to " + TotalFreedomMod.nukeMonitorCountBreak + " blocks destroyed per 5 seconds."); playerMsg("Block throttle rate is set to " + TFM_ConfigEntry.NUKE_MONITOR_COUNT_BREAK.getInteger() + " blocks destroyed per 5 seconds.");
} }
else else
{ {
TotalFreedomMod.nukeMonitor = false; TFM_ConfigEntry.NUKE_MONITOR.setBoolean(false);
playerMsg("Nuke monitor is disabled."); playerMsg("Nuke monitor is disabled.");
} }

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -18,11 +18,9 @@ public class Command_petprotect extends TFM_Command
return false; return false;
} }
TotalFreedomMod.petProtectEnabled = !TFM_Util.isStopCommand(args[0]);
TFM_Util.adminAction( TFM_Util.adminAction(
sender.getName(), sender.getName(),
"Tamed pet protection is now " + (TotalFreedomMod.petProtectEnabled ? "enabled" : "disabled") + ".", "Tamed pet protection is now " + (TFM_ConfigEntry.PET_PROTECT_ENABLED.setBoolean(!TFM_Util.isStopCommand(args[0])) ? "enabled" : "disabled") + ".",
false); false);
return true; return true;

View File

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player; import org.bukkit.entity.Player;
@ -21,12 +21,12 @@ public class Command_prelog extends TFM_Command
if (args[0].equalsIgnoreCase("on")) if (args[0].equalsIgnoreCase("on"))
{ {
TotalFreedomMod.preprocessLogEnabled = true; TFM_ConfigEntry.PREPROCESS_LOG_ENABLED.setBoolean(true);
playerMsg("Command preprocess logging is now enabled. This will be spammy in the log."); playerMsg("Command preprocess logging is now enabled. This will be spammy in the log.");
} }
else else
{ {
TotalFreedomMod.preprocessLogEnabled = false; TFM_ConfigEntry.PREPROCESS_LOG_ENABLED.setBoolean(false);
playerMsg("Command preprocess logging is now disabled."); playerMsg("Command preprocess logging is now disabled.");
} }

View File

@ -1,8 +1,8 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea; import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -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 (!TotalFreedomMod.protectedAreasEnabled) if (!TFM_ConfigEntry.PROTECTED_AREAS_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

@ -1,8 +1,8 @@
package me.StevenLawson.TotalFreedomMod.Commands; package me.StevenLawson.TotalFreedomMod.Commands;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea; import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
import me.StevenLawson.TotalFreedomMod.TFM_Util; import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.command.Command; import org.bukkit.command.Command;
import org.bukkit.command.CommandSender; import org.bukkit.command.CommandSender;
@ -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 (TotalFreedomMod.protectedAreasEnabled && TotalFreedomMod.autoProtectSpawnpoints) if (TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean() && TFM_ConfigEntry.AUTO_PROTECT_SPAWNPOINTS.getBoolean())
{ {
TFM_ProtectedArea.addProtectedArea("spawn_" + sender_p.getWorld().getName(), pos, TotalFreedomMod.autoProtectRadius); TFM_ProtectedArea.addProtectedArea("spawn_" + sender_p.getWorld().getName(), pos, TFM_ConfigEntry.AUTO_PROTECT_RADIUS.getDouble());
} }
return true; return true;

View File

@ -1,14 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Listener; package me.StevenLawson.TotalFreedomMod.Listener;
import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry; import me.StevenLawson.TotalFreedomMod.*;
import me.StevenLawson.TotalFreedomMod.TFM_Heartbeat;
import me.StevenLawson.TotalFreedomMod.TFM_Log;
import me.StevenLawson.TotalFreedomMod.TFM_PlayerData;
import me.StevenLawson.TotalFreedomMod.TFM_ProtectedArea;
import me.StevenLawson.TotalFreedomMod.TFM_RollbackManager;
import me.StevenLawson.TotalFreedomMod.TFM_SuperadminList;
import me.StevenLawson.TotalFreedomMod.TFM_Util;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
import org.bukkit.ChatColor; import org.bukkit.ChatColor;
import org.bukkit.Location; import org.bukkit.Location;
import org.bukkit.Material; import org.bukkit.Material;
@ -45,25 +37,27 @@ public class TFM_BlockListener implements Listener
Player player = event.getPlayer(); Player player = event.getPlayer();
Location block_pos = event.getBlock().getLocation(); Location block_pos = event.getBlock().getLocation();
if (TotalFreedomMod.nukeMonitor) if (TFM_ConfigEntry.NUKE_MONITOR.getBoolean())
{ {
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
Location player_pos = player.getLocation(); Location player_pos = player.getLocation();
final double nukeMonitorRange = TFM_ConfigEntry.NUKE_MONITOR_RANGE.getDouble().doubleValue();
boolean out_of_range = false; boolean out_of_range = false;
if (!player_pos.getWorld().equals(block_pos.getWorld())) if (!player_pos.getWorld().equals(block_pos.getWorld()))
{ {
out_of_range = true; out_of_range = true;
} }
else if (player_pos.distanceSquared(block_pos) > (TotalFreedomMod.nukeMonitorRange * TotalFreedomMod.nukeMonitorRange)) else if (player_pos.distanceSquared(block_pos) > (nukeMonitorRange * nukeMonitorRange))
{ {
out_of_range = true; out_of_range = true;
} }
if (out_of_range) if (out_of_range)
{ {
if (playerdata.incrementAndGetFreecamDestroyCount() > TotalFreedomMod.freecamTriggerCount) if (playerdata.incrementAndGetFreecamDestroyCount() > TFM_ConfigEntry.FREECAM_TRIGGER_COUNT.getInteger())
{ {
TFM_Util.bcastMsg(player.getName() + " has been flagged for possible freecam nuking.", ChatColor.RED); TFM_Util.bcastMsg(player.getName() + " has been flagged for possible freecam nuking.", ChatColor.RED);
TFM_Util.autoEject(player, "Freecam (extended range) block breaking is not permitted on this server."); TFM_Util.autoEject(player, "Freecam (extended range) block breaking is not permitted on this server.");
@ -82,7 +76,7 @@ public class TFM_BlockListener implements Listener
} }
else else
{ {
if (playerdata.incrementAndGetBlockDestroyCount() > TotalFreedomMod.nukeMonitorCountBreak) if (playerdata.incrementAndGetBlockDestroyCount() > TFM_ConfigEntry.NUKE_MONITOR_COUNT_BREAK.getInteger())
{ {
TFM_Util.bcastMsg(player.getName() + " is breaking blocks too fast!", ChatColor.RED); TFM_Util.bcastMsg(player.getName() + " is breaking blocks too fast!", ChatColor.RED);
TFM_Util.autoEject(player, "You are breaking blocks too fast. Nukers are not permitted on this server."); TFM_Util.autoEject(player, "You are breaking blocks too fast. Nukers are not permitted on this server.");
@ -95,7 +89,7 @@ public class TFM_BlockListener implements Listener
} }
} }
if (TotalFreedomMod.protectedAreasEnabled) if (TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean())
{ {
if (!TFM_SuperadminList.isUserSuperadmin(player)) if (!TFM_SuperadminList.isUserSuperadmin(player))
{ {
@ -119,25 +113,27 @@ public class TFM_BlockListener implements Listener
Player player = event.getPlayer(); Player player = event.getPlayer();
Location block_pos = event.getBlock().getLocation(); Location block_pos = event.getBlock().getLocation();
if (TotalFreedomMod.nukeMonitor) if (TFM_ConfigEntry.NUKE_MONITOR.getBoolean())
{ {
TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player); TFM_PlayerData playerdata = TFM_PlayerData.getPlayerData(player);
Location player_pos = player.getLocation(); Location player_pos = player.getLocation();
double nukeMonitorRange = TFM_ConfigEntry.NUKE_MONITOR_RANGE.getDouble().doubleValue();
boolean out_of_range = false; boolean out_of_range = false;
if (!player_pos.getWorld().equals(block_pos.getWorld())) if (!player_pos.getWorld().equals(block_pos.getWorld()))
{ {
out_of_range = true; out_of_range = true;
} }
else if (player_pos.distanceSquared(block_pos) > (TotalFreedomMod.nukeMonitorRange * TotalFreedomMod.nukeMonitorRange)) else if (player_pos.distanceSquared(block_pos) > (nukeMonitorRange * nukeMonitorRange))
{ {
out_of_range = true; out_of_range = true;
} }
if (out_of_range) if (out_of_range)
{ {
if (playerdata.incrementAndGetFreecamPlaceCount() > TotalFreedomMod.freecamTriggerCount) if (playerdata.incrementAndGetFreecamPlaceCount() > TFM_ConfigEntry.FREECAM_TRIGGER_COUNT.getInteger())
{ {
TFM_Util.bcastMsg(player.getName() + " has been flagged for possible freecam building.", ChatColor.RED); TFM_Util.bcastMsg(player.getName() + " has been flagged for possible freecam building.", ChatColor.RED);
TFM_Util.autoEject(player, "Freecam (extended range) block building is not permitted on this server."); TFM_Util.autoEject(player, "Freecam (extended range) block building is not permitted on this server.");
@ -156,7 +152,7 @@ public class TFM_BlockListener implements Listener
} }
else else
{ {
if (playerdata.incrementAndGetBlockPlaceCount() > TotalFreedomMod.nukeMonitorCountPlace) if (playerdata.incrementAndGetBlockPlaceCount() > TFM_ConfigEntry.NUKE_MONITOR_COUNT_PLACE.getInteger())
{ {
TFM_Util.bcastMsg(player.getName() + " is placing blocks too fast!", ChatColor.RED); TFM_Util.bcastMsg(player.getName() + " is placing blocks too fast!", ChatColor.RED);
TFM_Util.autoEject(player, "You are placing blocks too fast."); TFM_Util.autoEject(player, "You are placing blocks too fast.");
@ -169,7 +165,7 @@ public class TFM_BlockListener implements Listener
} }
} }
if (TotalFreedomMod.protectedAreasEnabled) if (TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean())
{ {
if (!TFM_SuperadminList.isUserSuperadmin(player)) if (!TFM_SuperadminList.isUserSuperadmin(player))
{ {

View File

@ -58,7 +58,7 @@ public class TFM_EntityListener implements Listener
} }
} }
if (TotalFreedomMod.petProtectEnabled) if (TFM_ConfigEntry.PET_PROTECT_ENABLED.getBoolean())
{ {
Entity entity = event.getEntity(); Entity entity = event.getEntity();
if (entity instanceof Tameable) if (entity instanceof Tameable)
@ -74,7 +74,7 @@ public class TFM_EntityListener implements Listener
@EventHandler(priority = EventPriority.NORMAL) @EventHandler(priority = EventPriority.NORMAL)
public void onCreatureSpawn(CreatureSpawnEvent event) public void onCreatureSpawn(CreatureSpawnEvent event)
{ {
if (TotalFreedomMod.mobLimiterEnabled) if (TFM_ConfigEntry.MOB_LIMITER_ENABLED.getBoolean())
{ {
if (event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.EGG)) if (event.getSpawnReason().equals(CreatureSpawnEvent.SpawnReason.EGG))
{ {
@ -86,7 +86,7 @@ public class TFM_EntityListener implements Listener
if (spawned instanceof EnderDragon) if (spawned instanceof EnderDragon)
{ {
if (TotalFreedomMod.mobLimiterDisableDragon) if (TFM_ConfigEntry.MOB_LIMITER_DISABLE_DRAGON.getBoolean())
{ {
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -94,7 +94,7 @@ public class TFM_EntityListener implements Listener
} }
else if (spawned instanceof Ghast) else if (spawned instanceof Ghast)
{ {
if (TotalFreedomMod.mobLimiterDisableGhast) if (TFM_ConfigEntry.MOB_LIMITER_DISABLE_GHAST.getBoolean())
{ {
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -102,7 +102,7 @@ public class TFM_EntityListener implements Listener
} }
else if (spawned instanceof Slime) else if (spawned instanceof Slime)
{ {
if (TotalFreedomMod.mobLimiterDisableSlime) if (TFM_ConfigEntry.MOB_LIMITER_DISABLE_SLIME.getBoolean())
{ {
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -110,7 +110,7 @@ public class TFM_EntityListener implements Listener
} }
else if (spawned instanceof Giant) else if (spawned instanceof Giant)
{ {
if (TotalFreedomMod.mobLimiterDisableGiant) if (TFM_ConfigEntry.MOB_LIMITER_DISABLE_GIANT.getBoolean())
{ {
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -122,7 +122,9 @@ public class TFM_EntityListener implements Listener
return; return;
} }
if (TotalFreedomMod.mobLimiterMax > 0) int mobLimiterMax = TFM_ConfigEntry.MOB_LIMITER_MAX.getInteger().intValue();
if (mobLimiterMax > 0)
{ {
int mobcount = 0; int mobcount = 0;
@ -134,7 +136,7 @@ public class TFM_EntityListener implements Listener
} }
} }
if (mobcount > TotalFreedomMod.mobLimiterMax) if (mobcount > mobLimiterMax)
{ {
event.setCancelled(true); event.setCancelled(true);
} }

View File

@ -341,7 +341,7 @@ public class TFM_PlayerListener implements Listener
TFM_Jumppads.getInstance().PlayerMoveEvent(event); TFM_Jumppads.getInstance().PlayerMoveEvent(event);
} }
if (TotalFreedomMod.landminesEnabled && TFM_ConfigEntry.ALLOW_EXPLOSIONS.getBoolean()) if (TFM_ConfigEntry.LANDMINES_ENABLED.getBoolean() && TFM_ConfigEntry.ALLOW_EXPLOSIONS.getBoolean())
{ {
Iterator<TFM_LandmineData> landmines = TFM_LandmineData.landmines.iterator(); Iterator<TFM_LandmineData> landmines = TFM_LandmineData.landmines.iterator();
while (landmines.hasNext()) while (landmines.hasNext())
@ -542,7 +542,7 @@ public class TFM_PlayerListener implements Listener
} }
} }
if (TotalFreedomMod.preprocessLogEnabled) if (TFM_ConfigEntry.PREPROCESS_LOG_ENABLED.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

@ -1,6 +1,6 @@
package me.StevenLawson.TotalFreedomMod.Listener; package me.StevenLawson.TotalFreedomMod.Listener;
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod; import me.StevenLawson.TotalFreedomMod.TFM_ConfigEntry;
import org.bukkit.event.EventHandler; import org.bukkit.event.EventHandler;
import org.bukkit.event.EventPriority; import org.bukkit.event.EventPriority;
import org.bukkit.event.Listener; import org.bukkit.event.Listener;
@ -12,7 +12,7 @@ public class TFM_WeatherListener implements Listener
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void onThunderChange(ThunderChangeEvent event) public void onThunderChange(ThunderChangeEvent event)
{ {
if (event.toThunderState() && TotalFreedomMod.disableWeather) if (event.toThunderState() && TFM_ConfigEntry.DISABLE_WEATHER.getBoolean())
{ {
event.setCancelled(true); event.setCancelled(true);
return; return;
@ -22,7 +22,7 @@ public class TFM_WeatherListener implements Listener
@EventHandler(priority = EventPriority.HIGH) @EventHandler(priority = EventPriority.HIGH)
public void onWeatherChange(WeatherChangeEvent event) public void onWeatherChange(WeatherChangeEvent event)
{ {
if (event.toWeatherState() && TotalFreedomMod.disableWeather) if (event.toWeatherState() && TFM_ConfigEntry.DISABLE_WEATHER.getBoolean())
{ {
event.setCancelled(true); event.setCancelled(true);
return; return;

View File

@ -40,7 +40,7 @@ public class TFM_Heartbeat extends BukkitRunnable
TFM_Util.TFM_EntityWiper.wipeEntities(!TFM_ConfigEntry.ALLOW_EXPLOSIONS.getBoolean(), false); TFM_Util.TFM_EntityWiper.wipeEntities(!TFM_ConfigEntry.ALLOW_EXPLOSIONS.getBoolean(), false);
} }
if (TotalFreedomMod.disableWeather) if (TFM_ConfigEntry.DISABLE_WEATHER.getBoolean())
{ {
for (World world : server.getWorlds()) for (World world : server.getWorlds())
{ {

View File

@ -115,7 +115,7 @@ public class TFM_ProtectedArea implements Serializable
public static void autoAddSpawnpoints() public static void autoAddSpawnpoints()
{ {
if (TotalFreedomMod.autoProtectSpawnpoints) if (TFM_ConfigEntry.AUTO_PROTECT_SPAWNPOINTS.getBoolean())
{ {
for (World world : Bukkit.getWorlds()) for (World world : Bukkit.getWorlds())
{ {

View File

@ -76,7 +76,7 @@ public class TotalFreedomMod extends JavaPlugin
registerEventHandlers(); registerEventHandlers();
if (generateFlatlands) if (TFM_ConfigEntry.GENERATE_FLATLANDS.getBoolean())
{ {
TFM_Util.wipeFlatlandsIfFlagged(); TFM_Util.wipeFlatlandsIfFlagged();
TFM_Util.generateFlatlands(flatlandsGenerationParams); TFM_Util.generateFlatlands(flatlandsGenerationParams);
@ -84,7 +84,7 @@ public class TotalFreedomMod extends JavaPlugin
TFM_AdminWorld.getInstance().getAdminWorld(); TFM_AdminWorld.getInstance().getAdminWorld();
if (disableWeather) if (TFM_ConfigEntry.DISABLE_WEATHER.getBoolean())
{ {
for (World world : server.getWorlds()) for (World world : server.getWorlds())
{ {
@ -96,16 +96,16 @@ public class TotalFreedomMod extends JavaPlugin
} }
// Initialize game rules // Initialize game rules
TFM_GameRuleHandler.setGameRule(TFM_GameRuleHandler.TFM_GameRule.DO_DAYLIGHT_CYCLE, !disableNight, false); TFM_GameRuleHandler.setGameRule(TFM_GameRuleHandler.TFM_GameRule.DO_DAYLIGHT_CYCLE, !TFM_ConfigEntry.DISABLE_NIGHT.getBoolean(), false);
TFM_GameRuleHandler.setGameRule(TFM_GameRuleHandler.TFM_GameRule.DO_FIRE_TICK, TFM_ConfigEntry.ALLOW_FIRE_SPREAD.getBoolean(), false); TFM_GameRuleHandler.setGameRule(TFM_GameRuleHandler.TFM_GameRule.DO_FIRE_TICK, TFM_ConfigEntry.ALLOW_FIRE_SPREAD.getBoolean(), false);
TFM_GameRuleHandler.setGameRule(TFM_GameRuleHandler.TFM_GameRule.DO_MOB_LOOT, false, false); TFM_GameRuleHandler.setGameRule(TFM_GameRuleHandler.TFM_GameRule.DO_MOB_LOOT, false, false);
TFM_GameRuleHandler.setGameRule(TFM_GameRuleHandler.TFM_GameRule.DO_MOB_SPAWNING, !mobLimiterEnabled, false); TFM_GameRuleHandler.setGameRule(TFM_GameRuleHandler.TFM_GameRule.DO_MOB_SPAWNING, !TFM_ConfigEntry.MOB_LIMITER_ENABLED.getBoolean(), false);
TFM_GameRuleHandler.setGameRule(TFM_GameRuleHandler.TFM_GameRule.DO_TILE_DROPS, false, false); TFM_GameRuleHandler.setGameRule(TFM_GameRuleHandler.TFM_GameRule.DO_TILE_DROPS, false, false);
TFM_GameRuleHandler.setGameRule(TFM_GameRuleHandler.TFM_GameRule.MOB_GRIEFING, false, false); TFM_GameRuleHandler.setGameRule(TFM_GameRuleHandler.TFM_GameRule.MOB_GRIEFING, false, false);
TFM_GameRuleHandler.setGameRule(TFM_GameRuleHandler.TFM_GameRule.NATURAL_REGENERATION, true, false); TFM_GameRuleHandler.setGameRule(TFM_GameRuleHandler.TFM_GameRule.NATURAL_REGENERATION, true, false);
TFM_GameRuleHandler.commitGameRules(); TFM_GameRuleHandler.commitGameRules();
if (TotalFreedomMod.protectedAreasEnabled) if (TFM_ConfigEntry.PROTECTED_AREAS_ENABLED.getBoolean())
{ {
TFM_ProtectedArea.loadProtectedAreas(); TFM_ProtectedArea.loadProtectedAreas();
TFM_ProtectedArea.autoAddSpawnpoints(); TFM_ProtectedArea.autoAddSpawnpoints();
@ -230,34 +230,6 @@ public class TotalFreedomMod extends JavaPlugin
} }
// //
@Deprecated @Deprecated
public static boolean autoProtectSpawnpoints = true;
@Deprecated
public static boolean disableNight = true;
@Deprecated
public static boolean disableWeather = true;
@Deprecated
public static boolean generateFlatlands = true;
@Deprecated
public static boolean landminesEnabled = false;
@Deprecated
public static boolean mobLimiterDisableDragon = true;
@Deprecated
public static boolean mobLimiterDisableGhast = true;
@Deprecated
public static boolean mobLimiterDisableGiant = true;
@Deprecated
public static boolean mobLimiterDisableSlime = true;
@Deprecated
public static boolean mobLimiterEnabled = true;
@Deprecated
public static boolean mp44Enabled = false;
@Deprecated
public static boolean nukeMonitor = true;
@Deprecated
public static boolean petProtectEnabled = true;
@Deprecated
public static boolean preprocessLogEnabled = true;
@Deprecated
public static boolean protectedAreasEnabled = true; public static boolean protectedAreasEnabled = true;
@Deprecated @Deprecated
public static boolean tossmobEnabled = false; public static boolean tossmobEnabled = false;
@ -268,16 +240,6 @@ public class TotalFreedomMod extends JavaPlugin
@Deprecated @Deprecated
public static double explosiveRadius = 4.0D; public static double explosiveRadius = 4.0D;
@Deprecated @Deprecated
public static double nukeMonitorRange = 10.0D;
@Deprecated
public static int freecamTriggerCount = 10;
@Deprecated
public static int mobLimiterMax = 50;
@Deprecated
public static int nukeMonitorCountBreak = 100;
@Deprecated
public static int nukeMonitorCountPlace = 25;
@Deprecated
public static List<String> blockedCommands = new ArrayList<String>(); public static List<String> blockedCommands = new ArrayList<String>();
@Deprecated @Deprecated
public static List<String> host_sender_names = Arrays.asList("rcon", "remotebukkit"); public static List<String> host_sender_names = Arrays.asList("rcon", "remotebukkit");