Source:
private boolean post(Event event, List<RegisteredListener<?>> handlers) { if (!Sponge.getServer().isMainThread()) { for (@SuppressWarnings("rawtypes") RegisteredListener handler : handlers) { try { if (event instanceof AbstractEvent) { ((AbstractEvent) event).currentOrder = handler.getOrder(); } handler.handle(event); } catch (Throwable e) { SpongeImpl.getLogger().error("Could not pass to {}", event.getClass().getSimpleName(), handler.getPlugin(), e); } } if (event instanceof AbstractEvent) { ((AbstractEvent) event).currentOrder = null; } return event instanceof Cancellable && ((Cancellable) event).isCancelled(); } TimingsManager.PLUGIN_EVENT_HANDLER.startTimingIfSync(); for (@SuppressWarnings("rawtypes") RegisteredListener handler : handlers) { Sponge.getCauseStackManager().pushCause(handler.getPlugin()); try (CauseStackManager.StackFrame frame = Sponge.getCauseStackManager().pushCauseFrame(); final PhaseContext<?> context = PluginPhase.Listener.GENERAL_LISTENER.createPhaseContext() .source(handler.getPlugin()) .buildAndSwitch(); final Timing timings = handler.getTimingsHandler()) { timings.startTimingIfSync(); if (event instanceof AbstractEvent) { ((AbstractEvent) event).currentOrder = handler.getOrder(); } handler.handle(event); } catch (Throwable e) { final PrettyPrinter printer = new PrettyPrinter(60).add("Error with event listener handling").centre().hr(); printer.add("A listener threw an exception while being handled, this is usually not a sponge bug.") this.logger.error("Could not pass to {}", event.getClass().getSimpleName(), handler.getPlugin(), e); } Sponge.getCauseStackManager().popCause(); } if (event instanceof AbstractEvent) { ((AbstractEvent) event).currentOrder = null; } return event instanceof Cancellable && ((Cancellable) event).isCancelled(); }

Target:
private boolean post(Event event, List<RegisteredListener<?>> handlers) { if (!Sponge.getServer().isMainThread()) { for (@SuppressWarnings("rawtypes") RegisteredListener handler : handlers) { try { if (event instanceof AbstractEvent) { ((AbstractEvent) event).currentOrder = handler.getOrder(); } handler.handle(event); } catch (Throwable e) { SpongeImpl.getLogger().error("Could not pass to {}", event.getClass().getSimpleName(), handler.getPlugin(), e); } } if (event instanceof AbstractEvent) { ((AbstractEvent) event).currentOrder = null; } return event instanceof Cancellable && ((Cancellable) event).isCancelled(); } TimingsManager.PLUGIN_EVENT_HANDLER.startTimingIfSync(); for (@SuppressWarnings("rawtypes") RegisteredListener handler : handlers) { try (CauseStackManager.StackFrame frame = Sponge.getCauseStackManager().pushCauseFrame(); final PhaseContext<?> context = PluginPhase.Listener.GENERAL_LISTENER.createPhaseContext() .source(handler.getPlugin()); final Timing timings = handler.getTimingsHandler()) { frame.pushCause(handler.getPlugin()); context.buildAndSwitch(); timings.startTimingIfSync(); if (event instanceof AbstractEvent) { ((AbstractEvent) event).currentOrder = handler.getOrder(); } handler.handle(event); } catch (Throwable e) { final PrettyPrinter printer = new PrettyPrinter(60).add("Error with event listener handling").centre().hr(); printer.add("A listener threw an exception while being handled, this is usually not a sponge bug."); this.logger.error("Could not pass to {}", event.getClass().getSimpleName(), handler.getPlugin(), e); } } if (event instanceof AbstractEvent) { ((AbstractEvent) event).currentOrder = null; } return event instanceof Cancellable && ((Cancellable) event).isCancelled(); }