use of org.spongepowered.server.launch.plugin.asm.PluginClassVisitor in project SpongeVanilla by SpongePowered.
the class PluginScanner method scanClassFile.
private PluginCandidate scanClassFile(InputStream in, PluginSource source) throws IOException {
ClassReader reader = new ClassReader(in);
PluginClassVisitor visitor = new PluginClassVisitor();
try {
reader.accept(visitor, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);
PluginMetadata metadata = visitor.getMetadata();
if (metadata == null) {
// Not a plugin class
return null;
}
return new PluginCandidate(visitor.getClassName().replace('/', '.'), source, metadata);
} catch (InvalidPluginException e) {
logger.error("Skipping invalid plugin {} from {}", visitor.getClassName(), source, e);
}
return null;
}
Aggregations