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