SteamWar/SpigotCore
Archiviert
13
0

Add Mapper support for Enum Parameters

Dieser Commit ist enthalten in:
yoyosource 2021-03-25 14:16:03 +01:00
Ursprung 97a8862b62
Commit 451d30a496

Datei anzeigen

@ -55,7 +55,8 @@ class SubCommand {
clazz = clazz.getComponentType(); clazz = clazz.getComponentType();
} }
if (clazz.isEnum()) { SWCommand.Mapper mapper = parameter.getAnnotation(SWCommand.Mapper.class);
if (clazz.isEnum() && mapper == null) {
Class<Enum<?>> enumClass = (Class<Enum<?>>) clazz; Class<Enum<?>> enumClass = (Class<Enum<?>>) clazz;
List<String> tabCompletes = new ArrayList<>(); List<String> tabCompletes = new ArrayList<>();
for (Enum<?> enumConstant : enumClass.getEnumConstants()) { for (Enum<?> enumConstant : enumClass.getEnumConstants()) {
@ -76,7 +77,6 @@ class SubCommand {
} }
String name = clazz.getTypeName(); String name = clazz.getTypeName();
SWCommand.Mapper mapper = parameter.getAnnotation(SWCommand.Mapper.class);
if (mapper != null) { if (mapper != null) {
name = mapper.value(); name = mapper.value();
} }