prepare for better obfer

This commit is contained in:
Daniella / Tove 2023-09-29 19:54:58 +02:00
parent a77d21b1ac
commit 25e707f7af
Signed by: TudbuT
GPG key ID: 7D63D5634B7C417F
2 changed files with 6 additions and 4 deletions

View file

@ -34,11 +34,11 @@ import java.util.function.Consumer;
public class BaseBand { public class BaseBand {
public static int majorVersion = 1; public static int majorVersion = 1;
public static int buildNumber = 407; public static int buildNumber = 408;
public static String hash = "9e086ff8ab086183"; public static String hash = "42bc10b4c848031b";
public static String name = "BaseBand"; public static String name = "BaseBand";
public long timeOfCompile = 1695986519815L; public long timeOfCompile = 1696010092485L;
public CommandManager commandRegistry; public CommandManager commandRegistry;
public EventBus eventBus; public EventBus eventBus;
public ArrayList<Module> modules = new ArrayList<>(); public ArrayList<Module> modules = new ArrayList<>();
@ -75,7 +75,7 @@ public class BaseBand {
if(Arrays.equals(access.getParameterTypes(), new Class<?>[]{Consumer.class}) && access.getDeclaringClass() == keeper.getClass()) { if(Arrays.equals(access.getParameterTypes(), new Class<?>[]{Consumer.class}) && access.getDeclaringClass() == keeper.getClass()) {
access.invoke(keeper, (Consumer<Object>) accessor -> { access.invoke(keeper, (Consumer<Object>) accessor -> {
try { try {
Object registry = accessor.getClass().getMethods()[0].invoke(accessor); Object registry = Arrays.stream(accessor.getClass().getMethods()).filter(x -> x.getParameterCount() == 0 && x.getDeclaringClass() == accessor.getClass()).findAny().get().invoke(accessor);
for (Method save : registry.getClass().getMethods()) { for (Method save : registry.getClass().getMethods()) {
if (save.getParameterCount() == 0 && save.getReturnType() == Void.TYPE && save.getDeclaringClass() == registry.getClass()) { if (save.getParameterCount() == 0 && save.getReturnType() == Void.TYPE && save.getDeclaringClass() == registry.getClass()) {
save.invoke(registry); // registry save save.invoke(registry); // registry save

View file

@ -120,6 +120,8 @@ public class ReflectUtil {
if((thing.getModifiers() & Modifier.FINAL) != 0) if((thing.getModifiers() & Modifier.FINAL) != 0)
throw new IllegalAccessException(); throw new IllegalAccessException();
} catch (Throwable e2) { } catch (Throwable e2) {
e1.printStackTrace();
e2.printStackTrace();
throw new AssertionError("This JVM does not support changing field modifiers"); throw new AssertionError("This JVM does not support changing field modifiers");
} }
} }