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
@@ -308,7 +308,7 @@ public class BukkitService implements SettingsDependent {
}
/**
* Adds a ban to the this list. If a previous ban exists, this will
* Adds a ban to the list. If a previous ban exists, this will
* update the previous entry.
*
* @param ip the ip of the ban
@@ -46,7 +46,7 @@ public class BungeeReceiver implements PluginMessageListener, SettingsDependent
this.isEnabled = bukkitService.isBungeeCordConfiguredForSpigot().orElse(false);
}
if (this.isEnabled) {
Messenger messenger = plugin.getServer().getMessenger();
final Messenger messenger = plugin.getServer().getMessenger();
if (!messenger.isIncomingChannelRegistered(plugin, "BungeeCord")) {
messenger.registerIncomingPluginChannel(plugin, "BungeeCord", this);
}
@@ -83,6 +83,7 @@ public class BungeeSender implements SettingsDependent {
if (!isEnabled || destinationServerOnLogin.isEmpty()) {
return;
}
// Add a small delay, just in case...
bukkitService.scheduleSyncDelayedTask(() ->
sendBungeecordMessage(player, "Connect", destinationServerOnLogin), 5L);
}