Automatically register players who are not known to the auth plugin

Fixes #85
This commit is contained in:
games647
2016-10-03 13:46:33 +02:00
parent 157ca04691
commit e924b7a2fa
2 changed files with 17 additions and 15 deletions

View File

@ -36,16 +36,15 @@ public abstract class ForceLoginMangement<P extends C, C, L extends LoginSession
//maybe only bungeecord plugin //maybe only bungeecord plugin
onForceActionSuccess(session); onForceActionSuccess(session);
} else { } else {
boolean success = false; boolean success = true;
if (isOnline(player)) { String playerName = getName(player);
if (core.getConfig().get("autoLogin", true)) { if (core.getConfig().get("autoLogin", true)) {
if (session.needsRegistration()) { if (session.needsRegistration()
success = forceRegister(player); || (core.getConfig().get("auto-register-unknown", false)
} else { && !authPlugin.isRegistered(playerName))) {
success = forceLogin(player); success = forceRegister(player);
}
} else { } else {
success = true; success = forceLogin(player);
} }
} }
@ -61,13 +60,11 @@ public abstract class ForceLoginMangement<P extends C, C, L extends LoginSession
onForceActionSuccess(session); onForceActionSuccess(session);
} }
} }
} else { } else if (playerProfile != null) {
//cracked player //cracked player
if (playerProfile != null) { playerProfile.setUuid(null);
playerProfile.setUuid(null); playerProfile.setPremium(false);
playerProfile.setPremium(false); storage.save(playerProfile);
storage.save(playerProfile);
}
} }
} catch (Exception ex) { } catch (Exception ex) {
core.getPlugin().getLogger().log(Level.INFO, "ERROR ON FORCE LOGIN", ex); core.getPlugin().getLogger().log(Level.INFO, "ERROR ON FORCE LOGIN", ex);

View File

@ -144,6 +144,11 @@ ip-addresses: []
# If you want to join the discussion visit this: https://github.com/games647/FastLogin/issues/27#issuecomment-226954350 # If you want to join the discussion visit this: https://github.com/games647/FastLogin/issues/27#issuecomment-226954350
mojang-request-limit: 600 mojang-request-limit: 600
# This option automatically registers players which are in the FastLogin database, but not in the auth plugin database.
# This can happen if you switch your auth plugin or cleared the database of the auth plugin.
# https://github.com/games647/FastLogin/issues/85
auto-register-unknown: false
# This disables the auto login from fastlogin. So a premium (like a paid account) authentication is requested, but # This disables the auto login from fastlogin. So a premium (like a paid account) authentication is requested, but
# the player won't be auto logged into the account. # the player won't be auto logged into the account.
# #