From d42f635dfc824ce7b4f255202632dcb77227512a Mon Sep 17 00:00:00 2001 From: j502647092 Date: Mon, 7 Sep 2015 00:05:13 +0800 Subject: [PATCH] fix upgrade command... --- .../Yum/commands/CommandUpgrade.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main/java/cn/citycraft/Yum/commands/CommandUpgrade.java b/src/main/java/cn/citycraft/Yum/commands/CommandUpgrade.java index fd32f25..1aabf08 100644 --- a/src/main/java/cn/citycraft/Yum/commands/CommandUpgrade.java +++ b/src/main/java/cn/citycraft/Yum/commands/CommandUpgrade.java @@ -27,18 +27,19 @@ public class CommandUpgrade extends BaseCommand { @Override public void execute(final CommandSender sender, String label, final String[] args) throws CommandException { - final String pluginname = args[0]; - final Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin(pluginname); - sender.sendMessage("§a开始升级插件: " + pluginname); - if (plugin != null) - Bukkit.getScheduler().runTaskAsynchronously(main, () -> { - if (args.length == 1) + Bukkit.getScheduler().runTaskAsynchronously(main, () -> { + if (args.length == 0) + YumManager.plugman.upgrade(sender); + else { + String pluginname = args[0]; + Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin(pluginname); + sender.sendMessage("§a开始升级插件: " + pluginname); + if (plugin != null) YumManager.plugman.upgrade(sender, plugin); else - YumManager.plugman.upgrade(sender); - }); - else - sender.sendMessage("§c插件未安装或已卸载 需要安装请使用yum install " + pluginname + "!"); + sender.sendMessage("§c插件未安装或已卸载 需要安装请使用yum install " + pluginname + "!"); + } + }); }; @Override