Solved x has been updated!

Discussion in 'Plugin Development' started by Pink__Slime, May 7, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    Pink__Slime

    So I've seen a few plugins, VanishNoPacket & CommandSigns to name 2, that will send the player a message in chat when there is a new version of their plugin available.

    Can someone please tell me how this is done?
     
  2. Offline

    Barinade

    Write the latest version somewhere on a website you own, read it from your plugin, compare
     
  3. Offline

    Pink__Slime

    How would I read it exactly?

    EDIT: Just created a file on my website with the version on it, http://theaetherserver.com/v/pvpflight.html
     
  4. Offline

    Barinade

  5. Offline

    Pink__Slime

    Barinade
    Ok, is there a way to get the version from the plugin.yml as a double?

    If this works it will do but it would be so much easier if I could get the version as a double.
    Code:java
    1. @EventHandler
    2. public void login(PlayerLoginEvent event){
    3. Player player = event.getPlayer();
    4. try {
    5. double latest = Double.parseDouble(new BufferedReader(new InputStreamReader(new URL("[URL]http://theaetherserver.com/v/pvpflight.html[/URL]").openConnection().getInputStream())).readLine());
    6. double current = 2.0;
    7. if(player.isOp() == true){
    8. if(current < latest){
    9. player.sendMessage(ChatColor.GOLD + "[" + ChatColor.AQUA + "PVP Flight" + ChatColor.GOLD + "] " + ChatColor.YELLOW + "v" + latest + " is out! You are only using v" + current + "!");
    10. }
    11. }
    12. } catch (NumberFormatException e) {
    13. // TODO Auto-generated catch block
    14. e.printStackTrace();
    15. } catch (MalformedURLException e) {
    16. // TODO Auto-generated catch block
    17. e.printStackTrace();
    18. } catch (IOException e) {
    19. // TODO Auto-generated catch block
    20. e.printStackTrace();
    21. }
    22. }


    Barinade
    Ok that doesn't work.
    If it isn't obvious already, I'm not the best at Java ^.^

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  6. Offline

    MP5K

  7. Offline

    Pink__Slime

    1. That just gives me information on Auto-Updaters and the rules on using them.
    2. I do not plan on using them.

    Thanks though.

    bump

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 1, 2016
  8. Offline

    kreashenz

    There was a class that one of the admins made, for doing this. Maybe you should search for it. Autoupdater or something..
     
  9. Offline

    Barinade

    What was the error?
     
  10. Offline

    Pink__Slime

    Wasn't one...
     
  11. Offline

    r0306

  12. Offline

    Cro007

  13. Offline

    Barinade

    Print the readLine as a string and see what it says
     
  14. Offline

    Pink__Slime

    I know what the problem was before... I was using PlayerLoginEvent when I should have been using PlayerJoinEvent. I guess my post before didn't work?
     
Thread Status:
Not open for further replies.

Share This Page