diff --git a/src/main/java/net/t2code/lib/Spigot/Lib/update/UpdateAPI.java b/src/main/java/net/t2code/lib/Spigot/Lib/update/UpdateAPI.java index 01281a7..983e409 100644 --- a/src/main/java/net/t2code/lib/Spigot/Lib/update/UpdateAPI.java +++ b/src/main/java/net/t2code/lib/Spigot/Lib/update/UpdateAPI.java @@ -82,9 +82,12 @@ public class UpdateAPI { private static Boolean noUpdate = true; public static void onUpdateCheck(Plugin plugin, String Prefix, String Spigot, int SpigotID, String Discord) { + onUpdateCheck(plugin, Prefix, Spigot, SpigotID, Discord, 60); + } + + public static void onUpdateCheck(Plugin plugin, String Prefix, String Spigot, int SpigotID, String Discord, Integer timeInMin) { int taskID = Bukkit.getScheduler().scheduleSyncRepeatingTask(plugin, new Runnable() { public void run() { - (new UpdateAPI((JavaPlugin) plugin, SpigotID)).getVersion((update_version) -> { UpdateObject update = new UpdateObject( plugin.getName(), @@ -92,7 +95,6 @@ public class UpdateAPI { update_version ); UpdateAPI.PluginVersionen.put(plugin.getName(), update); - if (!plugin.getDescription().getVersion().equalsIgnoreCase(update_version)) { noUpdate = true; new BukkitRunnable() { @@ -102,7 +104,6 @@ public class UpdateAPI { } }.runTaskLater(plugin, 600L); } else { - if (noUpdate) { send.console(Prefix + " §2No update found."); noUpdate = false; @@ -110,7 +111,7 @@ public class UpdateAPI { } }, Prefix, plugin.getDescription().getVersion()); } - }, 0L, 20 * 60 * 60L); + }, 0L, timeInMin * 60 * 20L); } private JavaPlugin plugin; diff --git a/src/main/java/net/t2code/lib/Spigot/system/Main.java b/src/main/java/net/t2code/lib/Spigot/system/Main.java index fc4fae4..a60e136 100644 --- a/src/main/java/net/t2code/lib/Spigot/system/Main.java +++ b/src/main/java/net/t2code/lib/Spigot/system/Main.java @@ -48,18 +48,17 @@ public final class Main extends JavaPlugin { plugin = this; autor = plugin.getDescription().getAuthors(); version = plugin.getDescription().getVersion(); - UpdateAPI.onUpdateCheck(plugin, prefix, spigot, spigotID, discord); - new UpdateChecker(this, 12345).getVersion(ver -> { - if (this.getDescription().getVersion().equals(version)) { - if (Double.parseDouble(ver) < Double.parseDouble(version)) { - send.console(prefix + " §4 §e-------------------"); - send.console(prefix + " §eYou are running §4" + version + " §eof " + prefix + "§e! §4This is a trial version! §eSome features may not be working as expected. Please report all bugs here: http://dc.t2code.net §4UpdateChecker & bStats may be disabled!"); - send.console(prefix + " §4 §e-------------------"); - } - } - }); Long long_; long_ = T2CodeTemplate.onLoadHeader(prefix, autor, version, spigot, discord); + if (Util.getSnapshot()){ + send.console(prefix + " §eYou are running §4" + version + " §eof " + prefix + "§e! §4This is a trial version! §eSome features may not be working as expected. Please report all bugs here: http://dc.t2code.net §4UpdateChecker & bStats may be disabled!"); + send.console(prefix + " §4 §e-------------------"); + try { + Thread.sleep(5000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + } //send.console("§4 _|_|_|_|_| _|_| _|_|_| _| "); //send.console("§4 _| _| _| _| _|_| _|_|_| _|_| "); @@ -109,6 +108,7 @@ public final class Main extends JavaPlugin { LanguagesCreate.langCreate(); SelectLibConfig.onSelect(); SelectLibMsg.onSelect(prefix); + UpdateAPI.onUpdateCheck(plugin, prefix, spigot, spigotID, discord); Metrics.Bstats(plugin, bstatsID); Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), plugin); diff --git a/src/main/java/net/t2code/lib/Spigot/system/config/ConfigCreate.java b/src/main/java/net/t2code/lib/Spigot/system/config/ConfigCreate.java index 5a5a369..c7f1286 100644 --- a/src/main/java/net/t2code/lib/Spigot/system/config/ConfigCreate.java +++ b/src/main/java/net/t2code/lib/Spigot/system/config/ConfigCreate.java @@ -12,6 +12,7 @@ import java.io.IOException; public class ConfigCreate { private static Boolean UpdateCheckOnJoin = true; + private static Integer UpdateCheckTimeInterval = 60; private static Boolean Debug = false; private static String language = "english"; @@ -38,7 +39,8 @@ public class ConfigCreate { File config = new File(Main.getPath(), "config.yml"); YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config); - Config.set("Plugin.UpdateCheckOnJoin", UpdateCheckOnJoin, yamlConfiguration); + Config.set("Plugin.UpdateCheck.OnJoin", UpdateCheckOnJoin, yamlConfiguration); + Config.set("Plugin.UpdateCheck.TimeInterval", UpdateCheckTimeInterval, yamlConfiguration); Config.set("Plugin.language", language, yamlConfiguration); Config.set("BungeeCord.Enable", Bungee, yamlConfiguration); diff --git a/src/main/java/net/t2code/lib/Spigot/system/config/SelectLibConfig.java b/src/main/java/net/t2code/lib/Spigot/system/config/SelectLibConfig.java index f57a2fc..9769ca1 100644 --- a/src/main/java/net/t2code/lib/Spigot/system/config/SelectLibConfig.java +++ b/src/main/java/net/t2code/lib/Spigot/system/config/SelectLibConfig.java @@ -9,6 +9,7 @@ public class SelectLibConfig { public static Boolean UpdateCheckOnJoin; + public static Integer UpdateCheckTimeInterval; public static Boolean Debug; public static String language; public static Boolean InventoriesCloseByServerStop; @@ -17,7 +18,8 @@ public class SelectLibConfig { File config = new File(Main.getPath(), "config.yml"); YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config); - UpdateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheckOnJoin"); + UpdateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheck.OnJoin"); + UpdateCheckTimeInterval = yamlConfiguration.getInt("Plugin.UpdateCheck.TimeInterval"); Debug = yamlConfiguration.getBoolean("Plugin.Debug"); language = yamlConfiguration.getString("Plugin.language"); InventoriesCloseByServerStop = yamlConfiguration.getBoolean("Player.Inventories.CloseByServerStop"); diff --git a/target/classes/net/t2code/lib/Spigot/Lib/update/UpdateAPI$3$1.class b/target/classes/net/t2code/lib/Spigot/Lib/update/UpdateAPI$3$1.class index cb0ac2f..d429c19 100644 Binary files a/target/classes/net/t2code/lib/Spigot/Lib/update/UpdateAPI$3$1.class and b/target/classes/net/t2code/lib/Spigot/Lib/update/UpdateAPI$3$1.class differ diff --git a/target/classes/net/t2code/lib/Spigot/Lib/update/UpdateAPI$3.class b/target/classes/net/t2code/lib/Spigot/Lib/update/UpdateAPI$3.class index 5db194f..5d68ed7 100644 Binary files a/target/classes/net/t2code/lib/Spigot/Lib/update/UpdateAPI$3.class and b/target/classes/net/t2code/lib/Spigot/Lib/update/UpdateAPI$3.class differ diff --git a/target/classes/net/t2code/lib/Spigot/Lib/update/UpdateAPI.class b/target/classes/net/t2code/lib/Spigot/Lib/update/UpdateAPI.class index 4ec7435..da2a328 100644 Binary files a/target/classes/net/t2code/lib/Spigot/Lib/update/UpdateAPI.class and b/target/classes/net/t2code/lib/Spigot/Lib/update/UpdateAPI.class differ diff --git a/target/classes/net/t2code/lib/Spigot/system/Main.class b/target/classes/net/t2code/lib/Spigot/system/Main.class index 694b433..dd49c94 100644 Binary files a/target/classes/net/t2code/lib/Spigot/system/Main.class and b/target/classes/net/t2code/lib/Spigot/system/Main.class differ diff --git a/target/classes/net/t2code/lib/Spigot/system/config/ConfigCreate.class b/target/classes/net/t2code/lib/Spigot/system/config/ConfigCreate.class index 78d5090..d073feb 100644 Binary files a/target/classes/net/t2code/lib/Spigot/system/config/ConfigCreate.class and b/target/classes/net/t2code/lib/Spigot/system/config/ConfigCreate.class differ diff --git a/target/classes/net/t2code/lib/Spigot/system/config/SelectLibConfig.class b/target/classes/net/t2code/lib/Spigot/system/config/SelectLibConfig.class index b0c1611..d8f114d 100644 Binary files a/target/classes/net/t2code/lib/Spigot/system/config/SelectLibConfig.class and b/target/classes/net/t2code/lib/Spigot/system/config/SelectLibConfig.class differ