MVdWUpdater 1.6.0

Plugin updater API for spigot premium plugins

  1. Maximvdw
    Tested Minecraft Versions:
    • 1.7
    • 1.8
    • 1.9
    • 1.10
    • 1.11
    • 1.12
    MVdWUpdater
    Update Spigot premium plugins

    Supports Premium plugins
    Supports Two factory Auth. login

    1. About
    This plugin is made to allow Spigot users to update their premium plugins without developers needing to upload their plugins at insecure locations.

    2. Installation
    1. Drag and drop the plugin to the plugins folder
    2. Start the server once until it generated the plugins/MVdWUpdater directory
    3. You will see a file credentials.yml
    4. Code (Text):

      ## ---------------------------------------- #
      ## SpigotMC.org credentials
      ##   Enter your SpigotMC.org credentials in
      ##   this yaml file and restart the plugin
      ##   The plugin will log you in and store
      ##   the session cookies.
      ## ---------------------------------------- #

      # DO NOT EDIT THE CONFIG VERSION!
      config: 2


      # Enter your SpigotMC.org username
      username: ''

      # Enter the corresponding password
      password: ''

      # Enter the 2FA Secret if you have 2FA enabled
      # See plugin page for more info
      2fasecret: ''
       
    5. Enter your Spigot username and password and restart the server
    6. After the restart and if the credentials are correct the yml will contain the cookies.
    7. If all is fine you will see a confirmation message in the console and your purchased resources will be shown.
    8. [​IMG]
    3. Usage

    3.1. Server owners
    • Install the plugin
    • Log in using your credentials
    • If you have 2FA. You need to add the key in the config. If you did not store this, reset your 2FA and click "code" instead of the QR code. There will be a code you can also enter on Google Authenticator and the config of this plugin.
    3.2. Developers
    Updater Java Docs: http://ci.mvdw-software.com/job/MVdWUpdater/javadoc/
    CI Server: http://ci.mvdw-software.com/job/MVdWUpdater/
    Source: https://github.com/Maximvdw/MVdWUpdater
    Spigot Site API: https://github.com/Maximvdw/SpigotSite-API
    Spigot Site Implementation: https://github.com/Maximvdw/SpigotSite
    Spigot Site API Java Docs: http://ci.mvdw-software.com/job/SpigotSite-API/javadoc/

    • Your version syntax must be major.minor.release if you want to use the auto updater functionality. This applies to both the version in the plugins.yml of your plugin but also the version on your update description!
    • Optionally your version syntax can contain a "b" behind (1.0.0b) to indicate a beta release. This applies to both the version in the plugins.yml of your plugin but also the version on your update description!
    • When the major version is 0 the version will considered an alpha release. This applies to both the version in the plugins.yml of your plugin but also the version on your update description!
    • Make sure to softdepend on the plugin
    3.2.1 Example implementation
    Basic Example:

    Code (Text):

    MVdWUpdater updater = (MVdWUpdater) Bukkit.getPluginManager().getPlugin("MVdWUpdater");
    if (updater.hasBought(updater.getSpigotUser(), RESOURCEID)) {
        updater.updatePlugin(plugin, RESOURCEID, UpdateMethod.INSTALL_ON_RESTART, updater.getSpigotUser());
    }
     
    Advanced Example:
    Do not update when the major version is different

    Code (Text):
    try {
        MVdWUpdater updater = (MVdWUpdater) Bukkit.getPluginManager().getPlugin("MVdWUpdater");
        if (updater.hasBought(updater.getSpigotUser(), resourceId)) {
            SendConsole.info("Hooked into MVdWUpdater!");
     
            List<Resource> premiums = updater.getPurchasedResources(updater.getSpigotUser());
            for (Resource premium : premiums) {
                if (premium.getResourceId() == resourceId) {
                    // Resource id found
                    SendConsole.info("Checking for new updates for: " + plugin.getName() + " ...");

                    // Compare versions
                    Version currentPluginVersion = new Version(plugin.getDescription().getVersion());
                    Version newPluginVersion = new Version(updater.getResourceVersionString(resourceId));
         
                    if (currentPluginVersion.compare(newPluginVersion) == 1) {
                        SendConsole.info("An update for '" + plugin.getName() + "' is available");
             
                        // Do not update if the update is a major version
                        if (currentPluginVersion.getMajor() != newPluginVersion.getMajor()){
                            SendConsole.info("Update is a major update! Manual updating is required!");
                            return;
                        }

                        SendConsole.info("Getting download link ...");
                        Resource premiumResource = updater.getSpigotSiteAPI().getResourceManager()
                                .getResourceById(premium.getResourceId(),updater.getSpigotUser());

                        // Download the plugin to the update folder
                        File pluginFile = null;
                        try {
                            pluginFile = new File(URLDecoder.decode(
                                    plugin.getClass().getProtectionDomain().getCodeSource().getLocation().getPath(),
                                    "UTF-8"));
                        } catch (UnsupportedEncodingException e) {

                        }
             
                        File outputFile = null;
                        try{
                            outputFile = new File(Bukkit.getUpdateFolderFile(), pluginFile.getName());
                        }catch (Exception ex){
                 
                        }

                        if (pluginFile != null && outputFile != null) {
                            SendConsole.info("Downloading '" + plugin.getName() + "' ...");
                            premiumResource.downloadResource(updater.getSpigotUser(), outputFile);

                            SendConsole.info("An new update for " + plugin.getName() + " is ready to be installed on next restart!");
                        }
                    }

                    break;
                }
            }
     
            setUpdated(true);
        }
    } catch (Exception e) {
        e.printStackTrace();
    }

    3.2.2 Maven dependency
    Repository:

    Code (Text):
    <repository>
        <id>public</id>
        <name>Public Repositories</name>
        <url>http://repo.mvdw-software.be/content/groups/public/</url>
    </repository>
    Dependency:
    Code (Text):
    <dependency>
        <groupId>be.maximvdw</groupId>
        <artifactId>MVdWUpdater</artifactId>
        <version>1.2.0-SNAPSHOT</version>
       <exclusions>
           <exclusion>
               <groupId>*</groupId>
               <artifactId>*</artifactId>
           </exclusion>
       </exclusions>
    </dependency>
    4. Disclaimer
    The plugin requires your credentials. These are inside a config file so make sure that file can not be read by other users.

    Authors of plugins can access the logged in user in this API. This means they can see the cookies , username and use the account to update plugins using their own steps, file locations ,... . Again it is your job to make sure the plugins you put on your server are not malicious.

    The plugin loading time can time between 30-40 seconds the very first time.

