From 854ba613b531e4214c8b5ceb27f60130a0fdfed0 Mon Sep 17 00:00:00 2001 From: NorbiPeti Date: Fri, 14 Oct 2016 22:44:42 +0200 Subject: [PATCH] Made plugin updating async --- .../chat/commands/ucmds/admin/UpdatePlugin.java | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/src/main/java/buttondevteam/chat/commands/ucmds/admin/UpdatePlugin.java b/src/main/java/buttondevteam/chat/commands/ucmds/admin/UpdatePlugin.java index b44edf4..d52b26a 100644 --- a/src/main/java/buttondevteam/chat/commands/ucmds/admin/UpdatePlugin.java +++ b/src/main/java/buttondevteam/chat/commands/ucmds/admin/UpdatePlugin.java @@ -1,7 +1,9 @@ package buttondevteam.chat.commands.ucmds.admin; +import org.bukkit.Bukkit; import org.bukkit.command.CommandSender; import buttondevteam.bucket.core.TBMCCoreAPI; +import buttondevteam.chat.PluginMain; public class UpdatePlugin extends AdminCommandBase { @@ -27,12 +29,13 @@ public class UpdatePlugin extends AdminCommandBase { return true; } else { sender.sendMessage("Updating plugin..."); - String ret = ""; - if ((ret = TBMCCoreAPI.UpdatePlugin(args[0])).length() > 0) { - sender.sendMessage(ret); - return true; - } - sender.sendMessage("Updating done!"); + Bukkit.getScheduler().runTaskAsynchronously(PluginMain.Instance, () -> { + String ret = ""; + if ((ret = TBMCCoreAPI.UpdatePlugin(args[0])).length() > 0) { + sender.sendMessage(ret); + } else + sender.sendMessage("Updating done!"); + }); return true; } }