diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 8aadff8e..4131e9d4 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -9,7 +9,7 @@ [//]: # (What did you expect?) ### Steps/models to reproduce: -[//]: # (The actions that cause the issue) +[//]: # (The actions that cause the issue. Please explain it in detail) ### Plugin list: [//]: # (This can be found by running `/pl`) diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/MojangApiBukkit.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/MojangApiBukkit.java index b3518853..53d78f95 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/MojangApiBukkit.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/MojangApiBukkit.java @@ -37,7 +37,6 @@ public class MojangApiBukkit extends MojangApiConnector { String url = String.format(HAS_JOINED_URL, playerSession.getUsername(), serverId, encodedIp); HttpURLConnection conn = getConnection(url); - try (BufferedReader reader = new BufferedReader( new InputStreamReader(conn.getInputStream(), StandardCharsets.UTF_8))) { //validate parsing diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/SkinApplyListener.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/SkinApplyListener.java index 6df9da7a..2cc8699e 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/SkinApplyListener.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/SkinApplyListener.java @@ -57,17 +57,17 @@ public class SkinApplyListener implements Listener { private void applySkin(Player player, String skinData, String signature) { WrappedGameProfile gameProfile = WrappedGameProfile.fromPlayer(player); - if (skinData != null && signature != null) { - WrappedSignedProperty skin = WrappedSignedProperty.fromValues(SkinProperties.TEXTURE_KEY, skinData, signature); + + WrappedSignedProperty skin = WrappedSignedProperty.fromValues(SkinProperties.TEXTURE_KEY, skinData, signature); + try { + gameProfile.getProperties().put(SkinProperties.TEXTURE_KEY, skin); + } catch (ClassCastException castException) { + //Cauldron, MCPC, Thermos, ... + Object map = GET_PROPERTIES.invoke(gameProfile.getHandle()); try { - gameProfile.getProperties().put(SkinProperties.TEXTURE_KEY, skin); - } catch (ClassCastException castException) { - Object map = GET_PROPERTIES.invoke(gameProfile.getHandle()); - try { - MethodUtils.invokeMethod(map, "put", new Object[]{SkinProperties.TEXTURE_KEY, skin.getHandle()}); - } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) { - plugin.getLog().error("Error setting premium skin", ex); - } + MethodUtils.invokeMethod(map, "put", new Object[]{SkinProperties.TEXTURE_KEY, skin.getHandle()}); + } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) { + plugin.getLog().error("Error setting premium skin", ex); } } } diff --git a/core/src/main/java/com/github/games647/fastlogin/core/AuthStorage.java b/core/src/main/java/com/github/games647/fastlogin/core/AuthStorage.java index d00f2435..657a34e8 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/AuthStorage.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/AuthStorage.java @@ -50,13 +50,14 @@ public class AuthStorage { config.setThreadFactory(platformThreadFactory); } - String pluginFolder = core.getPlugin().getPluginFolder().toAbsolutePath().toString(); - databasePath = databasePath.replace("{pluginDir}", pluginFolder); - String jdbcUrl = "jdbc:"; if (driver.contains("sqlite")) { + String pluginFolder = core.getPlugin().getPluginFolder().toAbsolutePath().toString(); + databasePath = databasePath.replace("{pluginDir}", pluginFolder); + jdbcUrl += "sqlite://" + databasePath; config.setConnectionTestQuery("SELECT 1"); + config.setMaximumPoolSize(1); } else { jdbcUrl += "mysql://" + host + ':' + port + '/' + databasePath; } diff --git a/core/src/main/java/com/github/games647/fastlogin/core/hooks/DefaultPasswordGenerator.java b/core/src/main/java/com/github/games647/fastlogin/core/hooks/DefaultPasswordGenerator.java index 9667a0d0..5e7326db 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/hooks/DefaultPasswordGenerator.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/hooks/DefaultPasswordGenerator.java @@ -1,12 +1,14 @@ package com.github.games647.fastlogin.core.hooks; +import java.security.SecureRandom; import java.util.Random; public class DefaultPasswordGenerator
implements PasswordGenerator
{ private static final char[] PASSWORD_CHARACTERS = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" .toCharArray(); - private final Random random = new Random(); + + private final Random random = new SecureRandom(); @Override public String getRandomPassword(P player) { diff --git a/core/src/main/java/com/github/games647/fastlogin/core/mojang/SkinProperties.java b/core/src/main/java/com/github/games647/fastlogin/core/mojang/SkinProperties.java index 6eec07f9..042729ac 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/mojang/SkinProperties.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/mojang/SkinProperties.java @@ -4,7 +4,7 @@ public class SkinProperties { public static final String TEXTURE_KEY = "textures"; - private final String name = "textures"; + private final String name = TEXTURE_KEY; private String value; private String signature; diff --git a/core/src/main/resources/config.yml b/core/src/main/resources/config.yml index ab305d39..e62cbc19 100644 --- a/core/src/main/resources/config.yml +++ b/core/src/main/resources/config.yml @@ -167,7 +167,7 @@ database: '{pluginDir}/FastLogin.db' # MySQL/MariaDB #driver: com.mysql.jdbc.Driver -#host: localhost +#host: 127.0.0.1 #port: 3306 #database: fastlogin #username: myUser