From 2fcb5f11837a3abd80b6ba6095d6f63b4b81f972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tim=20Vis=C3=A9e?= Date: Sun, 1 Nov 2015 16:58:13 +0100 Subject: [PATCH] Added plugin name and version constants, implemented these --- src/main/java/fr/xephi/authme/AuthMe.java | 26 +++++++++++++++++++ .../command/executable/AuthMeCommand.java | 3 ++- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/src/main/java/fr/xephi/authme/AuthMe.java b/src/main/java/fr/xephi/authme/AuthMe.java index 4ce12c4c..f3ff8778 100644 --- a/src/main/java/fr/xephi/authme/AuthMe.java +++ b/src/main/java/fr/xephi/authme/AuthMe.java @@ -75,6 +75,14 @@ import net.minelink.ctplus.CombatTagPlus; public class AuthMe extends JavaPlugin { + /** Defines the name of the plugin. */ + // TODO: Create a getter method for this constant, and make it private + public 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. */ + private static final int PLUGIN_VERSION_CODE = 100; // Increase this number by one when an update is released + private static AuthMe authme; private static Server server; private Logger authmeLogger; @@ -848,4 +856,22 @@ public class AuthMe extends JavaPlugin { // Handle the command, return the result return commandHandler.onCommand(sender, cmd, commandLabel, args); } + + /** + * Get the current installed AuthMeReloaded version name. + * + * @return The version name of the currently installed AuthMeReloaded instance. + */ + public static String getVersionName() { + return PLUGIN_VERSION_NAME; + } + + /** + * Get the current installed AuthMeReloaded version code. + * + * @return The version code of the currently installed AuthMeReloaded instance. + */ + public static int getVersionCode() { + return PLUGIN_VERSION_CODE; + } } diff --git a/src/main/java/fr/xephi/authme/command/executable/AuthMeCommand.java b/src/main/java/fr/xephi/authme/command/executable/AuthMeCommand.java index a2b159e4..8f1edd84 100644 --- a/src/main/java/fr/xephi/authme/command/executable/AuthMeCommand.java +++ b/src/main/java/fr/xephi/authme/command/executable/AuthMeCommand.java @@ -1,5 +1,6 @@ package fr.xephi.authme.command.executable; +import fr.xephi.authme.AuthMe; import fr.xephi.authme.command.CommandParts; import fr.xephi.authme.command.ExecutableCommand; import org.bukkit.ChatColor; @@ -20,7 +21,7 @@ public class AuthMeCommand extends ExecutableCommand { public boolean executeCommand(CommandSender sender, CommandParts commandReference, CommandParts commandArguments) { // Show some version info // TODO: Use plugin name and version constants here! - sender.sendMessage(ChatColor.GREEN + "This server is running AuthMeReloaded v1.0! " + ChatColor.RED + "<3"); + sender.sendMessage(ChatColor.GREEN + "This server is running " + AuthMe.PLUGIN_NAME + " v" + AuthMe.getVersionName() + "! " + 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;