mirror of
https://e.coding.net/circlecloud/Yum.git
synced 2024-11-22 06:18:46 +00:00
插件在upgrade时自动重命名为原有名称...
This commit is contained in:
parent
c996cc43dd
commit
c5edf07ad6
9
pom.xml
9
pom.xml
@ -3,7 +3,7 @@
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>cn.citycraft</groupId>
|
||||
<artifactId>Yum</artifactId>
|
||||
<version>2.0</version>
|
||||
<version>2.0.1</version>
|
||||
<name>Yum</name>
|
||||
<description>Minecraft 服务器插件管理系统</description>
|
||||
<build>
|
||||
@ -56,7 +56,12 @@
|
||||
<properties>
|
||||
<jenkins.url>http://hs.yumc.pw:8080</jenkins.url>
|
||||
<update.description>&a全新 2.0 版本 震撼发布...</update.description>
|
||||
<update.changes>&a精简大量代码...;&a服务器启动后自动检查可更新插件...;&a优化检测流程...</update.changes>
|
||||
<update.changes>
|
||||
&b2.0.1 &6- &c插件在upgrade时自动重命名为原有名称...
|
||||
&b2.0 &6- &a精简大量代码...
|
||||
&a 服务器启动后自动检查可更新插件...
|
||||
&a 优化检测流程...
|
||||
</update.changes>
|
||||
<env.GIT_COMMIT>DEBUG</env.GIT_COMMIT>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
@ -45,14 +45,14 @@ public class PluginsManager {
|
||||
private final Set<String> ignoreList = new HashSet<>();
|
||||
private final Plugin main;
|
||||
|
||||
public static String getVersion(final Plugin plugin) {
|
||||
return StringUtils.substring(plugin.getDescription().getVersion(), 0, 15);
|
||||
}
|
||||
|
||||
public PluginsManager(final Plugin plugin) {
|
||||
this.main = plugin;
|
||||
}
|
||||
|
||||
public static String getVersion(final Plugin plugin) {
|
||||
return StringUtils.substring(plugin.getDescription().getVersion(), 0, 15);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加到忽略列表
|
||||
*
|
||||
@ -655,13 +655,21 @@ public class PluginsManager {
|
||||
if (plugin != null && !name.equals(plugin.getName())) {
|
||||
continue;
|
||||
}
|
||||
final Plugin oldplugin = Bukkit.getPluginManager().getPlugin(name);
|
||||
result = true;
|
||||
File dest = null;
|
||||
if (!unload(sender, name)) {
|
||||
sender.sendMessage("§6升级: §d开始安装 §b" + name + " §d插件!");
|
||||
FileUtil.copyFile(file, new File(Bukkit.getUpdateFolderFile().getParentFile(), File.separatorChar + file.getName()));
|
||||
dest = new File(Bukkit.getUpdateFolderFile().getParentFile(), File.separatorChar + file.getName());
|
||||
} else {
|
||||
if (oldplugin != null) {
|
||||
dest = new File(Bukkit.getUpdateFolderFile(), File.separatorChar + getPluginFile(oldplugin).getName());
|
||||
}
|
||||
sender.sendMessage("§6升级: §a开始升级 §b" + name + " §a插件!");
|
||||
}
|
||||
if (dest != null) {
|
||||
file.renameTo(dest);
|
||||
}
|
||||
load(sender, name);
|
||||
} catch (final InvalidDescriptionException e) {
|
||||
sender.sendMessage("§4异常: §c" + e.getMessage());
|
||||
|
Loading…
Reference in New Issue
Block a user