In one of my more recent plugins, I added an update checker to easily let my players know when there's an update for my plugin. I really like this because it gives me LOTS of flexibility. What I do here is that depending on the version of the plugin, it gets a message from a URL, but this is per version. You will need to store a .txt file somewhere, and I find it easy to store on github. Also- remember that somewhere (I dunno where) terms are stated that you must have a way to disable any update checker or auto updater of some sort, which is implemented as a config option here. Here's the class that I would use if this plugin's version is 1.3: http://pastebin.com/c76Jmhch Code:java package ; import java.io.BufferedReader;import java.io.IOException;import java.io.InputStreamReader;import java.net.URL;import java.util.logging.Logger; public class UpdateChecker {<MAINCLASS> plugin;public UpdateChecker(<MAINCLASS> plugin) {this.plugin = plugin;currentVersion = plugin.version;} private String currentVersion;private String readurl = "[url]https://raw.github.com/keybordpiano459/Newspaper/master/version.txt[/url]"; public void startUpdateCheck() {if (plugin.getConfig().getBoolean("update-checker")) {Logger log = plugin.getLogger();try {log.info("Checking for a new version...");URL url = new URL(readurl);BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));String str;while ((str = br.readLine()) != null) {String line = str;if (line.charAt(0) == '1' && line.charAt(2) == '3') {plugin.updatemsg = line.substring(5);log.info(plugin.updatemsg);}}br.close();} catch (IOException e) {log.severe("The UpdateChecker URL is invalid! Please let me know!");}}}} Then, you would just put a few lines in your main class: Code:java private UpdateChecker updatechecker;public void onEnable() {updatechecker = new UpdateChecker(this);updatechecker.startUpdateCheck();} Please comment if you see any bugs or... a suggestion... or... something =/ Whatever!
You just post somewhere that the variable readurl should not have the url bbcode and that it is the forums posting that is doing it, unless of course you can edit it and fix it.
I think that people should know that you wouldn't be putting a URL BBCode tag in java, as I can't fix it, it just comes back up, but in case anyone didn't know, there aren't supposed to be the url tags.
I believe I have another update checker using that method floating around the resources forum somewhere... But I prefer this method because it's more easily customizable.
breezeyboy You need one for URL connections you open, whether it downloads or not. http://wiki.bukkit.org/BukkitDev:Pr...ollection.2C_URLConnections_and_Auto-Updaters
This should also be a bukkitrunnable so that it does not completely stop the server when it is run. Opening URLs can be very laggy with slower internet connections.
Minnymin3 I didn't notice the dates, I just saw it appear in the recent threads (I was not the original bumper), but my bad.