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