Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public String key = "resource=";
- public void VersionChecker(int idOfPlugin, String nameOfPlugin, String versionofPlugin){
- try {
- HttpURLConnection connection = (HttpURLConnection) new URL("https://api.spigotmc.org/legacy/update.php").openConnection();
- connection.setDoOutput(true);
- connection.setRequestMethod("GET");
- connection.getOutputStream().write((idOfPlugin));
- String version = new BufferedReader(new InputStreamReader(connection.getInputStream())).readLine();
- if (!version.equals(versionofPlugin)){
- System.out.println(ChatColor.GOLD + "New version of " + nameOfPlugin + " is available");
- }else{
- System.out.println(ChatColor.GREEN + nameOfPlugin + " is up to date");
- }
- } catch (IOException e) {
- System.out.println(ChatColor.RED + "Unable to chceck the newest version of " + nameOfPlugin);
- e.printStackTrace();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement