好像没上传干净
This commit is contained in:
@@ -2,6 +2,7 @@ package me.skymc.taboolib.update;
|
||||
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParser;
|
||||
import com.ilummc.tlib.resources.TLocale;
|
||||
import me.skymc.taboolib.Main;
|
||||
import me.skymc.taboolib.TabooLib;
|
||||
import me.skymc.taboolib.fileutils.FileUtils;
|
||||
@@ -14,37 +15,30 @@ import org.bukkit.scheduler.BukkitRunnable;
|
||||
*/
|
||||
public class UpdateTask {
|
||||
|
||||
private static final String API = "https://api.github.com/repos/Bkm016/TabooLib/releases/latest";
|
||||
|
||||
/**
|
||||
* 检测更新
|
||||
*/
|
||||
public UpdateTask() {
|
||||
new BukkitRunnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (!Main.getInst().getConfig().getBoolean("UPDATE-CHECK")) {
|
||||
return;
|
||||
}
|
||||
String value = FileUtils.getStringFromURL(API, "{}");
|
||||
JsonObject json = new JsonParser().parse(value).getAsJsonObject();
|
||||
if (json.entrySet().size() > 0) {
|
||||
double newVersion = Double.parseDouble(json.get("tag_name").getAsString());
|
||||
if (TabooLib.getPluginVersion() >= newVersion) {
|
||||
MsgUtils.send("插件已是最新版, 无需更新!");
|
||||
}
|
||||
else {
|
||||
MsgUtils.send("&8####################################################");
|
||||
MsgUtils.send("检测到有新的版本更新!");
|
||||
MsgUtils.send("当前版本: &f" + TabooLib.getPluginVersion());
|
||||
MsgUtils.send("最新版本: &f" + newVersion);
|
||||
MsgUtils.send("下载地址: &fhttp://www.mcbbs.net/thread-773065-1-1.html");
|
||||
MsgUtils.send("开源地址: &fhttps://github.com/Bkm016/TabooLib/");
|
||||
MsgUtils.send("&8####################################################");
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskLaterAsynchronously(Main.getInst(), 100);
|
||||
}
|
||||
private static final String API = "https://internal.github.com/repos/Bkm016/TabooLib/releases/latest";
|
||||
|
||||
/**
|
||||
* 检测更新
|
||||
*/
|
||||
public UpdateTask() {
|
||||
new BukkitRunnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (!Main.getInst().getConfig().getBoolean("UPDATE-CHECK")) {
|
||||
return;
|
||||
}
|
||||
String value = FileUtils.getStringFromURL(API, "{}");
|
||||
JsonObject json = new JsonParser().parse(value).getAsJsonObject();
|
||||
if (json.entrySet().size() > 0) {
|
||||
double newVersion = Double.parseDouble(json.get("tag_name").getAsString());
|
||||
if (TabooLib.getPluginVersion() >= newVersion) {
|
||||
TLocale.Logger.info("UPDATETASK.VERSION-LATEST");
|
||||
} else {
|
||||
TLocale.Logger.info("UPDATETASK.VERSION-OUTDATED", String.valueOf(TabooLib.getPluginVersion()), String.valueOf(newVersion));
|
||||
}
|
||||
}
|
||||
}
|
||||
}.runTaskLaterAsynchronously(Main.getInst(), 100);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user