- * If the logger is currently enabled for the INFO 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) - */ - public static void info(String msg) { - logger.info(msg); + public static void i(String msg, Object... objs) { + logger.info(String.format(msg, objs)); } /** @@ -160,8 +150,10 @@ 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); @@ -175,9 +167,12 @@ 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); @@ -191,9 +186,12 @@ 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); @@ -212,16 +210,20 @@ 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); @@ -232,7 +234,8 @@ 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); @@ -241,8 +244,10 @@ public class Log { /** * Sends this sender a message * - * @param sender 命令发送者 - * @param msg 消息 + * @param sender + * 命令发送者 + * @param msg + * 消息 */ public static void sender(CommandSender sender, String msg) { sender.sendMessage(prefix + msg); @@ -251,9 +256,12 @@ public class Log { /** * Sends this sender a message * - * @param sender 命令发送者 - * @param msg 消息 - * @param objs 参数 + * @param sender + * 命令发送者 + * @param msg + * 消息 + * @param objs + * 参数 */ public static void sender(CommandSender sender, String msg, Object... objs) { sender.sendMessage(prefix + String.format(msg, objs)); @@ -262,8 +270,10 @@ public class Log { /** * Sends this sender a message * - * @param sender 命令发送者 - * @param msg 消息 + * @param sender + * 命令发送者 + * @param msg + * 消息 */ public static void sender(CommandSender sender, String[] msg) { for (String str : msg) { @@ -274,25 +284,22 @@ public class Log { /** * 格式化警告消息 * - * @param string 消息 - * @param objects 参数 + * @param string + * 消息 + */ + public static void w(String string) { + logger.warning(string); + } + + /** + * 格式化警告消息 + * + * @param string + * 消息 + * @param objects + * 参数 */ public static void w(String string, Object... objects) { logger.warning(String.format(string, objects)); } - - /** - * Log a WARNING message. - *
- * If the logger is currently enabled for the WARNING 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)
- */
- public static void warning(String msg) {
- logger.warning(msg);
- }
-
}
diff --git a/src/main/java/pw/yumc/YumCore/commands/annotation/Option.java b/src/main/java/pw/yumc/YumCore/commands/annotation/Option.java
index 56ddf78..50dc43f 100644
--- a/src/main/java/pw/yumc/YumCore/commands/annotation/Option.java
+++ b/src/main/java/pw/yumc/YumCore/commands/annotation/Option.java
@@ -7,7 +7,10 @@ import java.lang.annotation.Target;
/**
* 扩展选项注解
- *
+ *
+ * 例如 "def:默认值 max:最大值 min 最小值"
+ *
+ *
* @since 2016年7月23日 上午9:00:07
* @author 喵♂呜
*/
diff --git a/src/main/java/pw/yumc/YumCore/config/FileConfig.java b/src/main/java/pw/yumc/YumCore/config/FileConfig.java
index 19988c4..0f87545 100644
--- a/src/main/java/pw/yumc/YumCore/config/FileConfig.java
+++ b/src/main/java/pw/yumc/YumCore/config/FileConfig.java
@@ -1,16 +1,26 @@
package pw.yumc.YumCore.config;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Date;
+import java.util.List;
+import java.util.Set;
+
import org.apache.commons.lang.Validate;
import org.bukkit.ChatColor;
import org.bukkit.Location;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.MemorySection;
import org.bukkit.configuration.file.YamlConfiguration;
-import pw.yumc.YumCore.bukkit.Log;
-import java.io.*;
-import java.text.SimpleDateFormat;
-import java.util.*;
+import pw.yumc.YumCore.bukkit.Log;
/**
* 一个继承于 {@link YamlConfiguration} 的配置文件类
@@ -20,7 +30,6 @@ import java.util.*;
* @version 1.0
* @since 2015年11月7日 下午2:36:07
*/
-@SuppressWarnings({ "unchecked" })
public class FileConfig extends AbstractConfig {
protected static String VERSION = "Version";
@@ -277,7 +286,7 @@ public class FileConfig extends AbstractConfig {
commentConfig = new CommentConfig();
commentConfig.loadFromString(contents);
} catch (Exception e) {
- Log.debug(CONFIG_READ_COMMENT_ERROR);
+ Log.d(CONFIG_READ_COMMENT_ERROR);
commentConfig = null;
}
super.loadFromString(contents);
@@ -516,7 +525,7 @@ public class FileConfig extends AbstractConfig {
try {
init(new FileInputStream(file));
} catch (FileNotFoundException e) {
- Log.debug(String.format(CONFIG_NOT_FOUND, file.toPath()));
+ Log.d(CONFIG_NOT_FOUND, file.toPath());
}
return this;
}
@@ -603,7 +612,7 @@ public class FileConfig extends AbstractConfig {
if (newVer != null && !newVer.getClass().equals(var.getClass())) {
Log.w("警告! 旧数据类型与新配置类型不匹配!");
}
- Log.debug(String.format(CONFIG_UPDATE_VALUE, string, var));
+ Log.d(CONFIG_UPDATE_VALUE, string, var);
newCfg.set(string, var);
}
}
diff --git a/src/main/java/pw/yumc/YumCore/sql/DataBase.java b/src/main/java/pw/yumc/YumCore/sql/DataBase.java
index 29c85e2..d3d665d 100644
--- a/src/main/java/pw/yumc/YumCore/sql/DataBase.java
+++ b/src/main/java/pw/yumc/YumCore/sql/DataBase.java
@@ -1,7 +1,19 @@
package pw.yumc.YumCore.sql;
+import java.sql.Connection;
+import java.sql.DatabaseMetaData;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.List;
+
import org.bukkit.configuration.ConfigurationSection;
import org.bukkit.plugin.Plugin;
+
import pw.yumc.YumCore.bukkit.Log;
import pw.yumc.YumCore.bukkit.P;
import pw.yumc.YumCore.config.inject.InjectParse;
@@ -11,12 +23,6 @@ import pw.yumc.YumCore.sql.core.KeyValue;
import pw.yumc.YumCore.sql.core.MySQLCore;
import pw.yumc.YumCore.sql.core.SQLiteCore;
-import java.sql.*;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.List;
-
/**
* 数据库管理类
*
@@ -467,7 +473,7 @@ public class DataBase {
public void sqlerr(String sql, Exception e) {
info("数据库操作出错: " + e.getMessage());
info("SQL查询语句: " + sql);
- Log.debug(this.getClass().getName());
+ Log.d(this.getClass().getName());
Log.d(e);
}
diff --git a/src/main/java/pw/yumc/YumCore/sql/core/DataBaseCore.java b/src/main/java/pw/yumc/YumCore/sql/core/DataBaseCore.java
index cd79f04..857a068 100644
--- a/src/main/java/pw/yumc/YumCore/sql/core/DataBaseCore.java
+++ b/src/main/java/pw/yumc/YumCore/sql/core/DataBaseCore.java
@@ -1,6 +1,10 @@
package pw.yumc.YumCore.sql.core;
-import java.sql.*;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
import pw.yumc.YumCore.bukkit.Log;
@@ -150,7 +154,7 @@ public abstract class DataBaseCore {
* SQL语句
*/
private void debug(String sql) {
- Log.debug("[SQL] " + sql);
+ Log.d("[SQL] " + sql);
}
/**