From 348ea4cc2393fe6901af1684ba5ff6d5262122ba Mon Sep 17 00:00:00 2001 From: Andrew Steinborn Date: Sat, 15 May 2021 08:15:25 -0400 Subject: [PATCH] Fix annotation processor choking on event subscribers --- .../annotationprocessor/AnnotationProcessorConstants.java | 1 + .../annotationprocessor/ApiAnnotationProcessor.java | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/annotation-processor/src/main/java/com/velocitypowered/annotationprocessor/AnnotationProcessorConstants.java b/annotation-processor/src/main/java/com/velocitypowered/annotationprocessor/AnnotationProcessorConstants.java index cf16510e6..a204498f2 100644 --- a/annotation-processor/src/main/java/com/velocitypowered/annotationprocessor/AnnotationProcessorConstants.java +++ b/annotation-processor/src/main/java/com/velocitypowered/annotationprocessor/AnnotationProcessorConstants.java @@ -22,4 +22,5 @@ class AnnotationProcessorConstants { static final String PLUGIN_ANNOTATION_CLASS = "com.velocitypowered.api.plugin.Plugin"; static final String SUBSCRIBE_ANNOTATION_CLASS = "com.velocitypowered.api.event.Subscribe"; static final String EVENTTASK_CLASS = "com.velocitypowered.api.event.EventTask"; + static final String EVENT_INTERFACE= "com.velocitypowered.api.event.Event"; } diff --git a/annotation-processor/src/main/java/com/velocitypowered/annotationprocessor/ApiAnnotationProcessor.java b/annotation-processor/src/main/java/com/velocitypowered/annotationprocessor/ApiAnnotationProcessor.java index 0350d2974..45d4bb807 100644 --- a/annotation-processor/src/main/java/com/velocitypowered/annotationprocessor/ApiAnnotationProcessor.java +++ b/annotation-processor/src/main/java/com/velocitypowered/annotationprocessor/ApiAnnotationProcessor.java @@ -18,6 +18,7 @@ package com.velocitypowered.annotationprocessor; import static com.velocitypowered.annotationprocessor.AnnotationProcessorConstants.EVENTTASK_CLASS; +import static com.velocitypowered.annotationprocessor.AnnotationProcessorConstants.EVENT_INTERFACE; import static com.velocitypowered.annotationprocessor.AnnotationProcessorConstants.PLUGIN_ANNOTATION_CLASS; import static com.velocitypowered.annotationprocessor.AnnotationProcessorConstants.SUBSCRIBE_ANNOTATION_CLASS; @@ -33,7 +34,6 @@ import java.util.Set; import javax.annotation.Nullable; import javax.annotation.processing.AbstractProcessor; import javax.annotation.processing.Messager; -import javax.annotation.processing.ProcessingEnvironment; import javax.annotation.processing.RoundEnvironment; import javax.annotation.processing.SupportedAnnotationTypes; import javax.lang.model.SourceVersion; @@ -99,7 +99,7 @@ public class ApiAnnotationProcessor extends AbstractProcessor { } final List parameters = method.getParameters(); if (parameters.isEmpty() - || !this.isTypeSubclass(parameters.get(0), SUBSCRIBE_ANNOTATION_CLASS)) { + || !this.isTypeSubclass(parameters.get(0), EVENT_INTERFACE)) { msg.printMessage(Diagnostic.Kind.ERROR, "method must have an Event as its first parameter", method); }