diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/NameCheckTask.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/NameCheckTask.java index e7e228f3..85f5b713 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/NameCheckTask.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/NameCheckTask.java @@ -54,12 +54,14 @@ public class NameCheckTask implements Runnable { if (profile.getUserId() == -1) { UUID premiumUUID = null; - if (plugin.getConfig().getBoolean("nameChangeCheck") || plugin.getConfig().getBoolean("autoRegister")) { - premiumUUID = plugin.getCore().getMojangApiConnector().getPremiumUUID(username); - } - + //user not exists in the db 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")) { profile = plugin.getCore().getStorage().loadProfile(premiumUUID); if (profile != null) { @@ -69,8 +71,7 @@ public class NameCheckTask implements Runnable { } } - if (premiumUUID != null && plugin.getConfig().getBoolean("autoRegister") - && !plugin.getAuthPlugin().isRegistered(username)) { + if (premiumUUID != null && plugin.getConfig().getBoolean("autoRegister")) { plugin.getLogger().log(Level.FINER, "Player {0} uses a premium username", username); enablePremiumLogin(profile, false); return; diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocolsupport/ProtocolSupportListener.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocolsupport/ProtocolSupportListener.java index 91429fb3..762ca9b2 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocolsupport/ProtocolSupportListener.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocolsupport/ProtocolSupportListener.java @@ -44,12 +44,14 @@ public class ProtocolSupportListener implements Listener { if (profile != null) { if (profile.getUserId() == -1) { UUID premiumUUID = null; - if (plugin.getConfig().getBoolean("nameChangeCheck") || plugin.getConfig().getBoolean("autoRegister")) { - premiumUUID = plugin.getCore().getMojangApiConnector().getPremiumUUID(username); - } //user not exists in the db 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")) { profile = plugin.getCore().getStorage().loadProfile(premiumUUID); if (profile != null) { diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/tasks/AsyncPremiumCheck.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/tasks/AsyncPremiumCheck.java index d1961c22..46959727 100644 --- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/tasks/AsyncPremiumCheck.java +++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/tasks/AsyncPremiumCheck.java @@ -40,8 +40,8 @@ public class AsyncPremiumCheck implements Runnable { } if (premiumUUID == null - || checkNameChange(premiumUUID, connection, username) - || checkPremiumName(username, connection, profile)) { + || !checkNameChange(premiumUUID, connection, username) + || !checkPremiumName(username, connection, profile)) { //nothing detected the player as premium -> start a cracked session plugin.getSession().put(connection, new BungeeLoginSession(username, false, profile)); }