Glowstone
Glowstone copied to clipboard
Async events
md_5 did simple non blocking event system: https://github.com/SpigotMC/BungeeCord/blob/master/api/src/main/java/net/md_5/bungee/api/event/AsyncEvent.java
We can make something similar. #215 shows how it can be helpful. What do you think?
Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.
https://github.com/GlowstonePlusPlus/Glowkit/blob/bukkit%2Bglowkit/src/main/java/org/bukkit/event/Event.java#L32 ?
@mastercoms that events are called from other thread (not main), and it is only used for synchronization there
I mean to add way to delay event, like BungeeCord has
This ticket needs categorization on the waffle board.
Has this ticket seen any movement or has there been any action expected since the previous comment?
So the server should create a new Thread for each async event?
No. Small example: We have PlayerSpawnLocationEvent, it is called in main thread. Location is saved in mysql, so java will wait for that data. It cause some lags :confused:
Solution:
- event handler mark event like in BungeeCord
event.registerIntend
- plugin will create new thread (server dosen't care about it) and get needed data
- event.setSpawnLocation(locationFromMysql);
- call
event.completeIntend
- server will finish event in main thread (ofc in next tick)
Any updates on this issue?
No, there's been no movement on this.