diff options
author | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-06-19 19:41:06 +0700 |
---|---|---|
committer | Wyvest <45589059+Wyvest@users.noreply.github.com> | 2022-06-19 19:41:06 +0700 |
commit | bb6f1318a8d8f4b11c0648304317f4bf02c0f85c (patch) | |
tree | 1022a32ae0f212e013507343b087af0241bfb6d6 /src | |
parent | a929901f2dfb135cbb72036b5e49b4fdb38fe24a (diff) | |
download | OneConfig-bb6f1318a8d8f4b11c0648304317f4bf02c0f85c.tar.gz OneConfig-bb6f1318a8d8f4b11c0648304317f4bf02c0f85c.tar.bz2 OneConfig-bb6f1318a8d8f4b11c0648304317f4bf02c0f85c.zip |
exclude internal package from sources jar as well
remove debug stuff from mixin plugin
use try with resources for mixin things
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) { + } } |