mirror of
https://github.com/aikar/commands.git
synced 2026-05-31 06:11:55 +00:00
Default empty descriptions
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user