Fix defaults overriding config

This commit is contained in:
games647
2018-04-05 18:42:45 +02:00
parent cdf1988f2f
commit 791df26702
3 changed files with 5 additions and 5 deletions

View File

@ -93,7 +93,7 @@ public class BungeeListener implements PluginMessageListener {
playerSession.setVerified(true); playerSession.setVerified(true);
plugin.getLoginSessions().put(id, playerSession); plugin.getLoginSessions().put(id, playerSession);
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new ForceLoginTask(plugin.getCore(), player), 20L); Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, new ForceLoginTask(plugin.getCore(), player), 10L);
} else if (type == Type.REGISTER) { } else if (type == Type.REGISTER) {
Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, () -> { Bukkit.getScheduler().runTaskLaterAsynchronously(plugin, () -> {
AuthPlugin<Player> authPlugin = plugin.getCore().getAuthPluginHook(); AuthPlugin<Player> authPlugin = plugin.getCore().getAuthPluginHook();
@ -108,7 +108,7 @@ public class BungeeListener implements PluginMessageListener {
} catch (Exception ex) { } catch (Exception ex) {
plugin.getLog().error("Failed to query isRegistered for player: {}", player, ex); plugin.getLog().error("Failed to query isRegistered for player: {}", player, ex);
} }
}, 20L); }, 10L);
} else if (type == Type.CRACKED) { } else if (type == Type.CRACKED) {
//we don't start a forcelogin task here so update it manually //we don't start a forcelogin task here so update it manually
plugin.getPremiumPlayers().put(player.getUniqueId(), PremiumStatus.CRACKED); plugin.getPremiumPlayers().put(player.getUniqueId(), PremiumStatus.CRACKED);

View File

@ -115,12 +115,12 @@ public class FastLoginCore<P extends C, C, T extends PlatformPlugin<C>> {
Configuration config; Configuration config;
try (Reader reader = Files.newBufferedReader(file)) { try (Reader reader = Files.newBufferedReader(file)) {
config = configProvider.load(reader); config = configProvider.load(reader, defaults);
} }
//explicitly add keys here, because Configuration.getKeys doesn't return the keys from the default configuration //explicitly add keys here, because Configuration.getKeys doesn't return the keys from the default configuration
for (String key : defaults.getKeys()) { for (String key : defaults.getKeys()) {
config.set(key, defaults.get(key)); config.set(key, config.get(key));
} }
return config; return config;

View File

@ -84,8 +84,8 @@ public abstract class ForceLoginManagement<P extends C, C, L extends LoginSessio
public boolean forceLogin(P player) { public boolean forceLogin(P player) {
core.getPlugin().getLog().info("Logging player {} in", getName(player)); core.getPlugin().getLog().info("Logging player {} in", getName(player));
boolean success = core.getAuthPluginHook().forceLogin(player);
boolean success = core.getAuthPluginHook().forceLogin(player);
if (success) { if (success) {
core.sendLocaleMessage("auto-login", player); core.sendLocaleMessage("auto-login", player);
} }