diff --git a/src/main/java/pw/yumc/YumCore/bukkit/Log.java b/src/main/java/pw/yumc/YumCore/bukkit/Log.java index 3d38f55..0e7d23c 100644 --- a/src/main/java/pw/yumc/YumCore/bukkit/Log.java +++ b/src/main/java/pw/yumc/YumCore/bukkit/Log.java @@ -1,19 +1,19 @@ package pw.yumc.YumCore.bukkit; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.command.CommandSender; + import java.io.File; import java.util.logging.Handler; import java.util.logging.Level; import java.util.logging.Logger; -import org.bukkit.Bukkit; -import org.bukkit.ChatColor; -import org.bukkit.command.CommandSender; - /** * 插件日志输出类 * - * @since 2016年7月23日 上午9:11:01 * @author 喵♂呜 + * @since 2016年7月23日 上午9:11:01 */ public class Log { private static boolean debug = new File(String.format("plugins%1$sYumCore%1$sdebug", File.separatorChar)).exists(); @@ -31,11 +31,9 @@ public class Log { * Typically the root Logger is configured with a set of Handlers * that essentially act as default handlers for all loggers. * - * @param handler - * a logging Handler - * @exception SecurityException - * if a security manager exists and if - * the caller does not have LoggingPermission("control"). + * @param handler a logging Handler + * @throws SecurityException if a security manager exists and if + * the caller does not have LoggingPermission("control"). */ public static void addHandler(Handler handler) throws SecurityException { logger.addHandler(handler); @@ -44,8 +42,7 @@ public class Log { /** * Sends console a message * - * @param message - * Message to be displayed + * @param message Message to be displayed */ public static void console(String message) { console.sendMessage(prefix + message); @@ -54,10 +51,8 @@ public class Log { /** * Sends console a message * - * @param message - * 消息 - * @param object - * 格式化参数 + * @param message 消息 + * @param object 格式化参数 */ public static void console(String message, Object... object) { console.sendMessage(prefix + String.format(message, object)); @@ -66,8 +61,7 @@ public class Log { /** * Sends console a message * - * @param message - * Message to be displayed + * @param msg Message to be displayed */ public static void console(String[] msg) { for (String str : msg) { @@ -78,10 +72,8 @@ public class Log { /** * 调试消息 * - * @param msg - * 消息 - * @param object - * 参数 + * @param msg 消息 + * @param object 参数 */ public static void d(String msg, Object... object) { debug(String.format(msg, object)); @@ -90,8 +82,7 @@ public class Log { /** * 格式化调试消息 * - * @param msg - * 消息 + * @param msg 消息 */ public static void debug(String msg) { if (debug) { @@ -102,10 +93,8 @@ public class Log { /** * 调试消息 * - * @param msg - * 消息 - * @param object - * 参数 + * @param msg 消息 + * @param object 参数 */ public static void debug(String msg, Object... object) { if (debug) { @@ -116,10 +105,8 @@ public class Log { /** * 调试消息 * - * @param msg - * 消息 - * @param e - * 异常 + * @param msg 消息 + * @param e 异常 */ public static void debug(String msg, Throwable e) { if (debug) { @@ -131,8 +118,7 @@ public class Log { /** * 调试消息 * - * @param e - * 异常 + * @param e 异常 */ public static void debug(Throwable e) { if (debug) { @@ -147,6 +133,10 @@ public class Log { return prefix; } + public static void i(String msg, Object... objs) { + logger.info(String.format(msg, objs)); + } + /** * Log an INFO message. *
@@ -155,8 +145,7 @@ public class Log { * registered output Handler objects. *
* - * @param msg - * The string message (or a key in the message catalog) + * @param msg The string message (or a key in the message catalog) */ public static void info(String msg) { logger.info(msg); @@ -170,10 +159,8 @@ public class Log { * registered output Handler objects. *
* - * @param level - * One of the message level identifiers, e.g., SEVERE - * @param msg - * The string message (or a key in the message catalog) + * @param level One of the message level identifiers, e.g., SEVERE + * @param msg The string message (or a key in the message catalog) */ public static void log(Level level, String msg) { logger.log(level, msg); @@ -187,12 +174,9 @@ public class Log { * to all the registered output Handler objects. *
* - * @param level - * One of the message level identifiers, e.g., SEVERE - * @param msg - * The string message (or a key in the message catalog) - * @param param1 - * parameter to the message + * @param level One of the message level identifiers, e.g., SEVERE + * @param msg The string message (or a key in the message catalog) + * @param param1 parameter to the message */ public static void log(Level level, String msg, Object param1) { logger.log(level, msg, param1); @@ -206,12 +190,9 @@ public class Log { * to all the registered output Handler objects. *
* - * @param level - * One of the message level identifiers, e.g., SEVERE - * @param msg - * The string message (or a key in the message catalog) - * @param params - * array of parameters to the message + * @param level One of the message level identifiers, e.g., SEVERE + * @param msg The string message (or a key in the message catalog) + * @param params array of parameters to the message */ public static void log(Level level, String msg, Object[] params) { logger.log(level, msg, params); @@ -230,20 +211,16 @@ public class Log { * as a formatting parameter to the LogRecord message property. *
* - * @param level - * One of the message level identifiers, e.g., SEVERE - * @param msg - * The string message (or a key in the message catalog) - * @param thrown - * Throwable associated with log message. + * @param level One of the message level identifiers, e.g., SEVERE + * @param msg The string message (or a key in the message catalog) + * @param thrown Throwable associated with log message. */ public static void log(Level level, String msg, Throwable thrown) { logger.log(level, msg, thrown); } /** - * @param prefix - * 插件前缀 + * @param prefix 插件前缀 */ public static void setPrefix(String prefix) { Log.prefix = ChatColor.translateAlternateColorCodes('&', prefix); @@ -254,8 +231,7 @@ public class Log { *
* If the logger is currently enabled for the SEVERE message level then the given message is forwarded to all the registered output Handler objects. * - * @param msg - * The string message (or a key in the message catalog) + * @param msg The string message (or a key in the message catalog) */ public static void severe(String msg) { logger.severe(msg); @@ -264,10 +240,8 @@ public class Log { /** * Sends this sender a message * - * @param sender - * 命令发送者 - * @param msg - * 消息 + * @param sender 命令发送者 + * @param msg 消息 */ public static void toSender(CommandSender sender, String msg) { sender.sendMessage(prefix + msg); @@ -276,12 +250,9 @@ public class Log { /** * Sends this sender a message * - * @param sender - * 命令发送者 - * @param msg - * 消息 - * @param objs - * 参数 + * @param sender 命令发送者 + * @param msg 消息 + * @param objs 参数 */ public static void toSender(CommandSender sender, String msg, Object... objs) { sender.sendMessage(prefix + String.format(msg, objs)); @@ -290,10 +261,8 @@ public class Log { /** * Sends this sender a message * - * @param sender - * 命令发送者 - * @param msg - * 消息 + * @param sender 命令发送者 + * @param msg 消息 */ public static void toSender(CommandSender sender, String[] msg) { for (String str : msg) { @@ -304,10 +273,8 @@ public class Log { /** * 格式化警告消息 * - * @param string - * 消息 - * @param objects - * 参数 + * @param string 消息 + * @param objects 参数 */ public static void w(String string, Object... objects) { logger.warning(String.format(string, objects)); @@ -321,8 +288,7 @@ public class Log { * registered output Handler objects. *
*
- * @param msg
- * The string message (or a key in the message catalog)
+ * @param msg The string message (or a key in the message catalog)
*/
public static void warning(String msg) {
logger.warning(msg);
diff --git a/src/main/java/pw/yumc/YumCore/commands/CommandHelp.java b/src/main/java/pw/yumc/YumCore/commands/CommandHelp.java
index d9bb355..a5a03df 100644
--- a/src/main/java/pw/yumc/YumCore/commands/CommandHelp.java
+++ b/src/main/java/pw/yumc/YumCore/commands/CommandHelp.java
@@ -1,22 +1,14 @@
package pw.yumc.YumCore.commands;
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
-
import pw.yumc.YumCore.bukkit.P;
import pw.yumc.YumCore.commands.annotation.Help;
import pw.yumc.YumCore.commands.info.CommandInfo;
import pw.yumc.YumCore.commands.interfaces.CommandHelpParse;
+import java.util.*;
+
/**
* 命令帮助生成类
*
@@ -28,9 +20,9 @@ public class CommandHelp {
* 消息配置
*/
private static String prefix = String.format("§6[§b%s§6] ", P.instance.getName());
- private static String commandNotFound = prefix + "§c当前插件未注册任何子命令!";
+ private static String commandNotFound = prefix + "§c当前插件未注册默认命令以及子命令!";
private static String pageNotFound = prefix + "§c不存在的帮助页面 §b请输入 /%s help §e1-%s";
- private static String helpTitle = String.format("§6========= %s §6插件帮助列表=========", prefix);
+ private static String helpTitle = String.format("§6========= %s §6插件帮助列表 §aBy §b喵♂呜 §6=========", prefix);
private static String helpBody = "§6/%1$s §a%2$s §e%3$s §6- §b%4$s";
private static String helpFooter = "§6查看更多的帮助页面 §b请输入 /%s help §e1-%s";
/**
diff --git a/src/main/java/pw/yumc/YumCore/global/I18N.java b/src/main/java/pw/yumc/YumCore/global/I18N.java
new file mode 100644
index 0000000..5f2e265
--- /dev/null
+++ b/src/main/java/pw/yumc/YumCore/global/I18N.java
@@ -0,0 +1,75 @@
+package pw.yumc.YumCore.global;
+
+import org.bukkit.command.CommandSender;
+import pw.yumc.YumCore.bukkit.Log;
+import pw.yumc.YumCore.config.ext.YumConfig;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 国际化工具类
+ * Created by 喵♂呜 on 2016/10/14 0014.
+ */
+public class I18N {
+ private static String LANG = "zh_CN";
+ private static Map