mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2024-10-02 16:38:24 +02:00
Auto build number + helpHeader config
This commit is contained in:
parent
d6df921841
commit
109c85f4dd
65
pom.xml
65
pom.xml
@ -53,6 +53,7 @@
|
||||
<pluginName>AuthMe</pluginName>
|
||||
<mainClass>fr.xephi.authme.AuthMe</mainClass>
|
||||
<pluginAuthors>Xephi, sgdc3, DNx5, timvisee, games647, ljacqu</pluginAuthors>
|
||||
<buildNumber>Unknown</buildNumber>
|
||||
|
||||
<!-- Change Compiler Version (JDK) HERE! -->
|
||||
<javaVersion>1.7</javaVersion>
|
||||
@ -61,6 +62,20 @@
|
||||
<bukkitVersion>1.8.8-R0.1-SNAPSHOT</bukkitVersion>
|
||||
</properties>
|
||||
|
||||
<profiles>
|
||||
<profile>
|
||||
<id>jenkins</id>
|
||||
<activation>
|
||||
<property>
|
||||
<name>env.BUILD_NUMBER</name>
|
||||
</property>
|
||||
</activation>
|
||||
<properties>
|
||||
<buildNumber>${env.BUILD_NUMBER}</buildNumber>
|
||||
</properties>
|
||||
</profile>
|
||||
</profiles>
|
||||
|
||||
<build>
|
||||
<finalName>AuthMe-${project.version}</finalName>
|
||||
<sourceDirectory>src/main/java</sourceDirectory>
|
||||
@ -101,6 +116,39 @@
|
||||
</testResource>
|
||||
</testResources>
|
||||
|
||||
<!-- Just to keep Eclipse compatibility... -->
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.eclipse.m2e</groupId>
|
||||
<artifactId>lifecycle-mapping</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<configuration>
|
||||
<lifecycleMappingMetadata>
|
||||
<pluginExecutions>
|
||||
<pluginExecution>
|
||||
<pluginExecutionFilter>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>buildnumber-maven-plugin</artifactId>
|
||||
<versionRange>[1.0,)</versionRange>
|
||||
<goals>
|
||||
<goal>create-timestamp</goal>
|
||||
</goals>
|
||||
</pluginExecutionFilter>
|
||||
<action>
|
||||
<execute>
|
||||
<runOnConfiguration>true</runOnConfiguration>
|
||||
<runOnIncremental>true</runOnIncremental>
|
||||
</execute>
|
||||
</action>
|
||||
</pluginExecution>
|
||||
</pluginExecutions>
|
||||
</lifecycleMappingMetadata>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
@ -111,6 +159,23 @@
|
||||
<target>${javaVersion}</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>buildnumber-maven-plugin</artifactId>
|
||||
<version>1.4</version>
|
||||
<configuration>
|
||||
<timestampFormat>dd-MM-yy_HH:mm</timestampFormat>
|
||||
<timestampPropertyName>build.time</timestampPropertyName>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>generate-resources</phase>
|
||||
<goals>
|
||||
<goal>create-timestamp</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
|
||||
<!-- TODO: we need also to relocate the other libs -->
|
||||
<plugin>
|
||||
|
@ -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();
|
||||
|
@ -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;
|
||||
|
@ -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");
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user