mirror of
https://e.coding.net/circlecloud/Yum.git
synced 2024-11-22 14:28:46 +00:00
add unload load message...
Signed-off-by: j502647092 <jtb1@163.com>
This commit is contained in:
parent
74b2123445
commit
c75864ad9e
@ -69,7 +69,7 @@ public class DownloadManager {
|
||||
in = new BufferedInputStream(url.openStream());
|
||||
if (!file.getParentFile().exists()) {
|
||||
file.getParentFile().mkdirs();
|
||||
sender.sendMessage("§d创建新目录: " + file.getParentFile().getAbsolutePath());
|
||||
sender.sendMessage("§6创建新目录: §d" + file.getParentFile().getAbsolutePath());
|
||||
}
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
@ -88,10 +88,10 @@ public class DownloadManager {
|
||||
sender.sendMessage(String.format("§6已下载: §a" + getPer(percent / 10) + " %s%%", percent));
|
||||
}
|
||||
}
|
||||
sender.sendMessage("§a文件: " + file.getName() + " 下载完成!");
|
||||
sender.sendMessage("§6文件: §a" + file.getName() + " 下载完成!");
|
||||
return true;
|
||||
} catch (Exception ex) {
|
||||
sender.sendMessage("§c文件" + file.getName() + "下载失败!");
|
||||
sender.sendMessage("§6文件: §c" + file.getName() + "下载失败!");
|
||||
ex.printStackTrace();
|
||||
return false;
|
||||
} finally {
|
||||
|
@ -173,12 +173,14 @@ public class PluginsManager {
|
||||
}
|
||||
File file = new File("plugins/YumCenter", filename + ".jar");
|
||||
if (!file.exists()) {
|
||||
sender.sendMessage("§c仓库不存在该插件!");
|
||||
sender.sendMessage("§4错误: §c仓库不存在 " + filename + " 插件!");
|
||||
return false;
|
||||
}
|
||||
File pluginfile = new File("plugins", filename + ".jar");
|
||||
copyFile(file, pluginfile);
|
||||
load(sender, filename + ".jar");
|
||||
if (load(sender, filename + ".jar")) {
|
||||
sender.sendMessage("§6安装: §a从Yum仓库安装插件 " + filename + " 成功!");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -234,15 +236,14 @@ public class PluginsManager {
|
||||
sender.sendMessage("§c异常: " + e.getMessage() + " 文件: " + name + " 不是一个可载入的插件!");
|
||||
return false;
|
||||
} catch (UnknownDependencyException e) {
|
||||
sender.sendMessage("§c异常: " + e.getMessage() + " 插件: " + name + " 缺少部分依赖!");
|
||||
sender.sendMessage("§c异常: " + e.getMessage() + " 插件: " + name + " 缺少部分依赖项目!");
|
||||
return false;
|
||||
}
|
||||
|
||||
target.onLoad();
|
||||
Bukkit.getPluginManager().enablePlugin(target);
|
||||
|
||||
sender.sendMessage("§6载入: 插件 " + name + " 已成功载入到服务器!");
|
||||
return true;
|
||||
// "§a插件: " + name + " 已成功载入到服务器!";
|
||||
}
|
||||
|
||||
public static boolean load(Plugin plugin) {
|
||||
@ -306,12 +307,9 @@ public class PluginsManager {
|
||||
Field knownCommandsField = SimpleCommandMap.class.getDeclaredField("knownCommands");
|
||||
knownCommandsField.setAccessible(true);
|
||||
commands = (Map<String, Command>) knownCommandsField.get(commandMap);
|
||||
} catch (NoSuchFieldException e) {
|
||||
} catch (Exception e) {
|
||||
sender.sendMessage("§c异常: " + e.getMessage() + " 插件 " + name + " 卸载失败!");
|
||||
return false;
|
||||
// "§c异常: " + e.getMessage() + " 插件 " + name + " 卸载失败!";
|
||||
} catch (IllegalAccessException e) {
|
||||
return false;
|
||||
// "§c异常: " + e.getMessage() + " 插件 " + name + " 卸载失败!";
|
||||
}
|
||||
}
|
||||
pluginManager.disablePlugin(plugin);
|
||||
@ -351,8 +349,8 @@ public class PluginsManager {
|
||||
}
|
||||
}
|
||||
System.gc();
|
||||
sender.sendMessage("§6卸载: §a插件: " + name + " 已成功卸载!");
|
||||
return true;
|
||||
// "§a插件: " + name + " 已成功卸载!";
|
||||
}
|
||||
|
||||
public static boolean unload(Plugin plugin) {
|
||||
|
Loading…
Reference in New Issue
Block a user