Skip to content

EventManager#unregisterListeners unregisters the plugin main instance #780

Open
@hevav

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

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions