scriptvm: Fix cast exception
This commit is contained in:
@@ -139,6 +139,15 @@ public abstract class ScriptVMMixin implements RSClient
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean tryParseInt(String value) {
|
||||||
|
try {
|
||||||
|
Integer.parseInt(value);
|
||||||
|
return true;
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Copy("runScript")
|
@Copy("runScript")
|
||||||
static void rs$runScript(RSScriptEvent event, int maxExecutionTime)
|
static void rs$runScript(RSScriptEvent event, int maxExecutionTime)
|
||||||
{
|
{
|
||||||
@@ -171,11 +180,15 @@ public abstract class ScriptVMMixin implements RSClient
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
scriptIds.push((Integer) event.getArguments()[0]); // this is safe because it will always be the script id
|
try
|
||||||
|
{
|
||||||
|
scriptIds.push((Integer) event.getArguments()[0]); // this is safe because it will always be the script id
|
||||||
|
|
||||||
ScriptPreFired preFired = new ScriptPreFired(scriptIds.peek()); // peek doesn't remove the top item
|
ScriptPreFired preFired = new ScriptPreFired(scriptIds.peek()); // peek doesn't remove the top item
|
||||||
preFired.setScriptEvent(event);
|
preFired.setScriptEvent(event);
|
||||||
client.getCallbacks().post(ScriptPreFired.class, preFired);
|
client.getCallbacks().post(ScriptPreFired.class, preFired);
|
||||||
|
}
|
||||||
|
catch (ClassCastException ignored) {}
|
||||||
|
|
||||||
rs$runScript(event, maxExecutionTime);
|
rs$runScript(event, maxExecutionTime);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user