diff --git a/paper-api/src/main/java/org/bukkit/plugin/EventExecutor.java b/paper-api/src/main/java/org/bukkit/plugin/EventExecutor.java index 5aa1c5546..187a127c4 100644 --- a/paper-api/src/main/java/org/bukkit/plugin/EventExecutor.java +++ b/paper-api/src/main/java/org/bukkit/plugin/EventExecutor.java @@ -1,17 +1,14 @@ package org.bukkit.plugin; -import org.bukkit.event.Event; -import org.bukkit.event.EventException; -import org.bukkit.event.Listener; -import org.jetbrains.annotations.NotNull; - -// Paper start +import com.google.common.base.Preconditions; import io.papermc.paper.event.executor.EventExecutorFactory; import java.lang.reflect.Method; import java.lang.reflect.Modifier; - -import com.google.common.base.Preconditions; -// Paper end +import org.bukkit.event.Event; +import org.bukkit.event.EventException; +import org.bukkit.event.Listener; +import org.bukkit.plugin.java.JavaPlugin; +import org.jetbrains.annotations.NotNull; /** * Interface which defines the class for event call backs to plugins @@ -21,18 +18,18 @@ public interface EventExecutor { // Paper start @NotNull - public static EventExecutor create(@NotNull Method m, @NotNull Class eventClass) { + static EventExecutor create(@NotNull Method m, @NotNull Class eventClass) { Preconditions.checkNotNull(m, "Null method"); Preconditions.checkArgument(m.getParameterCount() != 0, "Incorrect number of arguments %s", m.getParameterCount()); Preconditions.checkArgument(m.getParameterTypes()[0] == eventClass, "First parameter %s doesn't match event class %s", m.getParameterTypes()[0], eventClass); if (m.getReturnType() != Void.TYPE) { - final org.bukkit.plugin.java.JavaPlugin plugin = org.bukkit.plugin.java.JavaPlugin.getProvidingPlugin(m.getDeclaringClass()); + final JavaPlugin plugin = JavaPlugin.getProvidingPlugin(m.getDeclaringClass()); org.bukkit.Bukkit.getLogger().warning("@EventHandler method " + m.getDeclaringClass().getName() + (Modifier.isStatic(m.getModifiers()) ? '.' : '#') + m.getName() + " returns non-void type " + m.getReturnType().getName() + ". This is unsupported behavior and will no longer work in a future version of Paper." + " This should be reported to the developers of " + plugin.getPluginMeta().getDisplayName() + " (" + String.join(",", plugin.getPluginMeta().getAuthors()) + ')'); } if (!m.trySetAccessible()) { - final org.bukkit.plugin.java.JavaPlugin plugin = org.bukkit.plugin.java.JavaPlugin.getProvidingPlugin(m.getDeclaringClass()); + final JavaPlugin plugin = JavaPlugin.getProvidingPlugin(m.getDeclaringClass()); throw new AssertionError( "@EventHandler method " + m.getDeclaringClass().getName() + (Modifier.isStatic(m.getModifiers()) ? '.' : '#') + m.getName() + " is not accessible." + " This should be reported to the developers of " + plugin.getDescription().getName() + " (" + String.join(",", plugin.getDescription().getAuthors()) + ')'