mirror of
https://e.coding.net/circlecloud/Yum.git
synced 2024-11-22 14:28:46 +00:00
使用新的通用更新类 添加载入卸载版本提示...
Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
parent
cb386fd056
commit
78a73e3e40
@ -223,12 +223,12 @@ public class YumAPI {
|
|||||||
* - 命令发送者
|
* - 命令发送者
|
||||||
*/
|
*/
|
||||||
public static void updateall(final CommandSender sender) {
|
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) {
|
if (updatelist.size() > 0) {
|
||||||
for (final Entry<Plugin, String> updateplugin : UpdatePlugin.getList().entrySet()) {
|
for (final Entry<String, Plugin> updateplugin : UpdatePlugin.getUpdateList().entrySet()) {
|
||||||
updatefromyum(sender, updateplugin.getKey(), null);
|
updatefromyum(sender, updateplugin.getValue(), null);
|
||||||
}
|
}
|
||||||
UpdatePlugin.getList().clear();
|
UpdatePlugin.clearList();
|
||||||
sender.sendMessage("§6更新: §c已下载所有需要插件的插件到 到update文件夹 重启后自动更新(或使用/yum upgrade直接升级)!");
|
sender.sendMessage("§6更新: §c已下载所有需要插件的插件到 到update文件夹 重启后自动更新(或使用/yum upgrade直接升级)!");
|
||||||
} else {
|
} else {
|
||||||
sender.sendMessage("§6更新: §e未找到需要更新且可以用Yum处理的插件!");
|
sender.sendMessage("§6更新: §e未找到需要更新且可以用Yum处理的插件!");
|
||||||
|
@ -274,7 +274,7 @@ public class PluginsManager {
|
|||||||
target = Bukkit.getPluginManager().loadPlugin(pluginFile);
|
target = Bukkit.getPluginManager().loadPlugin(pluginFile);
|
||||||
} catch (final InvalidDescriptionException e) {
|
} catch (final InvalidDescriptionException e) {
|
||||||
sender.sendMessage("§4异常: §c" + e.getMessage());
|
sender.sendMessage("§4异常: §c" + e.getMessage());
|
||||||
sender.sendMessage("§c插件: " + name + " 的 plugin.yml 文件存在错误!");
|
sender.sendMessage("§4插件: §c" + name + " 的 plugin.yml 文件存在错误!");
|
||||||
return false;
|
return false;
|
||||||
} catch (final UnsupportedClassVersionError e) {
|
} catch (final UnsupportedClassVersionError e) {
|
||||||
sender.sendMessage("§4异常: §c" + e.getMessage());
|
sender.sendMessage("§4异常: §c" + e.getMessage());
|
||||||
@ -282,17 +282,17 @@ public class PluginsManager {
|
|||||||
return false;
|
return false;
|
||||||
} catch (final InvalidPluginException e) {
|
} catch (final InvalidPluginException e) {
|
||||||
sender.sendMessage("§4异常: §c" + e.getMessage());
|
sender.sendMessage("§4异常: §c" + e.getMessage());
|
||||||
sender.sendMessage("§c文件: " + name + " 不是一个可载入的插件!");
|
sender.sendMessage("§4文件: §c" + name + " 不是一个可载入的插件!");
|
||||||
return false;
|
return false;
|
||||||
} catch (final UnknownDependencyException e) {
|
} catch (final UnknownDependencyException e) {
|
||||||
sender.sendMessage("§4异常: §c服务器未安装必须依赖: " + e.getMessage());
|
sender.sendMessage("§4异常: §c服务器未安装必须依赖: " + e.getMessage());
|
||||||
sender.sendMessage("§c插件: " + name + " 载入失败 缺少部分依赖项目!");
|
sender.sendMessage("§4插件: §c" + name + " 载入失败 缺少部分依赖项目!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
target.onLoad();
|
target.onLoad();
|
||||||
Bukkit.getPluginManager().enablePlugin(target);
|
Bukkit.getPluginManager().enablePlugin(target);
|
||||||
sender.sendMessage("§6载入: §a插件 " + name + " 已成功载入到服务器!");
|
sender.sendMessage("§6载入: §a插件 §b" + target.getName() + " §a版本 §d" + target.getDescription().getVersion() + " 已成功载入到服务器!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -464,7 +464,7 @@ public class PluginsManager {
|
|||||||
Map<String, Plugin> lookupNames = null;
|
Map<String, Plugin> lookupNames = null;
|
||||||
Map<String, Command> knownCommands = null;
|
Map<String, Command> knownCommands = null;
|
||||||
if (pluginManager == null) {
|
if (pluginManager == null) {
|
||||||
sender.sendMessage("§4异常: §c插件管理类为Null!");
|
sender.sendMessage("§4异常: §c插件管理类反射获取失败!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
@ -487,10 +487,12 @@ public class PluginsManager {
|
|||||||
sender.sendMessage("§4异常: §c" + e.getMessage() + " 插件 " + name + " 卸载失败!");
|
sender.sendMessage("§4异常: §c" + e.getMessage() + " 插件 " + name + " 卸载失败!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
String pluginVersion = "";
|
||||||
for (final Plugin next : pluginManager.getPlugins()) {
|
for (final Plugin next : pluginManager.getPlugins()) {
|
||||||
if (next.getName().equals(name)) {
|
if (next.getName().equals(name)) {
|
||||||
pluginManager.disablePlugin(next);
|
pluginManager.disablePlugin(next);
|
||||||
if ((plugins != null) && (plugins.contains(next))) {
|
if ((plugins != null) && (plugins.contains(next))) {
|
||||||
|
pluginVersion = next.getDescription().getVersion();
|
||||||
plugins.remove(next);
|
plugins.remove(next);
|
||||||
sender.sendMessage("§6卸载: §a从服务器插件列表删除 " + name + " 的实例!");
|
sender.sendMessage("§6卸载: §a从服务器插件列表删除 " + name + " 的实例!");
|
||||||
}
|
}
|
||||||
@ -521,7 +523,7 @@ public class PluginsManager {
|
|||||||
System.gc();
|
System.gc();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
sender.sendMessage("§6卸载: §a插件 " + name + " 已成功卸载!");
|
sender.sendMessage("§6卸载: §a插件 §b" + name + " §a版本 §d" + pluginVersion + " 已成功卸载!");
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user