diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java index 99a59c61..7d31a37c 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/FastLoginBukkit.java @@ -53,6 +53,8 @@ import org.slf4j.Logger; import java.net.InetSocketAddress; import java.nio.file.Path; import java.time.Duration; +import java.util.Collection; +import java.util.HashSet; import java.util.Map; import java.util.Optional; import java.util.UUID; @@ -75,6 +77,9 @@ public class FastLoginBukkit extends JavaPlugin implements PlatformPlugin pendingConfirms = new HashSet<>(); + @Getter private FastLoginCore core; @@ -84,6 +89,7 @@ public class FastLoginBukkit extends JavaPlugin implements PlatformPlugin getBedrockService() { if (floodgateService != null) { diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/auth/ConnectionListener.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/auth/ConnectionListener.java index 45579241..6f09c982 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/auth/ConnectionListener.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/auth/ConnectionListener.java @@ -94,7 +94,7 @@ public class ConnectionListener implements Listener { public void onPlayerQuit(PlayerQuitEvent quitEvent) { Player player = quitEvent.getPlayer(); - plugin.getCore().getPendingConfirms().remove(player.getUniqueId()); + plugin.getPendingConfirms().remove(player.getUniqueId()); plugin.getPremiumPlayers().remove(player.getUniqueId()); } } diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/auth/ForceLoginTask.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/auth/ForceLoginTask.java index b300c6ae..03f8aabd 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/auth/ForceLoginTask.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/auth/ForceLoginTask.java @@ -80,7 +80,7 @@ public class ForceLoginTask extends ForceLoginManagement either = packet.getSpecificModifier(Either.class).read(0); if (clientPublicKey == null) { Optional left = either.left(); - if (left.isEmpty()) { + if (!left.isPresent()) { plugin.getLog().error("No verify token sent if requested without player signed key {}", sender); return false; } @@ -212,7 +212,7 @@ public class ProtocolLibListener extends PacketAdapter { return EncryptionUtil.verifyNonce(expectedToken, keyPair.getPrivate(), left.get()); } else { Optional optSignatureData = either.right(); - if (optSignatureData.isEmpty()) { + if (!optSignatureData.isPresent()) { plugin.getLog().error("No signature given to sent player signing key {}", sender); return false; } diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/auth/proxy/ProxyAuthentication.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/auth/proxy/ProxyAuthentication.java index ca5c0e34..b426c741 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/auth/proxy/ProxyAuthentication.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/auth/proxy/ProxyAuthentication.java @@ -27,11 +27,15 @@ package com.github.games647.fastlogin.bukkit.auth.proxy; import com.github.games647.fastlogin.bukkit.FastLoginBukkit; import com.github.games647.fastlogin.bukkit.auth.AuthenticationBackend; +import com.github.games647.fastlogin.core.message.ChannelMessage; import com.github.games647.fastlogin.core.message.LoginActionMessage; import com.github.games647.fastlogin.core.message.NamespaceKey; +import com.google.common.io.ByteArrayDataOutput; +import com.google.common.io.ByteStreams; import org.bukkit.Bukkit; import org.bukkit.Server; import org.bukkit.plugin.PluginManager; +import org.bukkit.plugin.messaging.PluginMessageRecipient; import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; @@ -138,4 +142,14 @@ public class ProxyAuthentication implements AuthenticationBackend { return false; } + + public void sendPluginMessage(PluginMessageRecipient player, ChannelMessage message) { + if (player != null) { + ByteArrayDataOutput dataOutput = ByteStreams.newDataOutput(); + message.writeTo(dataOutput); + + NamespaceKey channel = new NamespaceKey(plugin.getName(), message.getChannelName()); + player.sendPluginMessage(plugin, channel.getCombinedName(), dataOutput.toByteArray()); + } + } } diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/auth/proxy/ProxyVerifier.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/auth/proxy/ProxyVerifier.java index be760b96..0f94c5d2 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/auth/proxy/ProxyVerifier.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/auth/proxy/ProxyVerifier.java @@ -26,13 +26,8 @@ package com.github.games647.fastlogin.bukkit.auth.proxy; import com.github.games647.fastlogin.bukkit.FastLoginBukkit; -import com.github.games647.fastlogin.core.message.ChannelMessage; -import com.github.games647.fastlogin.core.message.NamespaceKey; -import com.google.common.io.ByteArrayDataOutput; -import com.google.common.io.ByteStreams; import org.bukkit.Bukkit; import org.bukkit.entity.Player; -import org.bukkit.plugin.messaging.PluginMessageRecipient; import java.io.IOException; import java.nio.file.Files; @@ -67,16 +62,6 @@ public class ProxyVerifier { Bukkit.getOnlinePlayers().forEach(player -> player.removeMetadata(plugin.getName(), plugin)); } - public void sendPluginMessage(PluginMessageRecipient player, ChannelMessage message) { - if (player != null) { - ByteArrayDataOutput dataOutput = ByteStreams.newDataOutput(); - message.writeTo(dataOutput); - - NamespaceKey channel = new NamespaceKey(plugin.getName(), message.getChannelName()); - player.sendPluginMessage(plugin, channel.getCombinedName(), dataOutput.toByteArray()); - } - } - public void loadSecrets() { proxyIds = loadBungeeCordIds(); if (proxyIds.isEmpty()) { diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/command/PremiumCommand.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/command/PremiumCommand.java index 6f132271..37aac05b 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/command/PremiumCommand.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/command/PremiumCommand.java @@ -64,18 +64,18 @@ public class PremiumCommand extends ToggleCommand { return; } + UUID id = ((Player) sender).getUniqueId(); + if (plugin.getConfig().getBoolean("premium-warning") && !plugin.getPendingConfirms().contains(id)) { + sender.sendMessage(plugin.getCore().getMessage("premium-warning")); + plugin.getPendingConfirms().add(id); + return; + } + if (forwardPremiumCommand(sender, sender.getName())) { return; } - UUID id = ((Player) sender).getUniqueId(); - if (plugin.getConfig().getBoolean("premium-warning") && !plugin.getCore().getPendingConfirms().contains(id)) { - sender.sendMessage(plugin.getCore().getMessage("premium-warning")); - plugin.getCore().getPendingConfirms().add(id); - return; - } - - plugin.getCore().getPendingConfirms().remove(id); + plugin.getPendingConfirms().remove(id); //todo: load async StoredProfile profile = plugin.getCore().getStorage().loadProfile(sender.getName()); if (profile.isOnlinemodePreferred()) { diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/command/ToggleCommand.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/command/ToggleCommand.java index c0f9b032..12c29231 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/command/ToggleCommand.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/command/ToggleCommand.java @@ -26,6 +26,7 @@ package com.github.games647.fastlogin.bukkit.command; import com.github.games647.fastlogin.bukkit.FastLoginBukkit; +import com.github.games647.fastlogin.bukkit.auth.proxy.ProxyAuthentication; import com.github.games647.fastlogin.core.message.ChangePremiumMessage; import com.github.games647.fastlogin.core.message.ChannelMessage; import org.bukkit.Bukkit; @@ -55,7 +56,7 @@ public abstract class ToggleCommand implements CommandExecutor { } protected boolean forwardBungeeCommand(CommandSender sender, String target, boolean activate) { - if (plugin.getBungeeManager().isEnabled()) { + if (plugin.getBackend() instanceof ProxyAuthentication) { sendBungeeActivateMessage(sender, target, activate); plugin.getCore().sendLocaleMessage("wait-on-proxy", sender); return true; @@ -80,7 +81,7 @@ public abstract class ToggleCommand implements CommandExecutor { plugin.getBungeeManager().sendPluginMessage((PluginMessageRecipient) invoker, message); } else { Optional optPlayer = Bukkit.getServer().getOnlinePlayers().stream().findFirst(); - if (optPlayer.isEmpty()) { + if (!optPlayer.isPresent()) { plugin.getLog().info("No player online to send a plugin message to the proxy"); return; } diff --git a/bukkit/src/test/java/com/github/games647/fastlogin/bukkit/listener/protocollib/Base64Adapter.java b/bukkit/src/test/java/com/github/games647/fastlogin/bukkit/auth/protocollib/Base64Adapter.java similarity index 96% rename from bukkit/src/test/java/com/github/games647/fastlogin/bukkit/listener/protocollib/Base64Adapter.java rename to bukkit/src/test/java/com/github/games647/fastlogin/bukkit/auth/protocollib/Base64Adapter.java index 7376ef99..6f1c2cc8 100644 --- a/bukkit/src/test/java/com/github/games647/fastlogin/bukkit/listener/protocollib/Base64Adapter.java +++ b/bukkit/src/test/java/com/github/games647/fastlogin/bukkit/auth/protocollib/Base64Adapter.java @@ -23,7 +23,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.github.games647.fastlogin.bukkit.listener.protocollib; +package com.github.games647.fastlogin.bukkit.auth.protocollib; import com.google.gson.TypeAdapter; import com.google.gson.stream.JsonReader; diff --git a/bukkit/src/test/java/com/github/games647/fastlogin/bukkit/listener/protocollib/EncryptionUtilTest.java b/bukkit/src/test/java/com/github/games647/fastlogin/bukkit/auth/protocollib/EncryptionUtilTest.java similarity index 87% rename from bukkit/src/test/java/com/github/games647/fastlogin/bukkit/listener/protocollib/EncryptionUtilTest.java rename to bukkit/src/test/java/com/github/games647/fastlogin/bukkit/auth/protocollib/EncryptionUtilTest.java index 9255c25c..5bb469c0 100644 --- a/bukkit/src/test/java/com/github/games647/fastlogin/bukkit/listener/protocollib/EncryptionUtilTest.java +++ b/bukkit/src/test/java/com/github/games647/fastlogin/bukkit/auth/protocollib/EncryptionUtilTest.java @@ -23,11 +23,10 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.github.games647.fastlogin.bukkit.listener.protocollib; +package com.github.games647.fastlogin.bukkit.auth.protocollib; +import com.github.games647.fastlogin.bukkit.auth.protocollib.SignatureTestData.SignatureData; import com.github.games647.fastlogin.bukkit.auth.protocollib.packet.ClientPublicKey; -import com.github.games647.fastlogin.bukkit.auth.protocollib.protocollib.EncryptionUtil; -import com.github.games647.fastlogin.bukkit.listener.protocollib.SignatureTestData.SignatureData; import com.google.common.hash.Hashing; import lombok.val; import org.junit.jupiter.api.Test; @@ -89,7 +88,7 @@ class EncryptionUtilTest { @Test void testExpiredClientKey() throws Exception { - val clientKey = ResourceLoader.loadClientKey("client_keys/valid_public_key.json"); + val clientKey = com.github.games647.fastlogin.bukkit.auth.protocollib.ResourceLoader.loadClientKey("client_keys/valid_public_key.json"); // Client expires at the exact second mentioned, so use it for verification val expiredTimestamp = clientKey.expiry(); @@ -106,7 +105,7 @@ class EncryptionUtilTest { "client_keys/invalid_wrong_signature.json" }) void testInvalidClientKey(String clientKeySource) throws Exception { - val clientKey = ResourceLoader.loadClientKey(clientKeySource); + val clientKey = com.github.games647.fastlogin.bukkit.auth.protocollib.ResourceLoader.loadClientKey(clientKeySource); Instant expireTimestamp = clientKey.expiry().minus(5, ChronoUnit.HOURS); assertFalse(EncryptionUtil.verifyClientKey(clientKey, expireTimestamp, null)); @@ -114,7 +113,7 @@ class EncryptionUtilTest { @Test void testValidClientKey() throws Exception { - val clientKey = ResourceLoader.loadClientKey("client_keys/valid_public_key.json"); + val clientKey = com.github.games647.fastlogin.bukkit.auth.protocollib.ResourceLoader.loadClientKey("client_keys/valid_public_key.json"); val verificationTimestamp = clientKey.expiry().minus(5, ChronoUnit.HOURS); assertTrue(EncryptionUtil.verifyClientKey(clientKey, verificationTimestamp, null)); @@ -122,7 +121,7 @@ class EncryptionUtilTest { @Test void testValid191ClientKey() throws Exception { - val clientKey = ResourceLoader.loadClientKey("client_keys/valid_public_key_19_1.json"); + val clientKey = com.github.games647.fastlogin.bukkit.auth.protocollib.ResourceLoader.loadClientKey("client_keys/valid_public_key_19_1.json"); val verificationTimestamp = clientKey.expiry().minus(5, ChronoUnit.HOURS); val ownerPremiumId = UUID.fromString("0aaa2c13-922a-411b-b655-9b8c08404695"); @@ -131,7 +130,7 @@ class EncryptionUtilTest { @Test void testIncorrect191ClientOwner() throws Exception { - val clientKey = ResourceLoader.loadClientKey("client_keys/valid_public_key_19_1.json"); + val clientKey = com.github.games647.fastlogin.bukkit.auth.protocollib.ResourceLoader.loadClientKey("client_keys/valid_public_key_19_1.json"); val verificationTimestamp = clientKey.expiry().minus(5, ChronoUnit.HOURS); val ownerPremiumId = UUID.fromString("61699b2e-d327-4a01-9f1e-0ea8c3f06bc6"); @@ -171,7 +170,7 @@ class EncryptionUtilTest { void testServerIdHash() throws Exception { val serverId = ""; val sharedSecret = generateSharedKey(); - val serverPK = ResourceLoader.loadClientKey("client_keys/valid_public_key.json").key(); + val serverPK = com.github.games647.fastlogin.bukkit.auth.protocollib.ResourceLoader.loadClientKey("client_keys/valid_public_key.json").key(); String sessionHash = getServerHash(serverId, sharedSecret, serverPK); assertEquals(EncryptionUtil.getServerIdHashString(serverId, sharedSecret, serverPK), sessionHash); @@ -201,7 +200,7 @@ class EncryptionUtilTest { void testServerIdHashWrongSecret() throws Exception { val serverId = ""; val sharedSecret = generateSharedKey(); - val serverPK = ResourceLoader.loadClientKey("client_keys/valid_public_key.json").key(); + val serverPK = com.github.games647.fastlogin.bukkit.auth.protocollib.ResourceLoader.loadClientKey("client_keys/valid_public_key.json").key(); String sessionHash = getServerHash(serverId, sharedSecret, serverPK); assertNotEquals(EncryptionUtil.getServerIdHashString("", generateSharedKey(), serverPK), sessionHash); @@ -220,7 +219,7 @@ class EncryptionUtilTest { @Test void testValidSignedNonce() throws Exception { - ClientPublicKey clientKey = ResourceLoader.loadClientKey("client_keys/valid_public_key.json"); + ClientPublicKey clientKey = com.github.games647.fastlogin.bukkit.auth.protocollib.ResourceLoader.loadClientKey("client_keys/valid_public_key.json"); SignatureTestData testData = SignatureTestData.fromResource("signature/valid_signature.json"); assertTrue(verifySignedNonce(testData, clientKey)); } @@ -232,7 +231,7 @@ class EncryptionUtilTest { "signature/incorrect_signature.json", }) void testIncorrectNonce(String signatureSource) throws Exception { - ClientPublicKey clientKey = ResourceLoader.loadClientKey("client_keys/valid_public_key.json"); + ClientPublicKey clientKey = com.github.games647.fastlogin.bukkit.auth.protocollib.ResourceLoader.loadClientKey("client_keys/valid_public_key.json"); SignatureTestData testData = SignatureTestData.fromResource(signatureSource); assertFalse(verifySignedNonce(testData, clientKey)); } @@ -240,7 +239,7 @@ class EncryptionUtilTest { @Test void testWrongPublicKeySigned() throws Exception { // load a different public key - ClientPublicKey clientKey = ResourceLoader.loadClientKey("client_keys/invalid_wrong_key.json"); + ClientPublicKey clientKey = com.github.games647.fastlogin.bukkit.auth.protocollib.ResourceLoader.loadClientKey("client_keys/invalid_wrong_key.json"); SignatureTestData testData = SignatureTestData.fromResource("signature/valid_signature.json"); assertFalse(verifySignedNonce(testData, clientKey)); } diff --git a/bukkit/src/test/java/com/github/games647/fastlogin/bukkit/listener/protocollib/ResourceLoader.java b/bukkit/src/test/java/com/github/games647/fastlogin/bukkit/auth/protocollib/ResourceLoader.java similarity index 98% rename from bukkit/src/test/java/com/github/games647/fastlogin/bukkit/listener/protocollib/ResourceLoader.java rename to bukkit/src/test/java/com/github/games647/fastlogin/bukkit/auth/protocollib/ResourceLoader.java index 2f90bbc7..f4b16c8f 100644 --- a/bukkit/src/test/java/com/github/games647/fastlogin/bukkit/listener/protocollib/ResourceLoader.java +++ b/bukkit/src/test/java/com/github/games647/fastlogin/bukkit/auth/protocollib/ResourceLoader.java @@ -23,7 +23,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.github.games647.fastlogin.bukkit.listener.protocollib; +package com.github.games647.fastlogin.bukkit.auth.protocollib; import com.github.games647.fastlogin.bukkit.auth.protocollib.packet.ClientPublicKey; import com.google.common.io.Resources; diff --git a/bukkit/src/test/java/com/github/games647/fastlogin/bukkit/listener/protocollib/SignatureTestData.java b/bukkit/src/test/java/com/github/games647/fastlogin/bukkit/auth/protocollib/SignatureTestData.java similarity index 97% rename from bukkit/src/test/java/com/github/games647/fastlogin/bukkit/listener/protocollib/SignatureTestData.java rename to bukkit/src/test/java/com/github/games647/fastlogin/bukkit/auth/protocollib/SignatureTestData.java index 937c72b0..6306942a 100644 --- a/bukkit/src/test/java/com/github/games647/fastlogin/bukkit/listener/protocollib/SignatureTestData.java +++ b/bukkit/src/test/java/com/github/games647/fastlogin/bukkit/auth/protocollib/SignatureTestData.java @@ -23,7 +23,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.github.games647.fastlogin.bukkit.listener.protocollib; +package com.github.games647.fastlogin.bukkit.auth.protocollib; import com.google.common.io.Resources; import com.google.gson.Gson; diff --git a/bukkit/src/test/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTaskTest.java b/bukkit/src/test/java/com/github/games647/fastlogin/bukkit/auth/protocollib/VerifyResponseTaskTest.java similarity index 97% rename from bukkit/src/test/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTaskTest.java rename to bukkit/src/test/java/com/github/games647/fastlogin/bukkit/auth/protocollib/VerifyResponseTaskTest.java index 8309aecf..ce93d668 100644 --- a/bukkit/src/test/java/com/github/games647/fastlogin/bukkit/listener/protocollib/VerifyResponseTaskTest.java +++ b/bukkit/src/test/java/com/github/games647/fastlogin/bukkit/auth/protocollib/VerifyResponseTaskTest.java @@ -23,7 +23,7 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.github.games647.fastlogin.bukkit.listener.protocollib; +package com.github.games647.fastlogin.bukkit.auth.protocollib; import com.comphenix.protocol.injector.packet.PacketRegistry; import com.comphenix.protocol.reflect.accessors.Accessors; diff --git a/bukkit/src/test/java/com/github/games647/fastlogin/bukkit/task/DelayedAuthHookTest.java b/bukkit/src/test/java/com/github/games647/fastlogin/bukkit/hook/DelayedAuthHookTest.java similarity index 94% rename from bukkit/src/test/java/com/github/games647/fastlogin/bukkit/task/DelayedAuthHookTest.java rename to bukkit/src/test/java/com/github/games647/fastlogin/bukkit/hook/DelayedAuthHookTest.java index 4ac5ce55..28a22cba 100644 --- a/bukkit/src/test/java/com/github/games647/fastlogin/bukkit/task/DelayedAuthHookTest.java +++ b/bukkit/src/test/java/com/github/games647/fastlogin/bukkit/hook/DelayedAuthHookTest.java @@ -23,9 +23,8 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ -package com.github.games647.fastlogin.bukkit.task; +package com.github.games647.fastlogin.bukkit.hook; -import com.github.games647.fastlogin.bukkit.hook.DelayedAuthHook; import com.github.games647.fastlogin.core.hooks.AuthPlugin; import lombok.val; import org.bukkit.entity.Player; diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java index afdd6a7e..b94eb690 100644 --- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java +++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/ConnectListener.java @@ -244,6 +244,5 @@ public class ConnectListener implements Listener { public void onDisconnect(PlayerDisconnectEvent disconnectEvent) { ProxiedPlayer player = disconnectEvent.getPlayer(); plugin.getSession().remove(player.getPendingConnection()); - plugin.getCore().getPendingConfirms().remove(player.getUniqueId()); } } diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/PluginMessageListener.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/PluginMessageListener.java index bb4ca89d..79c8dd92 100644 --- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/PluginMessageListener.java +++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/listener/PluginMessageListener.java @@ -37,7 +37,6 @@ import com.github.games647.fastlogin.core.storage.StoredProfile; import com.google.common.io.ByteArrayDataInput; import com.google.common.io.ByteStreams; import net.md_5.bungee.api.CommandSender; -import net.md_5.bungee.api.chat.TextComponent; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.connection.Server; import net.md_5.bungee.api.event.PluginMessageEvent; @@ -96,15 +95,6 @@ public class PluginMessageListener implements Listener { String playerName = changeMessage.getPlayerName(); boolean isSourceInvoker = changeMessage.isSourceInvoker(); if (changeMessage.shouldEnable()) { - if (playerName.equals(forPlayer.getName()) && plugin.getCore().getConfig().get("premium-warning", true) - && !core.getPendingConfirms().contains(forPlayer.getUniqueId())) { - String message = core.getMessage("premium-warning"); - forPlayer.sendMessage(TextComponent.fromLegacyText(message)); - core.getPendingConfirms().add(forPlayer.getUniqueId()); - return; - } - - core.getPendingConfirms().remove(forPlayer.getUniqueId()); Runnable task = new AsyncToggleMessage(core, forPlayer, playerName, true, isSourceInvoker); plugin.getScheduler().runAsync(task); } else { diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java index 7503d0ec..cb476afa 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/FastLoginCore.java @@ -61,7 +61,6 @@ import java.util.HashSet; import java.util.Map; import java.util.Objects; import java.util.Set; -import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; @@ -83,7 +82,6 @@ public class FastLoginCore

> { Duration.ofMinutes(5), -1 ); - private final Collection pendingConfirms = new HashSet<>(); private final T plugin; private MojangResolver resolver; @@ -123,7 +121,7 @@ public class FastLoginCore

> { // Initialize the resolver based on the config parameter this.resolver = this.config.getBoolean("useProxyAgnosticResolver", false) - ? new ProxyAgnosticMojangResolver() : new MojangResolver(); + ? new ProxyAgnosticMojangResolver() : new MojangResolver(); antiBot = createAntiBotService(config.getSection("anti-bot")); Set proxies = config.getStringList("proxies") @@ -287,10 +285,6 @@ public class FastLoginCore

> { return pendingLogin.remove(ip + username) != null; } - public Collection getPendingConfirms() { - return pendingConfirms; - } - public AuthPlugin

getAuthPluginHook() { return authPlugin; } diff --git a/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/ConnectListener.java b/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/ConnectListener.java index 0246ce25..b2e1a4a3 100644 --- a/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/ConnectListener.java +++ b/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/ConnectListener.java @@ -38,7 +38,6 @@ import com.github.games647.fastlogin.velocity.task.FloodgateAuthTask; import com.github.games647.fastlogin.velocity.task.ForceLoginTask; import com.velocitypowered.api.event.EventTask; import com.velocitypowered.api.event.Subscribe; -import com.velocitypowered.api.event.connection.DisconnectEvent; import com.velocitypowered.api.event.connection.PreLoginEvent; import com.velocitypowered.api.event.connection.PreLoginEvent.PreLoginComponentResult; import com.velocitypowered.api.event.player.GameProfileRequestEvent; @@ -170,10 +169,4 @@ public class ConnectListener { // Delay at least one second, otherwise the login command can be missed plugin.getScheduler().runAsyncDelayed(loginTask, Duration.ofSeconds(1)); } - - @Subscribe - public void onDisconnect(DisconnectEvent disconnectEvent) { - Player player = disconnectEvent.getPlayer(); - plugin.getCore().getPendingConfirms().remove(player.getUniqueId()); - } } diff --git a/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/PluginMessageListener.java b/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/PluginMessageListener.java index 8dcb014c..69e3d5e4 100644 --- a/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/PluginMessageListener.java +++ b/velocity/src/main/java/com/github/games647/fastlogin/velocity/listener/PluginMessageListener.java @@ -42,7 +42,6 @@ import com.velocitypowered.api.event.connection.PluginMessageEvent.ForwardResult import com.velocitypowered.api.proxy.Player; import com.velocitypowered.api.proxy.ServerConnection; import com.velocitypowered.api.proxy.messages.MinecraftChannelIdentifier; -import net.kyori.adventure.text.serializer.legacy.LegacyComponentSerializer; import java.util.Arrays; @@ -97,16 +96,6 @@ public class PluginMessageListener { String playerName = changeMessage.getPlayerName(); boolean isSourceInvoker = changeMessage.isSourceInvoker(); if (changeMessage.shouldEnable()) { - Boolean premiumWarning = plugin.getCore().getConfig().get("premium-warning", true); - if (playerName.equals(forPlayer.getUsername()) && premiumWarning - && !core.getPendingConfirms().contains(forPlayer.getUniqueId())) { - String message = core.getMessage("premium-warning"); - forPlayer.sendMessage(LegacyComponentSerializer.legacyAmpersand().deserialize(message)); - core.getPendingConfirms().add(forPlayer.getUniqueId()); - return; - } - - core.getPendingConfirms().remove(forPlayer.getUniqueId()); Runnable task = new AsyncToggleMessage(core, forPlayer, playerName, true, isSourceInvoker); plugin.getScheduler().runAsync(task); } else {