mirror of
https://github.com/PaperMC/Paper.git
synced 2025-01-23 16:56:31 +01:00
[ci skip] Replace FQN with import in EventExecutor
This commit is contained in:
parent
287eb52fa4
commit
887f3f74d1
1 changed files with 9 additions and 12 deletions
|
@ -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<? extends Event> eventClass) {
|
||||
static EventExecutor create(@NotNull Method m, @NotNull Class<? extends Event> 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()) + ')'
|
||||
|
|
Loading…
Add table
Reference in a new issue