Conversation
| CompletableFuture.allOf( | ||
| clients.stream() | ||
| .map(client -> CompletableFuture.runAsync(() -> client.sendEvent(event, message))) | ||
| .toArray(CompletableFuture[]::new) | ||
| ); |
There was a problem hiding this comment.
This can be simplified, the result of the futures is ignored so combining them into one is redundant.
(requires adding a plugin field obviously)
| CompletableFuture.allOf( | |
| clients.stream() | |
| .map(client -> CompletableFuture.runAsync(() -> client.sendEvent(event, message))) | |
| .toArray(CompletableFuture[]::new) | |
| ); | |
| for (final SseClient client : clients) { | |
| plugin.getServer().getAsyncScheduler().runNow(plugin, task -> client.sendEvent(event, message)); | |
| } |
| import net.earthmc.emcapi.manager.SSEManager; | ||
|
|
||
|
|
||
| public class PlayerConnectionListener implements Listener { |
There was a problem hiding this comment.
I think that player join/quit events are too intrusive, this class should be removed
There was a problem hiding this comment.
I shadow Warriorrrr's opinion, those events are intrusive though, it can prove helpful to have it...
|
Imo, the event names could cause some confusion, for example "DeleteNation" sounds like the event deletes the nation.
|
|
This PR has gone a bit stale but this is still something we're interested in having, feel free to re-open if this is still something you want to pursue (or someone else also can) |
This PR adds a
/eventsendpoint to the API that users can use as an EventSource. This endpoint relays and broadcasts multiple Towny events in real time, using server-sent events (SSE) through Javalin. The complete list and data structure can be found in the docs.