Closed ghost closed 6 years ago
Thanks for reporting.
I'm looking at the relevant code in your class that calls Reflect.compile()
:
public class CommandParser {
private HashMap<String, Command> compiledCode = new HashMap();
private HashMap<String, Reflect> compiledClasses = new HashMap();
private static String output;
String code;
public void parseCode(Command command) {
if (!this.compiledCode.containsKey(command.getInstanceID())) {
for (int i = 0; i < command.getCode().length; i++) {
code = code + command.getCode()[i];
}
Supplier<String> supplier = Reflect.compile(
"io.github.xavierdd1st." + command.getName(),
code).create().get();
this.compiledClasses.put(command.getInstanceID(), (Reflect) supplier);
this.compiledCode.put(command.getInstanceID(), command);
}
}
Notice how you did not initialise your String code
member to an empty string, thus when you concatenate some code to it, there's going to be "null"
at the beginning of your code, as you can see in the first statement of the error message:
nullpackage io.github.xavierdd1st.commands;
Hope this helps
Thanks a lot I never experimented with things like that.
Expected behavior and actual behavior:
To run the code from a json and compile it.
Steps to reproduce the problem:
Run the project. https://github.com/XavierDD1st/TBUA
Versions: