You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Multiple improvements with listeners and their documentation.
- Added a method to remove registered listeners again
- Fixed a bug where a listener that gets registered with onEnable when bluemap is already enabled is not being called
- Improved the documentation for the onEnable and onDisable functions
* @return <code>true</code> if a listener was removed as a result of this call
137
133
*
138
134
* @deprecated Implementing {@link BlueMapAPIListener} can cause a ClassNotFoundException when you soft-depend on BlueMap and your plugin/mod gets used without BlueMap.
139
-
* Use {@link BlueMapAPI#onEnable(Consumer)} and {@link BlueMapAPI#onDisable(Consumer)} instead.
135
+
* Use {@link BlueMapAPI#onEnable(Consumer)} and {@link BlueMapAPI#onDisable(Consumer)} instead.
if (BlueMapAPI.instance != null) consumer.accept(BlueMapAPI.instance);
162
161
}
163
162
164
163
/**
165
-
* Registers a {@link Consumer} that will be called <b>before</b> BlueMap is being unloaded and stopped, after the consumer returns the API is no longer usable!<br>
164
+
* Registers a {@link Consumer} that will be called every time <b>before</b> BlueMap is being unloaded and stopped, after the consumer returns the API is no longer usable!<br>
166
165
* Unlike with {@link BlueMapAPI#onEnable(Consumer)}, if {@link BlueMapAPI} is not enabled when this listener is registered the consumer will <b>not</b> be called.
166
+
* <p><b>The {@link Consumer} can be called multiple times if BlueMap disables and enables again, e.g. if BlueMap gets reloaded!</b></p>
167
167
* <p><i>(Note: The consumer will likely be called asynchronously, <b>not</b> on the server-thread!)</i></p>
168
+
* <p>Remember to unregister the consumer when you no longer need it using {@link #unregisterListener(Consumer)}.</p>
0 commit comments