From ab4b6ee6887aef3d6222c150d1ca56f2b55fbe04 Mon Sep 17 00:00:00 2001 From: Bryson Steck Date: Sun, 6 Jun 2021 17:17:52 -0600 Subject: added updater, checking if it works... --- src/net/brysonsteck/Resurrection/Resurrection.java | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) (limited to 'src/net/brysonsteck/Resurrection/Resurrection.java') diff --git a/src/net/brysonsteck/Resurrection/Resurrection.java b/src/net/brysonsteck/Resurrection/Resurrection.java index bfd8363..00c5568 100644 --- a/src/net/brysonsteck/Resurrection/Resurrection.java +++ b/src/net/brysonsteck/Resurrection/Resurrection.java @@ -2,8 +2,10 @@ package net.brysonsteck.Resurrection; import net.brysonsteck.Resurrection.commands.CommandAbout; import net.brysonsteck.Resurrection.commands.CommandResurrect; +import net.brysonsteck.Resurrection.startup.CheckForUpdate; import org.bukkit.command.CommandExecutor; import org.bukkit.plugin.Plugin; +import org.bukkit.plugin.PluginDescriptionFile; import org.bukkit.plugin.java.JavaPlugin; public class Resurrection extends JavaPlugin { @@ -18,6 +20,20 @@ public class Resurrection extends JavaPlugin { @Override public void onEnable() { super.onEnable(); + PluginDescriptionFile pluginInfo = getDescription(); + + // check for updates + System.out.println("[Resurrection] Checking for updates..."); + CheckForUpdate check = new CheckForUpdate(); + String newestVersion = check.getVersion(); + String newestVersionURL = check.getVersionURL(); + if (pluginInfo.getVersion().equals(newestVersion)) { + System.out.println("[Resurrection] " + newestVersion + " is the latest version of Resurrection."); + } else { + System.out.println("[Resurrection] A new version of Resurrection is available! (current: " + pluginInfo.getVersion() + ", newest: " + newestVersion); + System.out.println("[Resurrection] You can download the latest release on GitHub here \\/"); + System.out.println("[Resurrection] " + newestVersionURL); + } // register listener this.getServer().getPluginManager().registerEvents(new PlayerListener(), this); @@ -26,11 +42,12 @@ public class Resurrection extends JavaPlugin { this.getCommand("about").setExecutor(new CommandAbout()); this.getCommand("resurrect").setExecutor(new CommandResurrect()); - System.out.println("[Resurrection] I'm alive!"); + System.out.println("[Resurrection] Successfully Started."); } // end of spigot things public static void main(String[] args) { + // PlayerData playerData = new PlayerData(); // playerData.saveData("This is the first line\nthis is the second line"); // System.out.println(playerData.getPlayers()); -- cgit v1.2.3