removed getDescription from the updateCheck as it's not

technically thread safe, even though it wont get called during normal
execution ever.
This commit is contained in:
sleak 2011-12-18 10:38:09 -08:00
parent 366c1f5132
commit 042176eb4e

View File

@ -73,6 +73,7 @@ public class Vault extends JavaPlugin {
private static final Logger log = Logger.getLogger("Minecraft"); private static final Logger log = Logger.getLogger("Minecraft");
private Permission perms; private Permission perms;
private String newVersion; private String newVersion;
private String currentVersion;
@Override @Override
public void onDisable() { public void onDisable() {
@ -84,6 +85,7 @@ public class Vault extends JavaPlugin {
@Override @Override
public void onEnable() { public void onEnable() {
currentVersion = getDescription().getVersion().substring(0, 5);
// Load Vault Addons // Load Vault Addons
loadEconomy(); loadEconomy();
loadPermission(); loadPermission();
@ -100,7 +102,7 @@ public class Vault extends JavaPlugin {
@Override @Override
public void run() { public void run() {
try { try {
newVersion = updateCheck(); newVersion = updateCheck(currentVersion);
String oldVersion = getDescription().getVersion().substring(0, 5); String oldVersion = getDescription().getVersion().substring(0, 5);
if (!newVersion.contains(oldVersion)) { if (!newVersion.contains(oldVersion)) {
log.warning(newVersion + " is out! You are running " + oldVersion); log.warning(newVersion + " is out! You are running " + oldVersion);
@ -374,7 +376,7 @@ public class Vault extends JavaPlugin {
} }
} }
public String updateCheck() throws Exception { public String updateCheck(String currentVersion) throws Exception {
String pluginUrlString = "http://dev.bukkit.org/server-mods/vault/files.rss"; String pluginUrlString = "http://dev.bukkit.org/server-mods/vault/files.rss";
try { try {
URL url = new URL(pluginUrlString); URL url = new URL(pluginUrlString);
@ -391,9 +393,8 @@ public class Vault extends JavaPlugin {
} }
} }
catch (Exception localException) { catch (Exception localException) {
return getDescription().getVersion().substring(0, 5);
} }
return getDescription().getVersion().substring(0, 5); return currentVersion;
} }
public class VaultPlayerListener extends PlayerListener { public class VaultPlayerListener extends PlayerListener {