diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BungeeManager.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BungeeManager.java index 95cd70da..3e283c2a 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BungeeManager.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BungeeManager.java @@ -99,18 +99,19 @@ public class BungeeManager { } } - private boolean isProxySupported(String className, String fieldName) throws Exception { + private boolean isProxySupported(String className, String fieldName) { try { return Class.forName(className).getDeclaredField(fieldName).getBoolean(null); } catch (ClassNotFoundException notFoundEx) { //ignore server has no proxy support - return false; - } catch (Exception ex) { - throw ex; + } catch (NoSuchFieldException | IllegalAccessException noSuchFieldException) { + plugin.getLog().warn("Cannot access proxy field", noSuchFieldException); } + + return false; } - private boolean detectProxy() throws Exception { + private boolean detectProxy() { return isProxySupported("org.spigotmc.SpigotConfig", "bungee") || isProxySupported("com.destroystokyo.paper.PaperConfig", "velocitySupport"); } @@ -166,7 +167,7 @@ public class BungeeManager { /** * Mark the event to be fired including the task delay. * - * @param player + * @param player joining player */ public synchronized void markJoinEventFired(Player player) { firedJoinEvents.add(player.getUniqueId()); @@ -180,7 +181,7 @@ public class BungeeManager { * session. If not fired, we can start a new force login task. This will still match the requirement that we wait * a certain time after the player join event fired. * - * @param player + * @param player joining player * @return event fired including delay */ public synchronized boolean didJoinEventFired(Player player) { @@ -190,7 +191,7 @@ public class BungeeManager { /** * Player quit clean up * - * @param player + * @param player joining player */ public synchronized void cleanup(Player player) { firedJoinEvents.remove(player.getUniqueId()); diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/ConnectionListener.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/ConnectionListener.java index f0f2adb4..61161d5c 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/ConnectionListener.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/ConnectionListener.java @@ -40,6 +40,7 @@ import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerLoginEvent.Result; import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.metadata.Metadatable; import org.geysermc.floodgate.api.player.FloodgatePlayer; /** @@ -111,7 +112,7 @@ public class ConnectionListener implements Listener { plugin.getBungeeManager().cleanup(player); } - private void removeBlockedStatus(Player player) { + private void removeBlockedStatus(Metadatable player) { player.removeMetadata(plugin.getName(), plugin); } } diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/PaperCacheListener.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/PaperCacheListener.java index 884960ca..5e240a00 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/PaperCacheListener.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/PaperCacheListener.java @@ -44,8 +44,8 @@ public class PaperCacheListener implements Listener { } @EventHandler(priority = EventPriority.HIGHEST) - //if paper is used - player skin must be set at pre login, otherwise usercache is used - //using usercache makes premium name change basically impossible + //if paper is used - player skin must be set at pre login, otherwise user cache is used + // user cache makes premium name change basically impossible public void onAsyncPlayerPreLogin(AsyncPlayerPreLoginEvent event) { if (event.getLoginResult() != Result.ALLOWED) { return; diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/EncryptionUtil.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/EncryptionUtil.java index 9471217a..cf1dc6ef 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/EncryptionUtil.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/EncryptionUtil.java @@ -35,6 +35,7 @@ import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.PublicKey; import java.util.Random; + import javax.crypto.Cipher; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/ProtocolLibLoginSource.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/ProtocolLibLoginSource.java index c8a5f45c..81d8a2e9 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/ProtocolLibLoginSource.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/ProtocolLibLoginSource.java @@ -60,7 +60,7 @@ class ProtocolLibLoginSource implements LoginSource { } @Override - public void enableOnlinemode() throws Exception { + public void enableOnlinemode() throws InvocationTargetException { verifyToken = EncryptionUtil.generateVerifyToken(random); /* 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/listener/protocollib/EncryptionUtilTest.java index 681b31ad..3257d7b1 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/listener/protocollib/EncryptionUtilTest.java @@ -36,31 +36,11 @@ import static org.hamcrest.MatcherAssert.assertThat; public class EncryptionUtilTest { @Test - public void testVerifyToken() throws Exception { + public void testVerifyToken() { SecureRandom random = new SecureRandom(); byte[] token = EncryptionUtil.generateVerifyToken(random); assertThat(token, notNullValue()); assertThat(token.length, is(4)); } - - // @Test - // public void testDecryptSharedSecret() throws Exception { - // - // } - // - // @Test - // public void testDecryptData() throws Exception { - // - // } - - // private static SecretKey createNewSharedKey() { - // try { - // KeyGenerator keygenerator = KeyGenerator.getInstance("AES"); - // keygenerator.init(128); - // return keygenerator.generateKey(); - // } catch (NoSuchAlgorithmException nosuchalgorithmexception) { - // throw new Error(nosuchalgorithmexception); - // } - // } } diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/hook/BungeeCordAuthenticatorBungeeHook.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/hook/BungeeCordAuthenticatorBungeeHook.java index beb56d96..ff5ae89f 100644 --- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/hook/BungeeCordAuthenticatorBungeeHook.java +++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/hook/BungeeCordAuthenticatorBungeeHook.java @@ -25,22 +25,23 @@ */ package com.github.games647.fastlogin.bungee.hook; -import java.sql.SQLException; - import com.github.games647.fastlogin.bungee.FastLoginBungee; import com.github.games647.fastlogin.core.hooks.AuthPlugin; import de.xxschrandxx.bca.bungee.BungeeCordAuthenticatorBungee; import de.xxschrandxx.bca.bungee.api.BungeeCordAuthenticatorBungeeAPI; +import java.sql.SQLException; +import java.util.logging.Level; + import net.md_5.bungee.api.connection.ProxiedPlayer; /** * GitHub: * https://github.com/xXSchrandXx/SpigotPlugins/tree/master/BungeeCordAuthenticator - * + *
* Project page: - * + *
* Spigot: https://www.spigotmc.org/resources/bungeecordauthenticator.87669/
*/
public class BungeeCordAuthenticatorBungeeHook implements AuthPlugin