mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2024-11-30 02:05:41 +00:00
Added TFM_Log class to organize logging. !!STILL UNSTABLE!!
Will complete JeromSar merge next commit, using these loggers.
This commit is contained in:
parent
7d5b52b24e
commit
fce0ca3498
@ -4,7 +4,7 @@ import java.io.File;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Level;
|
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
@ -103,7 +103,7 @@ public class Command_saconfig extends TFM_Command
|
|||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, null, ex);
|
TFM_Log.severe(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (args[0].equalsIgnoreCase("delete") || args[0].equalsIgnoreCase("del") || args[0].equalsIgnoreCase("remove"))
|
else if (args[0].equalsIgnoreCase("delete") || args[0].equalsIgnoreCase("del") || args[0].equalsIgnoreCase("remove"))
|
||||||
@ -157,7 +157,7 @@ public class Command_saconfig extends TFM_Command
|
|||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, null, ex);
|
TFM_Log.severe(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2,7 +2,7 @@ package me.StevenLawson.TotalFreedomMod.Commands;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.util.logging.Level;
|
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.command.Command;
|
import org.bukkit.command.Command;
|
||||||
@ -45,7 +45,7 @@ public class Command_ziptool extends TFM_Command
|
|||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, null, ex);
|
TFM_Log.severe(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage("Zip finished.");
|
sender.sendMessage("Zip finished.");
|
||||||
@ -68,7 +68,7 @@ public class Command_ziptool extends TFM_Command
|
|||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, null, ex);
|
TFM_Log.severe(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
sender.sendMessage("Unzip finished.");
|
sender.sendMessage("Unzip finished.");
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Commands;
|
package me.StevenLawson.TotalFreedomMod.Commands;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.logging.Logger;
|
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@ -13,7 +13,6 @@ public class TFM_Command
|
|||||||
{
|
{
|
||||||
protected TotalFreedomMod plugin;
|
protected TotalFreedomMod plugin;
|
||||||
protected Server server;
|
protected Server server;
|
||||||
protected static final Logger log = Logger.getLogger("Minecraft");
|
|
||||||
|
|
||||||
public TFM_Command()
|
public TFM_Command()
|
||||||
{
|
{
|
||||||
@ -21,7 +20,7 @@ public class TFM_Command
|
|||||||
|
|
||||||
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)
|
||||||
{
|
{
|
||||||
log.severe("Command Error: Command not implemented: " + cmd.getName());
|
TFM_Log.severe("Command Error: Command not implemented: " + cmd.getName());
|
||||||
sender.sendMessage(ChatColor.RED + "Command Error: Command not implemented: " + cmd.getName());
|
sender.sendMessage(ChatColor.RED + "Command Error: Command not implemented: " + cmd.getName());
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
package me.StevenLawson.TotalFreedomMod.Listener;
|
package me.StevenLawson.TotalFreedomMod.Listener;
|
||||||
|
|
||||||
import java.util.logging.Logger;
|
import me.StevenLawson.TotalFreedomMod.TFM_Log;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
import me.StevenLawson.TotalFreedomMod.TFM_UserInfo;
|
||||||
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
import me.StevenLawson.TotalFreedomMod.TFM_Util;
|
||||||
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
import me.StevenLawson.TotalFreedomMod.TotalFreedomMod;
|
||||||
@ -17,7 +17,6 @@ import org.bukkit.inventory.ItemStack;
|
|||||||
public class TFM_BlockListener implements Listener
|
public class TFM_BlockListener implements Listener
|
||||||
{
|
{
|
||||||
private final TotalFreedomMod plugin;
|
private final TotalFreedomMod plugin;
|
||||||
private static final Logger log = Logger.getLogger("Minecraft");
|
|
||||||
|
|
||||||
public TFM_BlockListener(TotalFreedomMod instance)
|
public TFM_BlockListener(TotalFreedomMod instance)
|
||||||
{
|
{
|
||||||
@ -152,7 +151,7 @@ public class TFM_BlockListener implements Listener
|
|||||||
{
|
{
|
||||||
if (TotalFreedomMod.allowLavaPlace)
|
if (TotalFreedomMod.allowLavaPlace)
|
||||||
{
|
{
|
||||||
log.info(String.format("%s placed lava @ %s", p.getName(), TFM_Util.formatLocation(event.getBlock().getLocation())));
|
TFM_Log.info(String.format("%s placed lava @ %s", p.getName(), TFM_Util.formatLocation(event.getBlock().getLocation())));
|
||||||
|
|
||||||
p.getInventory().clear(p.getInventory().getHeldItemSlot());
|
p.getInventory().clear(p.getInventory().getHeldItemSlot());
|
||||||
}
|
}
|
||||||
@ -171,7 +170,7 @@ public class TFM_BlockListener implements Listener
|
|||||||
{
|
{
|
||||||
if (TotalFreedomMod.allowWaterPlace)
|
if (TotalFreedomMod.allowWaterPlace)
|
||||||
{
|
{
|
||||||
log.info(String.format("%s placed water @ %s", p.getName(), TFM_Util.formatLocation(event.getBlock().getLocation())));
|
TFM_Log.info(String.format("%s placed water @ %s", p.getName(), TFM_Util.formatLocation(event.getBlock().getLocation())));
|
||||||
|
|
||||||
p.getInventory().clear(p.getInventory().getHeldItemSlot());
|
p.getInventory().clear(p.getInventory().getHeldItemSlot());
|
||||||
}
|
}
|
||||||
@ -189,7 +188,7 @@ public class TFM_BlockListener implements Listener
|
|||||||
{
|
{
|
||||||
if (TotalFreedomMod.allowFirePlace)
|
if (TotalFreedomMod.allowFirePlace)
|
||||||
{
|
{
|
||||||
log.info(String.format("%s placed fire @ %s", p.getName(), TFM_Util.formatLocation(event.getBlock().getLocation())));
|
TFM_Log.info(String.format("%s placed fire @ %s", p.getName(), TFM_Util.formatLocation(event.getBlock().getLocation())));
|
||||||
|
|
||||||
p.getInventory().clear(p.getInventory().getHeldItemSlot());
|
p.getInventory().clear(p.getInventory().getHeldItemSlot());
|
||||||
}
|
}
|
||||||
@ -207,7 +206,7 @@ public class TFM_BlockListener implements Listener
|
|||||||
{
|
{
|
||||||
if (TotalFreedomMod.allowExplosions)
|
if (TotalFreedomMod.allowExplosions)
|
||||||
{
|
{
|
||||||
log.info(String.format("%s placed TNT @ %s", p.getName(), TFM_Util.formatLocation(event.getBlock().getLocation())));
|
TFM_Log.info(String.format("%s placed TNT @ %s", p.getName(), TFM_Util.formatLocation(event.getBlock().getLocation())));
|
||||||
|
|
||||||
p.getInventory().clear(p.getInventory().getHeldItemSlot());
|
p.getInventory().clear(p.getInventory().getHeldItemSlot());
|
||||||
}
|
}
|
||||||
|
@ -3,8 +3,6 @@ package me.StevenLawson.TotalFreedomMod.Listener;
|
|||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map.Entry;
|
import java.util.Map.Entry;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
import me.StevenLawson.TotalFreedomMod.*;
|
import me.StevenLawson.TotalFreedomMod.*;
|
||||||
import net.minecraft.server.BanEntry;
|
import net.minecraft.server.BanEntry;
|
||||||
@ -27,7 +25,6 @@ import org.bukkit.util.Vector;
|
|||||||
public class TFM_PlayerListener implements Listener
|
public class TFM_PlayerListener implements Listener
|
||||||
{
|
{
|
||||||
private final TotalFreedomMod plugin;
|
private final TotalFreedomMod plugin;
|
||||||
private static final Logger log = Logger.getLogger("Minecraft");
|
|
||||||
private static final SimpleDateFormat date_format = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
|
private static final SimpleDateFormat date_format = new SimpleDateFormat("yyyy-MM-dd \'at\' HH:mm:ss z");
|
||||||
|
|
||||||
public TFM_PlayerListener(TotalFreedomMod instance)
|
public TFM_PlayerListener(TotalFreedomMod instance)
|
||||||
@ -337,7 +334,7 @@ public class TFM_PlayerListener implements Listener
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, null, ex);
|
TFM_Log.severe(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -365,7 +362,7 @@ public class TFM_PlayerListener implements Listener
|
|||||||
|
|
||||||
if (TotalFreedomMod.preprocessLogEnabled)
|
if (TotalFreedomMod.preprocessLogEnabled)
|
||||||
{
|
{
|
||||||
log.info(String.format("[PREPROCESS_COMMAND] %s(%s): %s", p.getName(), ChatColor.stripColor(p.getDisplayName()), command));
|
TFM_Log.info(String.format("[PREPROCESS_COMMAND] %s(%s): %s", p.getName(), ChatColor.stripColor(p.getDisplayName()), command), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
command = command.toLowerCase().trim();
|
command = command.toLowerCase().trim();
|
||||||
|
54
src/me/StevenLawson/TotalFreedomMod/TFM_Log.java
Normal file
54
src/me/StevenLawson/TotalFreedomMod/TFM_Log.java
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
package me.StevenLawson.TotalFreedomMod;
|
||||||
|
|
||||||
|
import java.util.logging.Level;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
public class TFM_Log
|
||||||
|
{
|
||||||
|
private static final Logger logger = Logger.getLogger("Minecraft");
|
||||||
|
|
||||||
|
private 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);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void info(String message, boolean raw)
|
||||||
|
{
|
||||||
|
TFM_Log.log(Level.INFO, message, raw);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void warning(String message)
|
||||||
|
{
|
||||||
|
TFM_Log.info(message, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void warning(String message, boolean raw)
|
||||||
|
{
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
@ -3,22 +3,16 @@ package me.StevenLawson.TotalFreedomMod;
|
|||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStreamReader;
|
import java.io.InputStreamReader;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import org.bukkit.Server;
|
|
||||||
|
|
||||||
public class TFM_RunSystemCommand implements Runnable
|
public class TFM_RunSystemCommand implements Runnable
|
||||||
{
|
{
|
||||||
private static final Logger log = Logger.getLogger("Minecraft");
|
|
||||||
private final String command;
|
private final String command;
|
||||||
private final TotalFreedomMod plugin;
|
private final TotalFreedomMod plugin;
|
||||||
private final Server server;
|
|
||||||
|
|
||||||
public TFM_RunSystemCommand(String command, TotalFreedomMod plugin)
|
public TFM_RunSystemCommand(String command, TotalFreedomMod plugin)
|
||||||
{
|
{
|
||||||
this.command = command;
|
this.command = command;
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
this.server = plugin.getServer();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -40,7 +34,7 @@ public class TFM_RunSystemCommand implements Runnable
|
|||||||
line = reader.readLine();
|
line = reader.readLine();
|
||||||
if (line != null)
|
if (line != null)
|
||||||
{
|
{
|
||||||
log.log(Level.INFO, line);
|
TFM_Log.info(line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (line != null);
|
while (line != null);
|
||||||
@ -52,15 +46,15 @@ public class TFM_RunSystemCommand implements Runnable
|
|||||||
}
|
}
|
||||||
catch (InterruptedException ex)
|
catch (InterruptedException ex)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, ex.getMessage());
|
TFM_Log.severe(ex.getMessage());
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, ex.getMessage());
|
TFM_Log.severe(ex.getMessage());
|
||||||
}
|
}
|
||||||
catch (Throwable ex)
|
catch (Throwable ex)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, null, ex);
|
TFM_Log.severe(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,8 +6,6 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import org.bukkit.configuration.file.FileConfiguration;
|
import org.bukkit.configuration.file.FileConfiguration;
|
||||||
import org.bukkit.configuration.file.YamlConfiguration;
|
import org.bukkit.configuration.file.YamlConfiguration;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
@ -16,8 +14,6 @@ public class TFM_UserList
|
|||||||
{
|
{
|
||||||
private static final String USERLIST_FILENAME = "userlist.yml";
|
private static final String USERLIST_FILENAME = "userlist.yml";
|
||||||
|
|
||||||
private static final Logger log = Logger.getLogger("Minecraft");
|
|
||||||
|
|
||||||
private static TFM_UserList instance = null;
|
private static TFM_UserList instance = null;
|
||||||
|
|
||||||
private Map<String, TFM_UserListEntry> _userlist = new HashMap<String, TFM_UserListEntry>();
|
private Map<String, TFM_UserListEntry> _userlist = new HashMap<String, TFM_UserListEntry>();
|
||||||
@ -65,7 +61,7 @@ public class TFM_UserList
|
|||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, null, ex);
|
TFM_Log.severe(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5,11 +5,10 @@ import java.net.InetSocketAddress;
|
|||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.jar.JarFile;
|
import java.util.jar.JarFile;
|
||||||
import java.util.logging.Level;
|
|
||||||
import java.util.logging.Logger;
|
|
||||||
import java.util.zip.ZipEntry;
|
import java.util.zip.ZipEntry;
|
||||||
import java.util.zip.ZipFile;
|
import java.util.zip.ZipFile;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
import org.apache.commons.lang.exception.ExceptionUtils;
|
||||||
import org.bukkit.*;
|
import org.bukkit.*;
|
||||||
import org.bukkit.block.Block;
|
import org.bukkit.block.Block;
|
||||||
import org.bukkit.command.CommandSender;
|
import org.bukkit.command.CommandSender;
|
||||||
@ -19,7 +18,6 @@ import org.bukkit.entity.*;
|
|||||||
|
|
||||||
public class TFM_Util
|
public class TFM_Util
|
||||||
{
|
{
|
||||||
private static final Logger log = Logger.getLogger("Minecraft");
|
|
||||||
private static Map<String, Integer> eject_tracker = new HashMap<String, Integer>();
|
private static Map<String, Integer> eject_tracker = new HashMap<String, Integer>();
|
||||||
public static final Map<String, EntityType> mobtypes = new HashMap<String, EntityType>();
|
public static final Map<String, EntityType> mobtypes = new HashMap<String, EntityType>();
|
||||||
public static final List<String> stop_commands = new ArrayList<String>();
|
public static final List<String> stop_commands = new ArrayList<String>();
|
||||||
@ -65,7 +63,7 @@ public class TFM_Util
|
|||||||
|
|
||||||
public static void bcastMsg(String message, ChatColor color)
|
public static void bcastMsg(String message, ChatColor color)
|
||||||
{
|
{
|
||||||
log.info(message);
|
TFM_Log.info(message);
|
||||||
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
@ -75,7 +73,7 @@ public class TFM_Util
|
|||||||
|
|
||||||
public static void bcastMsg(String message)
|
public static void bcastMsg(String message)
|
||||||
{
|
{
|
||||||
log.info(ChatColor.stripColor(message));
|
TFM_Log.info(message);
|
||||||
|
|
||||||
for (Player p : Bukkit.getOnlinePlayers())
|
for (Player p : Bukkit.getOnlinePlayers())
|
||||||
{
|
{
|
||||||
@ -206,7 +204,7 @@ public class TFM_Util
|
|||||||
File actual = new File(tfm.getDataFolder(), name);
|
File actual = new File(tfm.getDataFolder(), name);
|
||||||
if (!actual.exists())
|
if (!actual.exists())
|
||||||
{
|
{
|
||||||
log.info("[" + tfm.getDescription().getName() + "]: Installing default configuration file template: " + actual.getPath());
|
TFM_Log.info("Installing default configuration file template: " + actual.getPath());
|
||||||
InputStream input = null;
|
InputStream input = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -214,14 +212,14 @@ public class TFM_Util
|
|||||||
ZipEntry copy = file.getEntry(name);
|
ZipEntry copy = file.getEntry(name);
|
||||||
if (copy == null)
|
if (copy == null)
|
||||||
{
|
{
|
||||||
log.severe("[" + tfm.getDescription().getName() + "]: Unable to read default configuration: " + actual.getPath());
|
TFM_Log.severe("Unable to read default configuration: " + actual.getPath());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
input = file.getInputStream(copy);
|
input = file.getInputStream(copy);
|
||||||
}
|
}
|
||||||
catch (IOException ioex)
|
catch (IOException ioex)
|
||||||
{
|
{
|
||||||
log.severe("[" + tfm.getDescription().getName() + "]: Unable to read default configuration: " + actual.getPath());
|
TFM_Log.severe("Unable to read default configuration: " + actual.getPath());
|
||||||
}
|
}
|
||||||
if (input != null)
|
if (input != null)
|
||||||
{
|
{
|
||||||
@ -238,11 +236,11 @@ public class TFM_Util
|
|||||||
output.write(buf, 0, length);
|
output.write(buf, 0, length);
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("[" + tfm.getDescription().getName() + "]: Default configuration file written: " + actual.getPath());
|
TFM_Log.info("Default configuration file written: " + actual.getPath());
|
||||||
}
|
}
|
||||||
catch (IOException ioex)
|
catch (IOException ioex)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "[" + tfm.getDescription().getName() + "]: Unable to write default configuration: " + actual.getPath(), ioex);
|
TFM_Log.severe("Unable to write default configuration: " + actual.getPath() + "\n" + ExceptionUtils.getStackTrace(ioex));
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
@ -314,7 +312,7 @@ public class TFM_Util
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
log.severe("Exception in TFM_Util.isUserSuperadmin: " + ex.getMessage());
|
TFM_Log.severe(ex);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
@ -371,7 +369,7 @@ public class TFM_Util
|
|||||||
ip = ip.toLowerCase().trim();
|
ip = ip.toLowerCase().trim();
|
||||||
if (ip.equals(match_ip))
|
if (ip.equals(match_ip))
|
||||||
{
|
{
|
||||||
log.info("New IP '" + user_ip + "' matches old IP '" + match_ip + "' via partial match, adding it to superadmin list.");
|
TFM_Log.info("New IP '" + user_ip + "' matches old IP '" + match_ip + "' via partial match, adding it to superadmin list.");
|
||||||
user_ips.add(user_ip);
|
user_ips.add(user_ip);
|
||||||
config.set(user, user_ips);
|
config.set(user, user_ips);
|
||||||
break fileloop;
|
break fileloop;
|
||||||
@ -385,7 +383,7 @@ public class TFM_Util
|
|||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, null, ex);
|
TFM_Log.severe(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -611,7 +609,7 @@ public class TFM_Util
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("autoEject -> name: " + p.getName() + " - player_ip: " + player_ip + " - method: " + method.toString());
|
TFM_Log.info("autoEject -> name: " + p.getName() + " - player_ip: " + player_ip + " - method: " + method.toString());
|
||||||
|
|
||||||
p.setOp(false);
|
p.setOp(false);
|
||||||
p.setGameMode(GameMode.SURVIVAL);
|
p.setGameMode(GameMode.SURVIVAL);
|
||||||
|
@ -10,6 +10,7 @@ import me.StevenLawson.TotalFreedomMod.Listener.TFM_BlockListener;
|
|||||||
import me.StevenLawson.TotalFreedomMod.Listener.TFM_EntityListener;
|
import me.StevenLawson.TotalFreedomMod.Listener.TFM_EntityListener;
|
||||||
import me.StevenLawson.TotalFreedomMod.Listener.TFM_PlayerListener;
|
import me.StevenLawson.TotalFreedomMod.Listener.TFM_PlayerListener;
|
||||||
import me.StevenLawson.TotalFreedomMod.Listener.TFM_WeatherListener;
|
import me.StevenLawson.TotalFreedomMod.Listener.TFM_WeatherListener;
|
||||||
|
import org.apache.commons.lang.exception.ExceptionUtils;
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.ChatColor;
|
import org.bukkit.ChatColor;
|
||||||
import org.bukkit.Server;
|
import org.bukkit.Server;
|
||||||
@ -23,7 +24,6 @@ import org.bukkit.plugin.java.JavaPlugin;
|
|||||||
|
|
||||||
public class TotalFreedomMod extends JavaPlugin
|
public class TotalFreedomMod extends JavaPlugin
|
||||||
{
|
{
|
||||||
private static final Logger log = Logger.getLogger("Minecraft");
|
|
||||||
private final Server server = Bukkit.getServer();
|
private final Server server = Bukkit.getServer();
|
||||||
|
|
||||||
public static final long HEARTBEAT_RATE = 5L; //Seconds
|
public static final long HEARTBEAT_RATE = 5L; //Seconds
|
||||||
@ -43,6 +43,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
public static String pluginVersion = "";
|
public static String pluginVersion = "";
|
||||||
public static String buildNumber = "";
|
public static String buildNumber = "";
|
||||||
public static String buildDate = "";
|
public static String buildDate = "";
|
||||||
|
public static String pluginName = "";
|
||||||
|
|
||||||
public static TotalFreedomMod plugin = null;
|
public static TotalFreedomMod plugin = null;
|
||||||
|
|
||||||
@ -50,6 +51,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
public void onEnable()
|
public void onEnable()
|
||||||
{
|
{
|
||||||
TotalFreedomMod.plugin = this;
|
TotalFreedomMod.plugin = this;
|
||||||
|
TotalFreedomMod.pluginName = this.getDescription().getName();
|
||||||
|
|
||||||
setAppProperties();
|
setAppProperties();
|
||||||
|
|
||||||
@ -62,7 +64,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
|
|
||||||
server.getScheduler().scheduleAsyncRepeatingTask(this, new TFM_Heartbeat(this), HEARTBEAT_RATE * 20L, HEARTBEAT_RATE * 20L);
|
server.getScheduler().scheduleAsyncRepeatingTask(this, new TFM_Heartbeat(this), HEARTBEAT_RATE * 20L, HEARTBEAT_RATE * 20L);
|
||||||
|
|
||||||
log.log(Level.INFO, "[" + getDescription().getName() + "] - Enabled! - Version: " + TotalFreedomMod.pluginVersion + "." + TotalFreedomMod.buildNumber + " by Madgeek1450 and DarthSalamon");
|
TFM_Log.info("Plugin Enabled - Version: " + TotalFreedomMod.pluginVersion + "." + TotalFreedomMod.buildNumber + " by Madgeek1450 and DarthSalamon");
|
||||||
|
|
||||||
TFM_Util.deleteFolder(new File("./_deleteme"));
|
TFM_Util.deleteFolder(new File("./_deleteme"));
|
||||||
|
|
||||||
@ -76,7 +78,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
public void onDisable()
|
public void onDisable()
|
||||||
{
|
{
|
||||||
server.getScheduler().cancelTasks(this);
|
server.getScheduler().cancelTasks(this);
|
||||||
log.log(Level.INFO, "[" + getDescription().getName() + "] - Disabled.");
|
TFM_Log.info("Plugin Disabled");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -89,19 +91,19 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
if (sender instanceof Player)
|
if (sender instanceof Player)
|
||||||
{
|
{
|
||||||
sender_p = (Player) sender;
|
sender_p = (Player) sender;
|
||||||
log.info(String.format("[PLAYER_COMMAND] %s(%s): /%s %s",
|
TFM_Log.info(String.format("[PLAYER_COMMAND] %s(%s): /%s %s",
|
||||||
sender_p.getName(),
|
sender_p.getName(),
|
||||||
ChatColor.stripColor(sender_p.getDisplayName()),
|
ChatColor.stripColor(sender_p.getDisplayName()),
|
||||||
commandLabel,
|
commandLabel,
|
||||||
TFM_Util.implodeStringList(" ", Arrays.asList(args))));
|
TFM_Util.implodeStringList(" ", Arrays.asList(args))), true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
senderIsConsole = true;
|
senderIsConsole = true;
|
||||||
log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s",
|
TFM_Log.info(String.format("[CONSOLE_COMMAND] %s: /%s %s",
|
||||||
sender.getName(),
|
sender.getName(),
|
||||||
commandLabel,
|
commandLabel,
|
||||||
TFM_Util.implodeStringList(" ", Arrays.asList(args))));
|
TFM_Util.implodeStringList(" ", Arrays.asList(args))), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
TFM_Command dispatcher;
|
TFM_Command dispatcher;
|
||||||
@ -113,7 +115,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
}
|
}
|
||||||
catch (Throwable ex)
|
catch (Throwable ex)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "[" + getDescription().getName() + "] Command not loaded: " + cmd.getName(), ex);
|
TFM_Log.severe("Command not loaded: " + cmd.getName() + "\n" + ExceptionUtils.getStackTrace(ex));
|
||||||
sender.sendMessage(ChatColor.RED + "Command Error: Command not loaded: " + cmd.getName());
|
sender.sendMessage(ChatColor.RED + "Command Error: Command not loaded: " + cmd.getName());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -131,7 +133,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
}
|
}
|
||||||
catch (Throwable ex)
|
catch (Throwable ex)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, "[" + getDescription().getName() + "] Command Error: " + commandLabel, ex);
|
TFM_Log.severe("Command Error: " + commandLabel + "\n" + ExceptionUtils.getStackTrace(ex));
|
||||||
sender.sendMessage(ChatColor.RED + "Unknown Command Error.");
|
sender.sendMessage(ChatColor.RED + "Unknown Command Error.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,7 +258,7 @@ public class TotalFreedomMod extends JavaPlugin
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
log.log(Level.SEVERE, null, ex);
|
TFM_Log.severe(ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ name: TotalFreedomMod
|
|||||||
main: me.StevenLawson.TotalFreedomMod.TotalFreedomMod
|
main: me.StevenLawson.TotalFreedomMod.TotalFreedomMod
|
||||||
version: 2.7
|
version: 2.7
|
||||||
description: Plugin for the Total Freedom server.
|
description: Plugin for the Total Freedom server.
|
||||||
author: StevenLawson / Madgeek1450
|
authors: [StevenLawson / Madgeek1450, JeromSar / DarthSalamon]
|
||||||
commands:
|
commands:
|
||||||
cage:
|
cage:
|
||||||
description: Superadmin command - Place a cage around someone.
|
description: Superadmin command - Place a cage around someone.
|
||||||
|
Loading…
Reference in New Issue
Block a user