mirror of
https://github.com/AuthMe/AuthMeReloaded.git
synced 2025-01-08 00:47:34 +01:00
Add delay to bungee force-login messages
This commit is contained in:
parent
b65ffd7c74
commit
6f1c63e693
@ -153,7 +153,13 @@ public class AsynchronousJoin implements AsynchronousProcess {
|
||||
});
|
||||
|
||||
// Skip if registration is optional
|
||||
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);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user