@@ -2,8 +2,11 @@ package com.redmagic.undefinedapi.extension
22
33import org.bukkit.plugin.java.JavaPlugin
44import org.reflections.Reflections
5+ import org.reflections.scanners.FieldAnnotationsScanner
6+ import org.reflections.scanners.MethodAnnotationsScanner
57import org.reflections.scanners.ResourcesScanner
68import org.reflections.scanners.SubTypesScanner
9+ import org.reflections.scanners.TypeAnnotationsScanner
710import org.reflections.util.ConfigurationBuilder
811import java.lang.reflect.Method
912
@@ -14,9 +17,8 @@ import java.lang.reflect.Method
1417 * @return a set of classes annotated with the given annotation
1518 */
1619fun JavaPlugin.findClasses (annotation : Class <out Annotation >): Set <Class <* >> = Reflections (
17- ConfigurationBuilder ()
18- .forPackages(this ::class .java.packageName)
19- .setScanners(SubTypesScanner (false ), ResourcesScanner ())
20+ this ::class .java.packageName,
21+ TypeAnnotationsScanner ()
2022).getTypesAnnotatedWith(annotation)
2123
2224/* *
@@ -26,7 +28,6 @@ fun JavaPlugin.findClasses(annotation: Class<out Annotation>): Set<Class<*>> = R
2628 * @return a mutable set of methods annotated with the specified annotation
2729 */
2830fun JavaPlugin.findMethods (annotation : Class <out Annotation >): MutableSet <Method > = Reflections (
29- ConfigurationBuilder ()
30- .forPackages(this ::class .java.packageName)
31- .setScanners(SubTypesScanner (false ), ResourcesScanner ())
31+ this ::class .java.packageName,
32+ MethodAnnotationsScanner ()
3233).getMethodsAnnotatedWith(annotation)
0 commit comments