Advertisement
Insprill

code

Nov 13th, 2019
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. private void versionChecker() {
  2. try {
  3. HttpURLConnection connection = (HttpURLConnection) new URL("http://www.spigotmc.org/api/general.php").openConnection();
  4. connection.setDoOutput(true);
  5. connection.setRequestMethod("POST");
  6. connection.getOutputStream().write((key + 72711).getBytes("UTF-8"));
  7. String version = new BufferedReader (new InputStreamReader(connection.getInputStream())).readLine();
  8.  
  9. if (!version.equals("1.0")) {
  10. this.getServer().getConsoleSender().sendMessage(Utils.chat("You do not have the most updated version of Clear Chat. Please update it here: https://www.spigotmc.org/resources/clear-chat.72711/"));
  11. } else {
  12. this.getServer().getConsoleSender().sendMessage(Utils.chat("Clear Chat is up to date!"));
  13. }
  14. } catch (IOException e) {
  15. this.getServer().getConsoleSender().sendMessage(Utils.chat("&4ERROR: Could not make connection to SpigotMC.org"));
  16. e.printStackTrace();
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement