private <T extends LuckPermsEvent> EventSubscription<T> registerSubscription(Class<T> eventClass, Consumer<? super T> handler, Object plugin) {
        if (!eventClass.isInterface()) {
            throw new IllegalArgumentException("class " + eventClass + " is not an interface");
        }
        if (!LuckPermsEvent.class.isAssignableFrom(eventClass)) {
            throw new IllegalArgumentException("class " + eventClass.getName() + " does not implement LuckPermsEvent");
        }

        LuckPermsEventSubscription<T> eventHandler = new LuckPermsEventSubscription<>(this, eventClass, handler, plugin);
        this.bus.register(eventClass, eventHandler);

        return eventHandler;
    }
Checks that the given plugin object is a valid plugin instance for the platform

@param plugin the object
@return a plugin
@throws IllegalArgumentException if the plugin is invalid
common/src/main/java/me/lucko/luckperms/common/event/AbstractEventBus.java