Incremented version number, changed startup logic

Improved logging, small changes
This commit is contained in:
JeromSar 2013-08-20 17:35:00 +02:00
parent 5c32c66390
commit 75ec2330f5
8 changed files with 79 additions and 70 deletions

View File

@ -1,5 +1,5 @@
#Sun, 18 Aug 2013 16:44:40 -0400
#Tue, 20 Aug 2013 17:31:27 +0200
program.VERSION=3.00
program.BUILDNUM=461
program.BUILDDATE=08/18/2013 04\:44 PM
program.VERSION=3.1
program.BUILDNUM=469
program.BUILDDATE=08/20/2013 05\:31 PM

View File

@ -1,3 +1,3 @@
#Build Number for ANT. Do not edit!
#Sun Aug 18 16:44:40 EDT 2013
build.number=462
#Tue Aug 20 17:31:27 CEST 2013
build.number=470

View File

@ -1,4 +1,4 @@
# TotalFreedomMod v3.00 Configuration
# TotalFreedomMod v3.1 Configuration
# by Madgeek1450 and DarthSalamon
# Block placement prevention:
@ -12,7 +12,7 @@ allow_tnt_minecarts: false
# Explosion management:
allow_explosions: false
explosiveRadius: 4.0
explosive_radius: 4.0
# Blocked commands:
#
@ -126,15 +126,15 @@ host_sender_names:
# TwitterBot - Used to allow superadmins to verify themselves using twitter
twitterbot_enabled: false
twitterbot_url:
twitterbot_secret:
twitterbot_url: ''
twitterbot_secret: ''
# Pet Protect - Prevent tamed pets from being killed.
pet_protect_enabled: true
# Logs Registration
logs_register_password:
logs_register_url:
logs_register_password: ''
logs_register_url: ''
# Mojang service checker
service_checker_url: http://status.mojang.com/check

View File

@ -65,7 +65,6 @@ public class TFM_CommandLoader
Command existing = commandMap.getCommand(dynamicCommand.getName());
if (existing != null)
{
TFM_Log.info("Replacing command: " + existing.getName());
unregisterCommand(existing, commandMap);
}

View File

@ -33,7 +33,7 @@ public enum TFM_ConfigEntry
TWITTERBOT_ENABLED(Boolean.class, "twitterbot_enabled"),
//
AUTO_PROTECT_RADIUS(Double.class, "auto_protect_radius"),
EXPLOSIVE_RADIUS(Double.class, "explosiveRadius"),
EXPLOSIVE_RADIUS(Double.class, "explosive_radius"),
NUKE_MONITOR_RANGE(Double.class, "nuke_monitor_range"),
//
FREECAM_TRIGGER_COUNT(Integer.class, "freecam_trigger_count"),

View File

@ -1,7 +1,7 @@
package me.StevenLawson.TotalFreedomMod;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.commons.lang.exception.ExceptionUtils;
import org.bukkit.Bukkit;
public class TFM_Log
@ -13,43 +13,44 @@ public class TFM_Log
throw new AssertionError();
}
private static void log(Level level, String message, boolean raw)
{
logger.log(level, (raw ? "" : "[" + TotalFreedomMod.pluginName + "]: ") + message);
}
public static void info(String message)
{
TFM_Log.info(message, false);
TotalFreedomMod.logger.info(message);
}
public static void info(String message, boolean raw)
{
TFM_Log.log(Level.INFO, message, raw);
if (raw)
{
TotalFreedomMod.logger.info(message);
}
else
{
info(message);
}
}
public static void warning(String message)
public static void severe(Object message)
{
TFM_Log.info(message, false);
if (message instanceof Throwable)
{
TotalFreedomMod.logger.severe(ExceptionUtils.getFullStackTrace((Throwable) message));
}
else
{
TotalFreedomMod.logger.severe(String.valueOf(message));
}
}
public static void warning(String message, boolean raw)
public static void warning(Object message)
{
TFM_Log.log(Level.WARNING, message, raw);
}
public static void severe(String message)
{
TFM_Log.info(message, false);
}
public static void severe(String message, boolean raw)
{
TFM_Log.log(Level.SEVERE, message, raw);
}
public static void severe(Throwable ex)
{
logger.log(Level.SEVERE, null, ex);
if (message instanceof Throwable)
{
TotalFreedomMod.logger.warning(ExceptionUtils.getFullStackTrace((Throwable) message));
}
else
{
TotalFreedomMod.logger.warning(String.valueOf(message));
}
}
}

View File

