From b158d5369aa66e2193153c0cfbcda15373bdb9a0 Mon Sep 17 00:00:00 2001 From: asofold Date: Fri, 9 Nov 2012 08:39:04 +0100 Subject: [PATCH] Deprecate some methods, delegate to LogUtil. --- .../nocheatplus/utilities/CheckUtils.java | 81 ++++++++++++------- 1 file changed, 50 insertions(+), 31 deletions(-) diff --git a/src/fr/neatmonster/nocheatplus/utilities/CheckUtils.java b/src/fr/neatmonster/nocheatplus/utilities/CheckUtils.java index b14f9ac1..3c89b102 100644 --- a/src/fr/neatmonster/nocheatplus/utilities/CheckUtils.java +++ b/src/fr/neatmonster/nocheatplus/utilities/CheckUtils.java @@ -1,7 +1,5 @@ package fr.neatmonster.nocheatplus.utilities; -import java.io.PrintWriter; -import java.io.StringWriter; import java.text.DecimalFormat; import java.text.DecimalFormatSymbols; import java.util.Collection; @@ -198,37 +196,35 @@ public class CheckUtils { /** * Convenience method. - * + * @deprecated Use LogUtil.scheduleLogInfo instead. * @param parts * @param link * @return */ public static boolean scheduleOutputJoined(final List parts, String link) { - return scheduleOutput(join(parts, link)); + return LogUtil.scheduleLogInfo(parts, link); } - - /** - * Schedule a message to be output by the bukkit logger. - * @param message - * @return If scheduled successfully. - */ - public static boolean scheduleOutput(final String message){ - try{ - return Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("NoCheatPlus"), - new Runnable() { - @Override - public void run() { - Bukkit.getLogger().info(message); - } - }) != -1; - } - catch (final Exception exc){ - return false; - } - } - /** + /** + * @deprecated Use instead: scheduleLogInfo + * @param message + * @return + */ + public static boolean scheduleOutput(final String message) { + try { + return Bukkit.getScheduler().scheduleSyncDelayedTask(Bukkit.getPluginManager().getPlugin("NoCheatPlus"), new Runnable() { + @Override + public void run() { + Bukkit.getLogger().info(message); + } + }) != -1; + } catch (final Exception exc) { + return false; + } + } + + /** * Removes the colors of a message. * * @param text @@ -254,19 +250,30 @@ public class CheckUtils { return text; } + /** + * @deprecated Use instead: LogUtil.scheduleLogInfo or similar. + * @param t + */ public static void scheduleOutput(final Throwable t) { scheduleOutput(toString(t)); } + + /** + * @deprecated Use instead: LogUtil.logSevere + * @param t + */ public static void logSevere(final Throwable t) { - Bukkit.getLogger().severe(toString(t)); + LogUtil.logSevere(toString(t)); } - public static String toString(final Throwable t){ - // TODO: Find the fastest way. - final StringWriter w = new StringWriter(); - t.printStackTrace(new PrintWriter(w)); - return w.toString(); + /** + * @deprecated Use instead: LogUtil.toString + * @param t + * @return + */ + public static final String toString(final Throwable t){ + return LogUtil.toString(t); } /** @@ -302,14 +309,26 @@ public class CheckUtils { else return diff; } + /** + * @deprecated Use instead: LogUtil.logSevere + * @param msg + */ public static void logSevere(final String msg) { Bukkit.getLogger().severe((msg)); } + /** + * @deprecated Use instead: LogUtil.logWarning + * @param msg + */ public static void logWarning(final String msg) { Bukkit.getLogger().warning((msg)); } + /** + * @deprecated Use instead: LogUtil.logInfo + * @param msg + */ public static void logInfo(final String msg) { Bukkit.getLogger().info((msg)); }