9
0
mirror of https://github.com/Xiao-MoMi/craft-engine.git synced 2025-12-26 18:39:20 +00:00

refactor(core): 优化

This commit is contained in:
jhqwqmc
2025-06-25 20:02:30 +08:00
parent f925a1ee15
commit 904adc5e08

View File

@@ -235,14 +235,13 @@ public abstract class AbstractPackManager implements PackManager {
int fileCount = ObfA.VALUES[1] - ObfA.VALUES[17];
Constructor<?> magicConstructor = ReflectionUtils.getConstructor(magicClazz, fileCount);
assert magicConstructor != null;
// magicConstructor.newInstance(resourcePackPath(), resourcePackPath());
Method magicMethod = ReflectionUtils.getMethod(magicClazz, void.class);
assert magicMethod != null;
this.zipGenerator = (p1, p2) -> {
try {
Object magicObject = magicConstructor.newInstance(p1, p2);
magicMethod.invoke(magicObject);
} catch (Exception e) {
} catch (Throwable e) {
this.plugin.logger().warn("Failed to generate zip files\n" + new StringWriter(){{e.printStackTrace(new PrintWriter(this));}}.toString().replaceAll("\\.[Il]{2,}", "").replaceAll("/[Il]{2,}", ""));
}
};