Skip to content

Commit

Permalink
Don't spam launchplugins if they didn't transform, add more logging.
Browse files Browse the repository at this point in the history
Closes #29

Signed-off-by: cpw <cpw+github@weeksfamily.ca>
  • Loading branch information
cpw committed Jun 11, 2019
1 parent 7052a0a commit 866a8b3
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions src/main/java/cpw/mods/modlauncher/LaunchPluginHandler.java
Expand Up @@ -34,11 +34,16 @@ public EnumMap<ILaunchPluginService.Phase, List<ILaunchPluginService>> computeLa
return phaseObjectEnumMap;
}

public boolean offerClassNodeToPlugins(final ILaunchPluginService.Phase phase, final List<ILaunchPluginService> plugins, @Nullable final ClassNode node, final Type className, TransformerAuditTrail auditTrail) {
return plugins.stream().
peek(iLaunchPluginService -> LOGGER.debug(LAUNCHPLUGIN, "LauncherPluginService {} transforming {}", iLaunchPluginService.name(), className)).
peek(iLaunchPluginService -> auditTrail.addPluginAuditTrail(className.getClassName(), iLaunchPluginService, phase)).
map(iLaunchPluginService -> iLaunchPluginService.processClass(phase, node, className)).
reduce(Boolean.FALSE, Boolean::logicalOr);
boolean offerClassNodeToPlugins(final ILaunchPluginService.Phase phase, final List<ILaunchPluginService> plugins, @Nullable final ClassNode node, final Type className, TransformerAuditTrail auditTrail) {
boolean needsRewriting = false;
for (ILaunchPluginService iLaunchPluginService : plugins) {
LOGGER.debug(LAUNCHPLUGIN, "LauncherPluginService {} offering transform {}", iLaunchPluginService.name(), className.getClassName());
if (iLaunchPluginService.processClass(phase, node, className)) {
auditTrail.addPluginAuditTrail(className.getClassName(), iLaunchPluginService, phase);
LOGGER.debug(LAUNCHPLUGIN, "LauncherPluginService {} transformed {}", iLaunchPluginService.name(), className.getClassName());
needsRewriting = true;
}
}
return needsRewriting;
}
}

0 comments on commit 866a8b3

Please sign in to comment.