Create test for HelpSyntaxHelperTest
(cherry picked from commit 9a6e96d)
This commit is contained in:
@@ -681,6 +681,7 @@ public class CommandDescription {
|
||||
*
|
||||
* @param maximumArguments True if there is an argument maximum, based on the number of registered arguments.
|
||||
*/
|
||||
// TODO ljacqu 20151121: Rename the setter
|
||||
public void setMaximumArguments(boolean maximumArguments) {
|
||||
this.noArgumentMaximum = !maximumArguments;
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@ public class CommandManager {
|
||||
/**
|
||||
* Register all commands.
|
||||
*/
|
||||
// TODO ljacqu 20151121: Create a builder class for CommandDescription
|
||||
@SuppressWarnings({ "serial" })
|
||||
public void registerCommands() {
|
||||
// Register the base AuthMe Reloaded command
|
||||
|
||||
@@ -9,7 +9,11 @@ import fr.xephi.authme.util.ListUtils;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class HelpSyntaxHelper {
|
||||
public final class HelpSyntaxHelper {
|
||||
|
||||
private HelpSyntaxHelper() {
|
||||
// Helper class
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the proper syntax for a command.
|
||||
@@ -19,8 +23,8 @@ public class HelpSyntaxHelper {
|
||||
* @param alternativeLabel The alternative label to use for this command syntax.
|
||||
* @param highlight True to highlight the important parts of this command.
|
||||
*
|
||||
|
||||
* @return The command with proper syntax. */
|
||||
* @return The command with proper syntax.
|
||||
*/
|
||||
@SuppressWarnings("StringConcatenationInsideStringBufferAppend")
|
||||
public static String getCommandSyntax(CommandDescription commandDescription, CommandParts commandReference, String alternativeLabel, boolean highlight) {
|
||||
// Create a string builder to build the command
|
||||
@@ -35,9 +39,9 @@ public class HelpSyntaxHelper {
|
||||
String commandLabel = helpCommandReference.get(helpCommandReference.getCount() - 1);
|
||||
|
||||
// Check whether the alternative label should be used
|
||||
if(alternativeLabel != null)
|
||||
if(alternativeLabel.trim().length() > 0)
|
||||
commandLabel = alternativeLabel;
|
||||
if (alternativeLabel != null && alternativeLabel.trim().length() > 0) {
|
||||
commandLabel = alternativeLabel;
|
||||
}
|
||||
|
||||
// Show the important bit of the command, highlight this part if required
|
||||
sb.append(ListUtils.implode(parentCommand, (highlight ? ChatColor.YELLOW + "" + ChatColor.BOLD : "") + commandLabel, " "));
|
||||
|
||||
Reference in New Issue
Block a user