scriptvm: Fix cast exception

This commit is contained in:
Owain van Brakel
2020-02-11 23:56:41 +01:00
parent 2d2590e64d
commit b523003d0f

View File

@@ -139,6 +139,15 @@ public abstract class ScriptVMMixin implements RSClient
return false;
}
boolean tryParseInt(String value) {
try {
Integer.parseInt(value);
return true;
} catch (NumberFormatException e) {
return false;
}
}
@Copy("runScript")
static void rs$runScript(RSScriptEvent event, int maxExecutionTime)
{
@@ -168,6 +177,8 @@ public abstract class ScriptVMMixin implements RSClient
}
}
else
{
try
{
try
{
@@ -176,6 +187,8 @@ public abstract class ScriptVMMixin implements RSClient
ScriptPreFired preFired = new ScriptPreFired(scriptIds.peek()); // peek doesn't remove the top item
preFired.setScriptEvent(event);
client.getCallbacks().post(ScriptPreFired.class, preFired);
}
catch (ClassCastException ignored) {}
rs$runScript(event, maxExecutionTime);