@@ -20,10 +20,13 @@ public class VersionChk {
2020
2121 private static final Logger log = Logger .getLogger ("Minecraft" );
2222
23+ public static String [] changelog ;
24+
2325 public static void checkVersion (String name , int id ) throws Exception { //https://api.spigotmc.org/legacy/update.php?resource=76103"
2426
2527 //https://api.github.com/repos/MrButtersDEV/AutoPickup/releases/latest
2628 String url = "https://api.spigotmc.org/legacy/update.php?resource=" +id ;
29+ String url2 = "https://raw.githubusercontent.com/MrButtersDEV/AutoPickup/master/update-info.txt" ;
2730
2831 URL obj = new URL (url );
2932 HttpURLConnection con = (HttpURLConnection ) obj .openConnection ();
@@ -37,8 +40,7 @@ public static void checkVersion(String name, int id) throws Exception { //https:
3740 int responseCode = con .getResponseCode ();
3841 PLUGIN .getServer ().getConsoleSender ().sendMessage (PLUGIN .getMsg ().getPrefix () + ChatColor .RESET +" Checking for new verison..." );
3942
40- BufferedReader in = new BufferedReader (
41- new InputStreamReader (con .getInputStream ()));
43+ BufferedReader in = new BufferedReader (new InputStreamReader (con .getInputStream ()));
4244 String inputLine ;
4345 StringBuffer response = new StringBuffer ();
4446
@@ -47,6 +49,28 @@ public static void checkVersion(String name, int id) throws Exception { //https:
4749 }
4850 in .close ();
4951
52+ URL obj2 = new URL (url2 );
53+ HttpURLConnection con2 = (HttpURLConnection ) obj2 .openConnection ();
54+
55+ // optional default is GET
56+ con2 .setRequestMethod ("GET" );
57+
58+ //add request header
59+ con2 .setRequestProperty ("User-Agent" , USER_AGENT );
60+
61+ int responseCode2 = con2 .getResponseCode ();
62+
63+ BufferedReader in2 = new BufferedReader (new InputStreamReader (con2 .getInputStream ()));
64+ String inputLine2 ;
65+ StringBuffer response2 = new StringBuffer ();
66+
67+ while ((inputLine2 = in2 .readLine ()) != null ) {
68+ response2 .append (inputLine2 );
69+ }
70+ in2 .close ();
71+
72+ changelog = response2 .toString ().split ("- " );
73+
5074 //print result
5175 String spigotVerison = response .toString ();
5276 String ver = Bukkit .getServer ().getPluginManager ().getPlugin (name ).getDescription ().getVersion ();
@@ -56,6 +80,11 @@ public static void checkVersion(String name, int id) throws Exception { //https:
5680 PLUGIN .getServer ().getConsoleSender ().sendMessage (PLUGIN .getMsg ().getPrefix () + ChatColor .RED + " UPDATE FOUND: " + ChatColor .GREEN + "https://www.spigotmc.org/resources/" +id +"/" );
5781 PLUGIN .getServer ().getConsoleSender ().sendMessage (PLUGIN .getMsg ().getPrefix () + ChatColor .GOLD + " Version: " + ChatColor .GREEN + response .toString () + ChatColor .AQUA + " Using Version: " + ChatColor .DARK_AQUA + ver );
5882 PLUGIN .UP2Date = false ;
83+ for (String s : changelog ) {
84+ if (s .isEmpty ())
85+ continue ;
86+ PLUGIN .getServer ().getConsoleSender ().sendMessage (PLUGIN .getMsg ().getPrefix () + ChatColor .YELLOW + " - " + s );
87+ }
5988 }
6089
6190 // Config Version:
0 commit comments