Fix loading with unloaded configuration values
This commit is contained in:
1 parent
218bc50c96
commit
07d0aededa
13 files changed
+58
-35
No files matched your search
@@ -14,6 +14,7 @@ import com.github.games647.fastlogin.bukkit.listener.protocollib.LoginSkinApplyL
|
||||
import com.github.games647.fastlogin.bukkit.listener.protocollib.StartPacketListener;
|
||||
import com.github.games647.fastlogin.bukkit.listener.protocolsupport.ProtocolSupportListener;
|
||||
import com.github.games647.fastlogin.bukkit.tasks.DelayedAuthHook;
|
||||
import com.github.games647.fastlogin.core.hooks.AuthPlugin;
|
||||
import com.github.games647.fastlogin.core.shared.FastLoginCore;
|
||||
|
||||
import java.security.KeyPair;
|
||||
@@ -35,16 +36,16 @@ public class FastLoginBukkit extends JavaPlugin {
|
||||
private final KeyPair keyPair = EncryptionUtil.generateKeyPair();
|
||||
|
||||
private boolean bungeeCord;
|
||||
private final BukkitCore core = new BukkitCore(this);
|
||||
private BukkitCore core;
|
||||
private boolean serverStarted;
|
||||
|
||||
//1 minutes should be enough as a timeout for bad internet connection (Server, Client and Mojang)
|
||||
private final ConcurrentMap<String, BukkitLoginSession> session = FastLoginCore.buildCache(1, -1);
|
||||
|
||||
private BukkitAuthPlugin authPlugin;
|
||||
|
||||
@Override
|
||||
public void onEnable() {
|
||||
core = new BukkitCore(this);
|
||||
|
||||
core.loadConfig();
|
||||
core.loadMessages();
|
||||
|
||||
@@ -112,7 +113,6 @@ public class FastLoginBukkit extends JavaPlugin {
|
||||
|
||||
@Override
|
||||
public void onDisable() {
|
||||
//clean up
|
||||
session.clear();
|
||||
|
||||
if (core != null) {
|
||||
@@ -160,6 +160,7 @@ public class FastLoginBukkit extends JavaPlugin {
|
||||
* @return interface to any supported auth plugin
|
||||
*/
|
||||
public BukkitAuthPlugin getAuthPlugin() {
|
||||
AuthPlugin<Player> authPlugin = core.getAuthPlugin();
|
||||
if (authPlugin == null) {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
@@ -168,11 +169,11 @@ public class FastLoginBukkit extends JavaPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
return authPlugin;
|
||||
return (BukkitAuthPlugin) authPlugin;
|
||||
}
|
||||
|
||||
public void setAuthPluginHook(BukkitAuthPlugin authPlugin) {
|
||||
this.authPlugin = authPlugin;
|
||||
core.setAuthPlugin(authPlugin);
|
||||
}
|
||||
|
||||
public boolean isBungeeCord() {
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.github.games647.fastlogin.bukkit.hooks;
|
||||
|
||||
import com.avaje.ebeaninternal.api.ClassUtil;
|
||||
import com.github.games647.fastlogin.core.hooks.AuthPlugin;
|
||||
|
||||
import fr.xephi.authme.api.API;
|
||||
import fr.xephi.authme.api.NewAPI;
|
||||
@@ -14,7 +15,7 @@ import org.bukkit.entity.Player;
|
||||
* Bukkit: http://dev.bukkit.org/bukkit-plugins/authme-reloaded/
|
||||
* Spigot: https://www.spigotmc.org/resources/authme-reloaded.6269/
|
||||
*/
|
||||
public class AuthMeHook implements BukkitAuthPlugin {
|
||||
public class AuthMeHook implements AuthPlugin<Player> {
|
||||
|
||||
private final boolean isNewAPIAvailable;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.github.games647.fastlogin.bukkit.hooks;
|
||||
|
||||
import com.github.games647.fastlogin.core.hooks.AuthPlugin;
|
||||
|
||||
import de.st_ddt.crazylogin.CrazyLogin;
|
||||
import de.st_ddt.crazylogin.data.LoginPlayerData;
|
||||
@@ -23,7 +24,7 @@ import org.bukkit.entity.Player;
|
||||
*
|
||||
* Bukkit: http://dev.bukkit.org/server-mods/crazylogin/
|
||||
*/
|
||||
public class CrazyLoginHook implements BukkitAuthPlugin {
|
||||
public class CrazyLoginHook implements AuthPlugin<Player> {
|
||||
|
||||
protected final CrazyLogin crazyLoginPlugin = CrazyLogin.getPlugin();
|
||||
private final PlayerListener playerListener = getListener();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.github.games647.fastlogin.bukkit.hooks;
|
||||
|
||||
import com.github.games647.fastlogin.core.hooks.AuthPlugin;
|
||||
|
||||
import io.github.lucaseasedup.logit.CancelledState;
|
||||
import io.github.lucaseasedup.logit.LogItCore;
|
||||
@@ -14,7 +15,7 @@ import org.bukkit.entity.Player;
|
||||
* Bukkit: Unknown
|
||||
* Spigot: Unknown
|
||||
*/
|
||||
public class LogItHook implements BukkitAuthPlugin {
|
||||
public class LogItHook implements AuthPlugin<Player> {
|
||||
|
||||
@Override
|
||||
public boolean forceLogin(Player player) {
|
||||
|
||||
+2
-1
@@ -1,6 +1,7 @@
|
||||
package com.github.games647.fastlogin.bukkit.hooks;
|
||||
|
||||
import com.github.games647.fastlogin.bukkit.FastLoginBukkit;
|
||||
import com.github.games647.fastlogin.core.hooks.AuthPlugin;
|
||||
import com.lenis0012.bukkit.loginsecurity.LoginSecurity;
|
||||
import com.lenis0012.bukkit.loginsecurity.session.AuthService;
|
||||
import com.lenis0012.bukkit.loginsecurity.session.PlayerSession;
|
||||
@@ -16,7 +17,7 @@ import org.bukkit.entity.Player;
|
||||
* Bukkit: http://dev.bukkit.org/bukkit-plugins/loginsecurity/
|
||||
* Spigot: https://www.spigotmc.org/resources/loginsecurity.19362/
|
||||
*/
|
||||
public class LoginSecurityHook implements BukkitAuthPlugin {
|
||||
public class LoginSecurityHook implements AuthPlugin<Player> {
|
||||
|
||||
private final FastLoginBukkit plugin = (FastLoginBukkit) Bukkit.getPluginManager().getPlugin("FastLogin");
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.github.games647.fastlogin.bukkit.hooks;
|
||||
|
||||
import com.github.games647.fastlogin.core.hooks.AuthPlugin;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
@@ -19,7 +20,7 @@ import org.royaldev.royalauth.RoyalAuth;
|
||||
*
|
||||
* Bukkit: http://dev.bukkit.org/bukkit-plugins/royalauth/
|
||||
*/
|
||||
public class RoyalAuthHook implements BukkitAuthPlugin {
|
||||
public class RoyalAuthHook implements AuthPlugin<Player> {
|
||||
|
||||
private final RoyalAuth royalAuthPlugin = (RoyalAuth) Bukkit.getPluginManager().getPlugin("RoyalAuth");
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.github.games647.fastlogin.bukkit.hooks;
|
||||
|
||||
import com.github.games647.fastlogin.core.hooks.AuthPlugin;
|
||||
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
@@ -20,7 +21,7 @@ import ultraauth.managers.PlayerManager;
|
||||
* Bukkit: http://dev.bukkit.org/bukkit-plugins/ultraauth-aa/
|
||||
* Spigot: https://www.spigotmc.org/resources/ultraauth.17044/
|
||||
*/
|
||||
public class UltraAuthHook implements BukkitAuthPlugin {
|
||||
public class UltraAuthHook implements AuthPlugin<Player> {
|
||||
|
||||
protected final Plugin ultraAuthPlugin = Main.main;
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.github.games647.fastlogin.bukkit.hooks;
|
||||
|
||||
import com.github.games647.fastlogin.core.hooks.AuthPlugin;
|
||||
|
||||
import de.luricos.bukkit.xAuth.xAuth;
|
||||
import de.luricos.bukkit.xAuth.xAuthPlayer;
|
||||
@@ -20,7 +21,7 @@ import org.bukkit.entity.Player;
|
||||
*
|
||||
* Bukkit: http://dev.bukkit.org/bukkit-plugins/xauth/
|
||||
*/
|
||||
public class xAuthHook implements BukkitAuthPlugin {
|
||||
public class xAuthHook implements AuthPlugin<Player> {
|
||||
|
||||
protected final xAuth xAuthPlugin = xAuth.getPlugin();
|
||||
|
||||
|
||||
+7
-6
@@ -2,18 +2,19 @@ package com.github.games647.fastlogin.bukkit.tasks;
|
||||
|
||||
import com.github.games647.fastlogin.bukkit.FastLoginBukkit;
|
||||
import com.github.games647.fastlogin.bukkit.hooks.AuthMeHook;
|
||||
import com.github.games647.fastlogin.bukkit.hooks.BukkitAuthPlugin;
|
||||
import com.github.games647.fastlogin.bukkit.hooks.CrazyLoginHook;
|
||||
import com.github.games647.fastlogin.bukkit.hooks.LogItHook;
|
||||
import com.github.games647.fastlogin.bukkit.hooks.LoginSecurityHook;
|
||||
import com.github.games647.fastlogin.bukkit.hooks.UltraAuthHook;
|
||||
import com.github.games647.fastlogin.bukkit.hooks.xAuthHook;
|
||||
import com.github.games647.fastlogin.core.hooks.AuthPlugin;
|
||||
import com.google.common.collect.Lists;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.ArrayList;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.bukkit.Bukkit;
|
||||
import org.bukkit.entity.Player;
|
||||
|
||||
public class DelayedAuthHook implements Runnable {
|
||||
|
||||
@@ -37,12 +38,12 @@ public class DelayedAuthHook implements Runnable {
|
||||
}
|
||||
|
||||
private boolean registerHooks() {
|
||||
BukkitAuthPlugin authPluginHook = null;
|
||||
AuthPlugin<Player> authPluginHook = null;
|
||||
try {
|
||||
List<Class<? extends BukkitAuthPlugin>> supportedHooks = Lists.newArrayList(AuthMeHook.class
|
||||
ArrayList<Class<? extends AuthPlugin<Player>>> supportedHooks = Lists.newArrayList(AuthMeHook.class
|
||||
, CrazyLoginHook.class, LogItHook.class, LoginSecurityHook.class, UltraAuthHook.class
|
||||
, xAuthHook.class);
|
||||
for (Class<? extends BukkitAuthPlugin> clazz : supportedHooks) {
|
||||
for (Class<? extends AuthPlugin<Player>> clazz : supportedHooks) {
|
||||
String pluginName = clazz.getSimpleName().replace("Hook", "");
|
||||
//uses only member classes which uses AuthPlugin interface (skip interfaces)
|
||||
if (Bukkit.getServer().getPluginManager().getPlugin(pluginName) != null) {
|
||||
@@ -63,7 +64,7 @@ public class DelayedAuthHook implements Runnable {
|
||||
}
|
||||
|
||||
if (plugin.getAuthPlugin() == null) {
|
||||
plugin.setAuthPluginHook(authPluginHook);
|
||||
plugin.getCore().setAuthPlugin(authPluginHook);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in new issue
Block a user