Обновление JAConfigurator

This commit is contained in:
Gravit 2018-10-07 16:06:07 +07:00
parent abcf980844
commit aedddbff0d
2 changed files with 9 additions and 1 deletions

View file

@ -41,12 +41,19 @@ public void close() {
ctClass.defrost(); ctClass.defrost();
} }
public CtClass getCtClass() {
return ctClass;
}
public byte[] getBytecode() throws IOException, CannotCompileException { public byte[] getBytecode() throws IOException, CannotCompileException {
return ctClass.toBytecode();
}
public void compile() throws CannotCompileException {
body.append("}"); body.append("}");
moduleBody.append("}"); moduleBody.append("}");
ctConstructor.setBody(body.toString()); ctConstructor.setBody(body.toString());
initModuleMethod.insertAfter(moduleBody.toString()); initModuleMethod.insertAfter(moduleBody.toString());
return ctClass.toBytecode(); if(ctClass.isFrozen()) ctClass.defrost();
} }
public String getZipEntryPath() { public String getZipEntryPath() {

View file

@ -229,6 +229,7 @@ private void stdBuild() throws IOException {
output.write(launcherConfigBytes); output.write(launcherConfigBytes);
ZipEntry e = newZipEntry(jaConfigurator.getZipEntryPath()); ZipEntry e = newZipEntry(jaConfigurator.getZipEntryPath());
output.putNextEntry(e); output.putNextEntry(e);
jaConfigurator.compile();
output.write(jaConfigurator.getBytecode()); output.write(jaConfigurator.getBytecode());
server.buildHookManager.postHook(context); server.buildHookManager.postHook(context);
} catch (CannotCompileException | NotFoundException e) { } catch (CannotCompileException | NotFoundException e) {