From 56058007b57fe8b61f040a80233961d63a2860b5 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Sun, 29 Nov 2015 17:48:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8D=87=E7=BA=A7=E5=AE=8C=E6=88=90=E4=BB=A5?= =?UTF-8?q?=E5=90=8E=E5=88=A0=E9=99=A4=E6=8F=92=E4=BB=B6...?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 502647092 --- .../citycraft/Yum/manager/PluginsManager.java | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/main/java/cn/citycraft/Yum/manager/PluginsManager.java b/src/main/java/cn/citycraft/Yum/manager/PluginsManager.java index f9a129c..344139c 100644 --- a/src/main/java/cn/citycraft/Yum/manager/PluginsManager.java +++ b/src/main/java/cn/citycraft/Yum/manager/PluginsManager.java @@ -24,6 +24,7 @@ import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.PluginLoader; import org.bukkit.plugin.PluginManager; import org.bukkit.plugin.UnknownDependencyException; +import org.bukkit.util.FileUtil; import com.google.common.base.Joiner; @@ -523,8 +524,12 @@ public class PluginsManager { System.gc(); } } - sender.sendMessage("§6卸载: §a插件 §b" + name + " §a版本 §d" + pluginVersion + " §a已成功卸载!"); - return true; + if (!pluginVersion.isEmpty()) { + sender.sendMessage("§6卸载: §a插件 §b" + name + " §a版本 §d" + pluginVersion + " §a已成功卸载!"); + return true; + } else { + return false; + } } /** @@ -582,11 +587,17 @@ public class PluginsManager { } result = true; sender.sendMessage("§6升级: §a开始升级 " + name + " 插件!"); - reload(sender, name); + if (!unload(plugin)) { + FileUtil.copy(file, new File(Bukkit.getUpdateFolderFile().getParentFile(), File.separatorChar + file.getName())); + } + load(name); } catch (final InvalidDescriptionException e) { sender.sendMessage("§4异常: §c" + e.getMessage()); sender.sendMessage("§4文件: §c" + file.getName() + " 的plugin.yml文件存在错误!"); } + if (file.exists()) { + file.delete(); + } } sender.sendMessage("§6升级: §a所有插件升级完毕!"); return result;