Fix updater

This commit is contained in:
gomeow
2013-04-06 09:55:57 -07:00
parent 07f222647f
commit 8bfbf76754
2 changed files with 7 additions and 5 deletions
@@ -55,16 +55,16 @@ public class Main extends JavaPlugin {
getServer().getPluginManager().registerEvents(new Listeners(this), this);
loadConfig();
startMetrics();
Updater u = new Updater(getDescription().getVersion());
if(getConfig().getBoolean("check-update")) {
Updater u = new Updater();
try {
if(u.getUpdate()) {
update = true;
name = u.getNewVersion();
}
} catch (Exception e) {
log.log(Level.SEVERE, "PlayerVaults: Failed to check for updates.");
log.log(Level.SEVERE, "PlayerVaults: Report this stack trace to drtshock and gomeow.");
log.log(Level.WARNING, "PlayerVaults: Failed to check for updates.");
log.log(Level.WARNING, "PlayerVaults: Report this stack trace to drtshock and gomeow.");
e.printStackTrace();
}
}
@@ -16,8 +16,10 @@ import com.drtshock.playervaults.Main;
public class Updater extends Main {
SortedMap<String, String> lang = new TreeMap<String, String>();
String version;
public Updater() {
public Updater(String version) {
this.version = version;
lang.put("title-name", "&4[&fPlayerVaults&4]:");
lang.put("open-vault", "&fOpening vault &a%v");
lang.put("open-other-vault", "&fOpening vault &a%v &fof &a%p");
@@ -51,7 +53,7 @@ public class Updater extends Main {
return this.newVersion;
}
public boolean getUpdate() throws Exception {
String version = getDescription().getVersion();
String version = this.version;
URL url = new URL("http://dev.bukkit.org/server-mods/playervaults/files.rss");
InputStreamReader isr = null;
try {