This commit is contained in:
JaTiTV 2022-11-15 15:31:17 +01:00
parent 69fd07b183
commit 03d4e8f8ed
4 changed files with 36 additions and 13 deletions

View File

@ -6,7 +6,7 @@
<groupId>de.jatitv</groupId> <groupId>de.jatitv</groupId>
<artifactId>PaPiTest</artifactId> <artifactId>PaPiTest</artifactId>
<version>1.5</version> <version>1.6</version>
<packaging>jar</packaging> <packaging>jar</packaging>
<name>PaPiTest</name> <name>PaPiTest</name>
@ -78,7 +78,7 @@
<dependency> <dependency>
<groupId>net.t2code</groupId> <groupId>net.t2code</groupId>
<artifactId>T2CodeLib</artifactId> <artifactId>T2CodeLib</artifactId>
<version>13.0</version> <version>13.4</version>
</dependency> </dependency>
</dependencies> </dependencies>
</project> </project>

View File

@ -7,7 +7,7 @@ public class Util {
} }
public static String getRequiredT2CodeLibVersion() { public static String getRequiredT2CodeLibVersion() {
return "13.0"; return "13.4";
} }
public static String getPrefix() { public static String getPrefix() {
@ -18,8 +18,12 @@ public class Util {
return 90439; return 90439;
} }
public static String getGit() {
return "JaTiTV/PaPiTest";
}
public static Integer getBstatsID() { public static Integer getBstatsID() {
return 10342; return 10767;
} }
public static String getSpigot() { public static String getSpigot() {

View File

@ -15,7 +15,9 @@ public class Config {
public static Integer ConfigVersion = 1; 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 Boolean Titel = true;
public static void configCreate() { public static void configCreate() {
@ -27,12 +29,27 @@ public class Config {
yamlConfiguration.set("ConfigVersion", ConfigVersion); yamlConfiguration.set("ConfigVersion", ConfigVersion);
if (yamlConfiguration.contains("Plugin.UpdateCheckOnJoin")) { if (yamlConfiguration.contains("Plugin.updateCheck.onJoin")) {
UpdateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.UpdateCheckOnJoin"); updateCheckOnJoin = yamlConfiguration.getBoolean("Plugin.updateCheck.onJoin");
} else { } else {
yamlConfiguration.set("Plugin.UpdateCheckOnJoin", true); yamlConfiguration.set("Plugin.updateCheck.onJoin", true);
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §4Setting §6UpdateCheckOnJoin §4was added to §9Config.yml§4!"); 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 (!T2CmcVersion.isMc1_8()) {
if (yamlConfiguration.contains("Titel.Enable")) { if (yamlConfiguration.contains("Titel.Enable")) {
Titel = yamlConfiguration.getBoolean("Titel.Enable"); Titel = yamlConfiguration.getBoolean("Titel.Enable");

View File

@ -6,6 +6,7 @@ import de.jatitv.papitest.Util;
import de.jatitv.papitest.commands.CmdExecuter; import de.jatitv.papitest.commands.CmdExecuter;
import de.jatitv.papitest.commands.TabComplete; import de.jatitv.papitest.commands.TabComplete;
import de.jatitv.papitest.config.Config; 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.plugins.T2CpluginCheck;
import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI; import net.t2code.t2codelib.SPIGOT.api.update.T2CupdateAPI;
import org.bukkit.Bukkit; import org.bukkit.Bukkit;
@ -34,8 +35,7 @@ public final class Main extends JavaPlugin {
if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return; if (pluginNotFound("T2CodeLib", 96388, Util.getRequiredT2CodeLibVersion())) return;
Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §4Plugin load..."); 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-------------------------------"); Bukkit.getConsoleSender().sendMessage(Util.getPrefix() + " §8-------------------------------");
Config.configCreate(); Config.configCreate();
@ -55,8 +55,9 @@ public final class Main extends JavaPlugin {
getCommand("papitest").setTabCompleter(new TabComplete()); getCommand("papitest").setTabCompleter(new TabComplete());
Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), this); Bukkit.getServer().getPluginManager().registerEvents(new JoinEvent(), this);
int pluginId = 10767; // <-- Replace with the id of your plugin! T2CupdateAPI.onUpdateCheck(plugin, Util.getPrefix(), Util.getGit(), Util.getSpigotID(), Util.getDiscord()
Metrics metrics = new Metrics(this, pluginId); , Config.updateCheckOnJoin, Config.updateCheckSeePreReleaseUpdates, Config.updateCheckTimeInterval);
Metrics.Bstats(Main.plugin, Util.getBstatsID());
} }
@ -64,6 +65,7 @@ public final class Main extends JavaPlugin {
@Override @Override
public void onDisable() { public void onDisable() {
// Plugin shutdown logic // Plugin shutdown logic
T2Ctemplate.onDisable(Util.getPrefix(), autor, version, Util.getSpigot(), Util.getDiscord());
} }
public static Boolean pluginNotFound(String pl, Integer spigotID, String ver) { public static Boolean pluginNotFound(String pl, Integer spigotID, String ver) {