console message

This commit is contained in:
boy0001 2015-02-19 21:23:36 +11:00
parent 0d3f6d5e0b
commit 55e2465bee
29 changed files with 185 additions and 185 deletions

View File

@ -472,13 +472,13 @@ public class _PlotSquared {
public static void configs() { public static void configs() {
final File folder = new File(getMain().getDataFolder() + File.separator + "config"); final File folder = new File(getMain().getDataFolder() + File.separator + "config");
if (!folder.exists() && !folder.mkdirs()) { if (!folder.exists() && !folder.mkdirs()) {
sendConsoleSenderMessage(C.PREFIX.s() + "&cFailed to create the /plugins/config folder. Please create it manually."); log(C.PREFIX.s() + "&cFailed to create the /plugins/config folder. Please create it manually.");
} }
try { try {
styleFile = new File(getMain().getDataFolder() + File.separator + "translations" + File.separator + "style.yml"); styleFile = new File(getMain().getDataFolder() + File.separator + "translations" + File.separator + "style.yml");
if (!styleFile.exists()) { if (!styleFile.exists()) {
if (!styleFile.createNewFile()) { if (!styleFile.createNewFile()) {
sendConsoleSenderMessage("Could not create the style file, please create \"translations/style.yml\" manually"); log("Could not create the style file, please create \"translations/style.yml\" manually");
} }
} }
styleConfig = YamlConfiguration.loadConfiguration(styleFile); styleConfig = YamlConfiguration.loadConfiguration(styleFile);
@ -491,7 +491,7 @@ public class _PlotSquared {
configFile = new File(getMain().getDataFolder() + File.separator + "config" + File.separator + "settings.yml"); configFile = new File(getMain().getDataFolder() + File.separator + "config" + File.separator + "settings.yml");
if (!configFile.exists()) { if (!configFile.exists()) {
if (!configFile.createNewFile()) { if (!configFile.createNewFile()) {
sendConsoleSenderMessage("Could not create the settings file, please create \"settings.yml\" manually."); log("Could not create the settings file, please create \"settings.yml\" manually.");
} }
} }
config = YamlConfiguration.loadConfiguration(configFile); config = YamlConfiguration.loadConfiguration(configFile);
@ -504,7 +504,7 @@ public class _PlotSquared {
storageFile = new File(getMain().getDataFolder() + File.separator + "config" + File.separator + "storage.yml"); storageFile = new File(getMain().getDataFolder() + File.separator + "config" + File.separator + "storage.yml");
if (!storageFile.exists()) { if (!storageFile.exists()) {
if (!storageFile.createNewFile()) { if (!storageFile.createNewFile()) {
sendConsoleSenderMessage("Could not the storage settings file, please create \"storage.yml\" manually."); log("Could not the storage settings file, please create \"storage.yml\" manually.");
} }
} }
storage = YamlConfiguration.loadConfiguration(storageFile); storage = YamlConfiguration.loadConfiguration(storageFile);
@ -557,7 +557,7 @@ public class _PlotSquared {
settings.put("Schematics Save Path", "" + Settings.SCHEMATIC_SAVE_PATH); settings.put("Schematics Save Path", "" + Settings.SCHEMATIC_SAVE_PATH);
settings.put("API Location", "" + Settings.API_URL); settings.put("API Location", "" + Settings.API_URL);
for (final Entry<String, String> setting : settings.entrySet()) { for (final Entry<String, String> setting : settings.entrySet()) {
sendConsoleSenderMessage(C.PREFIX.s() + String.format("&cKey: &6%s&c, Value: &6%s", setting.getKey(), setting.getValue())); log(C.PREFIX.s() + String.format("&cKey: &6%s&c, Value: &6%s", setting.getKey(), setting.getValue()));
} }
} }
} }
@ -571,7 +571,7 @@ public class _PlotSquared {
long error = 0l; long error = 0l;
{ {
sendConsoleSenderMessage(C.PREFIX.s() + "KillAllEntities started."); log(C.PREFIX.s() + "KillAllEntities started.");
} }
@Override @Override
@ -579,7 +579,7 @@ public class _PlotSquared {
if (this.ticked > 36_000L) { if (this.ticked > 36_000L) {
this.ticked = 0l; this.ticked = 0l;
if (this.error > 0) { if (this.error > 0) {
sendConsoleSenderMessage(C.PREFIX.s() + "KillAllEntities has been running for 6 hours. Errors: " + this.error); log(C.PREFIX.s() + "KillAllEntities has been running for 6 hours. Errors: " + this.error);
} }
this.error = 0l; this.error = 0l;
} }
@ -648,7 +648,7 @@ public class _PlotSquared {
Settings.ENABLE_CLUSTERS = config.getBoolean("clusters.enabled"); Settings.ENABLE_CLUSTERS = config.getBoolean("clusters.enabled");
Settings.DEBUG = config.getBoolean("debug"); Settings.DEBUG = config.getBoolean("debug");
if (Settings.DEBUG) { if (Settings.DEBUG) {
sendConsoleSenderMessage(C.PREFIX.s() + "&6Debug Mode Enabled (Default). Edit the config to turn this off."); log(C.PREFIX.s() + "&6Debug Mode Enabled (Default). Edit the config to turn this off.");
} }
Settings.TELEPORT_DELAY = config.getInt("teleport.delay"); Settings.TELEPORT_DELAY = config.getInt("teleport.delay");
Settings.CONSOLE_COLOR = config.getBoolean("console.color"); Settings.CONSOLE_COLOR = config.getBoolean("console.color");
@ -666,7 +666,7 @@ public class _PlotSquared {
Settings.TITLES = config.getBoolean("titles"); Settings.TITLES = config.getBoolean("titles");
Settings.MAX_PLOTS = config.getInt("max_plots"); Settings.MAX_PLOTS = config.getInt("max_plots");
if (Settings.MAX_PLOTS > 32767) { if (Settings.MAX_PLOTS > 32767) {
sendConsoleSenderMessage("&c`max_plots` Is set too high! This is a per player setting and does not need to be very large."); log("&c`max_plots` Is set too high! This is a per player setting and does not need to be very large.");
Settings.MAX_PLOTS = 32767; Settings.MAX_PLOTS = 32767;
} }
Settings.SCHEMATIC_SAVE_PATH = config.getString("schematics.save_path"); Settings.SCHEMATIC_SAVE_PATH = config.getString("schematics.save_path");
@ -698,7 +698,7 @@ public class _PlotSquared {
try { try {
config.save(PlotSquared.configFile); config.save(PlotSquared.configFile);
} catch (final IOException e) { } catch (final IOException e) {
PlotSquared.sendConsoleSenderMessage("&c[Warning] PlotSquared failed to save the configuration&7 (settings.yml may differ from the one in memory)\n - To force a save from console use /plots save"); PlotSquared.log("&c[Warning] PlotSquared failed to save the configuration&7 (settings.yml may differ from the one in memory)\n - To force a save from console use /plots save");
} }
} }
@ -708,10 +708,10 @@ public class _PlotSquared {
UUIDHandler.cacheAll(); UUIDHandler.cacheAll();
if (Settings.CONVERT_PLOTME) { if (Settings.CONVERT_PLOTME) {
if (Bukkit.getPluginManager().getPlugin("PlotMe") != null) { if (Bukkit.getPluginManager().getPlugin("PlotMe") != null) {
sendConsoleSenderMessage("&c[IMPORTANT] THIS MESSAGE MAY BE EXTREMELY HELPFUL IF YOU HAVE TROUBLE CONVERTING PLOTME!"); log("&c[IMPORTANT] THIS MESSAGE MAY BE EXTREMELY HELPFUL IF YOU HAVE TROUBLE CONVERTING PLOTME!");
sendConsoleSenderMessage("&c[IMPORTANT] - Make sure 'UUID.read-from-disk' is disabled (false)!"); log("&c[IMPORTANT] - Make sure 'UUID.read-from-disk' is disabled (false)!");
sendConsoleSenderMessage("&c[IMPORTANT] - Sometimes the database can be locked, deleting PlotMe.jar beforehand will fix the issue!"); log("&c[IMPORTANT] - Sometimes the database can be locked, deleting PlotMe.jar beforehand will fix the issue!");
sendConsoleSenderMessage("&c[IMPORTANT] - After the conversion is finished, please set 'plotme-convert.enabled' to false in the 'settings.yml@'"); log("&c[IMPORTANT] - After the conversion is finished, please set 'plotme-convert.enabled' to false in the 'settings.yml@'");
} }
try { try {
new PlotMeConverter(PlotSquared.getMain()).runAsync(); new PlotMeConverter(PlotSquared.getMain()).runAsync();
@ -739,10 +739,10 @@ public class _PlotSquared {
plotWorld = plotGenerator.getNewPlotWorld(world); plotWorld = plotGenerator.getNewPlotWorld(world);
plotManager = plotGenerator.getPlotManager(); plotManager = plotGenerator.getPlotManager();
if (!world.equals("CheckingPlotSquaredGenerator")) { if (!world.equals("CheckingPlotSquaredGenerator")) {
sendConsoleSenderMessage(C.PREFIX.s() + "&aDetected world load for '" + world + "'"); log(C.PREFIX.s() + "&aDetected world load for '" + world + "'");
sendConsoleSenderMessage(C.PREFIX.s() + "&3 - generator: &7" + plotGenerator.getClass().getName()); log(C.PREFIX.s() + "&3 - generator: &7" + plotGenerator.getClass().getName());
sendConsoleSenderMessage(C.PREFIX.s() + "&3 - plotworld: &7" + plotWorld.getClass().getName()); log(C.PREFIX.s() + "&3 - plotworld: &7" + plotWorld.getClass().getName());
sendConsoleSenderMessage(C.PREFIX.s() + "&3 - manager: &7" + plotManager.getClass().getName()); log(C.PREFIX.s() + "&3 - manager: &7" + plotManager.getClass().getName());
} }
if (!config.contains(path)) { if (!config.contains(path)) {
config.createSection(path); config.createSection(path);
@ -772,7 +772,7 @@ public class _PlotSquared {
new HybridGen(world); new HybridGen(world);
} }
} catch (Exception e) { } catch (Exception e) {
PlotSquared.sendConsoleSenderMessage("&d=== Oh no! Please set the generator for the " + world + " ==="); PlotSquared.log("&d=== Oh no! Please set the generator for the " + world + " ===");
e.printStackTrace(); e.printStackTrace();
LOADING_WORLD = false; LOADING_WORLD = false;
removePlotWorld(world); removePlotWorld(world);
@ -796,7 +796,7 @@ public class _PlotSquared {
e.printStackTrace(); e.printStackTrace();
} }
if ((plotWorld.TYPE == 2 && !Settings.ENABLE_CLUSTERS) || !(plotManager instanceof SquarePlotManager)) { if ((plotWorld.TYPE == 2 && !Settings.ENABLE_CLUSTERS) || !(plotManager instanceof SquarePlotManager)) {
sendConsoleSenderMessage("&c[ERROR] World '" + world + "' in settings.yml is not using PlotSquared generator! Please set the generator correctly or delete the world from the 'settings.yml'!"); log("&c[ERROR] World '" + world + "' in settings.yml is not using PlotSquared generator! Please set the generator correctly or delete the world from the 'settings.yml'!");
return; return;
} }
addPlotWorld(world, plotWorld, plotManager); addPlotWorld(world, plotWorld, plotManager);
@ -1078,7 +1078,7 @@ public class _PlotSquared {
for (String element : split) { for (String element : split) {
String[] pair = element.split("="); String[] pair = element.split("=");
if (pair.length != 2) { if (pair.length != 2) {
sendConsoleSenderMessage("&cNo value provided for: &7" + element); log("&cNo value provided for: &7" + element);
return null; return null;
} }
String key = pair[0].toLowerCase(); String key = pair[0].toLowerCase();
@ -1123,14 +1123,14 @@ public class _PlotSquared {
break; break;
} }
default: { default: {
sendConsoleSenderMessage("&cKey not found: &7" + element); log("&cKey not found: &7" + element);
return null; return null;
} }
} }
} }
catch (Exception e) { catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
sendConsoleSenderMessage("&cInvalid value: &7" + value + " in arg " + element); log("&cInvalid value: &7" + value + " in arg " + element);
return null; return null;
} }
} }
@ -1253,7 +1253,7 @@ public class _PlotSquared {
} }
@Override @Override
public void sendConsoleSenderMessage(String string) { public void log(String string) {
if (BukkitMain.plugin == null || Bukkit.getServer().getConsoleSender() == null) { if (BukkitMain.plugin == null || Bukkit.getServer().getConsoleSender() == null) {
System.out.println(ChatColor.stripColor(ConsoleColors.fromString(string))); System.out.println(ChatColor.stripColor(ConsoleColors.fromString(string)));
} else { } else {
@ -1277,13 +1277,13 @@ public class _PlotSquared {
C.saveTranslations(); C.saveTranslations();
// Check for outdated java version. // Check for outdated java version.
if (getJavaVersion() < 1.7) { if (getJavaVersion() < 1.7) {
sendConsoleSenderMessage(C.PREFIX.s() + "&cYour java version is outdated. Please update to at least 1.7."); log(C.PREFIX.s() + "&cYour java version is outdated. Please update to at least 1.7.");
// Didn't know of any other link :D // Didn't know of any other link :D
sendConsoleSenderMessage(C.PREFIX.s() + "&cURL: &6https://java.com/en/download/index.jsp"); log(C.PREFIX.s() + "&cURL: &6https://java.com/en/download/index.jsp");
Bukkit.getPluginManager().disablePlugin(this); Bukkit.getPluginManager().disablePlugin(this);
return; return;
} else if (getJavaVersion() < 1.8) { } else if (getJavaVersion() < 1.8) {
sendConsoleSenderMessage(C.PREFIX.s() + "&cIt's really recommended to run Java 1.8, as it increases performance"); log(C.PREFIX.s() + "&cIt's really recommended to run Java 1.8, as it increases performance");
} }
// Setup configuration // Setup configuration
configs(); configs();
@ -1293,20 +1293,20 @@ public class _PlotSquared {
try { try {
final Metrics metrics = new Metrics(this); final Metrics metrics = new Metrics(this);
metrics.start(); metrics.start();
sendConsoleSenderMessage(C.PREFIX.s() + "&6Metrics enabled."); log(C.PREFIX.s() + "&6Metrics enabled.");
} catch (final Exception e) { } catch (final Exception e) {
sendConsoleSenderMessage(C.PREFIX.s() + "&cFailed to load up metrics."); log(C.PREFIX.s() + "&cFailed to load up metrics.");
} }
} else { } else {
// We should at least make them feel bad. // We should at least make them feel bad.
sendConsoleSenderMessage("Using metrics will allow us to improve the plugin\nPlease consider it :)"); log("Using metrics will allow us to improve the plugin\nPlease consider it :)");
} }
// Kill mobs on roads? // Kill mobs on roads?
if (Settings.KILL_ROAD_MOBS) { if (Settings.KILL_ROAD_MOBS) {
killAllEntities(); killAllEntities();
} }
if (C.ENABLED.s().length() > 0) { if (C.ENABLED.s().length() > 0) {
sendConsoleSenderMessage(C.ENABLED); log(C.ENABLED);
} }
final String[] tables; final String[] tables;
if (Settings.ENABLE_CLUSTERS) { if (Settings.ENABLE_CLUSTERS) {
@ -1345,12 +1345,12 @@ public class _PlotSquared {
} }
} catch (final Exception e) { } catch (final Exception e) {
Logger.add(LogLevel.DANGER, "MySQL connection failed."); Logger.add(LogLevel.DANGER, "MySQL connection failed.");
sendConsoleSenderMessage("&c[Plots] MySQL is not setup correctly. The plugin will disable itself."); log("&c[Plots] MySQL is not setup correctly. The plugin will disable itself.");
if ((config == null) || config.getBoolean("debug")) { if ((config == null) || config.getBoolean("debug")) {
sendConsoleSenderMessage("&d==== Here is an ugly stacktrace if you are interested in those things ===="); log("&d==== Here is an ugly stacktrace if you are interested in those things ====");
e.printStackTrace(); e.printStackTrace();
sendConsoleSenderMessage("&d==== End of stacktrace ===="); log("&d==== End of stacktrace ====");
sendConsoleSenderMessage("&6Please go to the PlotSquared 'storage.yml' and configure MySQL correctly."); log("&6Please go to the PlotSquared 'storage.yml' and configure MySQL correctly.");
} }
Bukkit.getPluginManager().disablePlugin(this); Bukkit.getPluginManager().disablePlugin(this);
return; return;
@ -1363,7 +1363,7 @@ public class _PlotSquared {
// TODO: Implement mongo // TODO: Implement mongo
else if (Settings.DB.USE_MONGO) { else if (Settings.DB.USE_MONGO) {
// DBFunc.dbManager = new MongoManager(); // DBFunc.dbManager = new MongoManager();
sendConsoleSenderMessage(C.PREFIX.s() + "MongoDB is not yet implemented"); log(C.PREFIX.s() + "MongoDB is not yet implemented");
} else if (Settings.DB.USE_SQLITE) { } else if (Settings.DB.USE_SQLITE) {
try { try {
connection = new SQLite(this, this.getDataFolder() + File.separator + Settings.DB.SQLITE_DB + ".db").openConnection(); connection = new SQLite(this, this.getDataFolder() + File.separator + Settings.DB.SQLITE_DB + ".db").openConnection();
@ -1384,8 +1384,8 @@ public class _PlotSquared {
} }
} catch (final Exception e) { } catch (final Exception e) {
Logger.add(LogLevel.DANGER, "SQLite connection failed"); Logger.add(LogLevel.DANGER, "SQLite connection failed");
sendConsoleSenderMessage(C.PREFIX.s() + "&cFailed to open SQLite connection. The plugin will disable itself."); log(C.PREFIX.s() + "&cFailed to open SQLite connection. The plugin will disable itself.");
sendConsoleSenderMessage("&9==== Here is an ugly stacktrace, if you are interested in those things ==="); log("&9==== Here is an ugly stacktrace, if you are interested in those things ===");
e.printStackTrace(); e.printStackTrace();
Bukkit.getPluginManager().disablePlugin(this); Bukkit.getPluginManager().disablePlugin(this);
return; return;
@ -1396,7 +1396,7 @@ public class _PlotSquared {
} }
} else { } else {
Logger.add(LogLevel.DANGER, "No storage type is set."); Logger.add(LogLevel.DANGER, "No storage type is set.");
sendConsoleSenderMessage(C.PREFIX + "&cNo storage type is set!"); log(C.PREFIX + "&cNo storage type is set!");
getServer().getPluginManager().disablePlugin(this); getServer().getPluginManager().disablePlugin(this);
return; return;
} }
@ -1434,9 +1434,9 @@ public class _PlotSquared {
final String version = worldEdit.getDescription().getVersion(); final String version = worldEdit.getDescription().getVersion();
if ((version != null) && version.startsWith("5.")) { if ((version != null) && version.startsWith("5.")) {
PlotSquared.sendConsoleSenderMessage("&cThis version of WorldEdit does not support PlotSquared."); PlotSquared.log("&cThis version of WorldEdit does not support PlotSquared.");
PlotSquared.sendConsoleSenderMessage("&cPlease use WorldEdit 6+ for masking support"); PlotSquared.log("&cPlease use WorldEdit 6+ for masking support");
PlotSquared.sendConsoleSenderMessage("&c - http://builds.enginehub.org/job/worldedit"); PlotSquared.log("&c - http://builds.enginehub.org/job/worldedit");
} else { } else {
getServer().getPluginManager().registerEvents(new WorldEditListener(), this); getServer().getPluginManager().registerEvents(new WorldEditListener(), this);
MainCommand.subCommands.add(new WE_Anywhere()); MainCommand.subCommands.add(new WE_Anywhere());
@ -1500,7 +1500,7 @@ public class _PlotSquared {
{ {
boolean checkVersion = checkVersion(1, 7, 6); boolean checkVersion = checkVersion(1, 7, 6);
if (!checkVersion) { if (!checkVersion) {
sendConsoleSenderMessage(C.PREFIX.s()+" &c[WARN] Titles are disabled - please update your version of Bukkit to support this feature."); log(C.PREFIX.s()+" &c[WARN] Titles are disabled - please update your version of Bukkit to support this feature.");
Settings.TITLES = false; Settings.TITLES = false;
FlagManager.removeFlag(FlagManager.getFlag("titles")); FlagManager.removeFlag(FlagManager.getFlag("titles"));
} }
@ -1520,10 +1520,10 @@ public class _PlotSquared {
Settings.OFFLINE_MODE = true; Settings.OFFLINE_MODE = true;
} }
if (Settings.OFFLINE_MODE) { if (Settings.OFFLINE_MODE) {
sendConsoleSenderMessage(C.PREFIX.s()+" &6PlotSquared is using Offline Mode UUIDs either because of user preference, or because you are using an old version of Bukkit"); log(C.PREFIX.s()+" &6PlotSquared is using Offline Mode UUIDs either because of user preference, or because you are using an old version of Bukkit");
} }
else { else {
sendConsoleSenderMessage(C.PREFIX.s()+" &6PlotSquared is using online UUIDs"); log(C.PREFIX.s()+" &6PlotSquared is using online UUIDs");
} }
} }
// Now we're finished :D // Now we're finished :D

View File

@ -340,10 +340,10 @@ import com.intellectualcrafters.plot.util.UUIDHandler;
// * // *
// * @param msg Message that should be sent to the console // * @param msg Message that should be sent to the console
// * // *
// * @see PlotSquared#sendConsoleSenderMessage(String) // * @see PlotSquared#log(String)
// */ // */
// public void sendConsoleMessage(final String msg) { // public void sendConsoleMessage(final String msg) {
// PlotSquared.sendConsoleSenderMessage(msg); // PlotSquared.log(msg);
// } // }
// //
// /** // /**

View File

@ -43,22 +43,22 @@ public class Clear extends SubCommand {
if (plr == null) { if (plr == null) {
// Is console // Is console
if (args.length < 2) { if (args.length < 2) {
PlotSquared.sendConsoleSenderMessage("You need to specify two arguments: ID (0;0) & World (world)"); PlotSquared.log("You need to specify two arguments: ID (0;0) & World (world)");
} else { } else {
final PlotId id = PlotId.fromString(args[0]); final PlotId id = PlotId.fromString(args[0]);
final String world = args[1]; final String world = args[1];
if (id == null) { if (id == null) {
PlotSquared.sendConsoleSenderMessage("Invalid Plot ID: " + args[0]); PlotSquared.log("Invalid Plot ID: " + args[0]);
} else { } else {
if (!PlotSquared.isPlotWorld(world)) { if (!PlotSquared.isPlotWorld(world)) {
PlotSquared.sendConsoleSenderMessage("Invalid plot world: " + world); PlotSquared.log("Invalid plot world: " + world);
} else { } else {
final Plot plot = PlotHelper.getPlot(Bukkit.getWorld(world), id); final Plot plot = PlotHelper.getPlot(Bukkit.getWorld(world), id);
if (plot == null) { if (plot == null) {
PlotSquared.sendConsoleSenderMessage("Could not find plot " + args[0] + " in world " + world); PlotSquared.log("Could not find plot " + args[0] + " in world " + world);
} else { } else {
plot.clear(null, false); plot.clear(null, false);
PlotSquared.sendConsoleSenderMessage("Plot " + plot.getId().toString() + " cleared."); PlotSquared.log("Plot " + plot.getId().toString() + " cleared.");
} }
} }
} }

View File

@ -203,7 +203,7 @@ public class Condense extends SubCommand {
} }
public static void sendMessage(final String message) { public static void sendMessage(final String message) {
PlotSquared.sendConsoleSenderMessage("&3PlotSquared -> Plot condense&8: &7" + message); PlotSquared.log("&3PlotSquared -> Plot condense&8: &7" + message);
} }
} }

View File

@ -33,7 +33,7 @@ public class Database extends SubCommand {
private static boolean sendMessageU(final UUID uuid, final String msg) { private static boolean sendMessageU(final UUID uuid, final String msg) {
if (uuid == null) { if (uuid == null) {
PlotSquared.sendConsoleSenderMessage(msg); PlotSquared.log(msg);
} else { } else {
final Player p = UUIDHandler.uuidWrapper.getPlayer(uuid); final Player p = UUIDHandler.uuidWrapper.getPlayer(uuid);
if ((p != null) && p.isOnline()) { if ((p != null) && p.isOnline()) {
@ -141,7 +141,7 @@ public class Database extends SubCommand {
private boolean sendMessage(final Player player, final String msg) { private boolean sendMessage(final Player player, final String msg) {
if (player == null) { if (player == null) {
PlotSquared.sendConsoleSenderMessage(msg); PlotSquared.log(msg);
} else { } else {
PlayerFunctions.sendMessage(player, msg); PlayerFunctions.sendMessage(player, msg);
} }

View File

@ -47,19 +47,19 @@ public class DebugClear extends SubCommand {
if (plr == null) { if (plr == null) {
// Is console // Is console
if (args.length < 2) { if (args.length < 2) {
PlotSquared.sendConsoleSenderMessage("You need to specify two arguments: ID (0;0) & World (world)"); PlotSquared.log("You need to specify two arguments: ID (0;0) & World (world)");
} else { } else {
final PlotId id = PlotId.fromString(args[0]); final PlotId id = PlotId.fromString(args[0]);
final String world = args[1]; final String world = args[1];
if (id == null) { if (id == null) {
PlotSquared.sendConsoleSenderMessage("Invalid Plot ID: " + args[0]); PlotSquared.log("Invalid Plot ID: " + args[0]);
} else { } else {
if (!PlotSquared.isPlotWorld(world) || !(PlotSquared.getWorldSettings(world) instanceof SquarePlotWorld)) { if (!PlotSquared.isPlotWorld(world) || !(PlotSquared.getWorldSettings(world) instanceof SquarePlotWorld)) {
PlotSquared.sendConsoleSenderMessage("Invalid plot world: " + world); PlotSquared.log("Invalid plot world: " + world);
} else { } else {
final Plot plot = PlotHelper.getPlot(Bukkit.getWorld(world), id); final Plot plot = PlotHelper.getPlot(Bukkit.getWorld(world), id);
if (plot == null) { if (plot == null) {
PlotSquared.sendConsoleSenderMessage("Could not find plot " + args[0] + " in world " + world); PlotSquared.log("Could not find plot " + args[0] + " in world " + world);
} else { } else {
World bukkitWorld = Bukkit.getWorld(world); World bukkitWorld = Bukkit.getWorld(world);
Location pos1 = PlotHelper.getPlotBottomLoc(bukkitWorld, plot.id).add(1, 0, 1); Location pos1 = PlotHelper.getPlotBottomLoc(bukkitWorld, plot.id).add(1, 0, 1);
@ -73,8 +73,8 @@ public class DebugClear extends SubCommand {
@Override @Override
public void run() { public void run() {
PlotHelper.runners.remove(plot); PlotHelper.runners.remove(plot);
PlotSquared.sendConsoleSenderMessage("Plot " + plot.getId().toString() + " cleared."); PlotSquared.log("Plot " + plot.getId().toString() + " cleared.");
PlotSquared.sendConsoleSenderMessage("&aDone!"); PlotSquared.log("&aDone!");
} }
}); });
} }

View File

@ -46,9 +46,9 @@ public class DebugLoadTest extends SubCommand {
fPlots.setAccessible(true); fPlots.setAccessible(true);
fPlots.set(null, DBFunc.getPlots()); fPlots.set(null, DBFunc.getPlots());
} catch (final Exception e) { } catch (final Exception e) {
PlotSquared.sendConsoleSenderMessage("&3===FAILED&3==="); PlotSquared.log("&3===FAILED&3===");
e.printStackTrace(); e.printStackTrace();
PlotSquared.sendConsoleSenderMessage("&3===END OF STACKTRACE==="); PlotSquared.log("&3===END OF STACKTRACE===");
} }
} else { } else {
PlayerFunctions.sendMessage(plr, "&6This command can only be executed by console as it has been deemed unsafe if abused.."); PlayerFunctions.sendMessage(plr, "&6This command can only be executed by console as it has been deemed unsafe if abused..");

View File

@ -66,15 +66,15 @@ public class RegenAllRoads extends SubCommand {
World world = Bukkit.getWorld(name); World world = Bukkit.getWorld(name);
ArrayList<ChunkLoc> chunks = ChunkManager.getChunkChunks(world); ArrayList<ChunkLoc> chunks = ChunkManager.getChunkChunks(world);
PlotSquared.sendConsoleSenderMessage("&cIf no schematic is set, the following will not do anything"); PlotSquared.log("&cIf no schematic is set, the following will not do anything");
PlotSquared.sendConsoleSenderMessage("&7 - To set a schematic, stand in a plot and use &c/plot createroadschematic"); PlotSquared.log("&7 - To set a schematic, stand in a plot and use &c/plot createroadschematic");
PlotSquared.sendConsoleSenderMessage("&6Potential chunks to update: &7"+ (chunks.size() * 1024)); PlotSquared.log("&6Potential chunks to update: &7"+ (chunks.size() * 1024));
PlotSquared.sendConsoleSenderMessage("&6Estimated time: &7"+ (chunks.size()) + " seconds"); PlotSquared.log("&6Estimated time: &7"+ (chunks.size()) + " seconds");
boolean result = hpm.scheduleRoadUpdate(world); boolean result = hpm.scheduleRoadUpdate(world);
if (!result) { if (!result) {
PlotSquared.sendConsoleSenderMessage("&cCannot schedule mass schematic update! (Is one already in progress?)"); PlotSquared.log("&cCannot schedule mass schematic update! (Is one already in progress?)");
return false; return false;
} }

View File

@ -67,7 +67,7 @@ public class Schematic extends SubCommand {
switch (arg) { switch (arg) {
case "paste": case "paste":
if (plr == null) { if (plr == null) {
PlotSquared.sendConsoleSenderMessage(C.IS_CONSOLE); PlotSquared.log(C.IS_CONSOLE);
return false; return false;
} }
if (!BukkitMain.hasPermission(plr, "plots.schematic.paste")) { if (!BukkitMain.hasPermission(plr, "plots.schematic.paste")) {
@ -155,7 +155,7 @@ public class Schematic extends SubCommand {
break; break;
case "test": case "test":
if (plr == null) { if (plr == null) {
PlotSquared.sendConsoleSenderMessage(C.IS_CONSOLE); PlotSquared.log(C.IS_CONSOLE);
return false; return false;
} }
if (!BukkitMain.hasPermission(plr, "plots.schematic.test")) { if (!BukkitMain.hasPermission(plr, "plots.schematic.test")) {
@ -205,8 +205,8 @@ public class Schematic extends SubCommand {
return false; return false;
} }
PlotSquared.sendConsoleSenderMessage("&3PlotSquared&8->&3Schemaitc&8: &7Mass export has started. This may take a while."); PlotSquared.log("&3PlotSquared&8->&3Schemaitc&8: &7Mass export has started. This may take a while.");
PlotSquared.sendConsoleSenderMessage("&3PlotSquared&8->&3Schemaitc&8: &7Found &c" + plotmap.size() + "&7 plots..."); PlotSquared.log("&3PlotSquared&8->&3Schemaitc&8: &7Found &c" + plotmap.size() + "&7 plots...");
final World worldObj = Bukkit.getWorld(args[1]); final World worldObj = Bukkit.getWorld(args[1]);
final String worldname = Bukkit.getWorld(args[1]).getName(); final String worldname = Bukkit.getWorld(args[1]).getName();
@ -221,7 +221,7 @@ public class Schematic extends SubCommand {
@Override @Override
public void run() { public void run() {
if (Schematic.this.counter >= Schematic.this.plots.length) { if (Schematic.this.counter >= Schematic.this.plots.length) {
PlotSquared.sendConsoleSenderMessage("&3PlotSquared&8->&3Schemaitc&8: &aFinished!"); PlotSquared.log("&3PlotSquared&8->&3Schemaitc&8: &aFinished!");
Schematic.this.running = false; Schematic.this.running = false;
Bukkit.getScheduler().cancelTask(Schematic.this.task); Bukkit.getScheduler().cancelTask(Schematic.this.task);
return; return;
@ -305,7 +305,7 @@ public class Schematic extends SubCommand {
@Override @Override
public void run() { public void run() {
if (Schematic.this.counter >= Schematic.this.plots.length) { if (Schematic.this.counter >= Schematic.this.plots.length) {
PlotSquared.sendConsoleSenderMessage("&3PlotSquared&8->&3Schemaitc&8: &aFinished!"); PlotSquared.log("&3PlotSquared&8->&3Schemaitc&8: &aFinished!");
Schematic.this.running = false; Schematic.this.running = false;
Bukkit.getScheduler().cancelTask(Schematic.this.task); Bukkit.getScheduler().cancelTask(Schematic.this.task);
return; return;

View File

@ -260,7 +260,7 @@ public class Trim extends SubCommand {
} }
public static void sendMessage(final String message) { public static void sendMessage(final String message) {
PlotSquared.sendConsoleSenderMessage("&3PlotSquared -> World trim&8: &7" + message); PlotSquared.log("&3PlotSquared -> World trim&8: &7" + message);
} }
} }

View File

@ -73,7 +73,7 @@ public class Unlink extends SubCommand {
} catch (final Exception e) { } catch (final Exception e) {
// execute(final Player plr, final String... args) { // execute(final Player plr, final String... args) {
try { try {
PlotSquared.sendConsoleSenderMessage("Error on: " + getClass().getMethod("execute", Player.class, String[].class).toGenericString() + ":119, when trying to use \"SetBlockFast#update\""); PlotSquared.log("Error on: " + getClass().getMethod("execute", Player.class, String[].class).toGenericString() + ":119, when trying to use \"SetBlockFast#update\"");
} catch (final Exception ex) { } catch (final Exception ex) {
ex.printStackTrace(); ex.printStackTrace();
} }

View File

@ -126,7 +126,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotSquared.sendConsoleSenderMessage("&c[ERROR] "+"Could not set owner for plot " + plot.id); PlotSquared.log("&c[ERROR] "+"Could not set owner for plot " + plot.id);
} }
} }
}); });
@ -232,7 +232,7 @@ public class SQLManager implements AbstractDB {
} }
} }
catch (Exception e2) {} catch (Exception e2) {}
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to set all helpers for plots"); PlotSquared.log("&7[WARN] "+"Failed to set all helpers for plots");
} }
} }
} }
@ -284,20 +284,20 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final Exception e) { } catch (final Exception e) {
e.printStackTrace(); e.printStackTrace();
PlotSquared.sendConsoleSenderMessage("&6[WARN] "+"Could not bulk save. Conversion may be slower..."); PlotSquared.log("&6[WARN] "+"Could not bulk save. Conversion may be slower...");
try { try {
for (Plot plot : plots) { for (Plot plot : plots) {
try { try {
createPlot(plot); createPlot(plot);
} }
catch (Exception e3) { catch (Exception e3) {
PlotSquared.sendConsoleSenderMessage("&c[ERROR] "+"Failed to save plot: "+plot.id); PlotSquared.log("&c[ERROR] "+"Failed to save plot: "+plot.id);
} }
} }
} }
catch (Exception e2) { catch (Exception e2) {
e2.printStackTrace(); e2.printStackTrace();
PlotSquared.sendConsoleSenderMessage("&c[ERROR] "+"Failed to save plots!"); PlotSquared.log("&c[ERROR] "+"Failed to save plots!");
} }
} }
} }
@ -324,7 +324,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final Exception e) { } catch (final Exception e) {
e.printStackTrace(); e.printStackTrace();
PlotSquared.sendConsoleSenderMessage("&c[ERROR] "+"Failed to save plot " + plot.id); PlotSquared.log("&c[ERROR] "+"Failed to save plot " + plot.id);
} }
} }
}); });
@ -352,7 +352,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final Exception e) { } catch (final Exception e) {
e.printStackTrace(); e.printStackTrace();
PlotSquared.sendConsoleSenderMessage("&c[ERROR] "+"Failed to save plot " + plot.id); PlotSquared.log("&c[ERROR] "+"Failed to save plot " + plot.id);
} }
} }
}); });
@ -439,7 +439,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotSquared.sendConsoleSenderMessage("&c[ERROR] " + "Failed to delete plot " + plot.id); PlotSquared.log("&c[ERROR] " + "Failed to delete plot " + plot.id);
} }
} }
}); });
@ -582,7 +582,7 @@ public class SQLManager implements AbstractDB {
if (plot != null) { if (plot != null) {
plot.addHelper(user); plot.addHelper(user);
} else { } else {
PlotSquared.sendConsoleSenderMessage("&cPLOT " + id + " in plot_helpers does not exist. Please create the plot or remove this entry."); PlotSquared.log("&cPLOT " + id + " in plot_helpers does not exist. Please create the plot or remove this entry.");
} }
} }
/* /*
@ -601,7 +601,7 @@ public class SQLManager implements AbstractDB {
if (plot != null) { if (plot != null) {
plot.addTrusted(user); plot.addTrusted(user);
} else { } else {
PlotSquared.sendConsoleSenderMessage("&cPLOT " + id + " in plot_trusted does not exist. Please create the plot or remove this entry."); PlotSquared.log("&cPLOT " + id + " in plot_trusted does not exist. Please create the plot or remove this entry.");
} }
} }
/* /*
@ -620,7 +620,7 @@ public class SQLManager implements AbstractDB {
if (plot != null) { if (plot != null) {
plot.addDenied(user); plot.addDenied(user);
} else { } else {
PlotSquared.sendConsoleSenderMessage("&cPLOT " + id + " in plot_denied does not exist. Please create the plot or remove this entry."); PlotSquared.log("&cPLOT " + id + " in plot_denied does not exist. Please create the plot or remove this entry.");
} }
} }
r = stmt.executeQuery("SELECT * FROM `" + this.prefix + "plot_settings`"); r = stmt.executeQuery("SELECT * FROM `" + this.prefix + "plot_settings`");
@ -700,12 +700,12 @@ public class SQLManager implements AbstractDB {
} }
} }
if (exception) { if (exception) {
PlotSquared.sendConsoleSenderMessage("&cPlot " + id + " had an invalid flag. A fix has been attempted."); PlotSquared.log("&cPlot " + id + " had an invalid flag. A fix has been attempted.");
setFlags(id, flags.toArray(new Flag[0])); setFlags(id, flags.toArray(new Flag[0]));
} }
plot.settings.flags = flags; plot.settings.flags = flags;
} else { } else {
PlotSquared.sendConsoleSenderMessage("&cPLOT " + id + " in plot_settings does not exist. Please create the plot or remove this entry."); PlotSquared.log("&cPLOT " + id + " in plot_settings does not exist. Please create the plot or remove this entry.");
} }
} }
stmt.close(); stmt.close();
@ -720,13 +720,13 @@ public class SQLManager implements AbstractDB {
boolean invalidPlot = false; boolean invalidPlot = false;
for (final String worldname : noExist.keySet()) { for (final String worldname : noExist.keySet()) {
invalidPlot = true; invalidPlot = true;
PlotSquared.sendConsoleSenderMessage("&c[WARNING] Found " + noExist.get(worldname) + " plots in DB for non existant world; '" + worldname + "'."); PlotSquared.log("&c[WARNING] Found " + noExist.get(worldname) + " plots in DB for non existant world; '" + worldname + "'.");
} }
if (invalidPlot) { if (invalidPlot) {
PlotSquared.sendConsoleSenderMessage("&c[WARNING] - Please create the world/s or remove the plots using the purge command"); PlotSquared.log("&c[WARNING] - Please create the world/s or remove the plots using the purge command");
} }
} catch (final SQLException e) { } catch (final SQLException e) {
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to load plots."); PlotSquared.log("&7[WARN] "+"Failed to load plots.");
e.printStackTrace(); e.printStackTrace();
} }
return newplots; return newplots;
@ -750,7 +750,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Could not set merged for plot " + plot.id); PlotSquared.log("&7[WARN] "+"Could not set merged for plot " + plot.id);
} }
} }
}); });
@ -837,7 +837,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Could not set flag for plot " + plot.id); PlotSquared.log("&7[WARN] "+"Could not set flag for plot " + plot.id);
} }
} }
}); });
@ -862,7 +862,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Could not set flag for plot " + id); PlotSquared.log("&7[WARN] "+"Could not set flag for plot " + id);
} }
} }
}); });
@ -886,7 +886,7 @@ public class SQLManager implements AbstractDB {
stmt.executeUpdate(); stmt.executeUpdate();
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to set alias for plot " + plot.id); PlotSquared.log("&7[WARN] "+"Failed to set alias for plot " + plot.id);
e.printStackTrace(); e.printStackTrace();
} }
@ -930,11 +930,11 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotSquared.sendConsoleSenderMessage("&c[ERROR] "+"FAILED TO PURGE WORLD '" + world + "'!"); PlotSquared.log("&c[ERROR] "+"FAILED TO PURGE WORLD '" + world + "'!");
return; return;
} }
} }
PlotSquared.sendConsoleSenderMessage("&6[INFO] "+"SUCCESSFULLY PURGED WORLD '" + world + "'!"); PlotSquared.log("&6[INFO] "+"SUCCESSFULLY PURGED WORLD '" + world + "'!");
} }
@Override @Override
public void purge(final String world, Set<PlotId> plots) { public void purge(final String world, Set<PlotId> plots) {
@ -959,7 +959,7 @@ public class SQLManager implements AbstractDB {
r.close(); r.close();
} catch (SQLException e) { } catch (SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotSquared.sendConsoleSenderMessage("&c[ERROR] "+"FAILED TO PURGE WORLD '" + world + "'!"); PlotSquared.log("&c[ERROR] "+"FAILED TO PURGE WORLD '" + world + "'!");
} }
} }
@ -980,7 +980,7 @@ public class SQLManager implements AbstractDB {
stmt.executeUpdate(); stmt.executeUpdate();
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to set position for plot " + plot.id); PlotSquared.log("&7[WARN] "+"Failed to set position for plot " + plot.id);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -1034,7 +1034,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
r.close(); r.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to load settings for plot: " + id); PlotSquared.log("&7[WARN] "+"Failed to load settings for plot: " + id);
e.printStackTrace(); e.printStackTrace();
} }
return h; return h;
@ -1064,7 +1064,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to remove helper for plot " + plot.id); PlotSquared.log("&7[WARN] "+"Failed to remove helper for plot " + plot.id);
} }
} }
}); });
@ -1096,7 +1096,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
set.close(); set.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to fetch comment"); PlotSquared.log("&7[WARN] "+"Failed to fetch comment");
e.printStackTrace(); e.printStackTrace();
} }
return comments; return comments;
@ -1117,7 +1117,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to set comment for plot " + plot.id); PlotSquared.log("&7[WARN] "+"Failed to set comment for plot " + plot.id);
} }
} }
}); });
@ -1141,7 +1141,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to remove helper for plot " + plot.id); PlotSquared.log("&7[WARN] "+"Failed to remove helper for plot " + plot.id);
} }
} }
}); });
@ -1164,7 +1164,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to remove trusted user for plot " + plot.id); PlotSquared.log("&7[WARN] "+"Failed to remove trusted user for plot " + plot.id);
} }
} }
}); });
@ -1186,7 +1186,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate(); statement.executeUpdate();
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to set helper for plot " + plot.id); PlotSquared.log("&7[WARN] "+"Failed to set helper for plot " + plot.id);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -1204,7 +1204,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate(); statement.executeUpdate();
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to set helper for id " + id); PlotSquared.log("&7[WARN] "+"Failed to set helper for id " + id);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -1227,7 +1227,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate(); statement.executeUpdate();
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to set plot trusted for plot " + plot.id); PlotSquared.log("&7[WARN] "+"Failed to set plot trusted for plot " + plot.id);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -1251,7 +1251,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to remove denied for plot " + plot.id); PlotSquared.log("&7[WARN] "+"Failed to remove denied for plot " + plot.id);
} }
} }
}); });
@ -1273,7 +1273,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate(); statement.executeUpdate();
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to set denied for plot " + plot.id); PlotSquared.log("&7[WARN] "+"Failed to set denied for plot " + plot.id);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -1294,7 +1294,7 @@ public class SQLManager implements AbstractDB {
set.close(); set.close();
return rating; return rating;
} catch (final SQLException e) { } catch (final SQLException e) {
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to fetch rating for plot " + plot.getId().toString()); PlotSquared.log("&7[WARN] "+"Failed to fetch rating for plot " + plot.getId().toString());
e.printStackTrace(); e.printStackTrace();
} }
return 0.0d; return 0.0d;
@ -1325,7 +1325,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotSquared.sendConsoleSenderMessage("&c[ERROR] "+"Failed to delete plot cluster: " + cluster.getP1() + ":" + cluster.getP2()); PlotSquared.log("&c[ERROR] "+"Failed to delete plot cluster: " + cluster.getP1() + ":" + cluster.getP2());
} }
} }
}); });
@ -1419,7 +1419,7 @@ public class SQLManager implements AbstractDB {
if (cluster != null) { if (cluster != null) {
cluster.helpers.add(user); cluster.helpers.add(user);
} else { } else {
PlotSquared.sendConsoleSenderMessage("&cCluster " + id + " in cluster_helpers does not exist. Please create the cluster or remove this entry."); PlotSquared.log("&cCluster " + id + " in cluster_helpers does not exist. Please create the cluster or remove this entry.");
} }
} }
/* /*
@ -1438,7 +1438,7 @@ public class SQLManager implements AbstractDB {
if (cluster != null) { if (cluster != null) {
cluster.invited.add(user); cluster.invited.add(user);
} else { } else {
PlotSquared.sendConsoleSenderMessage("&cCluster " + id + " in cluster_invited does not exist. Please create the cluster or remove this entry."); PlotSquared.log("&cCluster " + id + " in cluster_invited does not exist. Please create the cluster or remove this entry.");
} }
} }
r = stmt.executeQuery("SELECT * FROM `" + this.prefix + "cluster_settings`"); r = stmt.executeQuery("SELECT * FROM `" + this.prefix + "cluster_settings`");
@ -1517,12 +1517,12 @@ public class SQLManager implements AbstractDB {
} }
} }
if (exception) { if (exception) {
PlotSquared.sendConsoleSenderMessage("&cPlot " + id + " had an invalid flag. A fix has been attempted."); PlotSquared.log("&cPlot " + id + " had an invalid flag. A fix has been attempted.");
setFlags(id, flags.toArray(new Flag[0])); setFlags(id, flags.toArray(new Flag[0]));
} }
cluster.settings.flags = flags; cluster.settings.flags = flags;
} else { } else {
PlotSquared.sendConsoleSenderMessage("&cCluster " + id + " in cluster_settings does not exist. Please create the cluster or remove this entry."); PlotSquared.log("&cCluster " + id + " in cluster_settings does not exist. Please create the cluster or remove this entry.");
} }
} }
stmt.close(); stmt.close();
@ -1537,13 +1537,13 @@ public class SQLManager implements AbstractDB {
boolean invalidPlot = false; boolean invalidPlot = false;
for (final String w : noExist.keySet()) { for (final String w : noExist.keySet()) {
invalidPlot = true; invalidPlot = true;
PlotSquared.sendConsoleSenderMessage("&c[WARNING] Found " + noExist.get(w) + " clusters in DB for non existant world; '" + w + "'."); PlotSquared.log("&c[WARNING] Found " + noExist.get(w) + " clusters in DB for non existant world; '" + w + "'.");
} }
if (invalidPlot) { if (invalidPlot) {
PlotSquared.sendConsoleSenderMessage("&c[WARNING] - Please create the world/s or remove the clusters using the purge command"); PlotSquared.log("&c[WARNING] - Please create the world/s or remove the clusters using the purge command");
} }
} catch (final SQLException e) { } catch (final SQLException e) {
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to load clusters."); PlotSquared.log("&7[WARN] "+"Failed to load clusters.");
e.printStackTrace(); e.printStackTrace();
} }
return newClusters; return newClusters;
@ -1571,7 +1571,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Could not set flag for plot " + cluster); PlotSquared.log("&7[WARN] "+"Could not set flag for plot " + cluster);
} }
} }
}); });
@ -1592,7 +1592,7 @@ public class SQLManager implements AbstractDB {
stmt.executeUpdate(); stmt.executeUpdate();
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to set alias for cluster " + cluster); PlotSquared.log("&7[WARN] "+"Failed to set alias for cluster " + cluster);
e.printStackTrace(); e.printStackTrace();
} }
@ -1613,7 +1613,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to remove helper for cluster " + cluster); PlotSquared.log("&7[WARN] "+"Failed to remove helper for cluster " + cluster);
} }
} }
}); });
@ -1631,7 +1631,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate(); statement.executeUpdate();
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to set helper for cluster " + cluster); PlotSquared.log("&7[WARN] "+"Failed to set helper for cluster " + cluster);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -1663,7 +1663,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
} catch (final Exception e) { } catch (final Exception e) {
e.printStackTrace(); e.printStackTrace();
PlotSquared.sendConsoleSenderMessage("&c[ERROR] "+"Failed to save cluster " + cluster); PlotSquared.log("&c[ERROR] "+"Failed to save cluster " + cluster);
} }
} }
}); });
@ -1689,7 +1689,7 @@ public class SQLManager implements AbstractDB {
stmt.executeUpdate(); stmt.executeUpdate();
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to rezize cluster " + current); PlotSquared.log("&7[WARN] "+"Failed to rezize cluster " + current);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -1709,7 +1709,7 @@ public class SQLManager implements AbstractDB {
stmt.executeUpdate(); stmt.executeUpdate();
stmt.close(); stmt.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to set position for cluster " + cluster); PlotSquared.log("&7[WARN] "+"Failed to set position for cluster " + cluster);
e.printStackTrace(); e.printStackTrace();
} }
} }
@ -1758,7 +1758,7 @@ public class SQLManager implements AbstractDB {
stmt.close(); stmt.close();
r.close(); r.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to load settings for cluster: " + id); PlotSquared.log("&7[WARN] "+"Failed to load settings for cluster: " + id);
e.printStackTrace(); e.printStackTrace();
} }
return h; return h;
@ -1777,7 +1777,7 @@ public class SQLManager implements AbstractDB {
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
e.printStackTrace(); e.printStackTrace();
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to remove invited for cluster " + cluster); PlotSquared.log("&7[WARN] "+"Failed to remove invited for cluster " + cluster);
} }
} }
}); });
@ -1796,7 +1796,7 @@ public class SQLManager implements AbstractDB {
statement.executeUpdate(); statement.executeUpdate();
statement.close(); statement.close();
} catch (final SQLException e) { } catch (final SQLException e) {
PlotSquared.sendConsoleSenderMessage("&7[WARN] "+"Failed to set helper for cluster " + cluster); PlotSquared.log("&7[WARN] "+"Failed to set helper for cluster " + cluster);
e.printStackTrace(); e.printStackTrace();
} }
} }

View File

@ -63,7 +63,7 @@ import com.intellectualcrafters.plot.object.PlotWorld;
* @return success? * @return success?
*/ */
public static boolean addFlag(final AbstractFlag af) { public static boolean addFlag(final AbstractFlag af) {
PlotSquared.sendConsoleSenderMessage(C.PREFIX.s() + "&8 - Adding flag: &7" + af); PlotSquared.log(C.PREFIX.s() + "&8 - Adding flag: &7" + af);
String key = af.getKey(); String key = af.getKey();
if (PlotSquared.getAllPlotsRaw() != null) { if (PlotSquared.getAllPlotsRaw() != null) {
for (Plot plot : PlotSquared.getPlots()) { for (Plot plot : PlotSquared.getPlots()) {

View File

@ -50,7 +50,7 @@ public abstract class ClassicPlotWorld extends SquarePlotWorld {
@Override @Override
public void loadConfiguration(final ConfigurationSection config) { public void loadConfiguration(final ConfigurationSection config) {
if (!config.contains("plot.height")) { if (!config.contains("plot.height")) {
PlotSquared.sendConsoleSenderMessage(" - &cConfiguration is null? (" + config.getCurrentPath() + ")"); PlotSquared.log(" - &cConfiguration is null? (" + config.getCurrentPath() + ")");
} }
this.PLOT_BEDROCK = config.getBoolean("plot.bedrock"); this.PLOT_BEDROCK = config.getBoolean("plot.bedrock");
this.PLOT_HEIGHT = Math.min(255, config.getInt("plot.height")); this.PLOT_HEIGHT = Math.min(255, config.getInt("plot.height"));

View File

@ -211,23 +211,23 @@ import com.intellectualcrafters.plot.util.bukkit.BukkitTaskManager;
public void run() { public void run() {
if (chunks.size() == 0) { if (chunks.size() == 0) {
HybridPlotManager.UPDATE = false; HybridPlotManager.UPDATE = false;
PlotSquared.sendConsoleSenderMessage(C.PREFIX.s() + "Finished road conversion"); PlotSquared.log(C.PREFIX.s() + "Finished road conversion");
Bukkit.getScheduler().cancelTask(task); Bukkit.getScheduler().cancelTask(task);
return; return;
} }
else { else {
try { try {
ChunkLoc loc = chunks.get(0); ChunkLoc loc = chunks.get(0);
PlotSquared.sendConsoleSenderMessage("Updating .mcr: " + loc.x + ", "+loc.z + " (aprrox 256 chunks)"); PlotSquared.log("Updating .mcr: " + loc.x + ", "+loc.z + " (aprrox 256 chunks)");
PlotSquared.sendConsoleSenderMessage("Remaining regions: "+chunks.size()); PlotSquared.log("Remaining regions: "+chunks.size());
regenerateChunkChunk(world, loc); regenerateChunkChunk(world, loc);
chunks.remove(0); chunks.remove(0);
} }
catch (Exception e) { catch (Exception e) {
ChunkLoc loc = chunks.get(0); ChunkLoc loc = chunks.get(0);
PlotSquared.sendConsoleSenderMessage("&c[ERROR]&7 Could not update '"+world.getName() + "/region/r." + loc.x + "." + loc.z + ".mca' (Corrupt chunk?)"); PlotSquared.log("&c[ERROR]&7 Could not update '"+world.getName() + "/region/r." + loc.x + "." + loc.z + ".mca' (Corrupt chunk?)");
PlotSquared.sendConsoleSenderMessage("&d - Potentially skipping 256 chunks"); PlotSquared.log("&d - Potentially skipping 256 chunks");
PlotSquared.sendConsoleSenderMessage("&d - TODO: recommend chunkster if corrupt"); PlotSquared.log("&d - TODO: recommend chunkster if corrupt");
} }
} }
} }

View File

@ -62,7 +62,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
@Override @Override
public void loadConfiguration(final ConfigurationSection config) { public void loadConfiguration(final ConfigurationSection config) {
if (!config.contains("plot.height")) { if (!config.contains("plot.height")) {
PlotSquared.sendConsoleSenderMessage(" - &cConfiguration is null? (" + config.getCurrentPath() + ")"); PlotSquared.log(" - &cConfiguration is null? (" + config.getCurrentPath() + ")");
} }
this.PLOT_BEDROCK = config.getBoolean("plot.bedrock"); this.PLOT_BEDROCK = config.getBoolean("plot.bedrock");
this.PLOT_HEIGHT = Math.min(255, config.getInt("plot.height")); this.PLOT_HEIGHT = Math.min(255, config.getInt("plot.height"));
@ -89,7 +89,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
try { try {
setupSchematics(); setupSchematics();
} catch (Exception e) { } catch (Exception e) {
PlotSquared.sendConsoleSenderMessage("&c - road schematics are disabled for this world."); PlotSquared.log("&c - road schematics are disabled for this world.");
this.ROAD_SCHEMATIC_ENABLED = false; this.ROAD_SCHEMATIC_ENABLED = false;
} }
System.out.print("LOADED!"); System.out.print("LOADED!");
@ -144,7 +144,7 @@ public class HybridPlotWorld extends ClassicPlotWorld {
} }
if (schem1 == null || schem2 == null || this.ROAD_WIDTH == 0) { if (schem1 == null || schem2 == null || this.ROAD_WIDTH == 0) {
PlotSquared.sendConsoleSenderMessage(C.PREFIX.s() + "&3 - schematic: &7false"); PlotSquared.log(C.PREFIX.s() + "&3 - schematic: &7false");
return; return;
} }
// Do not populate road if using schematic population // Do not populate road if using schematic population

View File

@ -15,7 +15,7 @@ public abstract class SquarePlotWorld extends GridPlotWorld {
@Override @Override
public void loadConfiguration(final ConfigurationSection config) { public void loadConfiguration(final ConfigurationSection config) {
if (!config.contains("plot.height")) { if (!config.contains("plot.height")) {
PlotSquared.sendConsoleSenderMessage(" - &cConfiguration is null? (" + config.getCurrentPath() + ")"); PlotSquared.log(" - &cConfiguration is null? (" + config.getCurrentPath() + ")");
} }
this.PLOT_WIDTH = config.getInt("plot.size"); this.PLOT_WIDTH = config.getInt("plot.size");
this.ROAD_WIDTH = config.getInt("road.width"); this.ROAD_WIDTH = config.getInt("road.width");

View File

@ -713,7 +713,7 @@ public class PlayerEvents extends com.intellectualcrafters.plot.listeners.PlotLi
final PlotManager manager = PlotSquared.getPlotManager(plot.getWorld()); final PlotManager manager = PlotSquared.getPlotManager(plot.getWorld());
manager.clearPlot(null, plotworld, plot, true, null); manager.clearPlot(null, plotworld, plot, true, null);
DBFunc.delete(plot.getWorld().getName(), plot); DBFunc.delete(plot.getWorld().getName(), plot);
PlotSquared.sendConsoleSenderMessage(String.format("&cPlot &6%s &cwas deleted + cleared due to &6%s&c getting banned", plot.getId(), event.getPlayer().getName())); PlotSquared.log(String.format("&cPlot &6%s &cwas deleted + cleared due to &6%s&c getting banned", plot.getId(), event.getPlayer().getName()));
} }
} }
} }

View File

@ -137,7 +137,7 @@ public abstract class PlotWorld {
this.DEFAULT_FLAGS = FlagManager.parseFlags(flags); this.DEFAULT_FLAGS = FlagManager.parseFlags(flags);
} }
catch (Exception e) { catch (Exception e) {
PlotSquared.sendConsoleSenderMessage("&cInvalid default flags for "+this.worldname+": "+StringUtils.join(flags,",")); PlotSquared.log("&cInvalid default flags for "+this.worldname+": "+StringUtils.join(flags,","));
this.DEFAULT_FLAGS = new Flag[]{}; this.DEFAULT_FLAGS = new Flag[]{};
} }
} }

View File

@ -227,7 +227,7 @@ public class EntityWrapper {
return; return;
} }
default: { default: {
PlotSquared.sendConsoleSenderMessage("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType()); PlotSquared.log("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
return; return;
} }
@ -443,7 +443,7 @@ public class EntityWrapper {
return entity; return entity;
} }
default: { default: {
PlotSquared.sendConsoleSenderMessage("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType()); PlotSquared.log("&cCOULD NOT IDENTIFY ENTITY: " + entity.getType());
return entity; return entity;
} }

View File

@ -16,7 +16,7 @@ public class HackTitle extends AbstractTitle {
title.send(player); title.send(player);
} }
catch (Throwable e) { catch (Throwable e) {
PlotSquared.sendConsoleSenderMessage("&cYour server version does not support titles!"); PlotSquared.log("&cYour server version does not support titles!");
Settings.TITLES = false; Settings.TITLES = false;
AbstractTitle.TITLE_CLASS = null; AbstractTitle.TITLE_CLASS = null;
} }

View File

@ -100,7 +100,7 @@ public class ChunkManager {
public void run() { public void run() {
String directory = world + File.separator + "region" + File.separator + "r." + loc.x + "." + loc.z + ".mca"; String directory = world + File.separator + "region" + File.separator + "r." + loc.x + "." + loc.z + ".mca";
File file = new File(directory); File file = new File(directory);
PlotSquared.sendConsoleSenderMessage("&6 - Deleting file: " + file.getName() + " (max 1024 chunks)"); PlotSquared.log("&6 - Deleting file: " + file.getName() + " (max 1024 chunks)");
if (file.exists()) { if (file.exists()) {
file.delete(); file.delete();
} }
@ -446,7 +446,7 @@ public class ChunkManager {
chest.getInventory().setContents(chestContents.get(loc)); chest.getInventory().setContents(chestContents.get(loc));
state.update(true); state.update(true);
} }
else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate chest: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.log("&c[WARN] Plot clear failed to regenerate chest: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: signContents.keySet()) { for (BlockLoc loc: signContents.keySet()) {
@ -461,7 +461,7 @@ public class ChunkManager {
} }
state.update(true); state.update(true);
} }
else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate sign: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.log("&c[WARN] Plot clear failed to regenerate sign: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: dispenserContents.keySet()) { for (BlockLoc loc: dispenserContents.keySet()) {
@ -471,7 +471,7 @@ public class ChunkManager {
((Dispenser) (state)).getInventory().setContents(dispenserContents.get(loc)); ((Dispenser) (state)).getInventory().setContents(dispenserContents.get(loc));
state.update(true); state.update(true);
} }
else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate dispenser: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.log("&c[WARN] Plot clear failed to regenerate dispenser: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: dropperContents.keySet()) { for (BlockLoc loc: dropperContents.keySet()) {
Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset); Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset);
@ -480,7 +480,7 @@ public class ChunkManager {
((Dropper) (state)).getInventory().setContents(dropperContents.get(loc)); ((Dropper) (state)).getInventory().setContents(dropperContents.get(loc));
state.update(true); state.update(true);
} }
else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate dispenser: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.log("&c[WARN] Plot clear failed to regenerate dispenser: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: beaconContents.keySet()) { for (BlockLoc loc: beaconContents.keySet()) {
Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset); Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset);
@ -489,7 +489,7 @@ public class ChunkManager {
((Beacon) (state)).getInventory().setContents(beaconContents.get(loc)); ((Beacon) (state)).getInventory().setContents(beaconContents.get(loc));
state.update(true); state.update(true);
} }
else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate beacon: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.log("&c[WARN] Plot clear failed to regenerate beacon: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: jukeDisc.keySet()) { for (BlockLoc loc: jukeDisc.keySet()) {
Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset); Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset);
@ -498,7 +498,7 @@ public class ChunkManager {
((Jukebox) (state)).setPlaying(Material.getMaterial(jukeDisc.get(loc))); ((Jukebox) (state)).setPlaying(Material.getMaterial(jukeDisc.get(loc)));
state.update(true); state.update(true);
} }
else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to restore jukebox: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.log("&c[WARN] Plot clear failed to restore jukebox: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: skullData.keySet()) { for (BlockLoc loc: skullData.keySet()) {
Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset); Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset);
@ -516,7 +516,7 @@ public class ChunkManager {
} }
state.update(true); state.update(true);
} }
else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to restore jukebox: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.log("&c[WARN] Plot clear failed to restore jukebox: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: hopperContents.keySet()) { for (BlockLoc loc: hopperContents.keySet()) {
Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset); Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset);
@ -525,7 +525,7 @@ public class ChunkManager {
((Hopper) (state)).getInventory().setContents(hopperContents.get(loc)); ((Hopper) (state)).getInventory().setContents(hopperContents.get(loc));
state.update(true); state.update(true);
} }
else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate hopper: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.log("&c[WARN] Plot clear failed to regenerate hopper: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: noteBlockContents.keySet()) { for (BlockLoc loc: noteBlockContents.keySet()) {
@ -535,7 +535,7 @@ public class ChunkManager {
((NoteBlock) (state)).setNote(noteBlockContents.get(loc)); ((NoteBlock) (state)).setNote(noteBlockContents.get(loc));
state.update(true); state.update(true);
} }
else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate note block: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.log("&c[WARN] Plot clear failed to regenerate note block: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: brewTime.keySet()) { for (BlockLoc loc: brewTime.keySet()) {
Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset); Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset);
@ -543,7 +543,7 @@ public class ChunkManager {
if (state instanceof BrewingStand) { if (state instanceof BrewingStand) {
((BrewingStand) (state)).setBrewingTime(brewTime.get(loc)); ((BrewingStand) (state)).setBrewingTime(brewTime.get(loc));
} }
else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to restore brewing stand cooking: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.log("&c[WARN] Plot clear failed to restore brewing stand cooking: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: spawnerData.keySet()) { for (BlockLoc loc: spawnerData.keySet()) {
@ -553,7 +553,7 @@ public class ChunkManager {
((CreatureSpawner) (state)).setCreatureTypeId(spawnerData.get(loc)); ((CreatureSpawner) (state)).setCreatureTypeId(spawnerData.get(loc));
state.update(true); state.update(true);
} }
else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to restore spawner type: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.log("&c[WARN] Plot clear failed to restore spawner type: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: cmdData.keySet()) { for (BlockLoc loc: cmdData.keySet()) {
Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset); Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset);
@ -562,7 +562,7 @@ public class ChunkManager {
((CommandBlock) (state)).setCommand(cmdData.get(loc)); ((CommandBlock) (state)).setCommand(cmdData.get(loc));
state.update(true); state.update(true);
} }
else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to restore command block: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.log("&c[WARN] Plot clear failed to restore command block: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: brewingStandContents.keySet()) { for (BlockLoc loc: brewingStandContents.keySet()) {
Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset); Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset);
@ -571,7 +571,7 @@ public class ChunkManager {
((BrewingStand) (state)).getInventory().setContents(brewingStandContents.get(loc)); ((BrewingStand) (state)).getInventory().setContents(brewingStandContents.get(loc));
state.update(true); state.update(true);
} }
else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate brewing stand: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.log("&c[WARN] Plot clear failed to regenerate brewing stand: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: furnaceTime.keySet()) { for (BlockLoc loc: furnaceTime.keySet()) {
Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset); Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset);
@ -581,7 +581,7 @@ public class ChunkManager {
((Furnace) (state)).setBurnTime(time[0]); ((Furnace) (state)).setBurnTime(time[0]);
((Furnace) (state)).setCookTime(time[1]); ((Furnace) (state)).setCookTime(time[1]);
} }
else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to restore furnace cooking: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.log("&c[WARN] Plot clear failed to restore furnace cooking: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: furnaceContents.keySet()) { for (BlockLoc loc: furnaceContents.keySet()) {
Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset); Block block = world.getBlockAt(loc.x + x_offset, loc.y, loc.z + z_offset);
@ -590,7 +590,7 @@ public class ChunkManager {
((Furnace) (state)).getInventory().setContents(furnaceContents.get(loc)); ((Furnace) (state)).getInventory().setContents(furnaceContents.get(loc));
state.update(true); state.update(true);
} }
else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate furnace: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.log("&c[WARN] Plot clear failed to regenerate furnace: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
for (BlockLoc loc: bannerBase.keySet()) { for (BlockLoc loc: bannerBase.keySet()) {
@ -606,7 +606,7 @@ public class ChunkManager {
} }
state.update(true); state.update(true);
} }
else { PlotSquared.sendConsoleSenderMessage("&c[WARN] Plot clear failed to regenerate banner: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); } else { PlotSquared.log("&c[WARN] Plot clear failed to regenerate banner: "+loc.x + x_offset+","+loc.y+","+loc.z + z_offset); }
} }
} }

