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 a3ba59598..cf16510e6 100644 --- a/annotation-processor/src/main/java/com/velocitypowered/annotationprocessor/AnnotationProcessorConstants.java +++ b/annotation-processor/src/main/java/com/velocitypowered/annotationprocessor/AnnotationProcessorConstants.java @@ -1,3 +1,20 @@ +/* + * Copyright (C) 2018 Velocity Contributors + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + package com.velocitypowered.annotationprocessor; class AnnotationProcessorConstants { 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 add7dfdcf..0350d2974 100644 --- a/annotation-processor/src/main/java/com/velocitypowered/annotationprocessor/ApiAnnotationProcessor.java +++ b/annotation-processor/src/main/java/com/velocitypowered/annotationprocessor/ApiAnnotationProcessor.java @@ -88,7 +88,8 @@ public class ApiAnnotationProcessor extends AbstractProcessor { msg.printMessage(Diagnostic.Kind.ERROR, "method must not be abstract", method); } - if (method.getEnclosingElement().getKind().isInterface()) { + Element enclosing = method.getEnclosingElement(); + if (enclosing != null && enclosing.getKind().isInterface()) { msg.printMessage(Diagnostic.Kind.ERROR, "interfaces cannot declare listeners", method); } @@ -97,7 +98,8 @@ public class ApiAnnotationProcessor extends AbstractProcessor { msg.printMessage(Kind.ERROR, "method must return void or EventTask", method); } final List parameters = method.getParameters(); - if (parameters.isEmpty() || !this.isTypeSubclass(parameters.get(0), SUBSCRIBE_ANNOTATION_CLASS)) { + if (parameters.isEmpty() + || !this.isTypeSubclass(parameters.get(0), SUBSCRIBE_ANNOTATION_CLASS)) { msg.printMessage(Diagnostic.Kind.ERROR, "method must have an Event as its first parameter", method); } @@ -116,9 +118,9 @@ public class ApiAnnotationProcessor extends AbstractProcessor { if (Objects.equals(pluginClassFound, qualifiedName.toString())) { if (!warnedAboutMultiplePlugins) { processingEnv.getMessager() - .printMessage(Diagnostic.Kind.WARNING, "Velocity does not yet currently support " - + "multiple plugins. We are using " + pluginClassFound - + " for your plugin's main class."); + .printMessage(Diagnostic.Kind.WARNING, + "Velocity does not yet currently support multiple plugins. " + + "We are using " + pluginClassFound + " for your plugin's main class."); warnedAboutMultiplePlugins = true; } return false; @@ -126,10 +128,10 @@ public class ApiAnnotationProcessor extends AbstractProcessor { Plugin plugin = element.getAnnotation(Plugin.class); if (!SerializedPluginDescription.ID_PATTERN.matcher(plugin.id()).matches()) { - processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, "Invalid ID for plugin " - + qualifiedName - + ". IDs must start alphabetically, have alphanumeric characters, and can " - + "contain dashes or underscores."); + processingEnv.getMessager().printMessage(Diagnostic.Kind.ERROR, + "Invalid ID for plugin " + qualifiedName + ". " + + "IDs must start alphabetically, have alphanumeric characters, and can " + + "contain dashes or underscores."); return false; } diff --git a/api/src/main/java/com/velocitypowered/api/event/Event.java b/api/src/main/java/com/velocitypowered/api/event/Event.java index 4d0568f55..36b6b2420 100644 --- a/api/src/main/java/com/velocitypowered/api/event/Event.java +++ b/api/src/main/java/com/velocitypowered/api/event/Event.java @@ -1,3 +1,10 @@ +/* + * Copyright (C) 2018 Velocity Contributors + * + * The Velocity API is licensed under the terms of the MIT License. For more details, + * reference the LICENSE file in the api top-level directory. + */ + package com.velocitypowered.api.event; /** diff --git a/proxy/src/test/java/com/velocitypowered/proxy/event/EventTest.java b/proxy/src/test/java/com/velocitypowered/proxy/event/EventTest.java index cea6cc4da..8ec6f0f77 100644 --- a/proxy/src/test/java/com/velocitypowered/proxy/event/EventTest.java +++ b/proxy/src/test/java/com/velocitypowered/proxy/event/EventTest.java @@ -20,6 +20,7 @@ package com.velocitypowered.proxy.event; import static org.junit.jupiter.api.Assertions.assertEquals; import static org.junit.jupiter.api.Assertions.assertTrue; +import com.velocitypowered.api.event.Event; import com.velocitypowered.api.event.EventTask; import com.velocitypowered.api.event.PostOrder; import com.velocitypowered.api.event.Subscribe; @@ -41,7 +42,7 @@ public class EventTest { eventManager.shutdown(); } - static final class TestEvent { + static final class TestEvent implements Event { } static void assertAsyncThread(final Thread thread) {