From acf587b02287a818f821cd5bef2d17a53b5c9495 Mon Sep 17 00:00:00 2001 From: 502647092 Date: Tue, 22 Sep 2015 20:32:17 +0800 Subject: [PATCH] clean up manager... Signed-off-by: 502647092 --- .../cn/citycraft/Yum/manager/PluginsManager.java | 1 - .../citycraft/Yum/manager/RepositoryManager.java | 14 +++++++------- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/main/java/cn/citycraft/Yum/manager/PluginsManager.java b/src/main/java/cn/citycraft/Yum/manager/PluginsManager.java index 626fe63..7fa9d14 100644 --- a/src/main/java/cn/citycraft/Yum/manager/PluginsManager.java +++ b/src/main/java/cn/citycraft/Yum/manager/PluginsManager.java @@ -527,7 +527,6 @@ public class PluginsManager { } catch (InvalidDescriptionException e) { sender.sendMessage("§4异常: §c" + e.getMessage()); sender.sendMessage("§4文件: §c" + file.getName() + " 的plugin.yml文件存在错误!"); - continue; } } sender.sendMessage("§6升级: §a所有插件升级完毕!"); diff --git a/src/main/java/cn/citycraft/Yum/manager/RepositoryManager.java b/src/main/java/cn/citycraft/Yum/manager/RepositoryManager.java index a05c9cd..07d45ef 100644 --- a/src/main/java/cn/citycraft/Yum/manager/RepositoryManager.java +++ b/src/main/java/cn/citycraft/Yum/manager/RepositoryManager.java @@ -46,7 +46,7 @@ public class RepositoryManager { public boolean addPackage(CommandSender sender, String urlstring) { String json = getHtml(urlstring); - if (json == "") + if (json.isEmpty()) return false; PackageInfo pkg = jsonToPackage(json); if (pkg == null) @@ -56,7 +56,7 @@ public class RepositoryManager { } public boolean addRepositories(CommandSender sender, String urlstring) { - if (urlstring == null || urlstring.isEmpty()) + if (urlstring.isEmpty()) return false; repos.add(urlstring); return updateRepositories(sender, urlstring); @@ -131,10 +131,10 @@ public class RepositoryManager { String repocache = config.getString("repocache"); String plugincache = config.getString("plugincache"); try { - if (repocache != null && repocache != "") + if (!repocache.isEmpty()) repos = gson.fromJson(repocache, new TypeToken>() { }.getType()); - if (plugincache != null && plugincache != "") + if (!plugincache.isEmpty()) plugins = gson.fromJson(plugincache, new TypeToken>() { }.getType()); return true; @@ -156,7 +156,7 @@ public class RepositoryManager { return gson.fromJson(json, new TypeToken>() { }.getType()); } catch (JsonSyntaxException e) { - return null; + return new ArrayList(); } } @@ -187,10 +187,10 @@ public class RepositoryManager { if (!urlstring.endsWith("repo.info")) urlstring = urlstring + "/repo.info"; String json = getHtml(urlstring); - if (json == "") + if (json.isEmpty()) return false; List lrepo = jsonToRepositories(json); - if (lrepo == null) + if (lrepo.isEmpty()) return false; for (Repository repository : lrepo) addPackage(sender, repository.url);