Allow assembly and loading of new scripts

This commit is contained in:
Max Weber
2018-03-28 04:36:48 -06:00
committed by Adam
parent 38f59146d5
commit aa02da45c0
2 changed files with 35 additions and 11 deletions

View File

@@ -73,12 +73,6 @@ public class AssembleMojo extends AbstractMojo
try (FileInputStream fin = new FileInputStream(scriptFile))
{
File hashFile = new File(scriptDirectory, Files.getNameWithoutExtension(scriptFile.getName()) + ".hash");
if (!hashFile.exists())
{
throw new MojoExecutionException("Unable to find hash file for " + scriptFile);
}
ScriptDefinition script = assembler.assemble(fin);
byte[] packedScript = saver.save(script);
@@ -86,7 +80,16 @@ public class AssembleMojo extends AbstractMojo
Files.write(packedScript, targetFile);
// Copy hash file
Files.copy(hashFile, new File(scriptOut, Integer.toString(script.getId()) + ".hash"));
File hashFile = new File(scriptDirectory, Files.getNameWithoutExtension(scriptFile.getName()) + ".hash");
if (hashFile.exists())
{
Files.copy(hashFile, new File(scriptOut, Integer.toString(script.getId()) + ".hash"));
}
else if (script.getId() < 10000) // Scripts >=10000 are RuneLite scripts, so they shouldn't have a .hash
{
throw new MojoExecutionException("Unable to find hash file for " + scriptFile);
}
++count;
}