From 96b7652324f229a0f64bcfdb2f082b631e2c97a8 Mon Sep 17 00:00:00 2001 From: yoyosource Date: Wed, 5 May 2021 08:58:03 +0200 Subject: [PATCH] Speed up SWCommand registration --- SpigotCore_Main/src/de/steamwar/command/SWCommand.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/SpigotCore_Main/src/de/steamwar/command/SWCommand.java b/SpigotCore_Main/src/de/steamwar/command/SWCommand.java index d20237b..e29b8e4 100644 --- a/SpigotCore_Main/src/de/steamwar/command/SWCommand.java +++ b/SpigotCore_Main/src/de/steamwar/command/SWCommand.java @@ -80,7 +80,8 @@ public abstract class SWCommand { unregister(); register(); - for (Method method : getClass().getDeclaredMethods()) { + Method[] methods = getClass().getDeclaredMethods(); + for (Method method : methods) { addMapper(Mapper.class, method, i -> i == 0, false, TypeMapper.class, (anno, typeMapper) -> { if (anno.local()) { localTypeMapper.put(anno.value(), typeMapper); @@ -112,7 +113,7 @@ public abstract class SWCommand { commandHelpSet.add(new SubCommand(this, method, anno.value(), new HashMap<>())); }); } - for (Method method : getClass().getDeclaredMethods()) { + for (Method method : methods) { add(Register.class, method, i -> i > 0, true, null, (anno, parameters) -> { if (anno.help()) { return;