PaperMC / PaperMC/Paper

Readd PluginLoader#createRegisteredListeners to public api

Open
#12,484 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

status: needs triage
Dominant language
Java
Stars
12.7k
Forks
3.5k
Avg merge
3d 13h
Merged PRs (30d)
11

Description

Is your feature request related to a problem?

Currently, Bukkit provides the method PluginLoader#createRegisteredListeners as public API. With the deprecation of plugin loaders this method has been moved to PaperEventManager#createRegisteredListeners but there isn't any way to access it from the API, as it's an internal class. This technically breaks Bukkit compatibility but i guess that was a given with the deprecation of PluginLoader.

Describe the solution you'd like.

It would be useful to put createRegisteredListeners back in public API (in whichever class would be the most convenient) as it allows access to the event listener method parsing logic that is used to create EventExecutors, allowing plugins to create custom EventExecutors delegating to "normal" ones without having to rewrite all the EventHandler annotation and method signature parsing logic.

Describe alternatives you've considered.

The alternative for the specific case i mentioned is for each plugin that needs a custom EventExecutor to reimplement the parsing logic (which afaik is what most plugins that need this functionality are currently doing) but:

  • This approach needs at best constant changes if the built in logic gets updated, and at worst breaks if the changes are substantial.
  • It also duplicates logic, which in general isn't the best of things.
Other

IMHO as this was already public API in Bukkit, even if it wasn't used much, and because although it was moved it still exists in the codebase (and is used internally) I don't see any reason not to have it be public for the limited but existing use cases for plugins.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with paper-api/src/main/java/org/bukkit/plugin/PluginLoader.java and paper-server/src/main/java/io/papermc/paper/plugin/manager/PaperEventManager.java, comparing the existing public and internal createRegisteredListeners methods. Trace how EventExecutors are created and check the API and compatibility tests. Done means plugins can access the listener-parsing behavior through a supported public API without duplicating it.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend-api-design
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.