[HOW TO] Update Checker

Discussion in 'Plugin Development' started by DreTaX, Jun 17, 2013.

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

    DreTaX

  2. Offline

    caseif

    Great work on the updater, but shouldn't this be in the Resources subforum?
     
    Hoolean likes this.
  3. Offline

    CoderCloud

    Good Work,
    but I think there is no directlink when you upload a Plugin to DevBukkit. So you cant use this Updates as long as you dont have your own fileServer.
     
  4. Offline

    Wingzzz

    No, you should be able to check against BukkitDev plugin files afaik but there are certain terms you must abide by I believe such as how often you check / connecting to the server / download limits (as far as I remember).
     
  5. Offline

    DreTaX

    Thanks.

    Well happens xD

    Not true. You can use dropbox's direct link or even githubs raw link. It's just that easy.
     
  6. Offline

    CoderCloud


    I dont know can you update a File without changing the link to the File. I havent used DropBox bevore so i dont know.
     
  7. Offline

    DreTaX

    Well yeah. You just edit the file and thats it. Just like github. You put the raw link in the code, and you just edit the file. Link stays the same.

    See: https://raw.github.com/dretax/Saving-it/master/update.txt

    Also in dropbox: https://www.dropbox.com/s/9b10nmrvwgrm2zw/as.txt

    Example: https://github.com/dretax/Saving-it/blob/master/src/main/java/me/dretax/SaveIt/SaveItUpdate.java
     
  8. Offline

    CoderCloud

    I didnt know that. Then your script will be a usefull update tool.

    The only thing, that i see is that when you use versions like 1.11 and then 2.0 the version 1.11 would be choosen for the update. I would use something like that:
    Code:
    String[] version = ?.split(".");
    String[] updateVersion = ?.split(".");
    boolean update = false;
     
    if(version.length > 0 && updateVersion.length > 0) {
        int i1 = Integer.phraseInt(version[0]);
        int i2 = Integer.phraseInt(updateVersion[0]);
     
        if(i2 > i1)
            update = true;
        else if(i2 == i1){
            if(version.length > 1 && updateVersion.length > 1)
                char[] v = version.toCharArray();
                char[] uv = updateVersion.toCharArray();
                for(int i = 0; i<version.toCharArray().length; i++)
                    if(uv.length > i)
                        if(Integer.phraseInt(uv[i])>Integer.phraseInt(v[i])) {
                            update = true;
                            break;
                        } else if(Integer.phraseInt(uv[i])<Integer.phraseInt(v[i]))
                            break;
        }
    }
    Then your versions can have numbers like 2.25, 1.10, 1.01, ... and the version numbers will get phrased correctly.
     
Thread Status:
Not open for further replies.

Share This Page