mirror of
https://github.com/LuckPerms/LuckPerms.git
synced 2026-11-24 08:14:25 +00:00
Don't attempt to load permissions data for login events cancelled at the lowest priority
Makes LuckPerms more compatible with "anti-bot" plugins.
This commit is contained in:
4 files changed
+33
-3
No files matched your search
+9
-1
@@ -59,7 +59,8 @@ public class SpongeConnectionListener extends AbstractConnectionListener {
|
||||
@IsCancelled(Tristate.UNDEFINED)
|
||||
public void onClientAuth(ClientConnectionEvent.Auth e) {
|
||||
/* Called when the player first attempts a connection with the server.
|
||||
Listening on AFTER_PRE priority to allow plugins to modify username / UUID data here. (auth plugins) */
|
||||
Listening on AFTER_PRE priority to allow plugins to modify username / UUID data here. (auth plugins)
|
||||
Also, give other plugins a chance to cancel the event. */
|
||||
|
||||
final GameProfile profile = e.getProfile();
|
||||
final String username = profile.getName().orElseThrow(() -> new RuntimeException("No username present for user " + profile.getUniqueId()));
|
||||
@@ -68,6 +69,13 @@ public class SpongeConnectionListener extends AbstractConnectionListener {
|
||||
this.plugin.getLogger().info("Processing auth event for " + profile.getUniqueId() + " - " + profile.getName());
|
||||
}
|
||||
|
||||
if (e.isCancelled()) {
|
||||
// another plugin has disallowed the login.
|
||||
this.plugin.getLogger().info("Another plugin has cancelled the connection for " + profile.getUniqueId() + " - " + username + ". No permissions data will be loaded.");
|
||||
this.deniedAsyncLogin.add(profile.getUniqueId());
|
||||
return;
|
||||
}
|
||||
|
||||
/* Actually process the login for the connection.
|
||||
We do this here to delay the login until the data is ready.
|
||||
If the login gets cancelled later on, then this will be cleaned up.
|
||||
|
||||
Reference in new issue
Block a user