Git Product home page Git Product logo

updatechecker's Introduction

Spigot Update Checker

Check for updates to a Spigot plugin.

Usage

Add the UpdateChecker package as a dependency to your plugin (or any other project). Example for Maven, using the author's personal repo:

<dependencies>
	<dependency>
		<groupId>net.ssterling</groupId>
		<artifactId>updatechecker</artifactid>
		<version>1.0.0</version> <!-- or whatever -->
		<scope>compile</scope>
	</dependency>
</dependencies>

<repositories>
	<repository>
		<id>ssterling.net</id>
		<url>https://www.ssterling.net/comp/maven-repo</url>
	</repository>
</repositories>

Next, create a new UpdateChecker object. The first variable is the project ID of your plugin (found following a . in the project URL), and the second is the current version, attainable using YourPlugin.getDescription().getVersion(). Method check() will return the new version as a string if it exists, or a null value if there is no new version. Example for BukkitGreentext:

import net.ssterling.updatechecker;

/* The following code would obviously be inside a method: */

String project_id = "55295";
String current_version = this.getDescription().getVersion();

UpdateChecker update_checker = new UpdateChecker(project_id, current_version);
try {
	String new_version = update_checker.check();
	if (new_version != null) {
		this.getLogger().info("Found new version " + new_version);
	} else {
		this.getLogger().info("No new version found");
	}
} catch (Throwable ex) {
	/* something happened */
	this.getLogger().info("Failed to check for updates");
}

If this documentation isn't clear enough (probably my fault), open an issue.

Notes

Some to-do:

  • Maybe a scheduler to check for updates at regular intervals

Contributing

Tab characters for indentation; spaces for alignment. Just look through the code and assimilate it.

updatechecker's People

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.