AutoUpdate - Update your plugins!

Discussion in 'Resources' started by V10lator, Jul 3, 2012.

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

    iKeirNez

    You could do "public boolean debug = false;" and then for CommandsEX I can just edit it to "public boolean debug = CommandsEX.getConfig().getBoolean("debug");"
     
  2. Offline

    p000ison

    I would prefere setDebug :p
     
  3. Offline

    Comphenix

    I see you're including your own stripped down version of org.json.simple, but I don't see why that's necessary. Bukkit includes this library in the API jar, allowing you to import it directly without having to install your own copy.

    The version in Bukkit is slightly different though - you have to use JSONParser to get the initial JSONObject, and then use get (with casts) instead of getString() and so on.

    I posted a modified (relevant commit) version of AutoUpdate in my GitHub repository:
    https://github.com/aadnk/Experience.../src/com/comphenix/xp/metrics/AutoUpdate.java

    Note that I also replaced printStackTraceSync with my own version.
     
  4. Offline

    V10lator

    I used a stripped down version of org.json. I implemented this in v1.1, thanks. :)
    Now you're making things more complicated than they have to be.
     
  5. Offline

    p000ison

    I think he only changed the array to a list :p Does the console support /n? If yes why dont use this?
     
  6. Offline

    Comphenix

    No problem. This is a great resource, so I wanted to contribute something back.

    Well, it's mostly because I wanted the error report to not exceed 80 characters (and be cut up in the console), and also because I suspected using ToStringBuilder.relfectionToString() and an array list might make the code smaller and easier to maintain.

    It doesn't matter though, it was just an idea I had for my version. :p
     
    V10lator likes this.
  7. Offline

    p000ison

    k :p one think I really would like is, if this would be hosted in a git repo, so everyone can make pull requests :p
     
  8. Offline

    V10lator

    But we use fixed-size arrays cause we know the size and so it's faster than using a list. He converts all the arrays to lists which justs slows down the code (and he does this in the main thread).
    I don't think so.

    //EDIT:
    https://github.com/V10lator/AutoUpdate/blob/master/src/AutoUpdate.java ^^
     
  9. Offline

    Comphenix

    It's not like creating lists is an expensive operation. Strings are immutable references types, so Java doesn't need to copy their internal text.

    But it's called due to an exception, not every server tick. And besides, creating a simple list is utterly dwarfed by the time it took to throw and catch that exception. :p

    In fact, you should be more worried about me using ToStringBuilder.reflectionToString than anything else. Reflection, like throwing exceptions, is quite slow, after all.

    But again, it was just me trying out different things. Not really meant to be submitted as a pull request.

    Nice. :)
     
  10. Offline

    p000ison

    Oh thanks nice :p
     
  11. Offline

    Comphenix

    Is bukget.v10lator.de up to date?

    I updated my mod to 2.3.0 early Monday morning, but it's still asking me to update to 2.2.3. Or is it a problem with BukkitDev?
     
  12. Offline

    TopGear93

    Im getting this error while using AutoUpdate v1.1

    Code:
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] 
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] Internal error!
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] If this bug hasn't been reported please open a ticket at http://forums.bukkit.org/threads/autoupdate-update-your-plugins.84421/
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] Include the following into your bug report:
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate]  ======= SNIP HERE =======
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] Unexpected token END OF FILE at position 0.
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate]     at org.json.simple.parser.JSONParser.parse(Unknown Source)
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate]     at org.json.simple.parser.JSONParser.parse(Unknown Source)
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate]     at us.topgear93.refergift.updater.AutoUpdate.run(AutoUpdate.java:453)
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate]     at org.bukkit.craftbukkit.scheduler.CraftWorker.run(CraftWorker.java:34)
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate]     at java.lang.Thread.run(Unknown Source)
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate]  ======= DUMP =======
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] version : 1.1
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] delay : 216000
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] ymlPrefix : 
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] ymlSuffix : 
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] bukkitdevPrefix: 
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] bukkitdevSuffix: 
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] bukkitdevSlug : refergift
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] COLOR_INFO : BLUE
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] COLO_OK : GREEN
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] COLOR_ERROR : RED
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] bukget : http://bukget.v10lator.de/refergift
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] bukgetFallback : http://bukget.org/api/plugin/refergift/latest
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] pid : 6
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] av : 1.0.5
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] config : YamlConfiguration[path='', root='YamlConfiguration']
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] lock : false
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] needUpdate : false
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] updatePending : false
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] UpdateUrl : null
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] updateVersion : null
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] pluginURL : null
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] type : null
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate]  ======= SNIP HERE =======
    2012-08-07 15:42:44 [INFO] ReferGift [AutoUpdate] 
    
     
  13. Offline

    V10lator

    For me line 453 is
    if(split.length > 1 && !plugin.getName().equalsIgnoreCase(split[1]))
    which has absolutely nothing to do with JSON parsing. Did you change the class? If so:
     
  14. Offline

    p000ison

    .resetConfig(); causes a endless loop for me :/
     
  15. Offline

    V10lator

    Do you have any errors (related to AutoUpdate) in your server.log file?
     
  16. Offline

    p000ison

    Nope, but it seems like it fails at setting the lock boolean :/ not sure
     
  17. Offline

    V10lator

    As far as I can see the only case where it doesn't release the lock is when there's an unexpected error (which will be printed out to the log). But that changed in the newest dev version (it disables AutoUpdate but releases the lock). Also setConfig (which is called by resetConfig) changed so it should be unable to cause a endless loop.

    But if you say there's nothing in the log I'm just removing the symptoms but not the root of the problem. :(
     
  18. Offline

    p000ison

    Ill test it a bit more :/
     
    V10lator likes this.
  19. Offline

    Icyene

    V10lator

    I have an idea, sorry if its completely flawed:

    Bukget returns a date: is that the date that it was cached, or the date that the file was uploaded? If its the latter, make AutoUpdate create a folder, add a dates.yml, and have things like

    Code:
    pluginName: timeUploaded
    
    If the time changes, then that means that its updated.

    Additionally, not sure if Bukget does this, but if it returns a list of all the files on the dl page, you could get the first link, get its hash, and compare it with the hash of the plugin on the server. If they differ, then its likely that the plugin has updated.
     
  20. Offline

    rudolf323

    Is this working on 1.3.1 R.2 ?
     
  21. Offline

    V10lator

    Yes.
     
  22. Offline

    Smiley43210

    At first, I thought bukget was down again. However, I have been getting this error message for 3 days now.

    Code:
    10:11:45 PM [INFO] V10lift [AutoUpdate]          ======= SNIP HERE =======
    10:11:45 PM [INFO] V10lift [AutoUpdate] java.io.IOException: Server returned HTTP response code: 500 for URL: http://api.bukget.org/api/plugin/v10lift/latest
    10:11:45 PM [INFO] V10lift [AutoUpdate]    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown Source)
    10:11:45 PM [INFO] V10lift [AutoUpdate]    at java.net.URL.openStream(Unknown Source)
    10:11:45 PM [INFO] V10lift [AutoUpdate]    at de.V10lator.V10lift.AutoUpdate.run(AutoUpdate.java:274)
    10:11:45 PM [INFO] V10lift [AutoUpdate]    at org.bukkit.craftbukkit.scheduler.CraftWorker.run(CraftWorker.java:34)
    10:11:45 PM [INFO] V10lift [AutoUpdate]    at java.lang.Thread.run(Unknown Source)
    10:11:45 PM [INFO] V10lift [AutoUpdate]          ======= DUMP =======
    10:11:45 PM [INFO] V10lift [AutoUpdate] version        : 1.0
    10:11:45 PM [INFO] V10lift [AutoUpdate] delay          : 216000
    10:11:45 PM [INFO] V10lift [AutoUpdate] ymlPrefix      : v
    10:11:45 PM [INFO] V10lift [AutoUpdate] ymlSuffix      :
    10:11:45 PM [INFO] V10lift [AutoUpdate] bukkitdevPrefix:
    10:11:45 PM [INFO] V10lift [AutoUpdate] bukkitdevSuffix:
    10:11:45 PM [INFO] V10lift [AutoUpdate] bukkitdevSlug  : v10lift
    10:11:45 PM [INFO] V10lift [AutoUpdate] COLOR_INFO    : AQUA
    10:11:45 PM [INFO] V10lift [AutoUpdate] COLO_OK        : GREEN
    10:11:45 PM [INFO] V10lift [AutoUpdate] COLOR_ERROR    : RED
    10:11:45 PM [INFO] V10lift [AutoUpdate] bukget        : http://bukget.v10lator.de/v10lift
    10:11:45 PM [INFO] V10lift [AutoUpdate] bukgetFallback : http://bukget.org/api/plugin/v10lift/latest
    10:11:45 PM [INFO] V10lift [AutoUpdate] pid            : 39
    10:11:45 PM [INFO] V10lift [AutoUpdate] av            : v0.4.11
    10:11:45 PM [INFO] V10lift [AutoUpdate] config        : YamlConfiguratio[path='', root='YamlConfiguration']
    10:11:45 PM [INFO] V10lift [AutoUpdate] lock          : true
    10:11:45 PM [INFO] V10lift [AutoUpdate] needUpdate    : false
    10:11:45 PM [INFO] V10lift [AutoUpdate] updatePending  : false
    10:11:45 PM [INFO] V10lift [AutoUpdate] UpdateUrl      : null
    10:11:45 PM [INFO] V10lift [AutoUpdate] updateVersion  : null
    10:11:46 PM [INFO] V10lift [AutoUpdate] pluginURL      : null
    10:11:46 PM [INFO] V10lift [AutoUpdate] type          : null
    10:11:46 PM [INFO] V10lift [AutoUpdate]          ======= SNIP HERE =======
    
     
  23. Offline

    V10lator

    Smiley43210 Server returned HTTP response code: 500

    There's nothing I can do against this. But anyway bukget has a new API which seems to be more stable. The next version may use this new API instead.

    //EDIT: v1.2 released. Updating is highly recommended!
     
  24. Offline

    Smiley43210

    Does 1.2 include a debugmode of some sort? Or some way to amke the messages less spammy?
     
  25. Offline

    V10lator

    Yes:
    Code:java
    1. private boolean debug = true;
    2. ...
    3. /**
    4.   * Use this to enable/disable debugging mode at runtime.
    5.   * @param mode True if you want to enable it, false otherwise.
    6.   */
    7. public void setDebug(boolean mode)
    8. {
    9. debug = mode;
    10. }
    11.  
    12. /**
    13.   * Use this to get the debugging mode.
    14.   * @return True if enabled, false otherwise.
    15.   */
    16. public boolean getDebug()
    17. {
    18. return debug;
    19. }

    The messages are that spammy for a reason, but if you look at the changelog you'll notice that HTTP errors are silenced now. That means you'll see nothing if debug mode is disabled and if it's enabled you'll see this:
    Also it uses bukgets new API now. Because of that the caching server isn't working atm. That's because the caching server would break old versions of AutoUpdate.

    all: Please note that the caching server will be back soon, so update your plugins!
     
  26. Offline

    Smiley43210

    It seems that AutoUpdate is prompting users for an update even though they already have that version.
    Code:
    1:33:48 AM [INFO] [RideThaDragon] New Release available!
    1:33:48 AM [INFO] If you want to update from v5.1.1 to 5.1.1 use /update RideThaDragon
    1:33:48 AM [INFO] See http://dev.bukkit.org/server-mods/RideThaDragon/ for more information.
    1:33:48 AM [INFO] [V10lift] New Release available!
    1:33:48 AM [INFO] If you want to update from v0.4.11 to 0.4.11 use /update V10lift
    1:33:48 AM [INFO] See http://dev.bukkit.org/server-mods/V10lift/ for more information.
    And also, if you do /update http://dev.bukkit.org/bukkit-plugins/ it will say 'Unknown command. Type "help" for help.' This may be because autoupdate is a class, and so the command is not in the plugin.yml, and if it was in everyone's plugin.yml, it would cause problems.[/S] EDIT: So much for reading the OP....does not work from console. Could you add a console command logger for when people attempt to use /update (log both the failed and and successful attempts)? Something like: [CODE]String ls = ""; if (args.length > 0){ for (String st : args){ ls = ls + " " + st; } getLogger().info(sender.getName() + ": /" + cmd.getName() + ls); }[/CODE] Or if you're really paranoid about the extra space character [CODE]String ls = ""; int ct = -1; if (args.length > 0){ for (String st : args){ ct = ct + 1; if (ct == args.length){ ls = ls + st; }else{ ls = ls + st + " "; } } getLogger().info(sender.getName() + ": /" + cmd.getName() + ls); }[/CODE] EDIT by Moderator: merged posts, please use the edit button instead of double posting./
     
    Last edited by a moderator: May 26, 2016
  27. Offline

    p000ison

     
  28. Offline

    V10lator

    That's because bukget v2 screwed up bukget v1 (bukget is an API for dev.bukkit.org).
    AutoUpdate v1.2 uses bukget v2, but the release is held back as TnT decided that AutoUpdate is doing something wrong. I'm trying to clear the situation ASAP but as TnT doesn't answer since 12 days to our conversation there's not much I can do.
     
  29. Offline

    TnT Retired Staff

    V10lator
    You were talking to mbaxter and obnoxint on that issue, I was only a participant. I have added h31ix who can help you further if needed.
     
  30. Offline

    V10lator

    TnT Not true. You wrote more than obnoxint and mbaxter together and my last questions where directed to you (hence the TnT... before), so "only a participant" isn't really true. Anyway, thanks for adding just another stuff member, hopefully your "We are happy to work with you to find a solution." wasn't a lie. :(
     
Thread Status:
Not open for further replies.

Share This Page