fix: 修复部分BUG

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2016-08-03 19:09:48 +08:00
parent 632ee1f20c
commit 6435f2a185
5 changed files with 15 additions and 3 deletions

View File

@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
<groupId>pw.yumc</groupId> <groupId>pw.yumc</groupId>
<artifactId>Yum</artifactId> <artifactId>Yum</artifactId>
<version>2.7.3</version> <version>2.7.5</version>
<name>Yum</name> <name>Yum</name>
<description>Minecraft 服务器插件管理系统</description> <description>Minecraft 服务器插件管理系统</description>
<build> <build>
@ -66,9 +66,10 @@
<update.description>§a全新 2.X 版本 更多守护与优化</update.description> <update.description>§a全新 2.X 版本 更多守护与优化</update.description>
<update.changes> <update.changes>
§c注意 §6- §aYum更新需要§d重启服务器!§c重启服务器!§4重启服务器!; §c注意 §6- §aYum更新需要§d重启服务器!§c重启服务器!§4重启服务器!;
§b2.7.5 §6- §c修复§eBukkitDev§e下载为空时的异常...;
§b2.7.4 §6- §e异步记录服务器报错与耗时操作 §a性能优化...;
§b2.7.3 §6- §a调整lag判断条件 减少高峰期误报...; §b2.7.3 §6- §a调整lag判断条件 减少高峰期误报...;
§b2.7.2 §6- §c修复mi lag命令参数错误报错 §d百分比显示能耗...; §b2.7.2 §6- §c修复mi lag命令参数错误报错 §d百分比显示能耗...;
§b2.7.1 §6- §c修复部分BUG(load可直接载入文件)...;
</update.changes> </update.changes>
<env.GIT_COMMIT>DEBUG</env.GIT_COMMIT> <env.GIT_COMMIT>DEBUG</env.GIT_COMMIT>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

View File

@ -27,6 +27,7 @@ import pw.yumc.Yum.managers.ConfigManager;
import pw.yumc.Yum.managers.MonitorManager; import pw.yumc.Yum.managers.MonitorManager;
import pw.yumc.Yum.managers.NetworkManager; import pw.yumc.Yum.managers.NetworkManager;
import pw.yumc.Yum.runnables.MainThreadCheckTask; import pw.yumc.Yum.runnables.MainThreadCheckTask;
import pw.yumc.YumCore.update.SubscribeTask;
/** /**
* MC插件仓库 * MC插件仓库
@ -63,6 +64,7 @@ public class Yum extends JavaPlugin {
initRunnable(); initRunnable();
MonitorManager.init(); MonitorManager.init();
new VersionChecker(this); new VersionChecker(this);
new SubscribeTask();
YumAPI.updateRepo(Bukkit.getConsoleSender()); YumAPI.updateRepo(Bukkit.getConsoleSender());
YumAPI.updateCheck(Bukkit.getConsoleSender()); YumAPI.updateCheck(Bukkit.getConsoleSender());
} }

View File

@ -227,7 +227,7 @@ public class YumAPI {
*/ */
public static void uninject(final Plugin plugin) { public static void uninject(final Plugin plugin) {
CommandInjector.uninject(plugin); CommandInjector.uninject(plugin);
// ListenerInjector.uninject(plugin); ListenerInjector.uninject(plugin);
TaskInjector.uninject(plugin); TaskInjector.uninject(plugin);
} }

View File

@ -130,6 +130,7 @@ public class YumCommand implements Listener, CommandExecutor {
}); });
break; break;
} }
case "i":
case "install": { case "install": {
sender.sendMessage(String.format(fsearching, id)); sender.sendMessage(String.format(fsearching, id));
final List<Files> lf = Files.parseList(IOUtil.getData(String.format(BukkitDev.PLUGIN, id))); final List<Files> lf = Files.parseList(IOUtil.getData(String.format(BukkitDev.PLUGIN, id)));

View File

@ -9,6 +9,8 @@ import org.json.simple.JSONArray;
import org.json.simple.JSONObject; import org.json.simple.JSONObject;
import org.json.simple.JSONValue; import org.json.simple.JSONValue;
import cn.citycraft.PluginHelper.kit.StrKit;
public class BukkitDev implements Serializable { public class BukkitDev implements Serializable {
public static String HOST = "https://api.curseforge.com"; public static String HOST = "https://api.curseforge.com";
public static String MODULE = "/servermods"; public static String MODULE = "/servermods";
@ -37,6 +39,9 @@ public class BukkitDev implements Serializable {
} }
public static List<Files> parseList(final String json) { public static List<Files> parseList(final String json) {
if (StrKit.isBlank(json) || json.equals("[]")) {
return Collections.emptyList();
}
final List<Files> temp = new ArrayList<>(); final List<Files> temp = new ArrayList<>();
final JSONArray ja = (JSONArray) JSONValue.parse(json); final JSONArray ja = (JSONArray) JSONValue.parse(json);
for (int i = 0; i < ja.size(); i++) { for (int i = 0; i < ja.size(); i++) {
@ -61,6 +66,9 @@ public class BukkitDev implements Serializable {
} }
public static List<Projects> parseList(final String json) { public static List<Projects> parseList(final String json) {
if (StrKit.isBlank(json) || json.equals("[]")) {
return Collections.emptyList();
}
final List<Projects> temp = new ArrayList<>(); final List<Projects> temp = new ArrayList<>();
final JSONArray ja = (JSONArray) JSONValue.parse(json); final JSONArray ja = (JSONArray) JSONValue.parse(json);
for (int i = 0; i < ja.size(); i++) { for (int i = 0; i < ja.size(); i++) {