Add api to get the build version of jail

More for future api usage for other plugins, to determine if the running
version has certain features.
This commit is contained in:
graywolf336
2015-06-03 11:59:20 -05:00
parent 68e35ed271
commit 89f709390a
3 changed files with 23 additions and 1 deletions

View File

@ -20,6 +20,22 @@ public class JailsAPI {
protected JailsAPI(JailMain plugin) {
pl = plugin;
}
/**
* Returns the build number, it will return <strong>-1</strong> if an errors occurs.
*
* @return the build number of jail or -1 if an error occurred.
*/
public static int getBuildNumber() {
String v = pl.getDescription().getVersion();
String[] split = v.split("-");
try {
return Integer.parseInt(split[split.length - 1].replace("b", ""));
}catch(NumberFormatException e) {
return -1;
}
}
/**
* The instance of the {@link JailManager} which contains all the jails and in return prisoners.