package me.hammerle.snuviscript.code; import java.util.HashMap; import java.util.HashSet; import java.util.List; import java.util.Stack; import java.util.function.Consumer; import me.hammerle.snuviscript.exceptions.CodeTooLongException; import me.hammerle.snuviscript.variable.LocalVariable; import me.hammerle.snuviscript.variable.Variable; public final class Script { protected final String simpleName; protected final String name; protected final int id; protected SnuviParser parser; protected ISnuviLogger logger; protected ISnuviScheduler scheduler; protected int currentLine; protected Instruction[] code; // waiting scripts stop executing and run again on an event protected boolean isWaiting; // holded scripts do not receive events protected boolean isHolded; // not valid means the script is waiting for its termination protected boolean isValid; // states if event broadcasts should be received, otherwise only direct event calls work protected boolean receiveEventBroadcast; // stores the used cpuTime, schedules the script if too high protected long cpuTime; protected int catchLine; protected String currentFunction; protected boolean ifState; protected final HashMap labels; protected final Stack returnStack; protected HashMap vars; protected final Stack> localVars; protected final HashSet events; protected Object returnValue; protected final boolean subScript; protected final String[] subScriptInput; protected final HashMap subScripts; protected boolean printStackTrace; private final Consumer