Update Checker | GhostLeaks.eu
Welcome at the GhostLeaks
We bringing a new era of leaks

Update Checker

  • Hey Guest!

    Our hosting provider or CloudFlare won't reply to any DMCA takedown notice!

    If you wish TakeDown of your resource then,
    Contact us at discord: TheSpace#0829


    Please allow up to a week for a discord reply!
  • Hey Guest !

    In order to be able to download resources,
    You need to register. Register by the Button at upside at right.

    Thanks for reading me :)

ProAnimator

Web Developer
Staff member
Web developer
Dec 25, 2020
24
5
5
Coins
614
To add a our api to check for updates, you will need to add the following code right under the onEnable().


Code:
    public void update() {
        String newVersion = getDescription().getVersion();
        String api = "https://ghostleaks.eu/api/v2/update.php";
      try
      {
        URLConnection localURLConnection = new URL(api + "?resource=" + "%%__RESOURCE__%%" + "&version=" + newVersion).openConnection();
        localURLConnection.setRequestProperty("User-Agent", "Mozilla/5.0");
        localURLConnection.connect();
      
        BufferedReader localBufferedReader = new BufferedReader(new InputStreamReader(localURLConnection.getInputStream(), Charset.forName("UTF-8")));
      
        StringBuilder localStringBuilder = new StringBuilder();
        String str1;
        while ((str1 = localBufferedReader.readLine()) != null) {
          localStringBuilder.append(str1);
        }
        String str2 = localStringBuilder.toString();
        ConsoleCommandSender console = getServer().getConsoleSender();
        if(str2.equals("UPDATE")) {
            console.sendMessage("[GhostLeaks] An update has been found!");
            console.sendMessage("[GhostLeaks] https://ghostleaks.eu/resources/" + "%%__RESOURCE__%%");
        }
        if(str2.equals("ERR")) {
            console.sendMessage("[GhostLeaks] Error while checking for updates!");
        }
        if(str2.equals("CURRENT")) {
               console.sendMessage("[GhostLeaks] You are running the latest version!");
        } 
        if (str2.equals(null)){
            console.sendMessage("[GhostLeaks] Resource could not be found!");
        }
      }
      catch (IOException localIOException)
      {
          System.out.print("Error: Please ensure your running the latest version!");
      }
    }
Once added, you will need to add
Code:
update();
in the onEnable() section and then your done.


Example:

1609139779761.png
 

Create an account or login to comment

You must be a member in order to leave a comment

Create account

Create an account on our community. It's easy!

Log in

Already have an account? Log in here.