View File

@ -50,7 +50,7 @@ public class ExpireManager {
@Override @Override
public void run() { public void run() {
HashMap<Plot, Long> plots = getOldPlots(world); HashMap<Plot, Long> plots = getOldPlots(world);
PlotSquared.sendConsoleSenderMessage("&cFound " + plots.size() + " expired plots for " + world + "!"); PlotSquared.log("&cFound " + plots.size() + " expired plots for " + world + "!");
expiredPlots.put(world, plots); expiredPlots.put(world, plots);
updatingPlots.put(world, false); updatingPlots.put(world, false);
} }
@ -120,13 +120,13 @@ public class ExpireManager {
DBFunc.delete(world, plot); DBFunc.delete(world, plot);
PlotSquared.removePlot(world, plot.id, true); PlotSquared.removePlot(world, plot.id, true);
expiredPlots.get(world).remove(plot); expiredPlots.get(world).remove(plot);
PlotSquared.sendConsoleSenderMessage("&cDeleted expired plot: " + plot.id); PlotSquared.log("&cDeleted expired plot: " + plot.id);
PlotSquared.sendConsoleSenderMessage("&3 - World: "+plot.world); PlotSquared.log("&3 - World: "+plot.world);
if (plot.hasOwner()) { if (plot.hasOwner()) {
PlotSquared.sendConsoleSenderMessage("&3 - Owner: "+UUIDHandler.getName(plot.owner)); PlotSquared.log("&3 - Owner: "+UUIDHandler.getName(plot.owner));
} }
else { else {
PlotSquared.sendConsoleSenderMessage("&3 - Owner: Unowned"); PlotSquared.log("&3 - Owner: Unowned");
} }
return; return;
} }
@ -205,7 +205,7 @@ public class ExpireManager {
if (filename != null) { if (filename != null) {
File playerFile = new File(worldname + File.separator + foldername + File.separator + filename); File playerFile = new File(worldname + File.separator + foldername + File.separator + filename);
if (!playerFile.exists()) { if (!playerFile.exists()) {
PlotSquared.sendConsoleSenderMessage("Could not find file: " + filename); PlotSquared.log("Could not find file: " + filename);
} }
else { else {
try { try {
@ -217,7 +217,7 @@ public class ExpireManager {
} }
} }
catch (Exception e) { catch (Exception e) {
PlotSquared.sendConsoleSenderMessage("Please disable disk checking in old plot auto clearing; Could not read file: " + filename); PlotSquared.log("Please disable disk checking in old plot auto clearing; Could not read file: " + filename);
} }
} }
} }

