Mirror von
https://github.com/PaperMC/Velocity.git
synchronisiert 2024-11-06 00:00:47 +01:00
Optimize VelocityEventManager#fireAndForget()
There isn't a need to create a CompletableFuture when firing an event and we do not want to know when it is completed.
Dieser Commit ist enthalten in:
Ursprung
9e6e1856e6
Commit
3ec67a7d4d
@ -118,6 +118,18 @@ public class VelocityEventManager implements EventManager {
|
|||||||
return eventFuture;
|
return eventFuture;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void fireAndForget(Object event) {
|
||||||
|
if (event == null) {
|
||||||
|
throw new NullPointerException("event");
|
||||||
|
}
|
||||||
|
if (!bus.hasSubscribers(event.getClass())) {
|
||||||
|
// Optimization: nobody's listening.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
service.execute(() -> fireEvent(event));
|
||||||
|
}
|
||||||
|
|
||||||
private void fireEvent(Object event) {
|
private void fireEvent(Object event) {
|
||||||
PostResult result = bus.post(event);
|
PostResult result = bus.post(event);
|
||||||
if (!result.exceptions().isEmpty()) {
|
if (!result.exceptions().isEmpty()) {
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren