src/main/java/me/senseiwells/arucas/api/ArucasThreadHandler.java
public Future<Value> runOnMainThreadFuture(Context context, String fileName, String fileContent) {
		// Make sure that this handler belongs to the provided context
		// Cannot have two main threads for the same program
		if (context.getThreadHandler() != this) {
			throw new IllegalStateException("Wrong context passed in");
		}
		if (this.isRunning()) {
			throw new IllegalStateException("Main thread is already running");
		}

		this.currentFileContent = fileContent;
		this.hasError = false;
		this.isRunning = true;

		CompletableFuture<Value> futureValue = new CompletableFuture<>();
		new ArucasThread(this.arucasThreadGroup, () -> {
			Value value;
			try {
				value = Run.run(context, fileName, fileContent);
				this.stop();
			}
			catch (Throwable t) {
				this.tryError(context, t);
				value = null;
			}
			futureValue.complete(value);
		}, "Arucas Main Thread").start(context);
		return futureValue;
	}
/**
	 * This method is to run the base script returning a Future
	 *
	 * @param context     the base context
	 * @param fileName    the name of the file you are running from
	 * @param fileContent the Arucas code you want to execute
	 */
This method is to run the base script returning a Future
@param context     the base context
@param fileName    the name of the file you are running from
@param fileContent the Arucas code you want to execute
This method is to run the base script returning a Future @param context the base context @param fileName the name of the file you are running from @param fileContent the Arucas code you want to execute
public Future<Value> runOnMainThreadFuture(Context context, String fileName, String fileContent) {
		if (context.getThreadHandler() != this) {
			throw new IllegalStateException("Wrong context passed in");
		}
		if (this.isRunning()) {
			throw new IllegalStateException("Main thread is already running");
		}
		this.currentFileContent = fileContent;
		this.hasError = false;
		this.isRunning = true;
		CompletableFuture<Value> futureValue = new CompletableFuture<>();
		new ArucasThread(this.arucasThreadGroup, () -> {
			Value value;
			try {
				value = Run.run(context, fileName, fileContent);
				this.stop();
			}
			catch (Throwable t) {
				this.tryError(context, t);
				value = null;
			}
			futureValue.complete(value);
		}, "Arucas Main Thread").start(context);
		return futureValue;
	}
public Future < Value > runOnMainThreadFuture ( Context context , String fileName , String fileContent ) { if ( context . getThreadHandler ( ) != this ) { throw new IllegalStateException ( "Wrong context passed in" ) ; } if ( this . isRunning ( ) ) { throw new IllegalStateException ( "Main thread is already running" ) ; } this . currentFileContent = fileContent ; this . hasError = false ; this . isRunning = true ; CompletableFuture < Value > futureValue = new CompletableFuture < > ( ) ; new ArucasThread ( this . arucasThreadGroup , ( ) -> { Value value ; try { value = Run . run ( context , fileName , fileContent ) ; this . stop ( ) ; } catch ( Throwable t ) { this . tryError ( context , t ) ; value = null ; } futureValue . complete ( value ) ; } , "Arucas Main Thread" ) . start ( context ) ; return futureValue ; }
This method is to run the base script returning a Future
 @param context     the base context
 @param fileName    the name of the file you are running from
 @param fileContent the Arucas code you want to execute
This method is to run the base script returning a Future @param context the base context @param fileName the name of the file you are running from @param fileContent the Arucas code you want to execute
// Make sure that this handler belongs to the provided context // Cannot have two main threads for the same program