From 8114035cd945d403e795f867bf1fbf5df8d2a1f6 Mon Sep 17 00:00:00 2001 From: JaTiTV Date: Mon, 14 Nov 2022 22:59:17 +0100 Subject: [PATCH] seePreReleaseUpdates #1 --- .../BUNGEE/api/update/T2CBupdateAPI.java | 1 + .../BUNGEE/system/config/T2CBlibConfig.java | 6 ++++ .../SPIGOT/api/update/T2CupdateAPI.java | 1 + .../SPIGOT/system/cmd/CreateReportLog.java | 12 ++++--- .../system/config/config/ConfigCreate.java | 1 + .../system/config/config/SelectLibConfig.java | 35 ++++++++++++------- 6 files changed, 38 insertions(+), 18 deletions(-) diff --git a/src/main/java/net/t2code/t2codelib/BUNGEE/api/update/T2CBupdateAPI.java b/src/main/java/net/t2code/t2codelib/BUNGEE/api/update/T2CBupdateAPI.java index 8e2bf32..7a0b001 100644 --- a/src/main/java/net/t2code/t2codelib/BUNGEE/api/update/T2CBupdateAPI.java +++ b/src/main/java/net/t2code/t2codelib/BUNGEE/api/update/T2CBupdateAPI.java @@ -31,6 +31,7 @@ public class T2CBupdateAPI { String pluginVersion = plugin.getDescription().getVersion(); String value; if (webData.isPreRelease()) { + if (!T2CBlibConfig.getSeePreReleaseUpdates()) return; value = UpdateType.PRERELEASE.text; if (publicVersion.toLowerCase().contains("dev")) { value = UpdateType.DEVELOPMENT.text; diff --git a/src/main/java/net/t2code/t2codelib/BUNGEE/system/config/T2CBlibConfig.java b/src/main/java/net/t2code/t2codelib/BUNGEE/system/config/T2CBlibConfig.java index 88ba548..1ee83fd 100644 --- a/src/main/java/net/t2code/t2codelib/BUNGEE/system/config/T2CBlibConfig.java +++ b/src/main/java/net/t2code/t2codelib/BUNGEE/system/config/T2CBlibConfig.java @@ -36,6 +36,7 @@ public class T2CBlibConfig { Configuration configuration = ConfigurationProvider.getProvider(YamlConfiguration.class).load(config); updateTimer = configuration.getInt("UpdateCheck.TimerInMin"); + seePreReleaseUpdates = configuration.getBoolean("UpdateCheck.SeePreReleaseUpdates"); apiCommandGUIEnable = configuration.getBoolean("API.CommandGUI.Enable"); apiAutoResponse = configuration.getBoolean("API.AutoResponse.Enable"); @@ -43,6 +44,7 @@ public class T2CBlibConfig { } private static Integer updateTimer; + private static Boolean seePreReleaseUpdates; private static Boolean apiCommandGUIEnable; private static Boolean apiAutoResponse; private static Boolean apiOpSecurity; @@ -51,6 +53,10 @@ public class T2CBlibConfig { return updateTimer; } + public static Boolean getSeePreReleaseUpdates() { + return seePreReleaseUpdates; + } + public static Boolean getApiCommandGUIEnable() { return apiCommandGUIEnable; } diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateAPI.java b/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateAPI.java index 7e92a48..8d2c819 100644 --- a/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateAPI.java +++ b/src/main/java/net/t2code/t2codelib/SPIGOT/api/update/T2CupdateAPI.java @@ -61,6 +61,7 @@ public class T2CupdateAPI { String value; if (webData.isPreRelease()) { + if (!SelectLibConfig.getSeePreReleaseUpdates()) return; value = UpdateType.PRERELEASE.text; if (publicVersion.toLowerCase().contains("dev")) { value = UpdateType.DEVELOPMENT.text; diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/system/cmd/CreateReportLog.java b/src/main/java/net/t2code/t2codelib/SPIGOT/system/cmd/CreateReportLog.java index 8d49b21..3835b40 100644 --- a/src/main/java/net/t2code/t2codelib/SPIGOT/system/cmd/CreateReportLog.java +++ b/src/main/java/net/t2code/t2codelib/SPIGOT/system/cmd/CreateReportLog.java @@ -158,11 +158,13 @@ public class CreateReportLog { zipFile.delete(); directoryTemp.delete(); if (sender instanceof Player) { - T2Csend.sender(sender, Util.getPrefix() + ("A DebugLog zip has been created. You can download it " + - "Download the debug file'>here. Please enter the following key " + - "in the ticket: Copy to clipboard'>[key]" + - "
Do not share the download URL with anyone!
" + - "You can Click to delete'>delte yor Debug-File by clicking me.").replace("[key]", fileID).replace("[url]", downloadURL)); + T2Csend.sender(sender, ("[prefix] A DebugLog zip has been created." + + "
[prefix] You can download it Download the debug file'>here." + + "
[prefix] Please enter the following key in the ticket: Copy to clipboard'>[key]
" + + "
[prefix]Do not share the download URL with anyone!" + + "
[prefix] Click to delete'>You can delte yor Debug-File by clicking me." + + "
[prefix] (If you do not delete the debug file, it will be deleted automatically after 14 days!)").replace("[key]", fileID) + .replace("[url]", downloadURL).replace("[prefix]",Util.getPrefix())); } T2Csend.console(Util.getPrefix() + (" §6A DebugLog zip has been created. You can download it here: [url].\n§6Please enter the following key in the ticket:" + " §e[key].\n§4Do not share the download URL with anyone!\nYou can delte yor Debug-File with the following command: /t2code debug deleteReportLog [key].") diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/system/config/config/ConfigCreate.java b/src/main/java/net/t2code/t2codelib/SPIGOT/system/config/config/ConfigCreate.java index 6cb30b2..4b20482 100644 --- a/src/main/java/net/t2code/t2codelib/SPIGOT/system/config/config/ConfigCreate.java +++ b/src/main/java/net/t2code/t2codelib/SPIGOT/system/config/config/ConfigCreate.java @@ -24,6 +24,7 @@ public class ConfigCreate { T2Cconfig.set("Plugin.UpdateCheck.OnJoin", true, yamlConfiguration); T2Cconfig.set("Plugin.UpdateCheck.TimeInterval", 60, yamlConfiguration); + T2Cconfig.set("Plugin.UpdateCheck.SeePreReleaseUpdates", true, yamlConfiguration); T2Cconfig.set("Plugin.language", "english", yamlConfiguration); T2Cconfig.set("BungeeCord.Enable", false, yamlConfiguration); diff --git a/src/main/java/net/t2code/t2codelib/SPIGOT/system/config/config/SelectLibConfig.java b/src/main/java/net/t2code/t2codelib/SPIGOT/system/config/config/SelectLibConfig.java index 93b9ad0..5ac9f9a 100644 --- a/src/main/java/net/t2code/t2codelib/SPIGOT/system/config/config/SelectLibConfig.java +++ b/src/main/java/net/t2code/t2codelib/SPIGOT/system/config/config/SelectLibConfig.java @@ -7,29 +7,34 @@ import java.io.File; public class SelectLibConfig { - private static Boolean UpdateCheckOnJoin; + private static Boolean updateCheckOnJoin; private static Boolean t2cTestDevelopment = false; - private static Integer UpdateCheckTimeInterval; - private static Boolean Debug; + private static Integer updateCheckTimeInterval; + private static Boolean seePreReleaseUpdates; + private static Boolean debug; private static String language; private static Boolean bungee; - private static Boolean InventoriesCloseByServerStop; + private static Boolean inventoriesCloseByServerStop; public static void onSelect() { File config = new File(T2CodeLibMain.getPath(), "config.yml"); YamlConfiguration yamlConfiguration = YamlConfiguration.loadConfiguration(config); - UpdateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheck.OnJoin"); - t2cTestDevelopment = yamlConfiguration.getBoolean("t2cTestDevelopment"); - UpdateCheckTimeInterval = yamlConfiguration.getInt("Plugin.UpdateCheck.TimeInterval"); - Debug = yamlConfiguration.getBoolean("Plugin.Debug"); + if (yamlConfiguration.contains("t2cTestDevelopment")){ + t2cTestDevelopment = yamlConfiguration.getBoolean("t2cTestDevelopment"); + } + + updateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheck.OnJoin"); + updateCheckTimeInterval = yamlConfiguration.getInt("Plugin.UpdateCheck.TimeInterval"); + seePreReleaseUpdates = yamlConfiguration.getBoolean("Plugin.UpdateCheck.SeePreReleaseUpdates"); + debug = yamlConfiguration.getBoolean("Plugin.Debug"); language = yamlConfiguration.getString("Plugin.language"); bungee = yamlConfiguration.getBoolean("BungeeCord.Enable"); - InventoriesCloseByServerStop = yamlConfiguration.getBoolean("Player.Inventories.CloseByServerStop"); + inventoriesCloseByServerStop = yamlConfiguration.getBoolean("Player.Inventories.CloseByServerStop"); } public static Boolean getUpdateCheckOnJoin() { - return UpdateCheckOnJoin; + return updateCheckOnJoin; } public static Boolean getT2cTestDevelopment() { @@ -37,11 +42,15 @@ public class SelectLibConfig { } public static Integer getUpdateCheckTimeInterval() { - return UpdateCheckTimeInterval; + return updateCheckTimeInterval; + } + + public static Boolean getSeePreReleaseUpdates() { + return seePreReleaseUpdates; } public static Boolean getDebug() { - return Debug; + return debug; } public static String getLanguage() { @@ -53,7 +62,7 @@ public class SelectLibConfig { } public static Boolean getInventoriesCloseByServerStop() { - return InventoriesCloseByServerStop; + return inventoriesCloseByServerStop; } }