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