From c310706d338e76c6924e9a6975f4349ade73a5ba Mon Sep 17 00:00:00 2001 From: 502647092 Date: Tue, 1 Sep 2015 08:53:12 +0800 Subject: [PATCH] fix null error add unload info... --- src/main/java/cn/citycraft/Yum/config/FileConfig.java | 4 ++++ .../java/cn/citycraft/Yum/manager/PluginsManager.java | 8 ++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/cn/citycraft/Yum/config/FileConfig.java b/src/main/java/cn/citycraft/Yum/config/FileConfig.java index 21e2c04..0aceb18 100644 --- a/src/main/java/cn/citycraft/Yum/config/FileConfig.java +++ b/src/main/java/cn/citycraft/Yum/config/FileConfig.java @@ -73,6 +73,7 @@ public class FileConfig extends YamlConfiguration { private void check(File file) { String filename = file.getName(); InputStream stream = plugin.getResource(filename); + try { if (!file.exists()) { file.getParentFile().mkdirs(); @@ -84,6 +85,9 @@ public class FileConfig extends YamlConfiguration { loger.info("配置文件 " + filename + " 不存在 从插件释放..."); } } else { + if (stream == null) { + return; + } FileConfig newcfg = new FileConfig(stream); FileConfig oldcfg = new FileConfig(file); String newver = newcfg.getString("version"); diff --git a/src/main/java/cn/citycraft/Yum/manager/PluginsManager.java b/src/main/java/cn/citycraft/Yum/manager/PluginsManager.java index f01ce10..edaaf06 100644 --- a/src/main/java/cn/citycraft/Yum/manager/PluginsManager.java +++ b/src/main/java/cn/citycraft/Yum/manager/PluginsManager.java @@ -454,7 +454,7 @@ public class PluginsManager { if (command.getPlugin() == next) { command.unregister(commandMap); it.remove(); - sender.sendMessage("§6卸载: §a插件: " + name + " 的命令!"); + sender.sendMessage("§6卸载: §a插件 " + name + " 的 " + command.getDescription() + " 命令已卸载!"); } } } @@ -467,7 +467,7 @@ public class PluginsManager { RegisteredListener value = it.next(); if (value.getPlugin().getName().equals(name)) { it.remove(); - sender.sendMessage("§6卸载: §a插件: " + name + " 的监听器!"); + sender.sendMessage("§6卸载: §a插件 " + name + " 的 " + value.getListener().getClass() + " 监听器已卸载!"); } } } @@ -476,11 +476,11 @@ public class PluginsManager { if ((cl instanceof URLClassLoader)) { try { ((URLClassLoader) cl).close(); - sender.sendMessage("§6卸载: §a插件: " + name + " 的类加载器!"); + sender.sendMessage("§6卸载: §a插件 " + name + " 类加载器已卸载!"); } catch (IOException ex) { } } - sender.sendMessage("§6卸载: §a插件: " + name + " 已成功卸载!"); + sender.sendMessage("§6卸载: §a插件 " + name + " 已成功卸载!"); return true; }