This is sort of a general java post, so it may be in the wrong place. However, I thought there may be some utility built into sponge, for convenience, that I’m missing, so I thought I would ask. What would you consider to be the easiest, most lightweight way to run code after a delay? I’ve seen Timers, ScheduledExecutorServices, etc, however I don’t know which would be best. Thoughts? Thanks!
Further thoughts: Of course, I’m probably capable of making it work in multiple ways, but this is more of a post asking for opinions from others with more experience
in the sense of minecraft plugins, the best way to probably do it would be to use the scheduler service as opposed to making your own timer. scheduler service ensures you’re running a task in sync with the server’s stuff. of course, you’re free to do some things on your own thread, but most things in Minecraft are stuck in the single-threaded handling–meaning you can’t access a lot of api methods without making the server cry; you’re better off letting it execute when it can instead of executing it alongside.
I’m sad I didn’t look at the docs for this. Sorry about that. But thank you @Xemiru, that’s exactly what I was looking for. Thanks for the awesome explanation too!