Add delay to bungee force-login messages

This commit is contained in:
Gabriele C
2022-08-18 03:39:40 +02:00
parent b65ffd7c74
commit 6f1c63e693
5 changed files with 17 additions and 4 deletions
@@ -300,7 +300,13 @@ public class AsynchronousLogin implements AsynchronousProcess {
playerCache.updatePlayer(auth);
dataSource.setLogged(name);
sessionService.grantSession(name);
bungeeSender.sendAuthMeBungeecordMessage(player, MessageType.LOGIN);
if (bungeeSender.isEnabled()) {
// As described at https://www.spigotmc.org/wiki/bukkit-bungee-plugin-messaging-channel/
// "Keep in mind that you can't send plugin messages directly after a player joins."
bukkitService.scheduleSyncDelayedTask(() ->
bungeeSender.sendAuthMeBungeecordMessage(player, MessageType.LOGIN), 10L);
}
// As the scheduling executes the Task most likely after the current
// task, we schedule it in the end