diff --git a/src/main/java/cn/citycraft/Yum/manager/DownloadManager.java b/src/main/java/cn/citycraft/Yum/manager/DownloadManager.java index 6e687b9..73a48f9 100644 --- a/src/main/java/cn/citycraft/Yum/manager/DownloadManager.java +++ b/src/main/java/cn/citycraft/Yum/manager/DownloadManager.java @@ -141,19 +141,23 @@ public class DownloadManager { byte[] data = new byte[1024]; long downloaded = 0L; int count; + long time = System.currentTimeMillis(); while ((count = in.read(data)) != -1) { downloaded += count; fout.write(data, 0, count); int percent = (int) (downloaded * 100L / fileLength); if (percent % 10 == 0) { - sender.sendMessage(String.format("§6已下载: §a" + getPer(percent / 10) + " %s%%", percent)); + if (fileLength < 102400 || System.currentTimeMillis() - time > 1000) { + sender.sendMessage(String.format("§6已下载: §a" + getPer(percent / 10) + " %s%%", percent)); + time = System.currentTimeMillis(); + } } } sender.sendMessage("§6文件: §a" + file.getName() + " 下载完成!"); return true; } catch (Exception ex) { + sender.sendMessage("§6异常: §c" + ex.getMessage()); sender.sendMessage("§6文件: §c" + file.getName() + "下载失败!"); - ex.printStackTrace(); return false; } finally { try { diff --git a/src/main/java/cn/citycraft/Yum/manager/PluginsManager.java b/src/main/java/cn/citycraft/Yum/manager/PluginsManager.java index 591ccd9..d551deb 100644 --- a/src/main/java/cn/citycraft/Yum/manager/PluginsManager.java +++ b/src/main/java/cn/citycraft/Yum/manager/PluginsManager.java @@ -307,13 +307,20 @@ public class PluginsManager { try { target = Bukkit.getPluginManager().loadPlugin(pluginFile); } catch (InvalidDescriptionException e) { - sender.sendMessage("§4异常: §c" + e.getMessage() + " 插件: " + name + " 的plugin.yml文件存在错误!"); + sender.sendMessage("§4异常: §c" + e.getMessage()); + sender.sendMessage("§c插件: " + name + " 的plugin.yml文件存在错误!"); + return false; + } catch (UnsupportedClassVersionError e) { + sender.sendMessage("§4异常: §c" + e.getMessage()); + sender.sendMessage("§c服务器或JAVA的版本低于插件: " + name + " 所需要的版本!!"); return false; } catch (InvalidPluginException e) { - sender.sendMessage("§4异常: §c" + e.getMessage() + " 文件: " + name + " 不是一个可载入的插件!"); + sender.sendMessage("§4异常: §c" + e.getMessage()); + sender.sendMessage("§c文件: " + name + " 不是一个可载入的插件!"); return false; } catch (UnknownDependencyException e) { - sender.sendMessage("§4异常: §c" + e.getMessage() + " 插件: " + name + " 缺少部分依赖项目!"); + sender.sendMessage("§4异常: §c" + e.getMessage()); + sender.sendMessage("§c插件: " + name + " 缺少部分依赖项目!"); return false; }