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
onForceActionSuccess(session);
} else {
boolean success = false;
if (isOnline(player)) {
if (core.getConfig().get("autoLogin", true)) {
if (session.needsRegistration()) {
success = forceRegister(player);
} else {
success = forceLogin(player);
}
boolean success = true;
String playerName = getName(player);
if (core.getConfig().get("autoLogin", true)) {
if (session.needsRegistration()
|| (core.getConfig().get("auto-register-unknown", false)
&& !authPlugin.isRegistered(playerName))) {
success = forceRegister(player);
} else {
success = true;
success = forceLogin(player);
}
}
@ -61,13 +60,11 @@ public abstract class ForceLoginMangement<P extends C, C, L extends LoginSession
onForceActionSuccess(session);
}
}
} else {
} else if (playerProfile != null) {
//cracked player
if (playerProfile != null) {
playerProfile.setUuid(null);
playerProfile.setPremium(false);
storage.save(playerProfile);
}
playerProfile.setUuid(null);
playerProfile.setPremium(false);
storage.save(playerProfile);
}
} catch (Exception 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
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
# the player won't be auto logged into the account.
#