diff --git a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java index 5ebdef3c4..be60f8c23 100644 --- a/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java +++ b/Bukkit/src/main/java/com/plotsquared/bukkit/BukkitMain.java @@ -72,12 +72,6 @@ import com.plotsquared.bukkit.uuid.LowerOfflineUUIDWrapper; import com.plotsquared.bukkit.uuid.OfflineUUIDWrapper; import com.plotsquared.bukkit.uuid.SQLUUIDHandler; import com.sk89q.worldedit.bukkit.WorldEditPlugin; -import java.io.File; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Iterator; -import java.util.List; -import java.util.UUID; import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.Chunk; @@ -93,6 +87,13 @@ import org.bukkit.metadata.MetadataValue; import org.bukkit.plugin.Plugin; import org.bukkit.plugin.java.JavaPlugin; +import java.io.File; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Iterator; +import java.util.List; +import java.util.UUID; + public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain { public static WorldEditPlugin worldEdit; @@ -139,9 +140,9 @@ public final class BukkitMain extends JavaPlugin implements Listener, IPlotMain message = ChatColor.stripColor(message); } this.getServer().getConsoleSender().sendMessage(message); - return; - } catch (Throwable ignored) {} - System.out.println(ConsoleColors.fromString(message)); + } catch (Throwable ignored) { + System.out.println(ConsoleColors.fromString(message)); + } } @Override diff --git a/Core/src/main/java/com/intellectualcrafters/plot/PS.java b/Core/src/main/java/com/intellectualcrafters/plot/PS.java index f80ed4429..0a0c476b3 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/PS.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/PS.java @@ -16,6 +16,7 @@ import com.intellectualcrafters.plot.generator.GeneratorWrapper; import com.intellectualcrafters.plot.generator.HybridPlotWorld; import com.intellectualcrafters.plot.generator.HybridUtils; import com.intellectualcrafters.plot.generator.IndependentPlotGenerator; +import com.intellectualcrafters.plot.logger.DelegateLogger; import com.intellectualcrafters.plot.logger.ILogger; import com.intellectualcrafters.plot.object.Location; import com.intellectualcrafters.plot.object.Plot; @@ -49,6 +50,7 @@ import com.intellectualcrafters.plot.util.WorldUtil; import com.intellectualcrafters.plot.util.area.QuadMap; import com.plotsquared.listener.WESubscriber; import com.sk89q.worldedit.WorldEdit; + import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; @@ -86,7 +88,6 @@ public class PS { private static PS instance; public final IPlotMain IMP; - public ILogger LOGGER; private final HashSet plotAreaHashCheck = new HashSet<>(); /** * All plot areas mapped by world (quick world access). @@ -99,6 +100,7 @@ public class PS { private final int[] version; private final String platform; private final Thread thread; + public ILogger logger; public HashMap> clusters_tmp; public HashMap> plots_tmp; public File styleFile; @@ -131,7 +133,7 @@ public class PS { PS.instance = this; this.thread = Thread.currentThread(); this.IMP = iPlotMain; - this.LOGGER = iPlotMain; + this.logger = iPlotMain; this.platform = platform; this.version = this.IMP.getPluginVersion(); try { @@ -297,27 +299,6 @@ public class PS { return PS.instance; } - /** - * Set the logger - * @see com.intellectualcrafters.plot.logger.DelegateLogger - * @see #getLogger() - * @param logger - */ - public void setLogger(ILogger logger) { - if (logger == null) { - throw new IllegalArgumentException("Logger may not be null"); - } - LOGGER = logger; - } - - /** - * Get the current logger - * @return - */ - public ILogger getLogger() { - return LOGGER; - } - /** * Log a message to the IPlotMain logger. * @@ -325,7 +306,7 @@ public class PS { * @see IPlotMain#log(String) */ public static void log(Object message) { - PS.get().LOGGER.log(StringMan.getString(message)); + PS.get().getLogger().log(StringMan.getString(message)); } /** @@ -340,6 +321,24 @@ public class PS { } } + /** + * Get the current logger + * @return + */ + public ILogger getLogger() { + return logger; + } + + /** + * Set the Logger. + * @see DelegateLogger + * @see #getLogger() + * @param logger + */ + public void setLogger(ILogger logger) { + this.logger = logger; + } + private void startUuidCatching() { TaskManager.runTaskLater(new Runnable() { @Override diff --git a/Core/src/main/java/com/intellectualcrafters/plot/logger/DelegateLogger.java b/Core/src/main/java/com/intellectualcrafters/plot/logger/DelegateLogger.java index 481e21f63..c6606bc1f 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/logger/DelegateLogger.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/logger/DelegateLogger.java @@ -5,9 +5,6 @@ public class DelegateLogger implements ILogger { private final ILogger parent; public DelegateLogger(ILogger parent) { - if (parent == null) { - throw new IllegalArgumentException("Parent cannot be null"); - } this.parent = parent; } diff --git a/Core/src/main/java/com/intellectualcrafters/plot/logger/ILogger.java b/Core/src/main/java/com/intellectualcrafters/plot/logger/ILogger.java index 983fd544c..d2f311640 100644 --- a/Core/src/main/java/com/intellectualcrafters/plot/logger/ILogger.java +++ b/Core/src/main/java/com/intellectualcrafters/plot/logger/ILogger.java @@ -1,5 +1,5 @@ package com.intellectualcrafters.plot.logger; public interface ILogger { - public void log(String message); + void log(String message); }