mirror of
https://e.coding.net/circlecloud/Yum.git
synced 2024-11-22 14:28:46 +00:00
add update force version...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
add505cc69
commit
8f8e3b3465
@ -26,7 +26,7 @@ public class CommandUpdate extends BaseCommand {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(final CommandSender sender, String label, String[] args) throws CommandException {
|
public void execute(final CommandSender sender, String label, final String[] args) throws CommandException {
|
||||||
final String pluginname = args[0];
|
final String pluginname = args[0];
|
||||||
final Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin(pluginname);
|
final Plugin plugin = Bukkit.getServer().getPluginManager().getPlugin(pluginname);
|
||||||
sender.sendMessage("§a开始更新插件: " + pluginname);
|
sender.sendMessage("§a开始更新插件: " + pluginname);
|
||||||
@ -35,13 +35,21 @@ public class CommandUpdate extends BaseCommand {
|
|||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
PluginInfo pi = main.repo.getPlugin(pluginname);
|
PluginInfo pi = main.repo.getPlugin(pluginname);
|
||||||
if (pi != null)
|
if (pi != null) {
|
||||||
if (main.download.run(sender, pi.getMavenUrl(), main.plugman.getPluginFile(plugin))) {
|
String fileurl;
|
||||||
|
if (args.length < 2) {
|
||||||
|
fileurl = pi.getMavenUrl();
|
||||||
|
} else {
|
||||||
|
fileurl = pi.getMavenUrl(args[1]);
|
||||||
|
}
|
||||||
|
if (main.download.run(sender, fileurl, main.plugman.getPluginFile(plugin))) {
|
||||||
if (main.plugman.unload(sender, plugin)) {
|
if (main.plugman.unload(sender, plugin)) {
|
||||||
main.plugman.load(sender, pluginname);
|
main.plugman.load(sender, pluginname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage("§c插件未安装或已卸载 需要安装请使用yum install " + pluginname + "!");
|
sender.sendMessage("§c插件未安装或已卸载 需要安装请使用yum install " + pluginname + "!");
|
||||||
@ -55,7 +63,7 @@ public class CommandUpdate extends BaseCommand {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getPossibleArguments() {
|
public String getPossibleArguments() {
|
||||||
return "<插件名称>";
|
return "<插件名称> <插件版本>";
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -16,6 +16,11 @@ public class PluginInfo {
|
|||||||
plugin.artifactId, plugin.version);
|
plugin.artifactId, plugin.version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getMavenUrl(String version) {
|
||||||
|
return String.format(url + (url.endsWith("/") ? "" : "/") + "%1$s/%2$s/%3$s/%2$s-%3$s.jar", plugin.groupId.replace(".", "/"),
|
||||||
|
plugin.artifactId, version);
|
||||||
|
}
|
||||||
|
|
||||||
public String getFileName() {
|
public String getFileName() {
|
||||||
return String.format("%1$s-%2$s.jar", plugin.artifactId, plugin.version);
|
return String.format("%1$s-%2$s.jar", plugin.artifactId, plugin.version);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user