changed how we check versions so we don't display update to people

running development versions.
This commit is contained in:
Sleaker 2012-02-18 11:16:13 -08:00
parent 0afb78399a
commit 264f769aad
2 changed files with 14 additions and 19 deletions

View File

@ -86,8 +86,8 @@ public class Vault extends JavaPlugin {
private static final Logger log = Logger.getLogger("Minecraft");
private Permission perms;
private String newVersion;
private String currentVersion;
private int newVersion;
private int currentVersion;
private ServicesManager sm;
private Metrics metrics;
@ -101,7 +101,7 @@ public class Vault extends JavaPlugin {
@Override
public void onEnable() {
currentVersion = getDescription().getVersion().substring(0, 5);
currentVersion = Integer.valueOf(getDescription().getVersion().substring(0, 5).replace(".", ""));
sm = getServer().getServicesManager();
// Load Vault Addons
loadEconomy();
@ -120,8 +120,8 @@ public class Vault extends JavaPlugin {
public void run() {
try {
newVersion = updateCheck(currentVersion);
if (!newVersion.contains(currentVersion)) {
log.warning(newVersion + " is out! You are running " + currentVersion);
if (newVersion > currentVersion) {
log.warning("Vault " + newVersion + " is out! You are running: Vault " + currentVersion);
log.warning("Update Vault at: http://dev.bukkit.org/server-mods/vault");
}
} catch (Exception e) {
@ -424,7 +424,7 @@ public class Vault extends JavaPlugin {
}
}
public synchronized void setVersion(String newVersion) {
public synchronized void setVersion(int newVersion) {
this.newVersion = newVersion;
}
@ -447,7 +447,7 @@ public class Vault extends JavaPlugin {
}
}
public String updateCheck(String currentVersion) throws Exception {
public int updateCheck(int currentVersion) throws Exception {
String pluginUrlString = "http://dev.bukkit.org/server-mods/vault/files.rss";
try {
URL url = new URL(pluginUrlString);
@ -460,7 +460,7 @@ public class Vault extends JavaPlugin {
NodeList firstElementTagName = firstElement.getElementsByTagName("title");
Element firstNameElement = (Element) firstElementTagName.item(0);
NodeList firstNodes = firstNameElement.getChildNodes();
return firstNodes.item(0).getNodeValue();
return Integer.valueOf(firstNodes.item(0).getNodeValue().replace("Vault", "").replace(".", "").trim());
}
}
catch (Exception localException) {
@ -476,7 +476,7 @@ public class Vault extends JavaPlugin {
if (perms.has(player, "vault.admin")) {
try {
String oldVersion = getDescription().getVersion().substring(0, 5);
if (!newVersion.contains(oldVersion)) {
if (newVersion > currentVersion) {
player.sendMessage(newVersion + " is out! You are running " + oldVersion);
player.sendMessage("Update Vault at: http://dev.bukkit.org/server-mods/vault");
}

View File

@ -211,8 +211,7 @@ public class Permission_GroupManager extends Permission {
AnjoPermissionsHandler handler;
if (worldName == null) {
handler = groupManager.getWorldsHolder().getWorldPermissionsByPlayerName(playerName);
}
else {
} else {
handler = groupManager.getWorldsHolder().getWorldPermissions(worldName);
}
if (handler == null) {
@ -226,8 +225,7 @@ public class Permission_GroupManager extends Permission {
OverloadedWorldHolder owh;
if (worldName == null) {
owh = groupManager.getWorldsHolder().getWorldDataByPlayerName(playerName);
}
else {
} else {
owh = groupManager.getWorldsHolder().getWorldData(worldName);
}
if (owh == null) {
@ -256,8 +254,7 @@ public class Permission_GroupManager extends Permission {
OverloadedWorldHolder owh;
if (worldName == null) {
owh = groupManager.getWorldsHolder().getWorldDataByPlayerName(playerName);
}
else {
} else {
owh = groupManager.getWorldsHolder().getWorldData(worldName);
}
if (owh == null) {
@ -284,8 +281,7 @@ public class Permission_GroupManager extends Permission {
AnjoPermissionsHandler handler;
if (worldName == null) {
handler = groupManager.getWorldsHolder().getWorldPermissionsByPlayerName(playerName);
}
else {
} else {
handler = groupManager.getWorldsHolder().getWorldPermissions(worldName);
}
return handler.getGroups(playerName);
@ -296,8 +292,7 @@ public class Permission_GroupManager extends Permission {
AnjoPermissionsHandler handler;
if (worldName == null) {
handler = groupManager.getWorldsHolder().getWorldPermissionsByPlayerName(playerName);
}
else {
} else {
handler = groupManager.getWorldsHolder().getWorldPermissions(worldName);
}
return handler.getGroup(playerName);