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
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -300,7 +300,13 @@ public class AsynchronousLogin implements AsynchronousProcess {
|
|||||||
playerCache.updatePlayer(auth);
|
playerCache.updatePlayer(auth);
|
||||||
dataSource.setLogged(name);
|
dataSource.setLogged(name);
|
||||||
sessionService.grantSession(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
|
// As the scheduling executes the Task most likely after the current
|
||||||
// task, we schedule it in the end
|
// 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.
|
* update the previous entry.
|
||||||
*
|
*
|
||||||
* @param ip the ip of the ban
|
* @param ip the ip of the ban
|
||||||
|
|||||||
@ -46,7 +46,7 @@ public class BungeeReceiver implements PluginMessageListener, SettingsDependent
|
|||||||
this.isEnabled = bukkitService.isBungeeCordConfiguredForSpigot().orElse(false);
|
this.isEnabled = bukkitService.isBungeeCordConfiguredForSpigot().orElse(false);
|
||||||
}
|
}
|
||||||
if (this.isEnabled) {
|
if (this.isEnabled) {
|
||||||
Messenger messenger = plugin.getServer().getMessenger();
|
final Messenger messenger = plugin.getServer().getMessenger();
|
||||||
if (!messenger.isIncomingChannelRegistered(plugin, "BungeeCord")) {
|
if (!messenger.isIncomingChannelRegistered(plugin, "BungeeCord")) {
|
||||||
messenger.registerIncomingPluginChannel(plugin, "BungeeCord", this);
|
messenger.registerIncomingPluginChannel(plugin, "BungeeCord", this);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -83,6 +83,7 @@ public class BungeeSender implements SettingsDependent {
|
|||||||
if (!isEnabled || destinationServerOnLogin.isEmpty()) {
|
if (!isEnabled || destinationServerOnLogin.isEmpty()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
// Add a small delay, just in case...
|
||||||
bukkitService.scheduleSyncDelayedTask(() ->
|
bukkitService.scheduleSyncDelayedTask(() ->
|
||||||
sendBungeecordMessage(player, "Connect", destinationServerOnLogin), 5L);
|
sendBungeecordMessage(player, "Connect", destinationServerOnLogin), 5L);
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user