[INACTIVE][ADMN] BukkitUp v2.0 - Keep your server current! [UPDATED!]

Discussion in 'Inactive/Unsupported Plugins' started by Lamp, Jan 18, 2011.

  1. Offline

    Lamp

    NOW DOWNLOADS ONLY RECOMMENDED CRAFTBUKKIT BUILDS

    I got fed up with having to check for updates daily so I wrote this handy plugin to do it for me!

    Pros: automatic checking and file downloading

    Tested on CraftBukkit version: 53+

    To install simply place the jar in your plugins directory

    Usage: simply close your server and replace the jar with the downloaded one

    Edit:

    There is also one property you can add / edit into server.properties
    Code:
    auto-download-updates=true
    
    EDIT: UPDATED TO 2.0 NOTE: Upon initial placement "Integration" of the BukkitUp plugin your version will be read as -1, this will change upon the first run as bukkitup updates.

    Download: - BukkitUp

    Source: - BukkitUp
     
  2. Offline

    4am

    As I understand it, due to Bukkit being GPL, all Plugins must be GPL. Therefore, he can do whatever he pleases with anyone's code as long as he a) gives credit to the original authors and b) releases his changes. They can talk all day about "don't use my code it's for reference" but the truth is anyone has the right to fork it and make changes, and it doesn't necessarily need to be pulled back into your branch, either.
     
  3. Offline

    jimmydorry

    While I haven't specifically looked into the issue, feel free to prove me wrong by quoting where it said contrary to this but...

    You can't just decide for someone else how they are going to license their IP. As far as I am aware, you have the right to do what ever you want with your own IP, and license it in what ever way you want. Breaching this would constitute IP theft and is punishable in various countries in the court of law. That being said, if people use code in ways the author does not want it used, he will stop providing what he already does and everyone loses out in the long-run.

    Plugin developers as a whole are not doing this for profit. So please try and honour what little restrictions they place on providing you code for free. Let's all just play nice... kay?
     
  4. Offline

    Angus

    I wrote this little plugin that replaces the downloaded Snapshot with the current. Simply place the file into your main server folder and run it!

    If you wrote a little plugin then put it in submissions. DO NOT post it in someone else's plugin thread. - Selbram
     
  5. Offline

    EvilSeph Retired Staff

  6. ehm, i have to say, it's the most complicated script for renaming a file i've ever seen.
    i think that can be build easier. unless you want all those checks in it(altough i don't see the use)

    you should make it so that it also downloads the file from this link:
    http://artifacts.lukegb.com/artifac...0.0.1-SNAPSHOT/craftbukkit-0.0.1-SNAPSHOT.jar

    as you see it the link will not change with different builds.
     
  7. I hope this will work on my server, which is hosted by server providers (sleekservers..com)
    --- merged: Feb 2, 2011 3:34 PM ---
    I can't
    I can't use exe files on my server :/ Could you make it a plugin?
     
  8. Offline

    Angus

    I don't know anything about java, but i can reqad some tutorials, but I think that it will be only useful on a windows, but I try.
     
  9. Offline

    zwarmapapa

    Can you make a plugin that finds updates for all used plugins? That would really be handy and used by everyone!
     
  10. Offline

    Angus

    Then I have to make a list in my program that contains all the links to the plugins, and that will be to much work... But I can make it for the devs, that they can Add their links in the src and compile it for themselves.
     
  11. Offline

    zwarmapapa

    That would be awesome, but ehm:

    Can't you load all plugin-links from a database?
    And that plugin developers can add their link to the database?

    That would be easier to use :p
     
  12. Offline

    wheelz

    Thank you for this it helps alot with keeping it up to date
     
  13. Offline

    ddubois89

    Does the code need to be updated on this? I was using this and ended up with an out of date build. Specifically Build 271. Found out Some errors I was getting were due to me being out of date and not with the plugin like i had assumed because was telling me i was "up to date" lol hope it gets fixed soon!
     
  14. Offline

    rct2guy

    Your plugin needs to be fixed. It's throwing me a whole bunch of errors and barring me from using my plugins unless I remove it. I'll post the errors in a bit.
     
  15. Offline

    MicroDark

    I confirm the problem.
     
  16. Offline

    mughi

  17. Offline

    Lolmewn Retired Staff

    Doesn't work anymore, with CB 328. I get this error:
    Code:
    17-feb-2011 14:58:44 org.bukkit.craftbukkit.CraftServer loadPlugins
    SEVERE: For input string: "            <a href="/browse/BUKKIT-CRAFTBUKKIT-339;jsessionid=o1cd6x0z7xhi151756uqp3wgq">339</a>" (Is it up to d
    ate?)
    java.lang.NumberFormatException: For input string: "            <a href="/browse/BUKKIT-CRAFTBUKKIT-339;jsessionid=o1cd6x0z7xhi151756uqp3wgq
    ">339</a>"
            at java.lang.NumberFormatException.forInputString(Unknown Source)
            at java.lang.Integer.parseInt(Unknown Source)
            at java.lang.Integer.parseInt(Unknown Source)
            at ws.triii.bu.PluginMain.getVersion(PluginMain.java:117)
            at ws.triii.bu.PluginMain.onEnable(PluginMain.java:45)
            at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:135)
            at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoader.java:425)
            at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManager.java:175)
            at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:74)
            at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:55)
            at net.minecraft.server.MinecraftServer.e(MinecraftServer.java:171)
            at net.minecraft.server.MinecraftServer.c(MinecraftServer.java:158)
            at net.minecraft.server.MinecraftServer.d(MinecraftServer.java:110)
            at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:209)
            at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)
    EDIT: Ok, I see the problem has been noticed.
     
  18. I repair it replace the PluginMain.java-Content with this:

    For all can't wait until Lamp fix this, I upload the Jar.

    Code:
    package ws.triii.bu;
    
    import java.io.BufferedInputStream;
    import java.io.BufferedOutputStream;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.FileReader;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.net.HttpURLConnection;
    import java.net.URL;
    import java.net.URLConnection;
    import java.util.Properties;
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
    
    import org.bukkit.Server;
    import org.bukkit.plugin.PluginDescriptionFile;
    import org.bukkit.plugin.PluginLoader;
    import org.bukkit.plugin.java.JavaPlugin;
    
    public class PluginMain extends JavaPlugin {
    
        public boolean download = true;
    
        public PluginMain(PluginLoader pluginLoader, Server instance, PluginDescriptionFile desc, File folder, File plugin, ClassLoader cLoader) {
            super(pluginLoader, instance, desc, folder, plugin, cLoader);
            //if(getPluginControl() == null)
                //pluginControl = this;
            try {
                Properties props = new Properties();
                props.load(new FileReader("server.properties"));
                download = props.getProperty("auto-download-updates").contains("true") ? true : false;
            } catch (IOException ex) {
                System.out.println("[BukkitUp]: unable to load properties file configuration, server will auto download updates.");
            }
        }
     
        public void onDisable() {
        }
     
        public void onEnable() {
            int version = 0;
            try {
                version = getVersion();
            } catch (Exception e) {
                version = -1;
                e.printStackTrace();
            }
            System.out.println("[BukkitUp]: Checking for updates to CraftBukkit...");
            if(version == -1) {
                System.out.println("[BukkitUp]: unable to grab version");
                return;
            }
            File directory = new File("bukkit_build/");
            if(!directory.exists())
                directory.mkdir();
            File checkFile = new File("bukkit_build/craft_bukkit_"+version+".chkjar");
            if(!checkFile.exists()) {
                if(!download) {
                    System.out.println("[BukkitUp]: CraftBukkit is outdated, please update it!");
                } else {
                    System.out.println("[BukkitUp]: CraftBukkit is outdated, attempting to download the new build");
                    File jarFile = new File("bukkit_build/craftbukkit-0.0.1-SNAPSHOT.jar");
                    if(jarFile.exists()) {
                        jarFile.delete();
                    }
                    try {
                        if(getJar(version, jarFile)) {
                            System.out.println("[BukkitUp]: Build updated to version "+version+" jar file stored in "+jarFile.getPath());
                        }
                    } catch (IOException e) {
                        System.out.println("[BukkitUp]: Unable to update your build; Error: "+e.getMessage());
                    }
                }
                try {
                    checkFile.createNewFile();
                } catch (IOException e) {
                    System.out.println("[BukkitUp]: Unable to update your build; Error: "+e.getMessage());
                }
            } else {
                System.out.println("[BukkitUp]: CraftBukkit is up to date!");
            }
        }
    
        public boolean getJar(int build, File f) throws IOException {
                    URL url = new URL("http://bamboo.lukegb.com/browse/BUKKIT-CRAFTBUKKIT-JOB1-"+build+"/artifact/CraftBukkit-JAR/craftbukkit-0.0.1-SNAPSHOT.jar");
                    BufferedInputStream in = new BufferedInputStream(url.openStream());
                    FileOutputStream fos = new java.io.FileOutputStream(f);
                    BufferedOutputStream bout = new BufferedOutputStream(fos,1024);
                    byte data[] = new byte[1024];
                    int count;
                    while((count = in.read(data,0,1024)) != -1)
                    {
                    bout.write(data,0,count);
                    }
                    bout.close();
                    in.close();
    
            return true;
    
        }
        public int getVersion() throws Exception {
            URL url = new URL("http://bamboo.lukegb.com/browse/BUKKIT-CRAFTBUKKIT/latest");
            URLConnection urlConnection = url.openConnection();
            HttpURLConnection connection = null;
            connection = (HttpURLConnection) urlConnection;
            BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
            String current;
            while ((current = in.readLine()) != null) {
                if(current.contains("Bukkit - CraftBukkit")) {
                    break;
                }
            }
            Pattern pattern = Pattern.compile("([^0-9.]*)([0-9]*)(.*)");
            Matcher matcher = pattern.matcher(current.trim());
            matcher.matches();
            current = matcher.group(2);
            connection.disconnect();
            return Integer.parseInt(current);
        }
     
    }
    
     
  19. Nicely done :) works fine. Can't wait for an official fix!
     
  20. Offline

    hyperch

    yeah, same here :) hope it'll get fixed :)
     
  21. Offline

    Lolmewn Retired Staff

    The position of the Bukkit Files have been changed, should be easy fix. Since I don't want to steal your project, I won't fix it, but can you pleeease fix it? :p
     
  22. Offline

    jordanneil23

    Well heres a totally fixed version (thanks to NoFear13) all I did was changed the -JOB1- location.

    Download (Includes source)
     
  23. Offline

    rolli01

    help pls

    java.io.IOException: Server returned HTTP response code: 502 for URL: http://ba
    boo.lukegb.com/browse/BUKKIT-CRAFTBUKKIT/latest
    at sun.net.www.protocol.http.HttpURLConnection.getInputStream(Unknown S
    urce)
    at com.jordanneil23.BukkitUp.BukkitUp.getVersion(BukkitUp.java:108)
    at com.jordanneil23.BukkitUp.BukkitUp.onEnable(BukkitUp.java:45)
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:135)
    at org.bukkit.plugin.java.JavaPluginLoader.enablePlugin(JavaPluginLoade
    .java:430)
    at org.bukkit.plugin.SimplePluginManager.enablePlugin(SimplePluginManag
    r.java:175)
    at org.bukkit.craftbukkit.CraftServer.loadPlugin(CraftServer.java:74)
    at org.bukkit.craftbukkit.CraftServer.loadPlugins(CraftServer.java:55)
    at org.bukkit.craftbukkit.CraftServer.reload(CraftServer.java:193)
    at org.bukkit.command.SimpleCommandMap$ReloadCommand.execute(SimpleComm
    ndMap.java:184)
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:7
    )
    at org.bukkit.craftbukkit.CraftServer.dispatchCommand(CraftServer.java:
    71)
    at net.minecraft.server.MinecraftServer.b(MinecraftServer.java:344)
    at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:326)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:232)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:512)
    [BukkitUp]: Checking for updates to CraftBukkit...
     
  24. this is because the Update-Site isn't reachable in the moment. We can't do nothing until the page is back.
     
  25. Offline

    Sol

    http://baboo.lukegb.com/browse/BUKKIT-CRAFTBUKKIT/latest

    it's meant to be bamboo not baboo.... that might be your problem?

    ~Sol
     
  26. This is because rolli01 doesn't copy the complete message. The URL in Source-Code is correct.
     
  27. Offline

    dak393

    yep latest community version is working for me
     
  28. Offline

    Maddin

    Its not working... when bukkitup is in the plugins folder it shows:
    [​IMG]
     
  29. Offline

    jordanneil23

    This is a fixed version- Download
     
  30. Offline

    Maddin

    it is added....
     
  31. Offline

    hyperch

    jordanneil23: seems to work fine - thx
     

Share This Page