diff --git a/pom.xml b/pom.xml
index 42a9edc9..2e8daf93 100644
--- a/pom.xml
+++ b/pom.xml
@@ -53,6 +53,7 @@
AuthMe
fr.xephi.authme.AuthMe
Xephi, sgdc3, DNx5, timvisee, games647, ljacqu
+ Unknown
1.7
@@ -61,6 +62,20 @@
1.8.8-R0.1-SNAPSHOT
+
+
+ jenkins
+
+
+ env.BUILD_NUMBER
+
+
+
+ ${env.BUILD_NUMBER}
+
+
+
+
AuthMe-${project.version}
src/main/java
@@ -101,6 +116,39 @@
+
+
+
+
+ org.eclipse.m2e
+ lifecycle-mapping
+ 1.0.0
+
+
+
+
+
+ org.codehaus.mojo
+ buildnumber-maven-plugin
+ [1.0,)
+
+ create-timestamp
+
+
+
+
+ true
+ true
+
+
+
+
+
+
+
+
+
+
org.apache.maven.plugins
@@ -111,6 +159,23 @@
${javaVersion}
+
+ org.codehaus.mojo
+ buildnumber-maven-plugin
+ 1.4
+
+ dd-MM-yy_HH:mm
+ build.time
+
+
+
+ generate-resources
+
+ create-timestamp
+
+
+
+
diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java
index ab54071a..800cbc71 100644
--- a/src/main/java/fr/xephi/authme/AuthMe.java
+++ b/src/main/java/fr/xephi/authme/AuthMe.java
@@ -60,15 +60,9 @@ public class AuthMe extends JavaPlugin {
* Defines the name of the plugin.
*/
private static final String PLUGIN_NAME = "AuthMeReloaded";
- /**
- * Defines the current AuthMeReloaded version name.
- */
- private static final String PLUGIN_VERSION_NAME = "5.1-SNAPSHOT";
- /**
- * Defines the current AuthMeReloaded version code.
- */
- // TODO: increment this value manually
- private static final int PLUGIN_VERSION_CODE = 120;
+
+ private static String pluginVersion = "N/D";
+ private static String pluginBuildNumber = "Unknown";
private static AuthMe plugin;
private static Server server;
@@ -128,8 +122,8 @@ public class AuthMe extends JavaPlugin {
*
* @return The version name of the currently installed AuthMeReloaded instance.
*/
- public static String getVersionName() {
- return PLUGIN_VERSION_NAME;
+ public static String getPluginVersion() {
+ return pluginVersion;
}
/**
@@ -137,8 +131,8 @@ public class AuthMe extends JavaPlugin {
*
* @return The version code of the currently installed AuthMeReloaded instance.
*/
- public static int getVersionCode() {
- return PLUGIN_VERSION_CODE;
+ public static String getPluginBuildNumber() {
+ return pluginBuildNumber;
}
/**
@@ -187,6 +181,15 @@ public class AuthMe extends JavaPlugin {
this.canConnect = canConnect;
}
+ // Get version and build number of the plugin
+ // TODO: enhance this
+ private void setupConstants() {
+ String versionRaw = this.getDescription().getVersion();
+ pluginVersion = versionRaw.substring(0, versionRaw.indexOf("-b"));
+ String buildRaw = versionRaw.substring(1, versionRaw.indexOf("-b"));
+ pluginBuildNumber = buildRaw.substring(0, buildRaw.indexOf("-t"));
+ }
+
/**
* Method called when the server enables the plugin.
*
@@ -197,6 +200,7 @@ public class AuthMe extends JavaPlugin {
// Set various instances
server = getServer();
plugin = this;
+ setupConstants();
// Set up the permissions manager
setupPermissionsManager();
diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/AuthMeCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/AuthMeCommand.java
index 98ea2e9c..f00ea916 100644
--- a/src/main/java/fr/xephi/authme/command/executable/authme/AuthMeCommand.java
+++ b/src/main/java/fr/xephi/authme/command/executable/authme/AuthMeCommand.java
@@ -13,7 +13,7 @@ public class AuthMeCommand extends ExecutableCommand {
@Override
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
// Show some version info
- sender.sendMessage(ChatColor.GREEN + "This server is running " + AuthMe.getPluginName() + " v" + AuthMe.getVersionName() + "! " + ChatColor.RED + "<3");
+ sender.sendMessage(ChatColor.GREEN + "This server is running " + AuthMe.getPluginName() + " v" + AuthMe.getPluginVersion() + " b" + AuthMe.getPluginBuildNumber()+ "! " + ChatColor.RED + "<3");
sender.sendMessage(ChatColor.YELLOW + "Use the command " + ChatColor.GOLD + "/" + commandReference.get(0) + " help" + ChatColor.YELLOW + " to view help.");
sender.sendMessage(ChatColor.YELLOW + "Use the command " + ChatColor.GOLD + "/" + commandReference.get(0) + " about" + ChatColor.YELLOW + " to view about.");
return true;
diff --git a/src/main/java/fr/xephi/authme/command/executable/authme/VersionCommand.java b/src/main/java/fr/xephi/authme/command/executable/authme/VersionCommand.java
index a07a0f88..fc92ac8f 100644
--- a/src/main/java/fr/xephi/authme/command/executable/authme/VersionCommand.java
+++ b/src/main/java/fr/xephi/authme/command/executable/authme/VersionCommand.java
@@ -3,6 +3,8 @@ package fr.xephi.authme.command.executable.authme;
import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.ExecutableCommand;
+import fr.xephi.authme.settings.Settings;
+
import org.bukkit.Bukkit;
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
@@ -24,8 +26,8 @@ public class VersionCommand extends ExecutableCommand {
@Override
public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) {
// Show some version info
- sender.sendMessage(ChatColor.GOLD + "==========[ " + AuthMe.getPluginName().toUpperCase() + " ABOUT ]==========");
- sender.sendMessage(ChatColor.GOLD + "Version: " + ChatColor.WHITE + AuthMe.getPluginName() + " v" + AuthMe.getVersionName() + ChatColor.GRAY + " (code: " + AuthMe.getVersionCode() + ")");
+ sender.sendMessage(ChatColor.GOLD + "==========[ " + Settings.helpHeader.toUpperCase() + " ABOUT ]==========");
+ sender.sendMessage(ChatColor.GOLD + "Version: " + ChatColor.WHITE + AuthMe.getPluginName() + " v" + AuthMe.getPluginVersion() + ChatColor.GRAY + " (build: " + AuthMe.getPluginBuildNumber() + ")");
sender.sendMessage(ChatColor.GOLD + "Developers:");
printDeveloper(sender, "Xephi", "xephi59", "Lead Developer");
printDeveloper(sender, "DNx5", "DNx5", "Developer");
diff --git a/src/main/java/fr/xephi/authme/command/help/HelpProvider.java b/src/main/java/fr/xephi/authme/command/help/HelpProvider.java
index ce4e8317..45427c50 100644
--- a/src/main/java/fr/xephi/authme/command/help/HelpProvider.java
+++ b/src/main/java/fr/xephi/authme/command/help/HelpProvider.java
@@ -4,6 +4,8 @@ import fr.xephi.authme.AuthMe;
import fr.xephi.authme.command.CommandDescription;
import fr.xephi.authme.command.CommandParts;
import fr.xephi.authme.command.FoundCommandResult;
+import fr.xephi.authme.settings.Settings;
+
import org.bukkit.ChatColor;
import org.bukkit.command.CommandSender;
@@ -99,7 +101,7 @@ public class HelpProvider {
}
// Print the help header
- sender.sendMessage(ChatColor.GOLD + "==========[ " + AuthMe.getPluginName().toUpperCase() + " HELP ]==========");
+ sender.sendMessage(ChatColor.GOLD + "==========[ " + Settings.helpHeader.toUpperCase() + " HELP ]==========");
// Print the command help information
if (showCommand)
diff --git a/src/main/java/fr/xephi/authme/settings/Settings.java b/src/main/java/fr/xephi/authme/settings/Settings.java
index 55c24cf9..7a209680 100644
--- a/src/main/java/fr/xephi/authme/settings/Settings.java
+++ b/src/main/java/fr/xephi/authme/settings/Settings.java
@@ -69,7 +69,7 @@ public final class Settings extends YamlConfiguration {
broadcastWelcomeMessage, forceRegKick, forceRegLogin,
checkVeryGames, delayJoinLeaveMessages, noTeleport, applyBlindEffect,
customAttributes, generateImage, isRemoveSpeedEnabled, isMySQLWebsite;
- public static String getNickRegex, getUnloggedinGroup, getMySQLHost,
+ public static String helpHeader, getNickRegex, getUnloggedinGroup, getMySQLHost,
getMySQLPort, getMySQLUsername, getMySQLPassword, getMySQLDatabase,
getMySQLTablename, getMySQLColumnName, getMySQLColumnPassword,
getMySQLColumnIp, getMySQLColumnLastLogin, getMySQLColumnSalt,
@@ -129,6 +129,7 @@ public final class Settings extends YamlConfiguration {
public static void loadVariables() {
+ helpHeader = configFile.getString("settings.helpHeader", "AuthMeReloaded");
messagesLanguage = checkLang(configFile.getString("settings.messagesLanguage", "en").toLowerCase());
isPermissionCheckEnabled = configFile.getBoolean("permission.EnablePermissionCheck", false);
isForcedRegistrationEnabled = configFile.getBoolean("settings.registration.force", true);
@@ -551,6 +552,10 @@ public final class Settings extends YamlConfiguration {
set("Protection.countriesBlacklist", countriesBlacklist);
changes = true;
}
+ if (!contains("settings.helpHeader")) {
+ set("settings.helpHeader", "AuthMeReloaded");
+ changes = true;
+ }
if (!contains("settings.broadcastWelcomeMessage")) {
set("settings.broadcastWelcomeMessage", false);
changes = true;
diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml
index cbf62dcb..5abd17eb 100644
--- a/src/main/resources/config.yml
+++ b/src/main/resources/config.yml
@@ -45,6 +45,8 @@ DataSource:
# Enable this when you allow registration through a website
mySQLWebsite: false
settings:
+ # The name shown in the help messages.
+ helpHeader: AuthMeReloaded
sessions:
# Do you want to enable the session feature?
# If enabled, when a player authenticates successfully,
diff --git a/src/main/resources/plugin.yml b/src/main/resources/plugin.yml
index 50d9ff38..3cb51c69 100644
--- a/src/main/resources/plugin.yml
+++ b/src/main/resources/plugin.yml
@@ -3,7 +3,7 @@ authors: [${pluginAuthors}]
website: ${project.url}
description: ${project.description}
main: ${mainClass}
-version: ${project.version}-b${env.BUILD_NUMBER}
+version: ${project.version}-b${buildNumber}-t${build.time}
softdepend:
- Vault
- PermissionsBukkit