使用新的通用更新类 添加载入卸载版本提示...

Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
502647092 2015-11-28 18:07:52 +08:00
parent cb386fd056
commit 78a73e3e40
2 changed files with 12 additions and 10 deletions

View File

@ -223,12 +223,12 @@ public class YumAPI {
* - 命令发送者
*/
public static void updateall(final CommandSender sender) {
final Map<Plugin, String> updatelist = UpdatePlugin.getList();
final Map<String, Plugin> updatelist = UpdatePlugin.getUpdateList();
if (updatelist.size() > 0) {
for (final Entry<Plugin, String> updateplugin : UpdatePlugin.getList().entrySet()) {
updatefromyum(sender, updateplugin.getKey(), null);
for (final Entry<String, Plugin> updateplugin : UpdatePlugin.getUpdateList().entrySet()) {
updatefromyum(sender, updateplugin.getValue(), null);
}
UpdatePlugin.getList().clear();
UpdatePlugin.clearList();
sender.sendMessage("§6更新: §c已下载所有需要插件的插件到 到update文件夹 重启后自动更新(或使用/yum upgrade直接升级)!");
} else {
sender.sendMessage("§6更新: §e未找到需要更新且可以用Yum处理的插件!");

View File

@ -274,7 +274,7 @@ public class PluginsManager {
target = Bukkit.getPluginManager().loadPlugin(pluginFile);
} catch (final InvalidDescriptionException e) {
sender.sendMessage("§4异常: §c" + e.getMessage());
sender.sendMessage("§c插件: " + name + " 的 plugin.yml 文件存在错误!");
sender.sendMessage("§4插件: §c" + name + " 的 plugin.yml 文件存在错误!");
return false;
} catch (final UnsupportedClassVersionError e) {
sender.sendMessage("§4异常: §c" + e.getMessage());
@ -282,17 +282,17 @@ public class PluginsManager {
return false;
} catch (final InvalidPluginException e) {
sender.sendMessage("§4异常: §c" + e.getMessage());
sender.sendMessage("§c文件: " + name + " 不是一个可载入的插件!");
sender.sendMessage("§4文件: §c" + name + " 不是一个可载入的插件!");
return false;
} catch (final UnknownDependencyException e) {
sender.sendMessage("§4异常: §c服务器未安装必须依赖: " + e.getMessage());
sender.sendMessage("§c插件: " + name + " 载入失败 缺少部分依赖项目!");
sender.sendMessage("§4插件: §c" + name + " 载入失败 缺少部分依赖项目!");
return false;
}
target.onLoad();
Bukkit.getPluginManager().enablePlugin(target);
sender.sendMessage("§6载入: §a插件 " + name + " 已成功载入到服务器!");
sender.sendMessage("§6载入: §a插件 §b" + target.getName() + " §a版本 §d" + target.getDescription().getVersion() + " 已成功载入到服务器!");
return true;
}
@ -464,7 +464,7 @@ public class PluginsManager {
Map<String, Plugin> lookupNames = null;
Map<String, Command> knownCommands = null;
if (pluginManager == null) {
sender.sendMessage("§4异常: §c插件管理类为Null!");
sender.sendMessage("§4异常: §c插件管理类反射获取失败!");
return false;
}
try {
@ -487,10 +487,12 @@ public class PluginsManager {
sender.sendMessage("§4异常: §c" + e.getMessage() + " 插件 " + name + " 卸载失败!");
return false;
}
String pluginVersion = "";
for (final Plugin next : pluginManager.getPlugins()) {
if (next.getName().equals(name)) {
pluginManager.disablePlugin(next);
if ((plugins != null) && (plugins.contains(next))) {
pluginVersion = next.getDescription().getVersion();
plugins.remove(next);
sender.sendMessage("§6卸载: §a从服务器插件列表删除 " + name + " 的实例!");
}
@ -521,7 +523,7 @@ public class PluginsManager {
System.gc();
}
}
sender.sendMessage("§6卸载: §a插件 " + name + " 已成功卸载!");
sender.sendMessage("§6卸载: §a插件 §b" + name + " §a版本 §d" + pluginVersion + " 已成功卸载!");
return true;
}