View File

@ -53,7 +53,7 @@ public class Logger {
} }
reader.close(); reader.close();
} catch (final IOException e) { } catch (final IOException e) {
PlotSquared.sendConsoleSenderMessage(C.PREFIX.s() + "File setup error Logger#setup"); PlotSquared.log(C.PREFIX.s() + "File setup error Logger#setup");
} }
} }

View File

@ -11,7 +11,7 @@ public class MainUtil {
* *
* @param c message * @param c message
*/ */
public static void sendConsoleSenderMessage(final C c) { public static void log(final C c) {
PlotSquared.MAIN_IMP.sendConsoleSenderMessage(c.s()); PlotSquared.MAIN_IMP.log(c.s());
} }
} }

View File

@ -286,7 +286,7 @@ import java.util.UUID;
public static boolean sendMessage(final Player plr, final String msg, final boolean prefix) { public static boolean sendMessage(final Player plr, final String msg, final boolean prefix) {
if ((msg.length() > 0) && !msg.equals("")) { if ((msg.length() > 0) && !msg.equals("")) {
if (plr == null) { if (plr == null) {
PlotSquared.MAIN_IMP.sendConsoleSenderMessage(C.PREFIX.s() + msg); PlotSquared.MAIN_IMP.log(C.PREFIX.s() + msg);
} else { } else {
sendMessageWrapped(plr, ChatColor.translateAlternateColorCodes('&', C.PREFIX.s() + msg)); sendMessageWrapped(plr, ChatColor.translateAlternateColorCodes('&', C.PREFIX.s() + msg));
} }
@ -313,7 +313,7 @@ import java.util.UUID;
} }
} }
if (plr == null) { if (plr == null) {
PlotSquared.sendConsoleSenderMessage(msg); PlotSquared.log(msg);
} }
else { else {
sendMessage(plr, msg, c.usePrefix()); sendMessage(plr, msg, c.usePrefix());

View File

@ -32,7 +32,7 @@ public class PlotSquaredException extends RuntimeException {
public PlotSquaredException(final PlotError error, final String details) { public PlotSquaredException(final PlotError error, final String details) {
super("PlotError >> " + error.getHeader() + ": " + details); super("PlotError >> " + error.getHeader() + ": " + details);
PlotSquared.sendConsoleSenderMessage("&cPlotError &6>> &c" + error.getHeader() + ": &6" + details); PlotSquared.log("&cPlotError &6>> &c" + error.getHeader() + ": &6" + details);
} }
public static enum PlotError { public static enum PlotError {

View File

@ -69,7 +69,7 @@ public class SchematicHandler {
*/ */
public static boolean paste(final Location location, final Schematic schematic, final Plot plot, final int x_offset, final int z_offset) { public static boolean paste(final Location location, final Schematic schematic, final Plot plot, final int x_offset, final int z_offset) {
if (schematic == null) { if (schematic == null) {
PlotSquared.sendConsoleSenderMessage("Schematic == null :|"); PlotSquared.log("Schematic == null :|");
return false; return false;
} }
try { try {
@ -179,7 +179,7 @@ public class SchematicHandler {
} }
final File file = new File(PlotSquared.getMain().getDirectory() + File.separator + "schematics" + File.separator + name + ".schematic"); final File file = new File(PlotSquared.getMain().getDirectory() + File.separator + "schematics" + File.separator + name + ".schematic");
if (!file.exists()) { if (!file.exists()) {
PlotSquared.sendConsoleSenderMessage(file.toString() + " doesn't exist"); PlotSquared.log(file.toString() + " doesn't exist");
return null; return null;
} }
@ -191,7 +191,7 @@ public class SchematicHandler {
return getSchematic(tag, file); return getSchematic(tag, file);
} catch (final Exception e) { } catch (final Exception e) {
PlotSquared.sendConsoleSenderMessage(file.toString() + " is not in GZIP format"); PlotSquared.log(file.toString() + " is not in GZIP format");
return null; return null;
} }
} }
@ -206,7 +206,7 @@ public class SchematicHandler {
*/ */
public static boolean save(final CompoundTag tag, final String path) { public static boolean save(final CompoundTag tag, final String path) {
if (tag == null) { if (tag == null) {
PlotSquared.sendConsoleSenderMessage("&cCannot save empty tag"); PlotSquared.log("&cCannot save empty tag");
return false; return false;
} }
try { try {
@ -265,7 +265,7 @@ public class SchematicHandler {
} }
} }
} catch (final Exception e) { } catch (final Exception e) {
PlotSquared.sendConsoleSenderMessage("&7 - Cannot save: corrupt chunk at " + (i / 16) + ", " + (j / 16)); PlotSquared.log("&7 - Cannot save: corrupt chunk at " + (i / 16) + ", " + (j / 16));
return null; return null;
} }
final int width = (pos2.getBlockX() - pos1.getBlockX()) + 1; final int width = (pos2.getBlockX() - pos1.getBlockX()) + 1;

View File

@ -109,7 +109,7 @@ public class UUIDHandler {
uuids.add(uuid); uuids.add(uuid);
} }
catch (Exception e) { catch (Exception e) {
PlotSquared.sendConsoleSenderMessage(C.PREFIX.s() + "Invalid playerdata: "+current); PlotSquared.log(C.PREFIX.s() + "Invalid playerdata: "+current);
} }
} }
} }
@ -136,7 +136,7 @@ public class UUIDHandler {
add(name, uuid); add(name, uuid);
} }
catch (Throwable e) { catch (Throwable e) {
PlotSquared.sendConsoleSenderMessage(C.PREFIX.s() + "&6Invalid playerdata: "+uuid.toString() + ".dat"); PlotSquared.log(C.PREFIX.s() + "&6Invalid playerdata: "+uuid.toString() + ".dat");
} }
} }
for (String name : names) { for (String name : names) {
@ -149,7 +149,7 @@ public class UUIDHandler {
// add the Everyone '*' UUID // add the Everyone '*' UUID
add(new StringWrapper("*"), DBFunc.everyone); add(new StringWrapper("*"), DBFunc.everyone);
PlotSquared.sendConsoleSenderMessage(C.PREFIX.s() + "&6Cached a total of: " + UUIDHandler.uuidMap.size() + " UUIDs"); PlotSquared.log(C.PREFIX.s() + "&6Cached a total of: " + UUIDHandler.uuidMap.size() + " UUIDs");
} }
public static UUID getUUID(Player player) { public static UUID getUUID(Player player) {