mirror of
https://e.coding.net/circlecloud/YumCore.git
synced 2024-11-21 01:38:51 +00:00
fix: 修复日志类更新错误
Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
parent
a699515d29
commit
c15a26b29b
@ -56,7 +56,7 @@ public class C {
|
||||
sendPacket = typePlayerConnection.getMethod("sendPacket", Class.forName(a("Packet")));
|
||||
init = true;
|
||||
} catch (Exception e) {
|
||||
Log.warning("C 兼容性工具初始化失败 可能造成部分功能不可用!");
|
||||
Log.w("C 兼容性工具初始化失败 可能造成部分功能不可用!");
|
||||
Log.d(e);
|
||||
}
|
||||
}
|
||||
@ -247,7 +247,7 @@ public class C {
|
||||
}
|
||||
// getOnlinePlayers end
|
||||
} catch (Exception e) {
|
||||
Log.warning("Player 兼容性工具初始化失败 可能造成部分功能不可用!");
|
||||
Log.w("Player 兼容性工具初始化失败 可能造成部分功能不可用!");
|
||||
}
|
||||
try {
|
||||
// getOfflinePlayer start
|
||||
@ -317,7 +317,7 @@ public class C {
|
||||
packetTitleSendConstructor = packetTitle.getConstructor(packetActions, nmsIChatBaseComponent);
|
||||
packetTitleSetTimeConstructor = packetTitle.getConstructor(packetActions, nmsIChatBaseComponent, Integer.TYPE, Integer.TYPE, Integer.TYPE);
|
||||
} catch (Exception ignore) {
|
||||
Log.warning("Title 兼容性工具初始化失败 可能造成部分功能不可用!");
|
||||
Log.w("Title 兼容性工具初始化失败 可能造成部分功能不可用!");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ public class CommandMain implements CommandExecutor {
|
||||
return true;
|
||||
} catch (ArrayIndexOutOfBoundsException | ClassCastException ignored) {
|
||||
}
|
||||
Log.warning(String.format(argumentTypeError, method.getName(), clazz.getClass().getName()));
|
||||
Log.w(argumentTypeError, method.getName(), clazz.getClass().getName());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -265,7 +265,7 @@ public class CommandSub implements TabExecutor {
|
||||
return true;
|
||||
} catch (ArrayIndexOutOfBoundsException | ClassCastException ignored) {
|
||||
}
|
||||
Log.warning(String.format(argumentTypeError, method.getName(), clazz.getClass().getName()));
|
||||
Log.w(argumentTypeError, method.getName(), clazz.getClass().getName());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -287,7 +287,7 @@ public class CommandSub implements TabExecutor {
|
||||
tabs.add(ti);
|
||||
return true;
|
||||
}
|
||||
Log.warning(String.format(returnTypeError, method.getName(), clazz.getClass().getName()));
|
||||
Log.w(returnTypeError, method.getName(), clazz.getClass().getName());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -1,6 +1,17 @@
|
||||
package pw.yumc.YumCore.config;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.io.Reader;
|
||||
import java.io.Writer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang.Validate;
|
||||
import org.bukkit.configuration.InvalidConfigurationException;
|
||||
import org.bukkit.configuration.file.YamlConfiguration;
|
||||
@ -9,15 +20,14 @@ import org.yaml.snakeyaml.DumperOptions;
|
||||
import org.yaml.snakeyaml.Yaml;
|
||||
import org.yaml.snakeyaml.error.YAMLException;
|
||||
import org.yaml.snakeyaml.representer.Representer;
|
||||
|
||||
import com.google.common.io.Files;
|
||||
|
||||
import pw.yumc.YumCore.bukkit.Log;
|
||||
import pw.yumc.YumCore.bukkit.P;
|
||||
import pw.yumc.YumCore.config.yaml.BukkitConstructor;
|
||||
import pw.yumc.YumCore.config.yaml.BukkitRepresenter;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 抽象配置文件
|
||||
*
|
||||
@ -99,7 +109,7 @@ public abstract class AbstractConfig extends YamlConfiguration {
|
||||
Files.createParentDirs(file);
|
||||
if (!file.exists()) {
|
||||
file.createNewFile();
|
||||
Log.info(String.format(CREATE_NEW_CONFIG, file.toPath()));
|
||||
Log.i(CREATE_NEW_CONFIG, file.toPath());
|
||||
}
|
||||
try (Writer writer = new OutputStreamWriter(new FileOutputStream(file), UTF_8)) {
|
||||
writer.write(data);
|
||||
|
@ -374,7 +374,7 @@ public class FileConfig extends AbstractConfig {
|
||||
this.save(file);
|
||||
return true;
|
||||
} catch (IOException e) {
|
||||
Log.warning(String.format(CONFIG_SAVE_ERROR, file.getName()));
|
||||
Log.w(CONFIG_SAVE_ERROR, file.getName());
|
||||
e.printStackTrace();
|
||||
return false;
|
||||
}
|
||||
@ -414,12 +414,12 @@ public class FileConfig extends AbstractConfig {
|
||||
} else {
|
||||
plugin.saveResource(filename, true);
|
||||
}
|
||||
Log.warning(String.format(CONFIG_BACKUP_AND_RESET, filename, errFileName));
|
||||
Log.w(CONFIG_BACKUP_AND_RESET, filename, errFileName);
|
||||
} catch (IOException | IllegalArgumentException e) {
|
||||
throw new IllegalArgumentException(e);
|
||||
}
|
||||
} else {
|
||||
Log.warning(String.format(CONFIG_NOT_FOUND_IN_JAR, file != null ? file.getName() : ""));
|
||||
Log.w(CONFIG_NOT_FOUND_IN_JAR, file != null ? file.getName() : "");
|
||||
}
|
||||
}
|
||||
|
||||
@ -435,9 +435,9 @@ public class FileConfig extends AbstractConfig {
|
||||
String newCfgName = this.getBakName(filename);
|
||||
File newcfg = new File(file.getParent(), newCfgName);
|
||||
oldcfg.save(newcfg);
|
||||
Log.warning(String.format(CONFIG_BACKUP, filename, newCfgName));
|
||||
Log.w(CONFIG_BACKUP, filename, newCfgName);
|
||||
} catch (IOException e) {
|
||||
Log.warning(String.format(CONFIG_BACKUP_ERROR, filename, e.getMessage()));
|
||||
Log.w(CONFIG_BACKUP_ERROR, filename, e.getMessage());
|
||||
Log.d(oldcfg.getConfigName(), e);
|
||||
}
|
||||
}
|
||||
@ -469,7 +469,7 @@ public class FileConfig extends AbstractConfig {
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
Log.warning(String.format(CONFIG_CREATE_ERROR, filename));
|
||||
Log.w(CONFIG_CREATE_ERROR, filename);
|
||||
}
|
||||
}
|
||||
|
||||
@ -543,12 +543,12 @@ public class FileConfig extends AbstractConfig {
|
||||
this.load(new InputStreamReader(stream, UTF_8));
|
||||
} catch (InvalidConfigurationException | IllegalArgumentException ex) {
|
||||
if (file == null) { throw new IllegalArgumentException(ex); }
|
||||
Log.warning(String.format(CONFIG_FORMAT_ERROR, file.getName()));
|
||||
Log.warning(ex.getMessage());
|
||||
Log.w(CONFIG_FORMAT_ERROR, file.getName());
|
||||
Log.w(ex.getMessage());
|
||||
saveFromJar();
|
||||
} catch (IOException ex) {
|
||||
if (file == null) { throw new IllegalStateException(ex); }
|
||||
Log.warning(String.format(CONFIG_READ_ERROR, file.getName()));
|
||||
Log.w(CONFIG_READ_ERROR, file.getName());
|
||||
}
|
||||
return this;
|
||||
}
|
||||
@ -595,12 +595,12 @@ public class FileConfig extends AbstractConfig {
|
||||
String newver = newCfg.getString(VERSION);
|
||||
String oldver = oldCfg.getString(VERSION);
|
||||
Set<String> oldConfigKeys = oldCfg.getKeys(true);
|
||||
Log.warning(String.format(CONFIG_UPDATE_WARN, filename, oldver, newver));
|
||||
Log.w(CONFIG_UPDATE_WARN, filename, oldver, newver);
|
||||
// 保留版本字段 不更新
|
||||
oldConfigKeys.remove(VERSION);
|
||||
// 强制更新 去除新版本存在的字段
|
||||
if (force) {
|
||||
Log.warning(String.format(CONFIG_OVERRIDE, filename));
|
||||
Log.w(CONFIG_OVERRIDE, filename);
|
||||
oldConfigKeys.removeAll(newCfg.getKeys(true));
|
||||
}
|
||||
// 复制旧的数据
|
||||
@ -616,7 +616,7 @@ public class FileConfig extends AbstractConfig {
|
||||
newCfg.set(string, var);
|
||||
}
|
||||
}
|
||||
Log.info(String.format(CONFIG_UPDATED, filename, newver));
|
||||
Log.i(CONFIG_UPDATED, filename, newver);
|
||||
return newCfg;
|
||||
}
|
||||
}
|
||||
|
@ -1,12 +1,13 @@
|
||||
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;
|
||||
|
||||
import org.bukkit.command.CommandSender;
|
||||
|
||||
import pw.yumc.YumCore.bukkit.Log;
|
||||
import pw.yumc.YumCore.config.ext.YumConfig;
|
||||
|
||||
/**
|
||||
* 国际化工具类
|
||||
* Created by 喵♂呜 on 2016/10/14 0014.
|
||||
@ -17,7 +18,7 @@ public class I18N {
|
||||
|
||||
static {
|
||||
content = new HashMap<>();
|
||||
Log.info("Async init I18N tool ...");
|
||||
Log.i("Async init I18N tool ...");
|
||||
load();
|
||||
}
|
||||
|
||||
@ -64,9 +65,9 @@ public class I18N {
|
||||
if (remote != null) {
|
||||
content.putAll(remote);
|
||||
}
|
||||
Log.info("本地化工具初始化完毕...");
|
||||
Log.i("本地化工具初始化完毕...");
|
||||
} catch (Exception e) {
|
||||
Log.warning(String.format("本地化工具初始化失败: %s %s", e.getClass().getName(), e.getMessage()));
|
||||
Log.w("本地化工具初始化失败: %s %s", e.getClass().getName(), e.getMessage());
|
||||
Log.d(LANG, e);
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ public class L10N {
|
||||
|
||||
static {
|
||||
content = new HashMap<>();
|
||||
Log.info("异步初始化本地化工具...");
|
||||
Log.i("异步初始化本地化工具...");
|
||||
load();
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ public class L10N {
|
||||
* 重载LocalUtil
|
||||
*/
|
||||
public static void reload() {
|
||||
Log.info("异步重载本地化工具...");
|
||||
Log.i("异步重载本地化工具...");
|
||||
content.clear();
|
||||
load();
|
||||
}
|
||||
@ -116,23 +116,22 @@ public class L10N {
|
||||
*/
|
||||
private static void load() {
|
||||
new Thread(new Runnable() {
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Map<String, String> local = YumConfig.getLocal(CONFIG_NAME).getContentMap();
|
||||
if (local != null) {
|
||||
Log.info("本地汉化文件词条数量: " + local.size());
|
||||
Log.i("本地汉化文件词条数量: " + local.size());
|
||||
content.putAll(local);
|
||||
}
|
||||
Map<String, String> remote = YumConfig.getRemote(CONFIG_NAME).getContentMap();
|
||||
if (remote != null) {
|
||||
Log.info("远程汉化文件词条数量: " + remote.size());
|
||||
Log.i("远程汉化文件词条数量: " + remote.size());
|
||||
content.putAll(remote);
|
||||
}
|
||||
Log.info("本地化工具初始化完毕...");
|
||||
Log.i("本地化工具初始化完毕...");
|
||||
} catch (Exception e) {
|
||||
Log.warning(String.format("本地化工具初始化失败: %s %s", e.getClass().getName(), e.getMessage()));
|
||||
Log.w("本地化工具初始化失败: %s %s", e.getClass().getName(), e.getMessage());
|
||||
Log.d(CONFIG_NAME, e);
|
||||
}
|
||||
}
|
||||
|
@ -33,7 +33,7 @@ public class PKit {
|
||||
* 关闭提示
|
||||
*/
|
||||
public static void disable(String msg) {
|
||||
Log.warning(msg);
|
||||
Log.w(msg);
|
||||
disable();
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ public class VaultChat extends VaultBase {
|
||||
if (rsp == null || (chat = rsp.getProvider()) == null) {
|
||||
PKit.disable("已加载 Vault 但是未找到聊天相关插件 停止加载...");
|
||||
} else {
|
||||
Log.info("发现 Vault 使用聊天管理系统 " + chat.getName());
|
||||
Log.i("发现 Vault 使用聊天管理系统 " + chat.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
package pw.yumc.YumCore.plugin.vault;
|
||||
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.economy.EconomyResponse;
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.OfflinePlayer;
|
||||
import org.bukkit.plugin.RegisteredServiceProvider;
|
||||
|
||||
import net.milkbowl.vault.economy.Economy;
|
||||
import net.milkbowl.vault.economy.EconomyResponse;
|
||||
import pw.yumc.YumCore.bukkit.Log;
|
||||
import pw.yumc.YumCore.kit.PKit;
|
||||
|
||||
@ -22,7 +23,7 @@ public class VaultEconomy extends VaultBase {
|
||||
if (rsp == null || (economy = rsp.getProvider()) == null) {
|
||||
PKit.disable("已加载 Vault 但是未找到经济相关插件 停止加载...");
|
||||
} else {
|
||||
Log.info("发现 Vault 使用经济管理系统 " + economy.getName());
|
||||
Log.i("发现 Vault 使用经济管理系统 " + economy.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ public class VaultPermission extends VaultBase {
|
||||
if (rsp == null || (permission = rsp.getProvider()) == null) {
|
||||
PKit.disable("已加载 Vault 但是未找到权限相关插件 停止加载...");
|
||||
} else {
|
||||
Log.info("发现 Vault 使用权限管理系统 " + permission.getName());
|
||||
Log.i("发现 Vault 使用权限管理系统 " + permission.getName());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -82,7 +82,7 @@ public class DataBase {
|
||||
try {
|
||||
String src = this.dataBaseCore.getConnection().getMetaData().getURL();
|
||||
String des = db.getConnection().getMetaData().getURL();
|
||||
Log.info("开始从源 " + src + " 复制数据到 " + des + " ...");
|
||||
Log.i("开始从源 " + src + " 复制数据到 " + des + " ...");
|
||||
ResultSet rs = this.dataBaseCore.getConnection().getMetaData().getTables(null, null, "%", null);
|
||||
List<String> tables = new LinkedList<>();
|
||||
while (rs.next()) {
|
||||
@ -93,11 +93,11 @@ public class DataBase {
|
||||
int s = 0;
|
||||
long start = System.currentTimeMillis();
|
||||
for (String table : tables) {
|
||||
Log.info("开始复制源数据库中的表 " + table + " ...");
|
||||
Log.i("开始复制源数据库中的表 " + table + " ...");
|
||||
if (table.toLowerCase().startsWith("sqlite_autoindex_")) {
|
||||
continue;
|
||||
}
|
||||
Log.info("清空目标数据库中的表 " + table + " ...");
|
||||
Log.i("清空目标数据库中的表 " + table + " ...");
|
||||
db.execute("DELETE FROM " + table);
|
||||
rs = this.dataBaseCore.query("SELECT * FROM " + table);
|
||||
int n = 0;
|
||||
@ -487,7 +487,7 @@ public class DataBase {
|
||||
}
|
||||
|
||||
private void info(String info) {
|
||||
Log.info(info);
|
||||
Log.i(info);
|
||||
}
|
||||
|
||||
public static class DataBaseParse implements Parse<DataBase> {
|
||||
|
@ -144,7 +144,7 @@ public abstract class DataBaseCore {
|
||||
* 警告消息
|
||||
*/
|
||||
public void warn(String warn) {
|
||||
Log.warning(warn);
|
||||
Log.w(warn);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user