mirror of
https://e.coding.net/circlecloud/Yum.git
synced 2024-11-22 14:28:46 +00:00
contorl download info output fix plugin load...
This commit is contained in:
parent
1e209f0d45
commit
04e6faa6be
@ -141,19 +141,23 @@ public class DownloadManager {
|
|||||||
byte[] data = new byte[1024];
|
byte[] data = new byte[1024];
|
||||||
long downloaded = 0L;
|
long downloaded = 0L;
|
||||||
int count;
|
int count;
|
||||||
|
long time = System.currentTimeMillis();
|
||||||
while ((count = in.read(data)) != -1) {
|
while ((count = in.read(data)) != -1) {
|
||||||
downloaded += count;
|
downloaded += count;
|
||||||
fout.write(data, 0, count);
|
fout.write(data, 0, count);
|
||||||
int percent = (int) (downloaded * 100L / fileLength);
|
int percent = (int) (downloaded * 100L / fileLength);
|
||||||
if (percent % 10 == 0) {
|
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() + " 下载完成!");
|
sender.sendMessage("§6文件: §a" + file.getName() + " 下载完成!");
|
||||||
return true;
|
return true;
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
|
sender.sendMessage("§6异常: §c" + ex.getMessage());
|
||||||
sender.sendMessage("§6文件: §c" + file.getName() + "下载失败!");
|
sender.sendMessage("§6文件: §c" + file.getName() + "下载失败!");
|
||||||
ex.printStackTrace();
|
|
||||||
return false;
|
return false;
|
||||||
} finally {
|
} finally {
|
||||||
try {
|
try {
|
||||||
|
@ -307,13 +307,20 @@ public class PluginsManager {
|
|||||||
try {
|
try {
|
||||||
target = Bukkit.getPluginManager().loadPlugin(pluginFile);
|
target = Bukkit.getPluginManager().loadPlugin(pluginFile);
|
||||||
} catch (InvalidDescriptionException e) {
|
} 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;
|
return false;
|
||||||
} catch (InvalidPluginException e) {
|
} catch (InvalidPluginException e) {
|
||||||
sender.sendMessage("§4异常: §c" + e.getMessage() + " 文件: " + name + " 不是一个可载入的插件!");
|
sender.sendMessage("§4异常: §c" + e.getMessage());
|
||||||
|
sender.sendMessage("§c文件: " + name + " 不是一个可载入的插件!");
|
||||||
return false;
|
return false;
|
||||||
} catch (UnknownDependencyException e) {
|
} catch (UnknownDependencyException e) {
|
||||||
sender.sendMessage("§4异常: §c" + e.getMessage() + " 插件: " + name + " 缺少部分依赖项目!");
|
sender.sendMessage("§4异常: §c" + e.getMessage());
|
||||||
|
sender.sendMessage("§c插件: " + name + " 缺少部分依赖项目!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user