From 5cd5186092a7d3e86f8d5d15bb6fc6e44af72963 Mon Sep 17 00:00:00 2001 From: Luck Date: Mon, 26 Jun 2017 21:39:59 +0100 Subject: [PATCH] Don't cancel re-allowed connections unless the cancel was made by LP --- .../lucko/luckperms/bukkit/BukkitListener.java | 14 -------------- .../lucko/luckperms/bungee/BungeeListener.java | 17 ----------------- .../lucko/luckperms/sponge/SpongeListener.java | 12 ------------ 3 files changed, 43 deletions(-) diff --git a/bukkit/src/main/java/me/lucko/luckperms/bukkit/BukkitListener.java b/bukkit/src/main/java/me/lucko/luckperms/bukkit/BukkitListener.java index e81097804..76568c34f 100644 --- a/bukkit/src/main/java/me/lucko/luckperms/bukkit/BukkitListener.java +++ b/bukkit/src/main/java/me/lucko/luckperms/bukkit/BukkitListener.java @@ -71,13 +71,6 @@ public class BukkitListener implements Listener { ex.printStackTrace(); } - /* the player was denied entry to the server before this priority. - log this, so we can handle appropriately later. */ - if (e.getLoginResult() != AsyncPlayerPreLoginEvent.Result.ALLOWED) { - deniedAsyncLogin.add(e.getUniqueId()); - return; - } - /* there was an issue connecting to the DB, performing file i/o, etc. we don't let players join in this case, because it means they can connect to the server without their permissions data. some server admins rely on negating perms to stop users from causing damage etc, so it's really important that @@ -144,13 +137,6 @@ public class BukkitListener implements Listener { At this point, the users data should be present and loaded. Listening on LOW priority to allow plugins to further modify data here. (auth plugins, etc.) */ - /* the player was denied entry to the server before this priority. - log this, so we can handle appropriately later. */ - if (e.getResult() != PlayerLoginEvent.Result.ALLOWED) { - deniedLogin.add(e.getPlayer().getUniqueId()); - return; - } - final Player player = e.getPlayer(); final User user = plugin.getUserManager().getIfLoaded(plugin.getUuidCache().getUUID(player.getUniqueId())); diff --git a/bungee/src/main/java/me/lucko/luckperms/bungee/BungeeListener.java b/bungee/src/main/java/me/lucko/luckperms/bungee/BungeeListener.java index 18fefe3ba..b39d1d43e 100644 --- a/bungee/src/main/java/me/lucko/luckperms/bungee/BungeeListener.java +++ b/bungee/src/main/java/me/lucko/luckperms/bungee/BungeeListener.java @@ -47,9 +47,6 @@ import net.md_5.bungee.api.plugin.Listener; import net.md_5.bungee.event.EventHandler; import net.md_5.bungee.event.EventPriority; -import java.util.Collections; -import java.util.HashSet; -import java.util.Set; import java.util.UUID; import java.util.concurrent.TimeUnit; @@ -57,8 +54,6 @@ import java.util.concurrent.TimeUnit; public class BungeeListener implements Listener { private final LPBungeePlugin plugin; - private final Set deniedLogin = Collections.synchronizedSet(new HashSet<>()); - @EventHandler(priority = EventPriority.LOW) public void onPlayerLogin(LoginEvent e) { /* Called when the player first attempts a connection with the server. @@ -74,16 +69,6 @@ public class BungeeListener implements Listener { final PendingConnection c = e.getConnection(); - /* another plugin (or the proxy itself) has cancelled this connection already */ - if (e.isCancelled()) { - - // log that we are not loading any data - deniedLogin.add(c.getUniqueId()); - - e.completeIntent(plugin); - return; - } - /* there was an issue connecting to the DB, performing file i/o, etc. as this is bungeecord, we will still allow the login, as players can't really do much harm without permissions data. the proxy will just fallback to using the config file perms. */ @@ -91,7 +76,6 @@ public class BungeeListener implements Listener { // log that the user tried to login, but was denied at this stage. plugin.getLog().warn("Permissions storage is not loaded. No permissions data will be loaded for: " + c.getUniqueId() + " - " + c.getName()); - deniedLogin.add(c.getUniqueId()); e.completeIntent(plugin); return; @@ -115,7 +99,6 @@ public class BungeeListener implements Listener { // there was some error loading plugin.getLog().warn("Error loading data. No permissions data will be loaded for: " + c.getUniqueId() + " - " + c.getName()); - deniedLogin.add(c.getUniqueId()); } // finally, complete our intent to modify state, so the proxy can continue handling the connection. diff --git a/sponge/src/main/java/me/lucko/luckperms/sponge/SpongeListener.java b/sponge/src/main/java/me/lucko/luckperms/sponge/SpongeListener.java index cb4d70b6f..5a513088e 100644 --- a/sponge/src/main/java/me/lucko/luckperms/sponge/SpongeListener.java +++ b/sponge/src/main/java/me/lucko/luckperms/sponge/SpongeListener.java @@ -72,13 +72,6 @@ public class SpongeListener { final GameProfile p = e.getProfile(); - /* the player was denied entry to the server before this priority. - log this, so we can handle appropriately later. */ - if (e.isCancelled()) { - deniedAsyncLogin.add(p.getUniqueId()); - return; - } - /* either the plugin hasn't finished starting yet, or there was an issue connecting to the DB, performing file i/o, etc. we don't let players join in this case, because it means they can connect to the server without their permissions data. some server admins rely on negating perms to stop users from causing damage etc, so it's really important that @@ -147,11 +140,6 @@ public class SpongeListener { final GameProfile player = e.getProfile(); - /* the player was denied entry to the server before this priority. */ - if (e.isCancelled()) { - return; - } - final User user = plugin.getUserManager().getIfLoaded(plugin.getUuidCache().getUUID(player.getUniqueId())); /* User instance is null for whatever reason. Could be that it was unloaded between asyncpre and now. */