fix versionchecker url...

pull/2/MERGE
j502647092 2015-09-01 22:47:10 +08:00
parent 0bd132f2b7
commit 64dbc4529b
1 changed files with 6 additions and 10 deletions

View File

@ -1,7 +1,6 @@
package cn.citycraft.SimpleEssential.utils; package cn.citycraft.SimpleEssential.utils;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader; import java.io.InputStreamReader;
import java.net.URL; import java.net.URL;
@ -20,12 +19,11 @@ import com.google.common.base.Charsets;
/** /**
* *
* *
* @author * @author 20158144:01:15
* 20158144:01:15
*/ */
public class VersionChecker implements Listener { public class VersionChecker implements Listener {
Plugin plugin; Plugin plugin;
public String checkurl = "https://coding.net/u/502647092/p/%s/git/raw/%s/src/plugin.yml"; public String checkurl = "https://coding.net/u/502647092/p/%s/git/raw/%s/src/main/resources/plugin.yml";
public String branch = "master"; public String branch = "master";
/** /**
@ -91,19 +89,17 @@ public class VersionChecker implements Listener {
String newVersion = config.getString("version"); String newVersion = config.getString("version");
br.close(); br.close();
if (!newVersion.equals(currentVersion)) { if (!newVersion.equals(currentVersion)) {
String[] msg = new String[] { String[] msg = new String[] { ChatColor.GREEN + plugin.getName() + " 插件最新版本 v" + newVersion,
ChatColor.GREEN + plugin.getName() + " 插件最新版本 v" + newVersion,
ChatColor.RED + "服务器运行版本: v" + currentVersion, ChatColor.RED + "服务器运行版本: v" + currentVersion,
ChatColor.GOLD + "插件更新网站: " + ChatColor.BLUE + plugin.getDescription().getWebsite() ChatColor.GOLD + "插件更新网站: " + ChatColor.BLUE + plugin.getDescription().getWebsite() };
};
if (player != null) { if (player != null) {
player.sendMessage(msg); player.sendMessage(msg);
} else { } else {
plugin.getServer().getConsoleSender().sendMessage(msg); plugin.getServer().getConsoleSender().sendMessage(msg);
} }
} }
} catch (IOException e) { } catch (Exception e) {
plugin.getLogger().warning("版本更新检查失败!"); plugin.getLogger().warning("版本更新检查失败 异常: " + e.getMessage());
} }
} }
}); });