No longer necessary to synchronize sync events

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot
2020-01-29 09:23:40 +11:00
parent 10ae864f52
commit e18807dc04

View File

@@ -506,8 +506,6 @@ public final class SimplePluginManager implements PluginManager {
/** /**
* Calls an event with the given details. * Calls an event with the given details.
* <p>
* This method only synchronizes when the event is not asynchronous.
* *
* @param event Event details * @param event Event details
*/ */
@@ -520,16 +518,14 @@ public final class SimplePluginManager implements PluginManager {
if (server.isPrimaryThread()) { if (server.isPrimaryThread()) {
throw new IllegalStateException(event.getEventName() + " cannot be triggered asynchronously from primary server thread."); throw new IllegalStateException(event.getEventName() + " cannot be triggered asynchronously from primary server thread.");
} }
fireEvent(event);
} else { } else {
if (!server.isPrimaryThread()) { if (!server.isPrimaryThread()) {
throw new IllegalStateException(event.getEventName() + " cannot be triggered asynchronously from another thread."); throw new IllegalStateException(event.getEventName() + " cannot be triggered asynchronously from another thread.");
} }
synchronized (this) { }
fireEvent(event); fireEvent(event);
} }
}
}
private void fireEvent(@NotNull Event event) { private void fireEvent(@NotNull Event event) {
HandlerList handlers = event.getHandlers(); HandlerList handlers = event.getHandlers();