PaperMC / PaperMC/Velocity

EventManager#unregisterListeners unregisters the plugin main instance

Open
#780 2 comments 2 reactions 1 assignee View on GitHub

@4drian3d is already working on this.

Since Jan 21, 2024.

type: feature
Dominant language
Java
Stars
2.3k
Forks
959
Avg merge
5d 10h
Merged PRs (30d)
2

Description

@Plugin(
    id = "testplugin"
)
public class TestPlugin {
  @Inject
  private ProxyServer server;

  @Subscribe
  public void onProxyInitialization(ProxyInitializeEvent event) {
    EventManager eventManager = this.server.getEventManager();
    eventManager.unregisterListeners(this);
    System.out.println("test123");
  }

  @Subscribe
  public void onProxyReload(ProxyReloadEvent event) {
    System.out.println("test321");
  }
}

Excepted behaviour:

  • It writes test123 on startup
  • It writes test321 after /velocity reload

Current behaviour:

  • It writes test123 on startup
  • It doesn't write test321 after /velocity reload

We can't register the main instance again (eventManager.registerListeners(this, this)) as the "The plugin main instance is automatically registered." error appears

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.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.