Recent Updates

  1. v1.6.0 - Java 9
  2. v1.5.0 - Important bugfixes
  3. v1.4.0 - Fast startup

Recent Reviews

  1. Qw4rtz
    Qw4rtz
    1/5,
    Version: 1.4.0
    1. Maximvdw
      Author's Response
      No it doesn't :/.. Please confirm your information first..
  2. Wintermuted
    Wintermuted
    5/5,
    Version: 1.0.2
    Idea: Inject this into your plugins and make the players login with their account ingame or it will disable the plugin.
    EX:
    /spigotlogin USERNAME PASSWORD
    This could easily stop LEAKERS!
  3. Taylor-PH
    Taylor-PH
    5/5,
    Version: 1.0.2
    Amazing work as always! :D
    Definitely helps considering I have and use all your premium plugins!
    Keep up the amazing work! <3
  4. Jake321433
    Jake321433
    5/5,
    Version: 1.0.1
    Bruhhh - MVDW I don't know what I would do without your plugins. You. Are. Amazing. ANOTHER GREAT PLUGIN BRUH.
  5. FloThePony
    FloThePony
    5/5,
    Version: 1.0.1
    Good plugin is good.
    I have TitleMOTDAdvanced, and is really cool, so knowing that it will get an auto updater is awesome.
    yay
  6. iSach
    iSach
    5/5,
    Version: 1.0.1
    An excellent resource from an excellent developer!
    Thanks for this resource, it'll help me a lot! ^^
  7. Gimmes
    Gimmes
    5/5,
    Version: 1.0.1
    #1, I hope it works with my FeatherBoard & ActionBar.
    Will it have placeholders: {buyer} {bought-on} {plugins-bought}

    Joking <3
    1. Maximvdw
      Author's Response
      it will work starting from next update