forked from TuxCoding/FastLogin
Reduce the number of lookups if a cracked player already exists
This commit is contained in:
@ -54,12 +54,14 @@ public class NameCheckTask implements Runnable {
|
|||||||
|
|
||||||
if (profile.getUserId() == -1) {
|
if (profile.getUserId() == -1) {
|
||||||
UUID premiumUUID = null;
|
UUID premiumUUID = null;
|
||||||
if (plugin.getConfig().getBoolean("nameChangeCheck") || plugin.getConfig().getBoolean("autoRegister")) {
|
|
||||||
premiumUUID = plugin.getCore().getMojangApiConnector().getPremiumUUID(username);
|
|
||||||
}
|
|
||||||
|
|
||||||
//user not exists in the db
|
//user not exists in the db
|
||||||
try {
|
try {
|
||||||
|
if (plugin.getConfig().getBoolean("nameChangeCheck") || (plugin.getConfig().getBoolean("autoRegister")
|
||||||
|
&& plugin.getAuthPlugin().isRegistered(username))) {
|
||||||
|
premiumUUID = plugin.getCore().getMojangApiConnector().getPremiumUUID(username);
|
||||||
|
}
|
||||||
|
|
||||||
if (premiumUUID != null && plugin.getConfig().getBoolean("nameChangeCheck")) {
|
if (premiumUUID != null && plugin.getConfig().getBoolean("nameChangeCheck")) {
|
||||||
profile = plugin.getCore().getStorage().loadProfile(premiumUUID);
|
profile = plugin.getCore().getStorage().loadProfile(premiumUUID);
|
||||||
if (profile != null) {
|
if (profile != null) {
|
||||||
@ -69,8 +71,7 @@ public class NameCheckTask implements Runnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (premiumUUID != null && plugin.getConfig().getBoolean("autoRegister")
|
if (premiumUUID != null && plugin.getConfig().getBoolean("autoRegister")) {
|
||||||
&& !plugin.getAuthPlugin().isRegistered(username)) {
|
|
||||||
plugin.getLogger().log(Level.FINER, "Player {0} uses a premium username", username);
|
plugin.getLogger().log(Level.FINER, "Player {0} uses a premium username", username);
|
||||||
enablePremiumLogin(profile, false);
|
enablePremiumLogin(profile, false);
|
||||||
return;
|
return;
|
||||||
|
@ -44,12 +44,14 @@ public class ProtocolSupportListener implements Listener {
|
|||||||
if (profile != null) {
|
if (profile != null) {
|
||||||
if (profile.getUserId() == -1) {
|
if (profile.getUserId() == -1) {
|
||||||
UUID premiumUUID = null;
|
UUID premiumUUID = null;
|
||||||
if (plugin.getConfig().getBoolean("nameChangeCheck") || plugin.getConfig().getBoolean("autoRegister")) {
|
|
||||||
premiumUUID = plugin.getCore().getMojangApiConnector().getPremiumUUID(username);
|
|
||||||
}
|
|
||||||
|
|
||||||
//user not exists in the db
|
//user not exists in the db
|
||||||
try {
|
try {
|
||||||
|
if (plugin.getConfig().getBoolean("nameChangeCheck") || (plugin.getConfig().getBoolean("autoRegister")
|
||||||
|
&& plugin.getAuthPlugin().isRegistered(username))) {
|
||||||
|
premiumUUID = plugin.getCore().getMojangApiConnector().getPremiumUUID(username);
|
||||||
|
}
|
||||||
|
|
||||||
if (premiumUUID != null && plugin.getConfig().getBoolean("nameChangeCheck")) {
|
if (premiumUUID != null && plugin.getConfig().getBoolean("nameChangeCheck")) {
|
||||||
profile = plugin.getCore().getStorage().loadProfile(premiumUUID);
|
profile = plugin.getCore().getStorage().loadProfile(premiumUUID);
|
||||||
if (profile != null) {
|
if (profile != null) {
|
||||||
|
@ -40,8 +40,8 @@ public class AsyncPremiumCheck implements Runnable {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (premiumUUID == null
|
if (premiumUUID == null
|
||||||
|| checkNameChange(premiumUUID, connection, username)
|
|| !checkNameChange(premiumUUID, connection, username)
|
||||||
|| checkPremiumName(username, connection, profile)) {
|
|| !checkPremiumName(username, connection, profile)) {
|
||||||
//nothing detected the player as premium -> start a cracked session
|
//nothing detected the player as premium -> start a cracked session
|
||||||
plugin.getSession().put(connection, new BungeeLoginSession(username, false, profile));
|
plugin.getSession().put(connection, new BungeeLoginSession(username, false, profile));
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user