From 03ea599487ca18290b048f2dd9dc34d23ffef20c Mon Sep 17 00:00:00 2001 From: Presti Date: Thu, 10 Oct 2024 17:09:27 +0200 Subject: [PATCH] Code clean up. Signed-off-by: Presti --- .../container/CustomEventContainerCreator.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/de/presti/ree6/module/actions/customevents/container/CustomEventContainerCreator.java b/src/main/java/de/presti/ree6/module/actions/customevents/container/CustomEventContainerCreator.java index 22b318fdf..467b87da1 100644 --- a/src/main/java/de/presti/ree6/module/actions/customevents/container/CustomEventContainerCreator.java +++ b/src/main/java/de/presti/ree6/module/actions/customevents/container/CustomEventContainerCreator.java @@ -36,6 +36,19 @@ private CustomEventContainerCreator() { * Load all actions. */ public static void loadAll() { + ConfigurationBuilder configurationBuilder = new ConfigurationBuilder(); + configurationBuilder.addClassLoaders(ClasspathHelper.staticClassLoader()); + Reflections reflections = new Reflections(configurationBuilder); + Set> classes = reflections.getSubTypesOf(IEventAction.class); + + for (Class aClass : classes) { + if (aClass.isAnnotationPresent(ActionInfo.class)) { + String actionName = aClass.getAnnotation(ActionInfo.class).name(); + if (!cachedActions.containsKey(actionName)) { + cachedActions.put(actionName, aClass); + } + } + } } /**