修改部分方案 增强稳定性...

Signed-off-by: 502647092 <jtb1@163.com>
This commit is contained in:
502647092 2015-11-29 15:20:34 +08:00
parent 78a73e3e40
commit c28bf9742a
3 changed files with 11 additions and 13 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>cn.citycraft</groupId> <groupId>cn.citycraft</groupId>
<artifactId>Yum</artifactId> <artifactId>Yum</artifactId>
<version>1.8.6</version> <version>1.8.7</version>
<name>Yum</name> <name>Yum</name>
<description>Minecraft 服务器插件管理系统</description> <description>Minecraft 服务器插件管理系统</description>
<build> <build>
@ -55,7 +55,7 @@
</build> </build>
<properties> <properties>
<jenkins.url>http://ci.citycraft.cn:8080</jenkins.url> <jenkins.url>http://ci.citycraft.cn:8080</jenkins.url>
<update.description>&amp;c新增只允许控制台执行选项...</update.description> <update.description>&amp;c修改部分方案 增强稳定性...</update.description>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties> </properties>
<repositories> <repositories>

View File

@ -21,9 +21,6 @@ import cn.citycraft.Yum.api.YumAPI;
public class CommandDelete extends BaseCommand { public class CommandDelete extends BaseCommand {
Yum main; Yum main;
/**
* @param name
*/
public CommandDelete(final Yum main) { public CommandDelete(final Yum main) {
super("remove"); super("remove");
this.main = main; this.main = main;
@ -37,8 +34,9 @@ public class CommandDelete extends BaseCommand {
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);
if (plugin != null) { if (plugin != null) {
final String version = plugin.getDescription().getVersion();
if (YumAPI.getPlugman().deletePlugin(sender, plugin)) { if (YumAPI.getPlugman().deletePlugin(sender, plugin)) {
sender.sendMessage("§c删除: §a插件 " + pluginname + " 已从服务器卸载并删除!"); sender.sendMessage("§c删除: §a插件 §6" + pluginname + " §a版本 §d" + version + " §a已从服务器卸载并删除!");
} else { } else {
sender.sendMessage("§c删除: §c插件 " + pluginname + " 卸载或删除时发生错误 删除失败!"); sender.sendMessage("§c删除: §c插件 " + pluginname + " 卸载或删除时发生错误 删除失败!");
} }

View File

@ -292,7 +292,7 @@ public class PluginsManager {
target.onLoad(); target.onLoad();
Bukkit.getPluginManager().enablePlugin(target); Bukkit.getPluginManager().enablePlugin(target);
sender.sendMessage("§6载入: §a插件 §b" + target.getName() + " §a版本 §d" + target.getDescription().getVersion() + " 已成功载入到服务器!"); sender.sendMessage("§6载入: §a插件 §b" + target.getName() + " §a版本 §d" + target.getDescription().getVersion() + " §a已成功载入到服务器!");
return true; return true;
} }
@ -316,7 +316,7 @@ public class PluginsManager {
final File pluginDir = new File("plugins"); final File pluginDir = new File("plugins");
final File updateDir = new File(pluginDir, "update"); final File updateDir = new File(pluginDir, "update");
if (!pluginDir.isDirectory()) { if (!pluginDir.isDirectory()) {
sender.sendMessage("§c插件目录不存在或IO错误!"); sender.sendMessage("§6载入: §c插件目录不存在或IO错误!");
return false; return false;
} }
@ -337,7 +337,7 @@ public class PluginsManager {
} }
} }
if (pluginFile == null) { if (pluginFile == null) {
sender.sendMessage("§6载入: §c在插件目录和更新目录均未找到 " + name + " 插件 请确认文件是否存在!"); sender.sendMessage("§6载入: §c在插件目录和更新目录均未找到 §b" + name + " §c插件 请确认文件是否存在!");
return false; return false;
} }
} }
@ -484,7 +484,7 @@ public class PluginsManager {
knownCommandsField.setAccessible(true); knownCommandsField.setAccessible(true);
knownCommands = (Map<String, Command>) knownCommandsField.get(commandMap); knownCommands = (Map<String, Command>) knownCommandsField.get(commandMap);
} catch (final Exception e) { } catch (final Exception e) {
sender.sendMessage("§4异常: §c" + e.getMessage() + " 插件 " + name + " 卸载失败!"); sender.sendMessage("§4异常: §c" + e.getMessage() + " 插件 §b" + name + " §c卸载失败!");
return false; return false;
} }
String pluginVersion = ""; String pluginVersion = "";
@ -494,12 +494,12 @@ public class PluginsManager {
if ((plugins != null) && (plugins.contains(next))) { if ((plugins != null) && (plugins.contains(next))) {
pluginVersion = next.getDescription().getVersion(); pluginVersion = next.getDescription().getVersion();
plugins.remove(next); plugins.remove(next);
sender.sendMessage("§6卸载: §a从服务器插件列表删除 " + name + " 的实例!"); sender.sendMessage("§6卸载: §a从服务器插件列表删除 §b" + name + " §a的实例!");
} }
if ((lookupNames != null) && (lookupNames.containsKey(name))) { if ((lookupNames != null) && (lookupNames.containsKey(name))) {
lookupNames.remove(name); lookupNames.remove(name);
sender.sendMessage("§6卸载: §a从插件查找列表删除 " + name + " 的实例!"); sender.sendMessage("§6卸载: §a从插件查找列表删除 §b" + name + " §a的实例!");
} }
if (commandMap != null) { if (commandMap != null) {
@ -523,7 +523,7 @@ public class PluginsManager {
System.gc(); System.gc();
} }
} }
sender.sendMessage("§6卸载: §a插件 §b" + name + " §a版本 §d" + pluginVersion + " 已成功卸载!"); sender.sendMessage("§6卸载: §a插件 §b" + name + " §a版本 §d" + pluginVersion + " §a已成功卸载!");
return true; return true;
} }