Replacing guava's class search with an explicit list (Fixes #11)

-> Fixed 1.7 Minecraft support 
-> Fixed Cauldron support
This commit is contained in:
games647
2016-05-22 18:31:34 +02:00
parent ae58e0539a
commit 2838c06ab3
3 changed files with 15 additions and 13 deletions

View File

@ -4,6 +4,7 @@
* Fixed premium logins if the server is not fully started
* Added other command argument to /premium and /cracked
* Added support for LogIt
* Fixed 1.7 Minecraft support by removing guava 11+ only features -> Cauldron support
######1.2.1

View File

@ -7,19 +7,25 @@ import com.comphenix.protocol.reflect.FuzzyReflection;
import com.comphenix.protocol.utility.SafeCacheBuilder;
import com.github.games647.fastlogin.bukkit.commands.CrackedCommand;
import com.github.games647.fastlogin.bukkit.commands.PremiumCommand;
import com.github.games647.fastlogin.bukkit.hooks.AuthMeHook;
import com.github.games647.fastlogin.bukkit.hooks.BukkitAuthPlugin;
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.bukkit.listener.BukkitJoinListener;
import com.github.games647.fastlogin.bukkit.listener.BungeeCordListener;
import com.github.games647.fastlogin.bukkit.listener.EncryptionPacketListener;
import com.github.games647.fastlogin.bukkit.listener.ProtocolSupportListener;
import com.github.games647.fastlogin.bukkit.listener.StartPacketListener;
import com.google.common.cache.CacheLoader;
import com.google.common.reflect.ClassPath;
import com.google.common.collect.Lists;
import de.st_ddt.crazylogin.CrazyLogin;
import java.io.IOException;
import java.lang.reflect.Method;
import java.security.KeyPair;
import java.sql.SQLException;
import java.util.List;
import java.util.UUID;
import java.util.concurrent.ConcurrentMap;
import java.util.concurrent.TimeUnit;
@ -224,12 +230,10 @@ public class FastLoginBukkit extends JavaPlugin {
private boolean registerHooks() {
BukkitAuthPlugin authPluginHook = null;
try {
String hooksPackage = this.getClass().getPackage().getName() + ".hooks";
//Look through all classes in the hooks package and look for supporting plugins on the server
for (ClassPath.ClassInfo clazzInfo : ClassPath.from(getClassLoader()).getTopLevelClasses(hooksPackage)) {
//remove the hook suffix
String pluginName = clazzInfo.getSimpleName().replace("Hook", "");
Class<?> clazz = clazzInfo.load();
List<Class<?>> supportedHooks = Lists.newArrayList(AuthMeHook.class, CrazyLogin.class
, LogItHook.class, LoginSecurityHook.class, UltraAuthHook.class, xAuthHook.class);
for (Class<?> clazz : supportedHooks) {
String pluginName = clazz.getSimpleName().replace("Hook", "");
//uses only member classes which uses AuthPlugin interface (skip interfaces)
if (BukkitAuthPlugin.class.isAssignableFrom(clazz)
//check only for enabled plugins. A single plugin could be disabled by plugin managers
@ -239,7 +243,7 @@ public class FastLoginBukkit extends JavaPlugin {
break;
}
}
} catch (InstantiationException | IllegalAccessException | IOException ex) {
} catch (InstantiationException | IllegalAccessException ex) {
getLogger().log(Level.SEVERE, "Couldn't load the integration class", ex);
}

View File

@ -1,15 +1,12 @@
package com.github.games647.fastlogin.bungee.listener;
import com.github.games647.fastlogin.bungee.FastLoginBungee;
import com.github.games647.fastlogin.bungee.FastLoginBungee;
import com.github.games647.fastlogin.bungee.ForceLoginTask;
import com.github.games647.fastlogin.bungee.ForceLoginTask;
import com.github.games647.fastlogin.bungee.PlayerProfile;
import com.github.games647.fastlogin.bungee.PlayerProfile;
import com.github.games647.fastlogin.bungee.hooks.BungeeAuthPlugin;
import com.google.common.base.Charsets;
import java.lang.reflect.Field;
import java.lang.reflect.Field;
import java.util.UUID;
import java.util.logging.Level;