Delay force login command for async logins on Paper from Bungee

Related #331
This commit is contained in:
games647
2020-05-07 16:21:03 +02:00
parent 9bae5c3f79
commit b6a95bb153
2 changed files with 17 additions and 6 deletions

View File

@ -11,25 +11,31 @@ So they don't need to enter passwords. This is also called auto login (auto-logi
* Cauldron support
* Forge/Sponge message support
* Premium UUID support
* Forwards Skins
* Forward skins
* Detect user name changed and will update the existing database record
* BungeeCord support
* Auto register new premium players
* Plugin: ProtocolSupport is supported and can be used as an alternative to ProtocolLib
* No client modifications needed
* Good performance by using async non blocking operations
* Good performance by using async operations
* Locale messages
* Import the database from similar plugins
## Issues
Please use issues for bug reports, suggestions, questions and more. Please check for existing issues. Existing issues
can be upvoted by adding up vote to the original post.
## Development builds
Development builds of this project can be acquired at the provided CI (continuous integration) server. It contains the
latest changes from the Source-Code in preparation for the following release. This means they could contain new
features, bug fixes and other changes since the last release.
Nevertheless builds are only tested using a small set of automated and a few manual tests. Therefore they **could**
contain new bugs and are likely to be less stable than released versions.
They **could** contain new bugs and are likely to be less stable than released versions.
Specific builds can be grabbed by clicking on the build number on the left side or by clicking on status to retrieve the
latest build.
https://ci.codemc.org/job/Games647/job/FastLogin/changes
***
@ -97,7 +103,7 @@ Put your stats id from the BungeeCord config into this file
5. Download and Install FastLogin (or FastLoginBungee in newer versions) on BungeeCord AND Spigot
(on the servers where your login plugin is or where player should be able to execute the commands of FastLogin)
6. Check your database settings in the config of FastLogin on BungeeCord
7. Set your proxy (BungeeCord) in offline mode by setting the value onlinemode in your config.yml to false
7. Set proxy and Spigot in offline mode by setting the value onlinemode in your config.yml to false
8. You should *always* firewall your Spigot server that it's only accessible through BungeeCord
* https://www.spigotmc.org/wiki/bungeecord-installation/#post-installation
* BungeeCord doesn't support SQLite per default, so you should change the configuration to MySQL or MariaDB

View File

@ -9,7 +9,9 @@ import com.github.games647.fastlogin.core.shared.LoginSession;
import java.lang.reflect.Field;
import java.util.UUID;
import java.util.concurrent.TimeUnit;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.api.connection.PendingConnection;
import net.md_5.bungee.api.connection.ProxiedPlayer;
import net.md_5.bungee.api.connection.Server;
@ -100,8 +102,11 @@ public class ConnectListener implements Listener {
ProxiedPlayer player = serverConnectedEvent.getPlayer();
Server server = serverConnectedEvent.getServer();
// delay sending force command, because Paper will process the login event asynchronously
// In this case it means that the force command (plugin message) is already received and processed while
// player is still in the login phase and reported to be offline.
Runnable loginTask = new ForceLoginTask(plugin.getCore(), player, server);
plugin.getScheduler().runAsync(loginTask);
ProxyServer.getInstance().getScheduler().schedule(plugin, loginTask, 500, TimeUnit.MILLISECONDS);
}
@EventHandler