@ -4,6 +4,7 @@ import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.*;
import java.util.logging.Logger;
import me.StevenLawson.TotalFreedomMod.Commands.TFM_Command;
import me.StevenLawson.TotalFreedomMod.Commands.TFM_CommandLoader;
import me.StevenLawson.TotalFreedomMod.Listener.*;
@ -26,8 +27,6 @@ import org.mcstats.Metrics;
public class TotalFreedomMod extends JavaPlugin
{
public static final Server server = Bukkit.getServer();
//
public static final long HEARTBEAT_RATE = 5L; //Seconds
public static final long SERVICE_CHECKER_RATE = 120L;
//
@ -45,34 +44,45 @@ public class TotalFreedomMod extends JavaPlugin
public static final String CAKE_LYRICS = "But there's no sense crying over every mistake. You just keep on trying till you run out of cake.";
public static final String NOT_FROM_CONSOLE = "This command may not be used from the console.";
//
public static final Server server = Bukkit.getServer();
public static TotalFreedomMod plugin = null;
public static File plugin_file = null;
//
public static Logger logger;
//
public static String pluginName = "";
public static String pluginVersion = "";
public static String buildNumber = "";
public static String buildDate = "";
//
public static boolean allPlayersFrozen = false;
public static BukkitTask freezePurgeTask = null;
public static BukkitTask mutePurgeTask = null;
public static boolean lockdownEnabled = false;
public static Map<Player, Double> fuckoffEnabledFor = new HashMap<Player, Double>();
//
public static String pluginVersion = "";
public static String buildNumber = "";
public static String buildDate = "";
public static String pluginName = "";
//
public static TotalFreedomMod plugin = null;
public static File plugin_file = null;
public static List<String> permbanned_players = new ArrayList<String>();
public static List<String> permbanned_ips = new ArrayList<String>();
@Override
public void onEnable()
{
TotalFreedomMod.plugin = this;
TotalFreedomMod.plugin_file = getFile();
TotalFreedomMod.pluginName = this.getDescription().getName();
TotalFreedomMod.plugin_file = plugin.getFile();
TotalFreedomMod.logger = plugin.getLogger();
TotalFreedomMod.pluginName = plugin.getDescription().getName();
setAppProperties();
logger = plugin.getLogger();
TFM_Log.info("Version: " + TotalFreedomMod.pluginVersion + "." + TotalFreedomMod.buildNumber + " by Madgeek1450 and DarthSalamon");
loadSuperadminConfig();
loadPermbanConfig();
TFM_UserList.getInstance(this);
TFM_UserList.getInstance(plugin);
registerEventHandlers();
@ -91,7 +101,6 @@ public class TotalFreedomMod extends JavaPlugin
world.setThundering(false);
world.setStorm(false);
world.setThunderDuration(0);
world.setThunderDuration(0);
}
}
@ -129,7 +138,7 @@ public class TotalFreedomMod extends JavaPlugin
}
// Heartbeat
new TFM_Heartbeat(this).runTaskTimer(plugin, HEARTBEAT_RATE * 20L, HEARTBEAT_RATE * 20L);
new TFM_Heartbeat(plugin).runTaskTimer(plugin, HEARTBEAT_RATE * 20L, HEARTBEAT_RATE * 20L);
// metrics @ http://mcstats.org/plugin/TotalFreedomMod
try
@ -142,8 +151,6 @@ public class TotalFreedomMod extends JavaPlugin
TFM_Log.warning("Failed to submit metrics data: " + ex.getMessage());
}
TFM_Log.info("Plugin Enabled - Version: " + TotalFreedomMod.pluginVersion + "." + TotalFreedomMod.buildNumber + " by Madgeek1450 and DarthSalamon");
TFM_ServiceChecker.getInstance().getUpdateRunnable().runTaskTimerAsynchronously(plugin, 40L, SERVICE_CHECKER_RATE * 20L);
new BukkitRunnable()
@ -154,13 +161,16 @@ public class TotalFreedomMod extends JavaPlugin
TFM_CommandLoader.getInstance().scan();
TFM_CommandBlocker.getInstance().parseBlockingRules();
}
}.runTaskLater(this, 20L);
}.runTaskLater(plugin, 20L);
TFM_Log.info("Plugin enabled");
}
@Override
public void onDisable()
{
server.getScheduler().cancelTasks(this);
server.getScheduler().cancelTasks(plugin);
TFM_Log.info("Plugin disabled");
}
@ -194,7 +204,7 @@ public class TotalFreedomMod extends JavaPlugin
{
ClassLoader classLoader = TotalFreedomMod.class.getClassLoader();
dispatcher = (TFM_Command) classLoader.loadClass(String.format("%s.%s%s", COMMAND_PATH, COMMAND_PREFIX, cmd.getName().toLowerCase())).newInstance();
dispatcher.setup(this, sender, dispatcher.getClass());
dispatcher.setup(plugin, sender, dispatcher.getClass());
}
catch (Throwable ex)
{
@ -241,9 +251,6 @@ public class TotalFreedomMod extends JavaPlugin
TFM_Log.severe("Error loading superadmin list: " + ex.getMessage());
}
}
//
public static List<String> permbanned_players = new ArrayList<String>();
public static List<String> permbanned_ips = new ArrayList<String>();
public static void loadPermbanConfig()
{
@ -272,7 +279,8 @@ public class TotalFreedomMod extends JavaPlugin
}
catch (Exception ex)
{
TFM_Log.severe("Error loading permban list: " + ex.getMessage());
TFM_Log.severe("Error loading permban list!");
TFM_Log.severe(ex);
}
}
@ -291,10 +299,10 @@ public class TotalFreedomMod extends JavaPlugin
{
try
{
InputStream in;
InputStream in = plugin.getResource("appinfo.properties");
Properties props = new Properties();
in = plugin.getClass().getResourceAsStream("/appinfo.properties");
// in = plugin.getClass().getResourceAsStream("/appinfo.properties");
props.load(in);
in.close();
@ -304,6 +312,7 @@ public class TotalFreedomMod extends JavaPlugin
}
catch (Exception ex)
{
TFM_Log.severe("Could not load App properties!");
TFM_Log.severe(ex);
}
}

View File

@ -1,7 +1,7 @@
name: TotalFreedomMod
main: me.StevenLawson.TotalFreedomMod.TotalFreedomMod
version: 3.00
version: 3.1
description: Plugin for the Total Freedom server.
authors: [StevenLawson / Madgeek1450, JeromSar / DarthSalamon]
authors: [Madgeek1450, DarthSalamon]
# plugin.yml is no longer used to define commands.