Want a better Minecraft server? Read about SpigotMC here!
Separate names with a comma.
Discussion in 'Spigot Plugin Development' started by Simo389, May 22, 2015.
Well, I always thought this event was actually called asynchronously, therefore the name... Sure it isn't?
AsyncChatEvent's are called in an Async thread (a thread that's not the main thread).
It can 'come back' to the main thread and tax the main thread if you're calling methods that run on the main thread. It depends on what you're doing in the listener.
Also something worth mentioning is that the documentation states:
This event will sometimes fire synchronously, depending on how it was triggered.
But it seems that's only when a plugin causes the event to fire.
methods have no context of what thread they're in. If you call a method it won't magically execute on a different thread.
If the event is running on the main thread and you call methods in it, it will run on the main thread. Just because it has async in the name doesn't mean it will always be async.
It could very well be, because PlayerChatEvent fires on the main thread 100% of the time...
Yes, that's a given.