fix: 修复一个调用错误问题 更新到1.6

Signed-off-by: 502647092 <admin@yumc.pw>
merge/1/MERGE
502647092 2017-01-25 00:12:02 +08:00
parent aa95b96d38
commit a699515d29
6 changed files with 138 additions and 109 deletions

View File

@ -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>

View File

@ -32,9 +32,11 @@ 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
* 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);
@ -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);
}
}

View File

@ -7,7 +7,10 @@ import java.lang.annotation.Target;
/**
*
*
* <code>
* "def:默认值 max:最大值 min 最小值"
*</code>
*
* @since 2016723 9:00:07
* @author
*/

View File

@ -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 2015117 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);
}
}

View File

@ -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);
}

View File

@ -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);
}
/**