From 03d4e8f8ed957944a59acf335962f49ed0521492 Mon Sep 17 00:00:00 2001 From: JaTiTV Date: Tue, 15 Nov 2022 15:31:17 +0100 Subject: [PATCH] 1.6 --- pom.xml | 4 +-- src/main/java/de/jatitv/papitest/Util.java | 8 ++++-- .../de/jatitv/papitest/config/Config.java | 27 +++++++++++++++---- .../java/de/jatitv/papitest/system/Main.java | 10 ++++--- 4 files changed, 36 insertions(+), 13 deletions(-) diff --git a/pom.xml b/pom.xml index 9c4b00b..65bcba6 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ de.jatitv PaPiTest - 1.5 + 1.6 jar PaPiTest @@ -78,7 +78,7 @@ net.t2code T2CodeLib - 13.0 + 13.4 diff --git a/src/main/java/de/jatitv/papitest/Util.java b/src/main/java/de/jatitv/papitest/Util.java index 946581a..ee97a26 100644 --- a/src/main/java/de/jatitv/papitest/Util.java +++ b/src/main/java/de/jatitv/papitest/Util.java @@ -7,7 +7,7 @@ public class Util { } public static String getRequiredT2CodeLibVersion() { - return "13.0"; + return "13.4"; } public static String getPrefix() { @@ -18,8 +18,12 @@ public class Util { return 90439; } + public static String getGit() { + return "JaTiTV/PaPiTest"; + } + public static Integer getBstatsID() { - return 10342; + return 10767; } public static String getSpigot() { diff --git a/src/main/java/de/jatitv/papitest/config/Config.java b/src/main/java/de/jatitv/papitest/config/Config.java index dbb6a7c..470f2a4 100644 --- a/src/main/java/de/jatitv/papitest/config/Config.java +++ b/src/main/java/de/jatitv/papitest/config/Config.java @@ -15,7 +15,9 @@ public class Config { public static Integer ConfigVersion = 1; - public static Boolean UpdateCheckOnJoin = true; + public static Boolean updateCheckOnJoin; + public static Boolean updateCheckSeePreReleaseUpdates; + public static Integer updateCheckTimeInterval; public static Boolean Titel = true; public static void configCreate() { @@ -27,12 +29,27 @@ public class Config { yamlConfiguration.set("ConfigVersion", ConfigVersion); - if (yamlConfiguration.contains("Plugin.UpdateCheckOnJoin")) { - UpdateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheckOnJoin"); + if (yamlConfiguration.contains("Plugin.updateCheck.onJoin")) { + updateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.updateCheck.onJoin"); } else { - yamlConfiguration.set("Plugin.UpdateCheckOnJoin", true); - Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §4Setting §6UpdateCheckOnJoin §4was added to §9Config.yml§4!"); + yamlConfiguration.set("Plugin.updateCheck.onJoin", true); + Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §4Setting §6updateCheck onJoin §4was added to §9Config.yml§4!"); } + + if (yamlConfiguration.contains("Plugin.updateCheck.seePreReleaseUpdates")) { + updateCheckSeePreReleaseUpdates = yamlConfiguration.getBoolean("Plugin.updateCheck.seePreReleaseUpdates"); + } else { + yamlConfiguration.set("Plugin.updateCheck.seePreReleaseUpdates", true); + Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §4Setting §6updateCheck seePreReleaseUpdates §4was added to §9Config.yml§4!"); + } + + if (yamlConfiguration.contains("Plugin.updateCheck.timeInterval")) { + updateCheckTimeInterval = yamlConfiguration.getInt("Plugin.updateCheck.timeInterval"); + } else { + yamlConfiguration.set("Plugin.updateCheck.timeInterval", 60); + Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §4Setting §6updateCheck timeInterval §4was added to §9Config.yml§4!"); + } + if (!T2CmcVersion.isMc1_8()) { if (yamlConfiguration.contains("Titel.Enable")) { Titel = yamlConfiguration.getBoolean("Titel.Enable"); diff --git a/src/main/java/de/jatitv/papitest/system/Main.java b/src/main/java/de/jatitv/papitest/system/Main.java index ec16d3b..bbcb551 100644 --- a/src/main/java/de/jatitv/papitest/system/Main.java +++ b/src/main/java/de/jatitv/papitest/system/Main.java @@ -6,6 +6,7 @@ import de.jatitv.papitest.Util; import de.jatitv.papitest.commands.CmdExecuter; import de.jatitv.papitest.commands.TabComplete; import de.jatitv.papitest.config.Config; +import net.t2code.t2codelib.SPIGOT.api.messages.T2Ctemplate; import net.t2code.t2codelib.SPIGOT.api.plugins.T2CpluginCheck; import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI; import org.bukkit.Bukkit; @@ -34,8 +35,7 @@ public final class Main extends JavaPlugin { if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return; Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §4Plugin load..."); - T2CupdateAPI.onUpdateCheck(plugin,Util.getPrefix(),Util.getSpigotID(),Util.getDiscord()); - Metrics.Bstats(Main.plugin, Util.getBstatsID()); + Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §8-------------------------------"); Config.configCreate(); @@ -55,8 +55,9 @@ public final class Main extends JavaPlugin { getCommand("papitest").setTabCompleter(new TabComplete()); Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), this); - int pluginId = 10767; // <-- Replace with the id of your plugin! - Metrics metrics = new Metrics(this, pluginId); + T2CupdateAPI.onUpdateCheck(plugin, Util.getPrefix(), Util.getGit(), Util.getSpigotID(), Util.getDiscord() + , Config.updateCheckOnJoin, Config.updateCheckSeePreReleaseUpdates, Config.updateCheckTimeInterval); + Metrics.Bstats(Main.plugin, Util.getBstatsID()); } @@ -64,6 +65,7 @@ public final class Main extends JavaPlugin { @Override public void onDisable() { // Plugin shutdown logic + T2Ctemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord()); } public static Boolean pluginNotFound(String pl, Integer spigotID, String ver) {