Remove the isAcceptingLogins storage state in favour of just throwing exceptions on usage

This commit is contained in:
Luck
2017-12-09 19:02:23 +00:00
Unverified
parent 94b4e3d366
commit 9dd4f71526
15 changed files with 82 additions and 105 deletions
@@ -67,24 +67,6 @@ public class SpongeConnectionListener {
plugin.getLog().info("Processing auth event for " + p.getUniqueId() + " - " + p.getName());
}
/* 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
this data is loaded. */
if (!plugin.getStorage().isAcceptingLogins()) {
// log that the user tried to login, but was denied at this stage.
deniedAsyncLogin.add(p.getUniqueId());
// actually deny the connection.
plugin.getLog().warn("Permissions storage is not loaded. Denying connection from: " + p.getUniqueId() + " - " + p.getName());
e.setCancelled(true);
e.setMessageCancelled(false);
//noinspection deprecation
e.setMessage(TextSerializers.LEGACY_FORMATTING_CODE.deserialize(Message.LOADING_ERROR.asString(plugin.getLocaleManager())));
return;
}
plugin.getUniqueConnections().add(p.getUniqueId());
/* Actually process the login for the connection.
@@ -100,6 +82,7 @@ public class SpongeConnectionListener {
User user = LoginHelper.loadUser(plugin, p.getUniqueId(), username, false);
plugin.getApiProvider().getEventFactory().handleUserLoginProcess(p.getUniqueId(), username, user);
} catch (Exception ex) {
plugin.getLog().severe("Exception occured whilst loading data for " + p.getUniqueId() + " - " + p.getName());
ex.printStackTrace();
deniedAsyncLogin.add(p.getUniqueId());