Cleanup reflection parameters

This commit is contained in:
Frank van der Heijden 2020-07-06 12:05:18 +02:00
parent 578f4e1b9e
commit e5038fce31
No known key found for this signature in database
GPG key ID: 26DA56488D314D11
20 changed files with 73 additions and 131 deletions

View file

@ -1,27 +0,0 @@
package net.frankheijden.serverutils.bungee.reflection;
import static net.frankheijden.serverutils.common.reflection.FieldParam.fieldOf;
import static net.frankheijden.serverutils.common.reflection.ReflectionUtils.getAllFields;
import static net.frankheijden.serverutils.common.reflection.VersionParam.ALL_VERSIONS;
import java.lang.reflect.Field;
import java.util.Map;
public class RPlugin {
private static Class<?> pluginClass;
private static Map<String, Field> fields;
static {
try {
pluginClass = Class.forName("net.md_5.bungee.api.plugin.Plugin");
fields = getAllFields(pluginClass,
fieldOf("plugins", ALL_VERSIONS),
fieldOf("toLoad", ALL_VERSIONS),
fieldOf("commandsByPlugin", ALL_VERSIONS),
fieldOf("listenersByPlugin", ALL_VERSIONS));
} catch (Exception ex) {
ex.printStackTrace();
}
}
}

View file

@ -3,7 +3,6 @@ package net.frankheijden.serverutils.bungee.reflection;
import static net.frankheijden.serverutils.common.reflection.FieldParam.fieldOf;
import static net.frankheijden.serverutils.common.reflection.ReflectionUtils.get;
import static net.frankheijden.serverutils.common.reflection.ReflectionUtils.getAllFields;
import static net.frankheijden.serverutils.common.reflection.VersionParam.ALL_VERSIONS;
import java.lang.reflect.Constructor;
import java.lang.reflect.Field;
@ -27,8 +26,8 @@ public class RPluginClassLoader {
constructor = loaderClass.getDeclaredConstructor(ProxyServer.class, PluginDescription.class, URL[].class);
constructor.setAccessible(true);
fields = getAllFields(loaderClass,
fieldOf("allLoaders", ALL_VERSIONS),
fieldOf("plugin", ALL_VERSIONS));
fieldOf("allLoaders"),
fieldOf("plugin"));
} catch (Exception ex) {
ex.printStackTrace();
}

View file

@ -3,7 +3,6 @@ package net.frankheijden.serverutils.bungee.reflection;
import static net.frankheijden.serverutils.common.reflection.FieldParam.fieldOf;
import static net.frankheijden.serverutils.common.reflection.ReflectionUtils.get;
import static net.frankheijden.serverutils.common.reflection.ReflectionUtils.getAllFields;
import static net.frankheijden.serverutils.common.reflection.VersionParam.ALL_VERSIONS;
import com.google.common.collect.Multimap;
@ -24,11 +23,11 @@ public class RPluginManager {
try {
pluginManagerClass = Class.forName("net.md_5.bungee.api.plugin.PluginManager");
fields = getAllFields(pluginManagerClass,
fieldOf("yaml", ALL_VERSIONS),
fieldOf("plugins", ALL_VERSIONS),
fieldOf("commandMap", ALL_VERSIONS),
fieldOf("toLoad", ALL_VERSIONS),
fieldOf("commandsByPlugin", ALL_VERSIONS));
fieldOf("yaml"),
fieldOf("plugins"),
fieldOf("commandMap"),
fieldOf("toLoad"),
fieldOf("commandsByPlugin"));
} catch (Exception ex) {
ex.printStackTrace();
}