mirror of
https://github.com/plexusorg/Plex.git
synced 2024-12-22 17:17:37 +00:00
Add missing retention policy to annotation classes
This commit is contained in:
parent
90cccb804a
commit
099680d068
@ -1,5 +1,9 @@
|
||||
package dev.plex.command.annotation;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface System
|
||||
{
|
||||
String value() default "";
|
||||
|
@ -21,10 +21,9 @@ public class CommandHandler extends PlexBase
|
||||
{
|
||||
try
|
||||
{
|
||||
System annotation = clazz.getDeclaredAnnotation(System.class);
|
||||
// TODO: Annotations are always null?
|
||||
if (annotation != null)
|
||||
if (clazz.isAnnotationPresent(System.class))
|
||||
{
|
||||
System annotation = clazz.getDeclaredAnnotation(System.class);
|
||||
PlexLog.debug(clazz.getName() + " has annotations");
|
||||
if (annotation.value().equalsIgnoreCase(plugin.getSystem().toLowerCase()))
|
||||
{
|
||||
@ -41,7 +40,6 @@ public class CommandHandler extends PlexBase
|
||||
else
|
||||
{
|
||||
commands.add(clazz.getConstructor().newInstance());
|
||||
// PlexLog.debug("Adding command normally " + clazz.getName());
|
||||
}
|
||||
}
|
||||
catch (InvocationTargetException | InstantiationException | IllegalAccessException | NoSuchMethodException ex)
|
||||
|
@ -21,12 +21,14 @@ public class ListenerHandler extends PlexBase
|
||||
{
|
||||
try
|
||||
{
|
||||
Toggleable annotation = clazz.getDeclaredAnnotation(Toggleable.class);
|
||||
if (annotation != null)
|
||||
if (clazz.isAnnotationPresent(Toggleable.class))
|
||||
{
|
||||
Toggleable annotation = clazz.getDeclaredAnnotation(Toggleable.class);
|
||||
PlexLog.debug(clazz.getName() + " has annotations");
|
||||
if (plugin.config.get(annotation.value()) != null && plugin.config.getBoolean(annotation.value()))
|
||||
{
|
||||
listeners.add(clazz.getConstructor().newInstance());
|
||||
PlexLog.debug("Registering " + clazz.getName() + " as a listener");
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1,5 +1,9 @@
|
||||
package dev.plex.listener.annotation;
|
||||
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Toggleable
|
||||
{
|
||||
String value();
|
||||
|
Loading…
Reference in New Issue
Block a user