Fix typo for numbered/custom build numbers display

This commit is contained in:
libraryaddict 2018-12-16 17:19:59 +13:00
parent 5a8d39a3a0
commit b81f99aa0f
3 changed files with 21 additions and 5 deletions

View File

@ -96,7 +96,7 @@ public class DisguiseListener implements Listener {
} }
// If build number is null, or not a number. Then we can't check snapshots regardless // If build number is null, or not a number. Then we can't check snapshots regardless
if (plugin.getBuildNo() == null || !plugin.getBuildNo().matches("[0-9]+")) { if (!plugin.isNumberedBuild()) {
return true; return true;
} }

View File

@ -43,8 +43,7 @@ public class LibsDisguises extends JavaPlugin {
getLogger().info("Discovered nms version: " + ReflectionManager.getBukkitVersion()); getLogger().info("Discovered nms version: " + ReflectionManager.getBukkitVersion());
boolean hashBuild = getBuildNo() != null && getBuildNo().matches("[0-9]+"); getLogger().info("Jenkins Build: " + (isNumberedBuild() ? "#" : "") + getBuildNo());
getLogger().info("Jenkins Build: " + (hashBuild ? "#" : "") + getBuildNo());
LibsPremium.check(getDescription().getVersion()); LibsPremium.check(getDescription().getVersion());
@ -116,8 +115,15 @@ public class LibsDisguises extends JavaPlugin {
// If a release build, attach build number // If a release build, attach build number
if (!isReleaseBuild()) { if (!isReleaseBuild()) {
version += "-";
// 9.7.0-SNAPSHOT-b30 // 9.7.0-SNAPSHOT-b30
version += "-b" + getBuildNo(); if (isNumberedBuild()) {
version += "b";
}
// else 9.7.0-SNAPSHOT-unknown
version += getBuildNo();
} }
Metrics metrics = new Metrics(this, version); Metrics metrics = new Metrics(this, version);
@ -314,6 +320,10 @@ public class LibsDisguises extends JavaPlugin {
return buildNumber; return buildNumber;
} }
public boolean isNumberedBuild() {
return getBuildNo() != null && getBuildNo().matches("[0-9]+");
}
private void registerCommand(String commandName, CommandExecutor executioner) { private void registerCommand(String commandName, CommandExecutor executioner) {
PluginCommand command = getCommand(commandName); PluginCommand command = getCommand(commandName);

View File

@ -57,7 +57,13 @@ public class LibsDisguisesCommand implements CommandExecutor, TabCompleter {
String version = disguises.getDescription().getVersion(); String version = disguises.getDescription().getVersion();
if (!disguises.isReleaseBuild()) { if (!disguises.isReleaseBuild()) {
version += "-b" + disguises.getBuildNo(); version += "-";
if (disguises.isNumberedBuild()) {
version += "b";
}
version += disguises.getBuildNo();
} }
sender.sendMessage(ChatColor.DARK_GREEN + "This server is running " + "Lib's Disguises v" + version + sender.sendMessage(ChatColor.DARK_GREEN + "This server is running " + "Lib's Disguises v" + version +