From 2f0eb8173547f650c58d5763447c7a000155d754 Mon Sep 17 00:00:00 2001 From: games647 Date: Fri, 22 Sep 2017 19:47:10 +0200 Subject: [PATCH] Shade the Bungee-Config implementation because it's platform independent --- .github/ISSUE_TEMPLATE.md | 3 +- .../fastlogin/bukkit/BukkitLoginSession.java | 20 ++--- .../fastlogin/bukkit/FastLoginBukkit.java | 10 +-- .../fastlogin/bukkit/MojangApiBukkit.java | 5 +- .../fastlogin/bukkit/hooks/AuthMeHook.java | 2 +- .../bukkit/hooks/CrazyLoginHook.java | 2 +- .../fastlogin/bukkit/hooks/LogItHook.java | 2 +- .../bukkit/hooks/LoginSecurityHook.java | 2 +- .../fastlogin/bukkit/hooks/UltraAuthHook.java | 2 +- .../fastlogin/bukkit/hooks/xAuthHook.java | 2 +- .../protocollib/LoginSkinApplyListener.java | 7 +- .../protocollib/ProtocolLibLoginSource.java | 2 +- bungee/pom.xml | 7 +- .../fastlogin/bungee/FastLoginBungee.java | 17 +--- .../bungee/hooks/BungeeAuthHook.java | 2 +- core/pom.xml | 20 +++++ .../games647/fastlogin/core/SharedConfig.java | 31 ------- .../fastlogin/core/shared/FastLoginCore.java | 90 +++++++++---------- .../fastlogin/core/shared/JoinManagement.java | 5 +- .../fastlogin/core/shared/PlatformPlugin.java | 3 - universal/pom.xml | 1 + 21 files changed, 92 insertions(+), 143 deletions(-) delete mode 100644 core/src/main/java/com/github/games647/fastlogin/core/SharedConfig.java diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index 7bf33670..49e0631c 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -22,4 +22,5 @@ This can be found by running `/version plugin-name` [Hastebin](https://hastebin.com/) / [Gist](https://gist.github.com/) link of the error or stacktrace (if any) ### Configuration: -[Hastebin](https://hastebin.com/) / [Gist](https://gist.github.com/) link of your config.yml file (remember to delete any sensitive data) +[Hastebin](https://hastebin.com/) / [Gist](https://gist.github.com/) link of your config.yml file +(remember to delete any sensitive data) diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BukkitLoginSession.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BukkitLoginSession.java index b21eddd2..ccf5389e 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BukkitLoginSession.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/BukkitLoginSession.java @@ -1,6 +1,7 @@ package com.github.games647.fastlogin.bukkit; import com.github.games647.fastlogin.core.PlayerProfile; +import com.github.games647.fastlogin.core.mojang.SkinProperties; import com.github.games647.fastlogin.core.shared.LoginSession; import org.apache.commons.lang.ArrayUtils; @@ -17,8 +18,7 @@ public class BukkitLoginSession extends LoginSession { private boolean verified; - private String encodedSkinData; - private String skinSignature; + private SkinProperties skinProperty; public BukkitLoginSession(String username, String serverId, byte[] verifyToken, boolean registered , PlayerProfile profile) { @@ -62,23 +62,15 @@ public class BukkitLoginSession extends LoginSession { return ArrayUtils.clone(verifyToken); } - public synchronized String getEncodedSkinData() { - return encodedSkinData; - } - - public synchronized String getSkinSignature() { - return skinSignature; + public synchronized SkinProperties getSkinProperty() { + return skinProperty; } /** * Sets the premium skin property which was retrieved by the session server - * - * @param encodedData - * @param skinSignature */ - public synchronized void setSkin(String encodedData, String skinSignature) { - this.encodedSkinData = encodedData; - this.skinSignature = skinSignature; + public synchronized void setSkinProperty(SkinProperties skinProperty) { + this.skinProperty = skinProperty; } /** 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 1b349bd9..45b4ea87 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 @@ -8,14 +8,13 @@ import com.github.games647.fastlogin.bukkit.listener.protocollib.LoginSkinApplyL import com.github.games647.fastlogin.bukkit.listener.protocollib.ProtocolLibListener; import com.github.games647.fastlogin.bukkit.listener.protocolsupport.ProtocolSupportListener; import com.github.games647.fastlogin.bukkit.tasks.DelayedAuthHook; -import com.github.games647.fastlogin.core.shared.FastLoginCore; import com.github.games647.fastlogin.core.mojang.MojangApiConnector; +import com.github.games647.fastlogin.core.shared.FastLoginCore; import com.github.games647.fastlogin.core.shared.PlatformPlugin; import com.google.common.collect.Iterables; import com.google.common.io.ByteArrayDataOutput; import com.google.common.io.ByteStreams; -import java.io.Reader; import java.security.KeyPair; import java.util.List; import java.util.Map; @@ -26,7 +25,6 @@ import java.util.logging.Logger; import org.bukkit.ChatColor; import org.bukkit.command.CommandSender; -import org.bukkit.configuration.file.YamlConfiguration; import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.plugin.messaging.PluginMessageRecipient; @@ -190,12 +188,6 @@ public class FastLoginBukkit extends JavaPlugin implements PlatformPlugin loadYamlFile(Reader reader) { - YamlConfiguration config = YamlConfiguration.loadConfiguration(reader); - return config.getValues(true); - } - @Override public void sendMessage(CommandSender receiver, String message) { receiver.sendMessage(message); 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 989b6bb4..ac55390a 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 @@ -50,10 +50,7 @@ public class MojangApiBukkit extends MojangApiConnector { SkinProperties[] properties = verification.getProperties(); if (properties != null && properties.length > 0) { SkinProperties skinProperty = properties[0]; - - String skinValue = skinProperty.getValue(); - String signature = skinProperty.getSignature(); - playerSession.setSkin(skinValue, signature); + playerSession.setSkinProperty(skinProperty); } return true; diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/AuthMeHook.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/AuthMeHook.java index 90b92ff6..d2a9405e 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/AuthMeHook.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/AuthMeHook.java @@ -30,7 +30,7 @@ public class AuthMeHook implements AuthPlugin { } @Override - public boolean isRegistered(String playerName) throws Exception { + public boolean isRegistered(String playerName) { return AuthMeApi.getInstance().isRegistered(playerName); } diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/CrazyLoginHook.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/CrazyLoginHook.java index 1c25a000..84c79154 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/CrazyLoginHook.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/CrazyLoginHook.java @@ -78,7 +78,7 @@ public class CrazyLoginHook implements AuthPlugin { } @Override - public boolean isRegistered(String playerName) throws Exception { + public boolean isRegistered(String playerName) { return crazyLoginPlugin.getPlayerData(playerName) != null; } diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/LogItHook.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/LogItHook.java index 0988a9ac..ad0c0183 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/LogItHook.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/LogItHook.java @@ -26,7 +26,7 @@ public class LogItHook implements AuthPlugin { } @Override - public boolean isRegistered(String playerName) throws Exception { + public boolean isRegistered(String playerName) { return LogItCore.getInstance().getAccountManager().isRegistered(playerName); } diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/LoginSecurityHook.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/LoginSecurityHook.java index 78ca7f02..61b4bff1 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/LoginSecurityHook.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/LoginSecurityHook.java @@ -29,7 +29,7 @@ public class LoginSecurityHook implements AuthPlugin { } @Override - public boolean isRegistered(String playerName) throws Exception { + public boolean isRegistered(String playerName) { PlayerSession session = LoginSecurity.getSessionManager().getOfflineSession(playerName); return session.isRegistered(); } diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/UltraAuthHook.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/UltraAuthHook.java index 8b61c4a9..2734b743 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/UltraAuthHook.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/UltraAuthHook.java @@ -45,7 +45,7 @@ public class UltraAuthHook implements AuthPlugin { } @Override - public boolean isRegistered(String playerName) throws Exception { + public boolean isRegistered(String playerName) { return UltraAuthAPI.isRegisterd(playerName); } diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/xAuthHook.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/xAuthHook.java index 22395d8e..0184d21b 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/xAuthHook.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/hooks/xAuthHook.java @@ -52,7 +52,7 @@ public class xAuthHook implements AuthPlugin { } @Override - public boolean isRegistered(String playerName) throws Exception { + public boolean isRegistered(String playerName) { //this will load the player if it's not in the cache xAuthPlayer xAuthPlayer = xAuthPlugin.getPlayerManager().getPlayer(playerName); return xAuthPlayer != null && xAuthPlayer.isRegistered(); diff --git a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/LoginSkinApplyListener.java b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/LoginSkinApplyListener.java index 0bbf03a9..663a42d4 100644 --- a/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/LoginSkinApplyListener.java +++ b/bukkit/src/main/java/com/github/games647/fastlogin/bukkit/listener/protocollib/LoginSkinApplyListener.java @@ -8,6 +8,7 @@ import com.comphenix.protocol.wrappers.WrappedGameProfile; import com.comphenix.protocol.wrappers.WrappedSignedProperty; import com.github.games647.fastlogin.bukkit.BukkitLoginSession; import com.github.games647.fastlogin.bukkit.FastLoginBukkit; +import com.github.games647.fastlogin.core.mojang.SkinProperties; import java.lang.reflect.InvocationTargetException; import java.util.logging.Level; @@ -45,10 +46,8 @@ public class LoginSkinApplyListener implements Listener { //loginEvent.getAddress is just a InetAddress not InetSocketAddress, so not unique enough for (BukkitLoginSession session : plugin.getLoginSessions().values()) { if (session.getUsername().equals(player.getName())) { - String signature = session.getSkinSignature(); - String skinData = session.getEncodedSkinData(); - - applySkin(player, skinData, signature); + SkinProperties skinProperty = session.getSkinProperty(); + applySkin(player, skinProperty.getValue(), skinProperty.getSignature()); break; } } 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 7d4eaf65..b915a593 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 @@ -49,7 +49,7 @@ public class ProtocolLibLoginSource implements LoginSource { } @Override - public void kick(String message) throws Exception { + public void kick(String message) throws InvocationTargetException { ProtocolManager protocolManager = ProtocolLibrary.getProtocolManager(); PacketContainer kickPacket = protocolManager.createPacket(DISCONNECT); diff --git a/bungee/pom.xml b/bungee/pom.xml index f0bd7fa4..c2875308 100644 --- a/bungee/pom.xml +++ b/bungee/pom.xml @@ -17,12 +17,6 @@ FastLoginBungee - - - luck-repo - https://ci.lucko.me/plugin/repository/everything - - vik1395-repo https://vik1395.github.io/repo.vik1395.me/repositories @@ -37,6 +31,7 @@ provided + net.md-5 bungeecord-proxy diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java index 93ac7ea1..3c35cbd8 100644 --- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java +++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/FastLoginBungee.java @@ -3,19 +3,16 @@ package com.github.games647.fastlogin.bungee; import com.github.games647.fastlogin.bungee.hooks.BungeeAuthHook; import com.github.games647.fastlogin.bungee.listener.ConnectionListener; import com.github.games647.fastlogin.bungee.listener.PluginMessageListener; -import com.github.games647.fastlogin.core.shared.FastLoginCore; import com.github.games647.fastlogin.core.mojang.MojangApiConnector; +import com.github.games647.fastlogin.core.shared.FastLoginCore; import com.github.games647.fastlogin.core.shared.PlatformPlugin; import com.google.common.collect.Maps; -import java.io.Reader; import java.util.List; import java.util.Map; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.ThreadFactory; -import java.util.function.Function; import java.util.logging.Logger; -import java.util.stream.Collectors; import net.md_5.bungee.api.ChatColor; import net.md_5.bungee.api.CommandSender; @@ -24,9 +21,6 @@ import net.md_5.bungee.api.connection.PendingConnection; import net.md_5.bungee.api.connection.ProxiedPlayer; import net.md_5.bungee.api.plugin.Plugin; import net.md_5.bungee.api.scheduler.GroupedThreadFactory; -import net.md_5.bungee.config.Configuration; -import net.md_5.bungee.config.ConfigurationProvider; -import net.md_5.bungee.config.YamlConfiguration; /** * BungeeCord version of FastLogin. This plugin keeps track on online mode connections. @@ -83,15 +77,6 @@ public class FastLoginBungee extends Plugin implements PlatformPlugin loadYamlFile(Reader reader) { - ConfigurationProvider configProvider = ConfigurationProvider.getProvider(YamlConfiguration.class); - Configuration config = configProvider.load(reader); - return config.getKeys().stream() - .filter(key -> config.get(key) != null) - .collect(Collectors.toMap(Function.identity(), config::get)); - } - @Override public void sendMessage(CommandSender receiver, String message) { receiver.sendMessage(TextComponent.fromLegacyText(message)); diff --git a/bungee/src/main/java/com/github/games647/fastlogin/bungee/hooks/BungeeAuthHook.java b/bungee/src/main/java/com/github/games647/fastlogin/bungee/hooks/BungeeAuthHook.java index 7cf0c558..834a1968 100644 --- a/bungee/src/main/java/com/github/games647/fastlogin/bungee/hooks/BungeeAuthHook.java +++ b/bungee/src/main/java/com/github/games647/fastlogin/bungee/hooks/BungeeAuthHook.java @@ -26,7 +26,7 @@ public class BungeeAuthHook implements AuthPlugin { } @Override - public boolean isRegistered(String playerName) throws Exception { + public boolean isRegistered(String playerName) { return requestHandler.isRegistered(playerName); } diff --git a/core/pom.xml b/core/pom.xml index bc07e2c6..ab0279a1 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -14,7 +14,16 @@ FastLoginCore + + + luck-repo + https://ci.lucko.me/plugin/repository/everything + + + + + com.zaxxer @@ -29,9 +38,20 @@ 1.7.25 + + + net.md-5 + bungeecord-config + 1.12-SNAPSHOT + + + + com.google.guava guava + + 10.0.1 provided diff --git a/core/src/main/java/com/github/games647/fastlogin/core/SharedConfig.java b/core/src/main/java/com/github/games647/fastlogin/core/SharedConfig.java deleted file mode 100644 index a63c9b9d..00000000 --- a/core/src/main/java/com/github/games647/fastlogin/core/SharedConfig.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.github.games647.fastlogin.core; - -import java.util.Map; - -public class SharedConfig { - - private final Map configValues; - - public SharedConfig(Map configValues) { - this.configValues = configValues; - } - - @SuppressWarnings("unchecked") - public T get(String path, T def) { - Object val = configValues.get(path); - - if (def instanceof String) { - return (T) String.valueOf(val); - } - - return ( val != null ) ? (T) val : def; - } - - public T get(String path) { - return get(path, null); - } - - public Map getConfigValues() { - return configValues; - } -} 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 1f149edc..532f8d6a 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 @@ -2,7 +2,6 @@ package com.github.games647.fastlogin.core.shared; import com.github.games647.fastlogin.core.AuthStorage; import com.github.games647.fastlogin.core.CompatibleCacheBuilder; -import com.github.games647.fastlogin.core.SharedConfig; import com.github.games647.fastlogin.core.hooks.AuthPlugin; import com.github.games647.fastlogin.core.hooks.DefaultPasswordGenerator; import com.github.games647.fastlogin.core.hooks.PasswordGenerator; @@ -11,24 +10,27 @@ import com.google.common.cache.CacheLoader; import com.google.common.collect.Lists; import com.google.common.collect.Sets; -import java.io.BufferedReader; +import java.io.File; import java.io.IOException; import java.io.InputStream; -import java.io.InputStreamReader; import java.nio.file.Files; import java.nio.file.Path; import java.util.Collection; import java.util.List; import java.util.Map; -import java.util.Map.Entry; import java.util.Set; import java.util.UUID; import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.TimeUnit; +import java.util.function.Function; import java.util.logging.Level; import java.util.stream.Collectors; +import net.md_5.bungee.config.Configuration; +import net.md_5.bungee.config.ConfigurationProvider; +import net.md_5.bungee.config.YamlConfiguration; + /** * @param

Player class * @param CommandSender @@ -70,7 +72,7 @@ public class FastLoginCore

> { private final Set pendingConfirms = Sets.newHashSet(); private final T plugin; - private SharedConfig sharedConfig; + private Configuration config; private MojangApiConnector apiConnector; private AuthStorage storage; private PasswordGenerator

passwordGenerator = new DefaultPasswordGenerator<>(); @@ -85,22 +87,26 @@ public class FastLoginCore

> { saveDefaultFile("config.yml"); try { - sharedConfig = new SharedConfig(loadFile("config.yml")); - Map messages = loadFile("messages.yml"); + config = loadFile("config.yml"); + Configuration messages = loadFile("messages.yml"); - for (Entry entry : messages.entrySet()) { - String message = plugin.translateColorCodes('&', (String) entry.getValue()); - if (!message.isEmpty()) { - localeMessages.put(entry.getKey(), message); - } - } + messages.getKeys() + .stream() + .filter(key -> config.get(key) != null) + .collect(Collectors.toMap(Function.identity(), config::get)) + .forEach((key, message) -> { + String colored = plugin.translateColorCodes('&', (String) message); + if (!colored.isEmpty()) { + localeMessages.put(key, colored); + } + }); } catch (IOException ioEx) { plugin.getLogger().log(Level.INFO, "Failed to load yaml files", ioEx); } - List ipAddresses = sharedConfig.get("ip-addresses"); - int requestLimit = sharedConfig.get("mojang-request-limit"); - List proxyList = sharedConfig.get("proxies", Lists.newArrayList()); + List ipAddresses = config.getStringList("ip-addresses"); + int requestLimit = config.getInt("mojang-request-limit"); + List proxyList = config.get("proxies", Lists.newArrayList()); Map proxies = proxyList.stream() .collect(Collectors .toMap(line -> line.split(":")[0], line -> Integer.parseInt(line.split(":")[1]))); @@ -108,20 +114,16 @@ public class FastLoginCore

> { this.apiConnector = plugin.makeApiConnector(plugin.getLogger(), ipAddresses, requestLimit, proxies); } - private Map loadFile(String fileName) throws IOException { - Map values; + private Configuration loadFile(String fileName) throws IOException { + Configuration defaults; - try (InputStream defaultStream = getClass().getClassLoader().getResourceAsStream(fileName); - BufferedReader reader = new BufferedReader(new InputStreamReader(defaultStream))) { - values = plugin.loadYamlFile(reader); + ConfigurationProvider configProvider = ConfigurationProvider.getProvider(YamlConfiguration.class); + try (InputStream defaultStream = getClass().getClassLoader().getResourceAsStream(fileName)) { + defaults = configProvider.load(defaultStream); } - Path file = plugin.getDataFolder().toPath().resolve(fileName); - try (BufferedReader reader = Files.newBufferedReader(file)) { - values.putAll(plugin.loadYamlFile(reader)); - } - - return values; + File file = new File(plugin.getDataFolder(), fileName); + return configProvider.load(file, defaults); } public MojangApiConnector getApiConnector() { @@ -148,15 +150,15 @@ public class FastLoginCore

> { } public boolean setupDatabase() { - String driver = sharedConfig.get("driver"); - String host = sharedConfig.get("host", ""); - int port = sharedConfig.get("port", 3306); - String database = sharedConfig.get("database"); + String driver = config.getString("driver"); + String host = config.get("host", ""); + int port = config.get("port", 3306); + String database = config.getString("database"); - String user = sharedConfig.get("username", ""); - String password = sharedConfig.get("password", ""); + String user = config.get("username", ""); + String password = config.get("password", ""); - boolean useSSL = sharedConfig.get("useSSL", false); + boolean useSSL = config.get("useSSL", false); storage = new AuthStorage(this, driver, host, port, database, user, password, useSSL); try { @@ -168,8 +170,8 @@ public class FastLoginCore

> { } } - public SharedConfig getConfig() { - return sharedConfig; + public Configuration getConfig() { + return config; } public PasswordGenerator

getPasswordGenerator() { @@ -201,18 +203,16 @@ public class FastLoginCore

> { try { Files.createDirectories(dataFolder); + + Path configFile = dataFolder.resolve(fileName); + if (Files.notExists(configFile)) { + try (InputStream defaultStream = getClass().getClassLoader().getResourceAsStream(fileName)) { + Files.copy(defaultStream, configFile); + } + } } catch (IOException ioExc) { plugin.getLogger().log(Level.SEVERE, "Cannot create plugin folder " + dataFolder, ioExc); } - - Path configFile = dataFolder.resolve(fileName); - if (Files.notExists(configFile)) { - try (InputStream in = getClass().getClassLoader().getResourceAsStream(fileName)) { - Files.copy(in, configFile); - } catch (IOException ioExc) { - plugin.getLogger().log(Level.SEVERE, "Error saving default " + fileName, ioExc); - } - } } public void close() { diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java index 28a8e96e..8d8d4add 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/JoinManagement.java @@ -1,12 +1,13 @@ package com.github.games647.fastlogin.core.shared; import com.github.games647.fastlogin.core.PlayerProfile; -import com.github.games647.fastlogin.core.SharedConfig; import com.github.games647.fastlogin.core.hooks.AuthPlugin; import java.util.UUID; import java.util.logging.Level; +import net.md_5.bungee.config.Configuration; + public abstract class JoinManagement

{ protected final FastLoginCore core; @@ -23,7 +24,7 @@ public abstract class JoinManagement

{ return; } - SharedConfig config = core.getConfig(); + Configuration config = core.getConfig(); String ip = source.getAddress().getAddress().getHostAddress(); profile.setLastIp(ip); diff --git a/core/src/main/java/com/github/games647/fastlogin/core/shared/PlatformPlugin.java b/core/src/main/java/com/github/games647/fastlogin/core/shared/PlatformPlugin.java index fc7b6ef3..e0338f88 100644 --- a/core/src/main/java/com/github/games647/fastlogin/core/shared/PlatformPlugin.java +++ b/core/src/main/java/com/github/games647/fastlogin/core/shared/PlatformPlugin.java @@ -3,7 +3,6 @@ package com.github.games647.fastlogin.core.shared; import com.github.games647.fastlogin.core.mojang.MojangApiConnector; import java.io.File; -import java.io.Reader; import java.util.List; import java.util.Map; import java.util.concurrent.ThreadFactory; @@ -17,8 +16,6 @@ public interface PlatformPlugin { Logger getLogger(); - Map loadYamlFile(Reader reader); - void sendMessage(C receiver, String message); ThreadFactory getThreadFactory(); diff --git a/universal/pom.xml b/universal/pom.xml index d6116498..d9bb1c8a 100644 --- a/universal/pom.xml +++ b/universal/pom.xml @@ -31,6 +31,7 @@ ${project.groupId}:* com.zaxxer:HikariCP org.slf4j:* + net.md-5:bungeecord-config