fix: 修复仓库数据读取错误的问题

Signed-off-by: 502647092 <admin@yumc.pw>
This commit is contained in:
502647092 2017-02-03 01:27:01 +08:00
parent 0a0e94a7fe
commit 3c270657f8
5 changed files with 24 additions and 33 deletions

20
pom.xml
View File

@ -3,11 +3,10 @@
<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.8</version> <version>2.7.9</version>
<name>Yum</name>
<description>Minecraft 服务器插件管理系统</description> <description>Minecraft 服务器插件管理系统</description>
<build> <build>
<finalName>${project.name}</finalName> <finalName>${project.artifactId}</finalName>
<resources> <resources>
<resource> <resource>
<directory>src/main/resources</directory> <directory>src/main/resources</directory>
@ -43,14 +42,6 @@
</execution> </execution>
</executions> </executions>
</plugin> </plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins> </plugins>
</build> </build>
<ciManagement> <ciManagement>
@ -60,8 +51,9 @@
<properties> <properties>
<update.description>§a补丁包 2.7.9 版本</update.description> <update.description>§a补丁包 2.7.9 版本</update.description>
<update.changes> <update.changes>
§6- §cfix: §7修复仓库数据读取错误的问题;
§6- §cfix: §7修复一个tab补全产生的错误; §6- §cfix: §7修复一个tab补全产生的错误;
§6- §btip: §a本插件最后一次更新 2.7.8 版本 §6- §btip: §a本插件最后一次更新 2.7.8 版本;
§6- §afeat: §7线程中断只显示一次调试信息; §6- §afeat: §7线程中断只显示一次调试信息;
§6- §afeat: §7更新线程检查 添加调试; §6- §afeat: §7更新线程检查 添加调试;
§6- §afeat: §7修改显示前缀; §6- §afeat: §7修改显示前缀;
@ -74,7 +66,7 @@
§6- §cfix: §7修复lasterror命令显示问题; §6- §cfix: §7修复lasterror命令显示问题;
§6- §afeat: §7使用SimpleJson解析仓库数据; §6- §afeat: §7使用SimpleJson解析仓库数据;
§6- §afeat: §7使用新的类库处理Tellraw; §6- §afeat: §7使用新的类库处理Tellraw;
§6- §cfix: §7当仓库未找到插件时没有提示的BUG; §6- §cfix: §7当仓库未找到插件时没有提示的BUG
</update.changes> </update.changes>
<env.GIT_COMMIT>DEV</env.GIT_COMMIT> <env.GIT_COMMIT>DEV</env.GIT_COMMIT>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
@ -99,7 +91,7 @@
<groupId>pw.yumc</groupId> <groupId>pw.yumc</groupId>
<artifactId>YumCore</artifactId> <artifactId>YumCore</artifactId>
<type>jar</type> <type>jar</type>
<version>1.5</version> <version>1.6</version>
</dependency> </dependency>
<dependency> <dependency>
<groupId>pw.yumc</groupId> <groupId>pw.yumc</groupId>

View File

@ -1,6 +1,3 @@
/**
*
*/
package pw.yumc.Yum.managers; package pw.yumc.Yum.managers;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -20,7 +20,7 @@ public class PluginInfo implements Serializable {
try { try {
NMSVersion = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3]; NMSVersion = Bukkit.getServer().getClass().getPackage().getName().split("\\.")[3];
} catch (Exception e) { } catch (Exception e) {
Log.warning("服务器NMS解析失败: " + Bukkit.getServer().getClass().getPackage().getName()); Log.w("服务器NMS解析失败: " + Bukkit.getServer().getClass().getPackage().getName());
NMSVersion = "NONMS"; NMSVersion = "NONMS";
} }
} }
@ -91,7 +91,7 @@ public class PluginInfo implements Serializable {
String ver = version; String ver = version;
if (ver == null) { if (ver == null) {
if (plugin.tags != null) { if (plugin.tags != null) {
Log.debug("发现存在TAG标签 开始检索: " + NMSVersion); Log.d("发现存在TAG标签 开始检索: " + NMSVersion);
for (TagInfo tagInfo : plugin.tags) { for (TagInfo tagInfo : plugin.tags) {
if (tagInfo.tag.equalsIgnoreCase(NMSVersion)) { if (tagInfo.tag.equalsIgnoreCase(NMSVersion)) {
sender.sendMessage("§6版本: §b从Tag标签中获取 §e" + NMSVersion + " §b的最新版本..."); sender.sendMessage("§6版本: §b从Tag标签中获取 §e" + NMSVersion + " §b的最新版本...");

View File

@ -43,17 +43,19 @@ public class RepoCache implements Serializable {
} }
public Repositories getRepo(String repo) { public Repositories getRepo(String repo) {
try {
String json = HttpKit.get(repo); String json = HttpKit.get(repo);
if (json.isEmpty()) {
Log.console("§c源地址获取数据为空 §b" + repo);
return null;
}
Repositories reposes = new Repositories((JSONObject) JSONValue.parse(json)); Repositories reposes = new Repositories((JSONObject) JSONValue.parse(json));
if (reposes.repos.isEmpty()) { if (reposes.repos.isEmpty()) {
Log.console("§c源地址解析Json为空 §b" + repo); Log.console("§c源地址解析Json为空 §b" + repo);
return null; return null;
} }
return reposes; return reposes;
} catch (Exception e) {
Throwable ex = e.getCause();
Log.console("§c源地址获取数据为空 §b%s §c异常: %s: %s", repo, ex.getClass().getName(), ex.getLocalizedMessage());
return null;
}
} }
public Map<String, Repositories> getRepos() { public Map<String, Repositories> getRepos() {