fix: 修复一个调用错误问题 更新到1.6
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
aa95b96d38
commit
a699515d29
2
pom.xml
2
pom.xml
|
@ -4,7 +4,7 @@
|
|||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>pw.yumc</groupId>
|
||||
<artifactId>YumCore</artifactId>
|
||||
<version>1.5</version>
|
||||
<version>1.6</version>
|
||||
<build>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<resources>
|
||||
|
|
|
@ -32,8 +32,10 @@ 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
|
||||
* @throws SecurityException if a security manager exists and if
|
||||
* @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 {
|
||||
|
@ -43,7 +45,8 @@ 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);
|
||||
|
@ -52,8 +55,10 @@ 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));
|
||||
|
@ -62,7 +67,8 @@ public class Log {
|
|||
/**
|
||||
* Sends console a message
|
||||
*
|
||||
* @param msg Message to be displayed
|
||||
* @param msg
|
||||
* Message to be displayed
|
||||
*/
|
||||
public static void console(String[] msg) {
|
||||
for (String str : msg) {
|
||||
|
@ -73,45 +79,35 @@ public class Log {
|
|||
/**
|
||||
* 调试消息
|
||||
*
|
||||
* @param msg 消息
|
||||
* @param object 参数
|
||||
* @param msg
|
||||
* 消息
|
||||
*/
|
||||
public static void d(String msg) {
|
||||
if (debug) {
|
||||
logger.info("[DEBUG] " + msg);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 调试消息
|
||||
*
|
||||
* @param msg
|
||||
* 消息
|
||||
* @param object
|
||||
* 参数
|
||||
*/
|
||||
public static void d(String msg, Object... object) {
|
||||
debug(String.format(msg, object));
|
||||
}
|
||||
|
||||
/**
|
||||
* 格式化调试消息
|
||||
*
|
||||
* @param msg 消息
|
||||
*/
|
||||
public static void debug(String msg) {
|
||||
if (debug) {
|
||||
logger.info("[DEBUG] " + msg);
|
||||
}
|
||||
d(String.format(msg, object));
|
||||
}
|
||||
|
||||
/**
|
||||
* 调试消息
|
||||
*
|
||||
* @param msg 消息
|
||||
* @param object 参数
|
||||
* @param e
|
||||
* 异常
|
||||
*/
|
||||
public static void debug(String msg, Object... object) {
|
||||
public static void d(Throwable e) {
|
||||
if (debug) {
|
||||
logger.log(Level.SEVERE, "[DEBUG] " + msg, object);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 调试消息
|
||||
*
|
||||
* @param msg 消息
|
||||
* @param e 异常
|
||||
*/
|
||||
public static void d(String msg, Throwable e) {
|
||||
if (debug) {
|
||||
logger.info("[DEBUG] " + msg);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -119,10 +115,14 @@ public class Log {
|
|||
/**
|
||||
* 调试消息
|
||||
*
|
||||
* @param e 异常
|
||||
* @param msg
|
||||
* 消息
|
||||
* @param e
|
||||
* 异常
|
||||
*/
|
||||
public static void d(Throwable e) {
|
||||
public static void d(String msg, Throwable e) {
|
||||
if (debug) {
|
||||
logger.info("[DEBUG] " + msg);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
@ -134,22 +134,12 @@ public class Log {
|
|||
return prefix;
|
||||
}
|
||||
|
||||
public static void i(String msg, Object... objs) {
|
||||
logger.info(String.format(msg, objs));
|
||||
public static void i(String msg) {
|
||||
logger.info(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* Log an INFO message.
|
||||
* <p>
|
||||
* If the logger is currently enabled for the INFO message
|
||||
* level then the given message is forwarded to all the
|
||||
* registered output Handler objects.
|
||||
* <p>
|
||||
*
|
||||
* @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.
|
||||
* <p>
|
||||
*
|
||||
* @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.
|
||||
* <p>
|
||||
*
|
||||
* @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.
|
||||
* <p>
|
||||
*
|
||||
* @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.
|
||||
* <p>
|
||||
*
|
||||
* @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 {
|
|||
* <p>
|
||||
* 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.
|
||||
* <p>
|
||||
* If the logger is currently enabled for the WARNING message
|
||||
* level then the given message is forwarded to all the
|
||||
* registered output Handler objects.
|
||||
* <p>
|
||||
*
|
||||
* @param msg The string message (or a key in the message catalog)
|
||||
*/
|
||||
public static void warning(String msg) {
|
||||
logger.warning(msg);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -7,6 +7,9 @@ import java.lang.annotation.Target;
|
|||
|
||||
/**
|
||||
* 扩展选项注解
|
||||
* <code>
|
||||
* 例如 "def:默认值 max:最大值 min 最小值"
|
||||
*</code>
|
||||
*
|
||||
* @since 2016年7月23日 上午9:00:07
|
||||
* @author 喵♂呜
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue