mirror of
https://e.coding.net/circlecloud/Yum.git
synced 2024-11-22 14:28:46 +00:00
async install plugin and fix install command...
This commit is contained in:
parent
755d49dc3b
commit
d53a27fb40
@ -33,13 +33,18 @@ public class CommandInstall extends BaseCommand {
|
||||
};
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
||||
String pluginname = args[0];
|
||||
public void execute(final CommandSender sender, String label, String[] args) throws CommandException {
|
||||
final String pluginname = args[0];
|
||||
Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin(pluginname);
|
||||
if (plugin != null) {
|
||||
if (yum.download.run(sender, pluginname)) {
|
||||
sender.sendMessage(PluginsManager.load(pluginname));
|
||||
}
|
||||
if (plugin == null) {
|
||||
Bukkit.getScheduler().runTaskAsynchronously(yum, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (yum.download.run(sender, pluginname)) {
|
||||
sender.sendMessage(PluginsManager.load(pluginname));
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
sender.sendMessage("§c插件已安装在服务器 需要更新请使用yum update " + pluginname + "!");
|
||||
}
|
||||
|
@ -31,15 +31,21 @@ public class CommandUpdate extends BaseCommand {
|
||||
};
|
||||
|
||||
@Override
|
||||
public void execute(CommandSender sender, String label, String[] args) throws CommandException {
|
||||
String pluginname = args[0];
|
||||
Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin(pluginname);
|
||||
public void execute(final CommandSender sender, String label, String[] args) throws CommandException {
|
||||
final String pluginname = args[0];
|
||||
final Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin(pluginname);
|
||||
sender.sendMessage("§a开始更新插件: " + pluginname);
|
||||
if (plugin != null) {
|
||||
sender.sendMessage(PluginsManager.unload(plugin));
|
||||
if (yum.download.run(sender, pluginname)) {
|
||||
sender.sendMessage(PluginsManager.load(pluginname));
|
||||
}
|
||||
Bukkit.getScheduler().runTaskAsynchronously(yum, new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
sender.sendMessage(PluginsManager.unload(plugin));
|
||||
PluginsManager.getPluginFile(plugin).delete();
|
||||
if (yum.download.run(sender, pluginname)) {
|
||||
sender.sendMessage(PluginsManager.load(pluginname));
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
sender.sendMessage("§c插件未安装或已卸载 需要安装请使用yum install " + pluginname + "!");
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user