uc
This commit is contained in:
parent
8034d8852a
commit
3bdbaacd64
@ -1,5 +1,6 @@
|
|||||||
package net.t2code.t2codelib.SPIGOT.api.messages;
|
package net.t2code.t2codelib.SPIGOT.api.messages;
|
||||||
|
|
||||||
|
import net.kyori.adventure.platform.bukkit.BukkitAudiences;
|
||||||
import net.kyori.adventure.text.Component;
|
import net.kyori.adventure.text.Component;
|
||||||
import net.kyori.adventure.text.minimessage.MiniMessage;
|
import net.kyori.adventure.text.minimessage.MiniMessage;
|
||||||
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
import net.t2code.t2codelib.SPIGOT.system.T2CodeLibMain;
|
||||||
@ -8,17 +9,18 @@ import org.bukkit.command.CommandSender;
|
|||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
|
||||||
public class T2CminiMessage {
|
public class T2CminiMessage {
|
||||||
|
private static final BukkitAudiences bukkitAudiences = T2CodeLibMain.getPlugin().getAdventure();
|
||||||
|
|
||||||
public static void miniMessage(String msg, CommandSender sender) {
|
public static void miniMessage(String msg, CommandSender sender) {
|
||||||
T2CodeLibMain.adventure().sender(sender).sendMessage(replace(msg));
|
bukkitAudiences.sender(sender).sendMessage(replace(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendMiniMessage(String msg) {
|
public static void sendMiniMessage(String msg) {
|
||||||
T2CodeLibMain.adventure().console().sendMessage(replace(msg));
|
bukkitAudiences.console().sendMessage(replace(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void miniMessage(String msg, Player player) {
|
public static void miniMessage(String msg, Player player) {
|
||||||
T2CodeLibMain.adventure().player(player).sendMessage(replace(msg));
|
bukkitAudiences.player(player).sendMessage(replace(msg));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static Component replace(String text) {
|
protected static Component replace(String text) {
|
||||||
|
@ -82,7 +82,7 @@ public class T2Ctemplate {
|
|||||||
|
|
||||||
public static void sendInfo(CommandSender sender, Plugin plugin, int spigotID, String discord, Boolean premiumVerified, String text) {
|
public static void sendInfo(CommandSender sender, Plugin plugin, int spigotID, String discord, Boolean premiumVerified, String text) {
|
||||||
String pluginVersion = plugin.getDescription().getVersion();
|
String pluginVersion = plugin.getDescription().getVersion();
|
||||||
String publicVersion = T2CupdateAPI.pluginVersions.get(plugin.getName()).webData.getTag_name();
|
String publicVersion = T2CupdateAPI.pluginVersions.get(plugin.getName()).webData.getTagName();
|
||||||
boolean update = !publicVersion.equalsIgnoreCase(pluginVersion);
|
boolean update = !publicVersion.equalsIgnoreCase(pluginVersion);
|
||||||
boolean player = sender instanceof Player;
|
boolean player = sender instanceof Player;
|
||||||
|
|
||||||
|
@ -29,19 +29,19 @@ public class T2CupdateAPI {
|
|||||||
}.runTaskLaterAsynchronously(plugin, 20L);
|
}.runTaskLaterAsynchronously(plugin, 20L);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
String publicVersion = pluginVersions.get(plugin.getName()).webData.getTag_name();
|
T2CupdateWebData webData = pluginVersions.get(plugin.getName()).webData;
|
||||||
String pluginVersion = plugin.getDescription().getVersion();
|
String pluginVersion = plugin.getDescription().getVersion();
|
||||||
if (pluginVersion.equals(publicVersion)) return;
|
if (pluginVersion.equals(webData.getTagName())) return;
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
sendUpdateMsg(prefix, spigotID, discord, plugin, player);
|
sendUpdateMsg(prefix, webData, discord, plugin, player);
|
||||||
}
|
}
|
||||||
}.runTaskLaterAsynchronously(T2CodeLibMain.getPlugin(), 200L);
|
}.runTaskLaterAsynchronously(T2CodeLibMain.getPlugin(), 200L);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendUpdateMsg(String prefix, Integer spigotID, String discord, Plugin plugin, Player player) {
|
public static void sendUpdateMsg(String prefix, T2CupdateWebData webData, String discord, Plugin plugin, Player player) {
|
||||||
String publicVersion = pluginVersions.get(plugin.getName()).webData.getTag_name();
|
String publicVersion = webData.getTagName();
|
||||||
String pluginVersion = plugin.getDescription().getVersion();
|
String pluginVersion = plugin.getDescription().getVersion();
|
||||||
if (publicVersion.equals("§4No public version found!")) {
|
if (publicVersion.equals("§4No public version found!")) {
|
||||||
return;
|
return;
|
||||||
@ -52,7 +52,9 @@ public class T2CupdateAPI {
|
|||||||
"<click:open_url:'[dc]'><hover:show_text:'<yellow>[dc]</yellow>'>[prefix] <gold>You can find more information on Discord.</gold></hover></click><br>" +
|
"<click:open_url:'[dc]'><hover:show_text:'<yellow>[dc]</yellow>'>[prefix] <gold>You can find more information on Discord.</gold></hover></click><br>" +
|
||||||
"[prefix]";
|
"[prefix]";
|
||||||
String value = "";
|
String value = "";
|
||||||
if (publicVersion.toLowerCase().contains("dev") || publicVersion.toLowerCase().contains("beta") || publicVersion.toLowerCase().contains("snapshot")) {
|
|
||||||
|
if (webData.isPreRelease()) {
|
||||||
|
value = "<light_purple>Pre-Release </light_purple>";
|
||||||
if (publicVersion.toLowerCase().contains("dev")) {
|
if (publicVersion.toLowerCase().contains("dev")) {
|
||||||
value = "<dark_red>DEV </dark_red>";
|
value = "<dark_red>DEV </dark_red>";
|
||||||
}
|
}
|
||||||
@ -63,19 +65,19 @@ public class T2CupdateAPI {
|
|||||||
value = "<yellow>SNAPSHOT </yellow>";
|
value = "<yellow>SNAPSHOT </yellow>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
T2Csend.player(player, st.replace("[prefix]", prefix).replace("[value]", value).replace("[link]", "https://www.spigotmc.org/resources/" + spigotID)
|
T2Csend.player(player, st.replace("[prefix]", prefix).replace("[value]", value).replace("[link]", webData.getUpdateUrl())
|
||||||
.replace("[plv]", pluginVersion).replace("[puv]", publicVersion).replace("[dc]", discord));
|
.replace("[plv]", pluginVersion).replace("[puv]", publicVersion).replace("[dc]", discord));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sendUpdateMsg(String prefix, T2CupdateWebData data, String discord, Plugin plugin) {
|
public static void sendUpdateMsg(String prefix, String discord, T2CupdateWebData webData, Plugin plugin) {
|
||||||
String publicVersion = pluginVersions.get(plugin.getName()).webData.getTag_name();
|
String publicVersion =webData.getTagName();
|
||||||
String pluginVersion = plugin.getDescription().getVersion();
|
String pluginVersion = plugin.getDescription().getVersion();
|
||||||
String h = "§4=========== " + prefix + " §4===========";
|
String h = "§4=========== " + prefix + " §4===========";
|
||||||
String s1 = "";
|
String s1 = "";
|
||||||
String s2 = "§6Your version: §c" + pluginVersion + " §7- §6Current version: §a" + publicVersion;
|
String s2 = "§6Your version: §c" + pluginVersion + " §7- §6Current version: §a" + publicVersion;
|
||||||
String s3 = "§6You can download it here: §e" + data.getUpdateurl();
|
String s3 = "§6You can download it here: §e" + webData.getUpdateUrl();
|
||||||
String s4 = "§6You can find more information on Discord: §e" + discord;
|
String s4 = "§6You can find more information on Discord: §e" + discord;
|
||||||
if (data.isPrerelease()) {
|
if (webData.isPreRelease()) {
|
||||||
s1 = "§6A new §4Pre-Release§6 version was found!§r";
|
s1 = "§6A new §4Pre-Release§6 version was found!§r";
|
||||||
if (publicVersion.toLowerCase().contains("dev")) {
|
if (publicVersion.toLowerCase().contains("dev")) {
|
||||||
s1 = "§6A new §4DEV§6 version was found!§r";
|
s1 = "§6A new §4DEV§6 version was found!§r";
|
||||||
@ -93,15 +95,49 @@ public class T2CupdateAPI {
|
|||||||
T2Csend.console(text);
|
T2Csend.console(text);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void onUpdateCheck(Plugin plugin, String prefix, String discord, String RepoURL) {
|
public static void onUpdateCheck(Plugin plugin, String prefix, Integer spigotID, String discord) {
|
||||||
if(!RepoURL.contains("?limit=1")){
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
(new T2CupdateChecker((JavaPlugin) plugin, spigotID)).getVersion((update_version) -> {
|
||||||
|
T2CupdateObject update = new T2CupdateObject(
|
||||||
|
plugin.getName(),
|
||||||
|
plugin.getDescription().getVersion(),
|
||||||
|
new T2CupdateWebData("OLD", update_version, "", "https://www.spigotmc.org/resources/" + spigotID, "",
|
||||||
|
"https://www.spigotmc.org/resources/" + spigotID, false),
|
||||||
|
false
|
||||||
|
);
|
||||||
|
pluginVersions.put(plugin.getName(), update);
|
||||||
|
if (!plugin.getDescription().getVersion().equalsIgnoreCase(update_version)) {
|
||||||
|
if (!update.load) {
|
||||||
|
new BukkitRunnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
update.load = true;
|
||||||
|
sendUpdateMsg(prefix, discord, update.webData, plugin);
|
||||||
|
}
|
||||||
|
}.runTaskLaterAsynchronously(plugin, 600L);
|
||||||
|
} else sendUpdateMsg(prefix, discord, update.webData, plugin);
|
||||||
|
} else {
|
||||||
|
if (!update.load) {
|
||||||
|
T2Csend.console(prefix + " §2No update found.");
|
||||||
|
update.load = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, prefix, plugin.getDescription().getVersion());
|
||||||
|
}
|
||||||
|
}.runTaskTimerAsynchronously(plugin, 0L, SelectLibConfig.getUpdateCheckTimeInterval() * 60 * 20L);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void onUpdateCheck(Plugin plugin, String prefix, String RepoURL, Integer spigotID, String discord) {
|
||||||
|
if (!RepoURL.contains("?limit=1")) {
|
||||||
RepoURL = RepoURL + "?limit=1";
|
RepoURL = RepoURL + "?limit=1";
|
||||||
}
|
}
|
||||||
String finalRepoURL = RepoURL;
|
String finalRepoURL = RepoURL;
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
(new T2CupdateChecker((JavaPlugin) plugin)).getVersion((webData) -> {
|
(new T2CupdateCheckerGit((JavaPlugin) plugin)).getVersion((webData) -> {
|
||||||
T2CupdateObject update = new T2CupdateObject(
|
T2CupdateObject update = new T2CupdateObject(
|
||||||
plugin.getName(),
|
plugin.getName(),
|
||||||
plugin.getDescription().getVersion(),
|
plugin.getDescription().getVersion(),
|
||||||
@ -109,23 +145,23 @@ public class T2CupdateAPI {
|
|||||||
false
|
false
|
||||||
);
|
);
|
||||||
pluginVersions.put(plugin.getName(), update);
|
pluginVersions.put(plugin.getName(), update);
|
||||||
if (!plugin.getDescription().getVersion().equalsIgnoreCase(webData.getTag_name())) {
|
if (!plugin.getDescription().getVersion().equalsIgnoreCase(webData.getTagName())) {
|
||||||
if (!update.load) {
|
if (!update.load) {
|
||||||
new BukkitRunnable() {
|
new BukkitRunnable() {
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
update.load = true;
|
update.load = true;
|
||||||
sendUpdateMsg(prefix, webData, discord, plugin);
|
sendUpdateMsg(prefix, discord, webData, plugin);
|
||||||
}
|
}
|
||||||
}.runTaskLaterAsynchronously(plugin, 600L);
|
}.runTaskLaterAsynchronously(plugin, 600L);
|
||||||
} else sendUpdateMsg(prefix, webData, discord, plugin);
|
} else sendUpdateMsg(prefix, discord, webData, plugin);
|
||||||
} else {
|
} else {
|
||||||
if (!update.load){
|
if (!update.load) {
|
||||||
T2Csend.console(prefix + " §2No update found.");
|
T2Csend.console(prefix + " §2No update found.");
|
||||||
update.load = true;
|
update.load = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, prefix, plugin.getDescription().getVersion(), finalRepoURL);
|
}, plugin.getDescription().getVersion(), spigotID, finalRepoURL);
|
||||||
}
|
}
|
||||||
}.runTaskTimerAsynchronously(plugin, 0L, SelectLibConfig.getUpdateCheckTimeInterval() * 60 * 20L);
|
}.runTaskTimerAsynchronously(plugin, 0L, SelectLibConfig.getUpdateCheckTimeInterval() * 60 * 20L);
|
||||||
}
|
}
|
||||||
|
@ -2,63 +2,62 @@ package net.t2code.t2codelib.SPIGOT.api.update;
|
|||||||
|
|
||||||
import org.bukkit.Bukkit;
|
import org.bukkit.Bukkit;
|
||||||
import org.bukkit.plugin.java.JavaPlugin;
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
import org.json.JSONArray;
|
|
||||||
import org.json.JSONObject;
|
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.net.URLConnection;
|
import java.util.Scanner;
|
||||||
import java.util.function.Consumer;
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
public class T2CupdateChecker {
|
public class T2CupdateChecker {
|
||||||
private JavaPlugin plugin;
|
private JavaPlugin plugin;
|
||||||
|
private int resourceId;
|
||||||
|
|
||||||
public T2CupdateChecker(JavaPlugin plugin) {
|
public T2CupdateChecker(JavaPlugin plugin, int resourceId) {
|
||||||
this.plugin = plugin;
|
this.plugin = plugin;
|
||||||
|
this.resourceId = resourceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void getVersion(Consumer<T2CupdateWebData> consumer, String Prefix, String pluginVersion, String URL) {
|
public void getVersion(Consumer<String> consumer, String Prefix, String pluginVersion) {
|
||||||
if (!plugin.isEnabled()) {
|
if (!plugin.isEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
|
Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
|
||||||
try {
|
try {
|
||||||
URL url = new URL(URL);
|
InputStream inputStream = (new URL("https://api.spigotmc.org/legacy/update.php?resource=" + this.resourceId)).openStream();
|
||||||
URLConnection yc = url.openConnection();
|
try {
|
||||||
BufferedReader in = new BufferedReader(
|
Scanner scanner = new Scanner(inputStream);
|
||||||
new InputStreamReader(
|
|
||||||
yc.getInputStream()));
|
try {
|
||||||
String inputLine;
|
if (scanner.hasNext()) {
|
||||||
String data = "";
|
consumer.accept(scanner.next());
|
||||||
while ((inputLine = in.readLine()) != null)
|
|
||||||
data = inputLine;
|
|
||||||
in.close();
|
|
||||||
data = data.substring(1, data.length() - 1);
|
|
||||||
if (data.isEmpty()) {
|
|
||||||
consumer.accept(null);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
JSONObject obj = new JSONObject(data);
|
} catch (Throwable var8) {
|
||||||
String UpdateName = obj.getString("name");
|
try {
|
||||||
String tag_name = obj.getString("tag_name");
|
scanner.close();
|
||||||
String body = obj.getString("body");
|
} catch (Throwable var7) {
|
||||||
String updateurl = obj.getString("url");
|
var8.addSuppressed(var7);
|
||||||
boolean prerelease = obj.getBoolean("prerelease");
|
|
||||||
String published_at = obj.getString("published_at");
|
|
||||||
JSONArray downloadArray = obj.getJSONArray("assets");
|
|
||||||
String downloadURL;
|
|
||||||
if (downloadArray.isEmpty()) {
|
|
||||||
downloadURL = "";
|
|
||||||
} else {
|
|
||||||
downloadURL = downloadArray.getJSONObject(0).getString("browser_download_url");
|
|
||||||
}
|
}
|
||||||
T2CupdateWebData webData = new T2CupdateWebData(UpdateName, tag_name, body, updateurl, published_at, downloadURL, prerelease);
|
throw var8;
|
||||||
consumer.accept(webData);
|
}
|
||||||
} catch (Exception var10) {
|
scanner.close();
|
||||||
|
} catch (Throwable var9) {
|
||||||
|
if (inputStream != null) {
|
||||||
|
try {
|
||||||
|
inputStream.close();
|
||||||
|
} catch (Throwable var6) {
|
||||||
|
var9.addSuppressed(var6);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw var9;
|
||||||
|
}
|
||||||
|
inputStream.close();
|
||||||
|
} catch (IOException var10) {
|
||||||
Boolean load = false;
|
Boolean load = false;
|
||||||
if (T2CupdateAPI.pluginVersions.containsKey(plugin.getName())) {
|
if (T2CupdateAPI.pluginVersions.containsKey(plugin.getName())){
|
||||||
load = T2CupdateAPI.pluginVersions.get(plugin.getName()).load;
|
load = T2CupdateAPI.pluginVersions.get(plugin.getName()).load;
|
||||||
}
|
}
|
||||||
|
|
||||||
T2CupdateObject update = new T2CupdateObject(
|
T2CupdateObject update = new T2CupdateObject(
|
||||||
plugin.getName(),
|
plugin.getName(),
|
||||||
pluginVersion,
|
pluginVersion,
|
||||||
@ -70,5 +69,4 @@ public class T2CupdateChecker {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,80 @@
|
|||||||
|
package net.t2code.t2codelib.SPIGOT.api.update;
|
||||||
|
|
||||||
|
import org.bukkit.Bukkit;
|
||||||
|
import org.bukkit.plugin.java.JavaPlugin;
|
||||||
|
import org.json.JSONArray;
|
||||||
|
import org.json.JSONObject;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.net.URLConnection;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
public class T2CupdateCheckerGit {
|
||||||
|
private JavaPlugin plugin;
|
||||||
|
|
||||||
|
public T2CupdateCheckerGit(JavaPlugin plugin) {
|
||||||
|
this.plugin = plugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void getVersion(Consumer<T2CupdateWebData> consumer, String pluginVersion, Integer spigotID, String URL) {
|
||||||
|
if (!plugin.isEnabled()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Bukkit.getScheduler().runTaskAsynchronously(this.plugin, () -> {
|
||||||
|
try {
|
||||||
|
URL url = new URL(URL);
|
||||||
|
URLConnection yc = url.openConnection();
|
||||||
|
BufferedReader in = new BufferedReader(
|
||||||
|
new InputStreamReader(
|
||||||
|
yc.getInputStream()));
|
||||||
|
String inputLine;
|
||||||
|
String data = "";
|
||||||
|
while ((inputLine = in.readLine()) != null)
|
||||||
|
data = inputLine;
|
||||||
|
in.close();
|
||||||
|
data = data.substring(1, data.length() - 1);
|
||||||
|
if (data.isEmpty()) {
|
||||||
|
consumer.accept(null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
JSONObject obj = new JSONObject(data);
|
||||||
|
String UpdateName = obj.getString("name");
|
||||||
|
String tag_name = obj.getString("tag_name");
|
||||||
|
String body = obj.getString("body");
|
||||||
|
String updateurl = obj.getString("url");
|
||||||
|
boolean prerelease = obj.getBoolean("prerelease");
|
||||||
|
String published_at = obj.getString("published_at");
|
||||||
|
JSONArray downloadArray = obj.getJSONArray("assets");
|
||||||
|
String downloadURL;
|
||||||
|
if (downloadArray.isEmpty()) {
|
||||||
|
downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
|
||||||
|
} else {
|
||||||
|
downloadURL = downloadArray.getJSONObject(0).getString("browser_download_url");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!prerelease) {
|
||||||
|
downloadURL = "https://www.spigotmc.org/resources/" + spigotID;
|
||||||
|
updateurl = "https://www.spigotmc.org/resources/" + spigotID;
|
||||||
|
}
|
||||||
|
|
||||||
|
T2CupdateWebData webData = new T2CupdateWebData(UpdateName, tag_name, body, updateurl, published_at, downloadURL, prerelease);
|
||||||
|
consumer.accept(webData);
|
||||||
|
} catch (Exception var10) {
|
||||||
|
Boolean load = false;
|
||||||
|
if (T2CupdateAPI.pluginVersions.containsKey(plugin.getName())) {
|
||||||
|
load = T2CupdateAPI.pluginVersions.get(plugin.getName()).load;
|
||||||
|
}
|
||||||
|
T2CupdateObject update = new T2CupdateObject(
|
||||||
|
plugin.getName(),
|
||||||
|
pluginVersion,
|
||||||
|
null,
|
||||||
|
load
|
||||||
|
);
|
||||||
|
T2CupdateAPI.pluginVersions.put(plugin.getName(), update);
|
||||||
|
this.plugin.getLogger().severe("§4 Cannot look for updates: " + var10.getMessage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -10,11 +10,11 @@ public class T2CupdateObject {
|
|||||||
|
|
||||||
public T2CupdateObject(String pluginName,
|
public T2CupdateObject(String pluginName,
|
||||||
String pluginVersion,
|
String pluginVersion,
|
||||||
T2CupdateWebData webData ,
|
T2CupdateWebData webData,
|
||||||
Boolean load) {
|
Boolean load) {
|
||||||
this.pluginName = pluginName;
|
this.pluginName = pluginName;
|
||||||
this.pluginVersion = pluginVersion;
|
this.pluginVersion = pluginVersion;
|
||||||
this.webData = webData;
|
this.webData = webData;
|
||||||
this.load=load;
|
this.load = load;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -4,28 +4,28 @@ import lombok.Getter;
|
|||||||
|
|
||||||
public class T2CupdateWebData {
|
public class T2CupdateWebData {
|
||||||
@Getter
|
@Getter
|
||||||
private String UpdateName;
|
private String updateName;
|
||||||
@Getter
|
@Getter
|
||||||
private String tag_name;
|
private String tagName;
|
||||||
@Getter
|
@Getter
|
||||||
private String body;
|
private String body;
|
||||||
@Getter
|
@Getter
|
||||||
private String updateurl;
|
private String updateUrl;
|
||||||
@Getter
|
@Getter
|
||||||
private String published_at;
|
private String publishedAt;
|
||||||
@Getter
|
@Getter
|
||||||
private String downloadURL;
|
private String downloadURL;
|
||||||
@Getter
|
@Getter
|
||||||
private boolean prerelease;
|
private boolean preRelease;
|
||||||
|
|
||||||
public T2CupdateWebData(String updateName, String tag_name, String body, String updateurl, String published_at, String downloadURL, boolean prerelease) {
|
public T2CupdateWebData(String updateName, String tagName, String body, String updateUrl, String publishedAt, String downloadURL, boolean preRelease) {
|
||||||
UpdateName = updateName;
|
this.updateName = updateName;
|
||||||
this.tag_name = tag_name;
|
this.tagName = tagName;
|
||||||
this.body = body;
|
this.body = body;
|
||||||
this.updateurl = updateurl;
|
this.updateUrl = updateUrl;
|
||||||
this.published_at = published_at;
|
this.publishedAt = publishedAt;
|
||||||
this.downloadURL = downloadURL;
|
this.downloadURL = downloadURL;
|
||||||
this.prerelease = prerelease;
|
this.preRelease = preRelease;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ public final class T2CodeLibMain extends JavaPlugin {
|
|||||||
plugin = this;
|
plugin = this;
|
||||||
autor = plugin.getDescription().getAuthors();
|
autor = plugin.getDescription().getAuthors();
|
||||||
version = plugin.getDescription().getVersion();
|
version = plugin.getDescription().getVersion();
|
||||||
this.adventure = BukkitAudiences.create(this);
|
adventure = BukkitAudiences.create(this);
|
||||||
long long_ = T2Ctemplate.onLoadHeader(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
|
long long_ = T2Ctemplate.onLoadHeader(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
|
||||||
String prefix = Util.getPrefix();
|
String prefix = Util.getPrefix();
|
||||||
|
|
||||||
@ -90,9 +90,9 @@ public final class T2CodeLibMain extends JavaPlugin {
|
|||||||
SelectLibConfig.onSelect();
|
SelectLibConfig.onSelect();
|
||||||
SelectLibMsg.onSelect();
|
SelectLibMsg.onSelect();
|
||||||
|
|
||||||
T2CupdateAPI.onUpdateCheck(plugin, prefix, Util.getDiscord(), "https://git.t2code.net/api/v1/repos/JaTiTV/T2CodeLib/releases?limit=1");
|
T2CupdateAPI.onUpdateCheck(plugin, prefix, Util.getGit(), Util.getSpigotID(), Util.getDiscord());
|
||||||
Metrics.Bstats(plugin, Util.getBstatsID());
|
Metrics.Bstats(plugin, Util.getBstatsID());
|
||||||
if (SelectLibConfig.getBungee()){
|
if (SelectLibConfig.getBungee()) {
|
||||||
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
|
Bukkit.getMessenger().registerOutgoingPluginChannel(plugin, "t2c:bcmd");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -155,7 +155,7 @@ public final class T2CodeLibMain extends JavaPlugin {
|
|||||||
|
|
||||||
private static BukkitAudiences adventure;
|
private static BukkitAudiences adventure;
|
||||||
|
|
||||||
public static BukkitAudiences adventure() {
|
public BukkitAudiences getAdventure() {
|
||||||
if (adventure == null) {
|
if (adventure == null) {
|
||||||
throw new IllegalStateException("Tried to access Adventure when the plugin was disabled!");
|
throw new IllegalStateException("Tried to access Adventure when the plugin was disabled!");
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,9 @@ public class Util {
|
|||||||
public static Integer getSpigotID() {
|
public static Integer getSpigotID() {
|
||||||
return 96388;
|
return 96388;
|
||||||
}
|
}
|
||||||
|
public static String getGit() {
|
||||||
|
return "https://git.t2code.net/api/v1/repos/JaTiTV/T2CodeLib/releases?limit=1";
|
||||||
|
}
|
||||||
|
|
||||||
public static Integer getBstatsID() {
|
public static Integer getBstatsID() {
|
||||||
return 12518;
|
return 12518;
|
||||||
|
Loading…
Reference in New Issue
Block a user