diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/internal/plugin/OneConfigMixinPlugin.java | 2 | ||||
-rw-r--r-- | src/main/java/cc/polyfrost/oneconfig/internal/plugin/OneConfigTweaker.java | 23 |
2 files changed, 12 insertions, 13 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/plugin/OneConfigMixinPlugin.java b/src/main/java/cc/polyfrost/oneconfig/internal/plugin/OneConfigMixinPlugin.java index 888cca3..1e0d432 100644 --- a/src/main/java/cc/polyfrost/oneconfig/internal/plugin/OneConfigMixinPlugin.java +++ b/src/main/java/cc/polyfrost/oneconfig/internal/plugin/OneConfigMixinPlugin.java @@ -48,9 +48,7 @@ public class OneConfigMixinPlugin implements IMixinConfigPlugin { @Override public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { - System.out.println(mixinClassName); if (mixinClassName.equals("cc.polyfrost.oneconfig.internal.mixin.VigilantMixin")) { - System.out.println("A"); VigilantTransformer.transform(targetClass); } } diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/plugin/OneConfigTweaker.java b/src/main/java/cc/polyfrost/oneconfig/internal/plugin/OneConfigTweaker.java index 0a709f6..5c57ca7 100644 --- a/src/main/java/cc/polyfrost/oneconfig/internal/plugin/OneConfigTweaker.java +++ b/src/main/java/cc/polyfrost/oneconfig/internal/plugin/OneConfigTweaker.java @@ -22,17 +22,18 @@ import java.util.jar.JarFile; public class OneConfigTweaker implements ITweaker { public OneConfigTweaker() { - doMagicMixinStuff(); + for (URL url : Launch.classLoader.getSources()) { + doMagicMixinStuff(url); + } } - private void doMagicMixinStuff() { - for (URL url : Launch.classLoader.getSources()) { - try { - URI uri = url.toURI(); - if (Objects.equals(uri.getScheme(), "file")) { - File file = new File(uri); - if (file.exists() && file.isFile()) { - JarFile jarFile = new JarFile(file); + private void doMagicMixinStuff(URL url) { + try { + URI uri = url.toURI(); + if (Objects.equals(uri.getScheme(), "file")) { + File file = new File(uri); + if (file.exists() && file.isFile()) { + try (JarFile jarFile = new JarFile(file)) { if (jarFile.getManifest() != null) { Attributes attributes = jarFile.getManifest().getMainAttributes(); String tweakerClass = attributes.getValue("TweakClass"); @@ -62,9 +63,9 @@ public class OneConfigTweaker implements ITweaker { } } } - } catch (Exception ignored) { - } + } catch (Exception ignored) { + } } |