Default empty descriptions

This commit is contained in:
Aikar
2018-03-17 20:38:45 -04:00
parent 9024e878b1
commit 65af80a430
3 changed files with 8 additions and 3 deletions
@@ -38,6 +38,7 @@ class Annotations <M extends CommandManager> extends AnnotationLookups {
public static int LOWERCASE = 1 << 1;
public static int UPPERCASE = 1 << 2;
public static int NO_EMPTY = 1 << 3;
public static int DEFAULT_EMPTY = 1 << 4;
private final M manager;
@@ -77,7 +78,11 @@ class Annotations <M extends CommandManager> extends AnnotationLookups {
// TODO: Aliases
if (value == null) {
return null;
if (hasOption(options, DEFAULT_EMPTY)) {
value = "";
} else {
return null;
}
}
// transforms
@@ -69,7 +69,7 @@ public class CommandParameter <CEC extends CommandExecutionContext<CEC, ? extend
Annotations annotations = manager.getAnnotations();
this.defaultValue = annotations.getAnnotationValue(param, Default.class, Annotations.REPLACEMENTS | (type != String.class ? Annotations.NO_EMPTY : 0));
this.description = annotations.getAnnotationValue(param, Description.class);
this.description = annotations.getAnnotationValue(param, Description.class, Annotations.REPLACEMENTS | Annotations.DEFAULT_EMPTY);
this.conditions = annotations.getAnnotationValue(param, Conditions.class, Annotations.REPLACEMENTS | Annotations.NO_EMPTY);
//noinspection unchecked
@@ -81,7 +81,7 @@ public class RegisteredCommand <CEC extends CommandExecutionContext<CEC, ? exten
this.permission = annotations.getAnnotationValue(method, CommandPermission.class, Annotations.REPLACEMENTS | Annotations.NO_EMPTY);
this.complete = annotations.getAnnotationValue(method, CommandCompletion.class);
this.helpText = annotations.getAnnotationValue(method, Description.class, Annotations.REPLACEMENTS | Annotations.NO_EMPTY);
this.helpText = annotations.getAnnotationValue(method, Description.class, Annotations.REPLACEMENTS | Annotations.DEFAULT_EMPTY);
this.conditions = annotations.getAnnotationValue(method, Conditions.class, Annotations.REPLACEMENTS | Annotations.NO_EMPTY);
this.helpSearchTags = annotations.getAnnotationValue(method, HelpSearchTags.class, Annotations.REPLACEMENTS | Annotations.NO_EMPTY);