From 020c278b3c6cdff38449e0fe67bb36bf196ed045 Mon Sep 17 00:00:00 2001 From: hannibal2 <24389977+hannibal00212@users.noreply.github.com> Date: Sat, 21 Oct 2023 09:38:28 +0200 Subject: code cleanup --- .../skyhanni/mixins/init/SkyhanniMixinPlugin.java | 46 +++++++++------------- 1 file changed, 19 insertions(+), 27 deletions(-) (limited to 'src/main') diff --git a/src/main/java/at/hannibal2/skyhanni/mixins/init/SkyhanniMixinPlugin.java b/src/main/java/at/hannibal2/skyhanni/mixins/init/SkyhanniMixinPlugin.java index 17cfb45e6..935314222 100644 --- a/src/main/java/at/hannibal2/skyhanni/mixins/init/SkyhanniMixinPlugin.java +++ b/src/main/java/at/hannibal2/skyhanni/mixins/init/SkyhanniMixinPlugin.java @@ -1,26 +1,18 @@ package at.hannibal2.skyhanni.mixins.init; -import org.spongepowered.asm.lib.tree.ClassNode; -import org.spongepowered.asm.mixin.extensibility.IMixinConfigPlugin; -import org.spongepowered.asm.mixin.extensibility.IMixinInfo; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URISyntaxException; -import java.net.URL; -import java.nio.file.Files; -import java.nio.file.Path; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.List; -import java.util.Set; -import java.util.stream.Stream; -import java.util.zip.ZipEntry; -import java.util.zip.ZipInputStream; +import org.spongepowered.asm.lib.tree.*; +import org.spongepowered.asm.mixin.extensibility.*; + +import java.io.*; +import java.net.*; +import java.nio.file.*; +import java.util.*; +import java.util.stream.*; +import java.util.zip.*; public class SkyhanniMixinPlugin implements IMixinConfigPlugin { @Override - public void onLoad(String s) { + public void onLoad(String mixinPackage) { } @@ -30,12 +22,12 @@ public class SkyhanniMixinPlugin implements IMixinConfigPlugin { } @Override - public boolean shouldApplyMixin(String s, String s1) { + public boolean shouldApplyMixin(String targetClassName, String mixinClassName) { return false; } @Override - public void acceptTargets(Set set, Set set1) { + public void acceptTargets(Set myTargets, Set otherTargets) { } @@ -43,7 +35,7 @@ public class SkyhanniMixinPlugin implements IMixinConfigPlugin { String string = classUrl.toString(); if (classUrl.getProtocol().equals("jar")) { try { - return new URL(string.substring(4).split("\\!")[0]); + return new URL(string.substring(4).split("!")[0]); } catch (MalformedURLException e) { throw new RuntimeException(e); } @@ -51,7 +43,7 @@ public class SkyhanniMixinPlugin implements IMixinConfigPlugin { if (string.endsWith(".class")) { try { return new URL(string.replace("\\", "/") - .replace(getClass().getCanonicalName().replace(".", "/") + ".class", "")); + .replace(getClass().getCanonicalName().replace(".", "/") + ".class", "")); } catch (MalformedURLException e) { throw new RuntimeException(e); } @@ -66,8 +58,8 @@ public class SkyhanniMixinPlugin implements IMixinConfigPlugin { public void tryAddMixinClass(String className) { String norm = (className.endsWith(".class") ? className.substring(0, className.length() - ".class".length()) : className) - .replace("\\", "/") - .replace("/", "."); + .replace("\\", "/") + .replace("/", "."); if (norm.startsWith(mixinBasePackage) && !norm.endsWith(".")) { mixins.add(norm.substring(mixinBasePackage.length())); } @@ -77,7 +69,7 @@ public class SkyhanniMixinPlugin implements IMixinConfigPlugin { System.out.println("Trying to find mixins from directory"); try (Stream classes = Files.walk(file.resolve(mixinBaseDir))) { classes.map(it -> file.relativize(it).toString()) - .forEach(this::tryAddMixinClass); + .forEach(this::tryAddMixinClass); } catch (IOException e) { throw new RuntimeException(e); } @@ -121,12 +113,12 @@ public class SkyhanniMixinPlugin implements IMixinConfigPlugin { } @Override - public void preApply(String s, ClassNode classNode, String s1, IMixinInfo iMixinInfo) { + public void preApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { } @Override - public void postApply(String s, ClassNode classNode, String s1, IMixinInfo iMixinInfo) { + public void postApply(String targetClassName, ClassNode targetClass, String mixinClassName, IMixinInfo mixinInfo) { } } -- cgit