From f29ccdf4a714b318ac03dfabdd22022794cf73ff Mon Sep 17 00:00:00 2001 From: 502647092 Date: Fri, 5 Aug 2016 10:47:11 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=8F=92=E4=BB=B6?= =?UTF-8?q?=E8=AE=A2=E9=98=85=E6=9B=B4=E6=96=B0=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 502647092 --- .../java/pw/yumc/YumCore/update/SubscribeTask.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/main/java/pw/yumc/YumCore/update/SubscribeTask.java b/src/main/java/pw/yumc/YumCore/update/SubscribeTask.java index 03d4b5d..b586c35 100644 --- a/src/main/java/pw/yumc/YumCore/update/SubscribeTask.java +++ b/src/main/java/pw/yumc/YumCore/update/SubscribeTask.java @@ -23,8 +23,11 @@ import pw.yumc.YumCore.bukkit.P; * @author 喵♂呜 */ public class SubscribeTask implements Runnable { + public static boolean navite = false; + public static boolean debug = false; private final static String url = "https://coding.net/u/502647092/p/%s/git/raw/%s/pom.xml"; private final static String direct = "http://ci.yumc.pw/job/%1$s/lastSuccessfulBuild/artifact/target/%1$s.jar"; + private final static String pom = "http://ci.yumc.pw/job/%s/lastSuccessfulBuild/artifact/pom.xml"; private final static String maven = "http://ci.yumc.pw/plugin/repository/everything/%1$s/%2$s/%3$s-%2$s.jar"; private final String branch; @@ -106,7 +109,7 @@ public class SubscribeTask implements Runnable { try { final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); final DocumentBuilder builder = factory.newDocumentBuilder(); - final String result = builder.parse(String.format(url, P.getName(), branch)).getElementsByTagName("version").item(0).getTextContent().split("-")[0]; + final String result = builder.parse(String.format(navite ? pom : url, P.getName(), branch)).getElementsByTagName("version").item(0).getTextContent().split("-")[0]; if (needUpdate(result, P.getDescription().getVersion().split("-")[0])) { final File target = new File("plugins/update/" + getPluginFile(P.instance).getName()); final File temp = new File("plugins/update/" + getPluginFile(P.instance).getName() + ".downloading"); @@ -122,7 +125,7 @@ public class SubscribeTask implements Runnable { } String durl = null; if (isMaven) { - durl = String.format(maven, P.instance.getClass().getPackage().getName().replaceAll(".", "/"), result, P.getName()); + durl = String.format(maven, P.instance.getClass().getPackage().getName().replaceAll("\\.", "/"), result, P.getName()); } else { durl = String.format(direct, P.getName()); } @@ -130,6 +133,9 @@ public class SubscribeTask implements Runnable { temp.renameTo(target); } } catch (final Exception e) { + if (debug) { + e.printStackTrace(); + } } } }