|
|
|
@@ -34,7 +34,7 @@ public class UpdateAPI {
|
|
|
|
|
public void run() {
|
|
|
|
|
join(plugin, prefix, perm, player, spigot, discord);
|
|
|
|
|
}
|
|
|
|
|
}.runTaskLater(plugin, 20L);
|
|
|
|
|
}.runTaskLaterAsynchronously(plugin, 20L);
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
String publicVersion = UpdateAPI.PluginVersionen.get(plugin.getName()).publicVersion;
|
|
|
|
@@ -45,12 +45,12 @@ public class UpdateAPI {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static void use(Plugin plugin, String prefix, Player player, String pluginVersion, String publicVersion, String spigot, String discord) {
|
|
|
|
|
Bukkit.getScheduler().runTaskLater(plugin, new Runnable() {
|
|
|
|
|
new BukkitRunnable() {
|
|
|
|
|
@Override
|
|
|
|
|
public void run() {
|
|
|
|
|
UpdateAPI.sendUpdateMsg(prefix, spigot, discord, pluginVersion, publicVersion, player);
|
|
|
|
|
}
|
|
|
|
|
}, 200L);
|
|
|
|
|
}.runTaskLaterAsynchronously(plugin, 200L);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void sendUpdateMsg(String Prefix, String Spigot, String Discord, String pluginVersion, String publicVersion) {
|
|
|
|
@@ -74,27 +74,29 @@ public class UpdateAPI {
|
|
|
|
|
send.console("§4=========== " + Prefix + " §4===========");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static void sendUpdateMsg(String Prefix, String Spigot, String Discord, String pluginVersion, String publicVersion, Player player) {
|
|
|
|
|
public static void sendUpdateMsg(String prefix, String Spigot, String Discord, String pluginVersion, String publicVersion, Player player) {
|
|
|
|
|
if (publicVersion.equals("§4No public version found!")) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
send.player(player, Prefix);
|
|
|
|
|
String st = "[prefix]<br>" +
|
|
|
|
|
"<click:open_url:'[link]'><hover:show_text:'<gold>You can download it here: <yellow>[link]</yellow></gold>'>[prefix] <gold>A new</gold> [value]<gold>version was found!</gold></hover></click><br>" +
|
|
|
|
|
"<click:open_url:'[link]'><hover:show_text:'<gold>You can download it here: <yellow>[link]</yellow></gold>'>[prefix] <red>[plv]</red> <gray>-></gray> <green>[puv]</green></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]";
|
|
|
|
|
String value = "";
|
|
|
|
|
if (publicVersion.toLowerCase().contains("dev") || publicVersion.toLowerCase().contains("beta") || publicVersion.toLowerCase().contains("snapshot")) {
|
|
|
|
|
if (publicVersion.toLowerCase().contains("dev")) {
|
|
|
|
|
HoverModule.modulePlayer(Prefix + " §6A new §4DEV§6 version was found!", "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player);
|
|
|
|
|
value = "<dark_red>DEV </dark_red>";
|
|
|
|
|
}
|
|
|
|
|
if (publicVersion.toLowerCase().contains("beta")) {
|
|
|
|
|
HoverModule.modulePlayer(Prefix + " §6A new §2BETA§6 version was found!", "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player);
|
|
|
|
|
value = "<green>BETA </green>";
|
|
|
|
|
}
|
|
|
|
|
if (publicVersion.toLowerCase().contains("snapshot")) {
|
|
|
|
|
HoverModule.modulePlayer(Prefix + " §6A new §eSNAPSHOT§6 version was found!", "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player);
|
|
|
|
|
value = "<yellow>SNAPSHOT </yellow>";
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
HoverModule.modulePlayer(Prefix + " §6A new version was found!", "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player);
|
|
|
|
|
}
|
|
|
|
|
HoverModule.modulePlayer(Prefix + " §c" + pluginVersion + " §7-> §a" + publicVersion, "§6You can download it here: §e" + Spigot, "OPEN_URL", Spigot, player);
|
|
|
|
|
HoverModule.modulePlayer(Prefix + " §6You can find more information on Discord.", "§e" + Discord, "OPEN_URL", Discord, player);
|
|
|
|
|
send.player(player, Prefix);
|
|
|
|
|
send.player(player, st.replace("[prefix]", prefix).replace("[value]", value).replace("[link]", Spigot)
|
|
|
|
|
.replace("[plv]",pluginVersion).replace("[puv]",publicVersion).replace("[dc]",Discord));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private static Boolean noUpdate = true;
|
|
|
|
|