From 451d30a4967002c8e03fae0c87988c3660a70b39 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Thu, 25 Mar 2021 14:16:03 +0100 Subject: [PATCH] Add Mapper support for Enum Parameters --- SpigotCore_Main/src/de/steamwar/command/SubCommand.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/command/SubCommand.java b/SpigotCore_Main/src/de/steamwar/command/SubCommand.java index b04abf5..7af8a46 100644 --- a/SpigotCore_Main/src/de/steamwar/command/SubCommand.java +++ b/SpigotCore_Main/src/de/steamwar/command/SubCommand.java @@ -55,7 +55,8 @@ class SubCommand { clazz = clazz.getComponentType(); } - if (clazz.isEnum()) { + SWCommand.Mapper mapper = parameter.getAnnotation(SWCommand.Mapper.class); + if (clazz.isEnum() && mapper == null) { Class> enumClass = (Class>) clazz; List tabCompletes = new ArrayList<>(); for (Enum enumConstant : enumClass.getEnumConstants()) { @@ -76,7 +77,6 @@ class SubCommand { } String name = clazz.getTypeName(); - SWCommand.Mapper mapper = parameter.getAnnotation(SWCommand.Mapper.class); if (mapper != null) { name = mapper.value(); }