refactor: use Invocable instead of ScriptEngine in script managers

- Make fields final
- Inject event script variable earlier
- Remove redundant fields
This commit is contained in:
P0nk
2021-04-18 11:26:05 +02:00
parent 58e69654a2
commit 46c2d92082
10 changed files with 182 additions and 195 deletions

View File

@@ -51,7 +51,6 @@ import server.maps.MapleReactor;
import tools.MaplePacketCreator;
import tools.Pair;
import javax.script.Invocable;
import javax.script.ScriptException;
import java.awt.*;
import java.util.List;
@@ -214,10 +213,10 @@ public class EventInstanceManager {
}
}
public Object invokeScriptFunction(String name, Object... args) throws ScriptException, NoSuchMethodException {
if (!disposed) {
return ((Invocable) em.getIv()).invokeFunction(name, args);
return em.getIv().invokeFunction(name, args);
} else {
return null;
}