-
Notifications
You must be signed in to change notification settings - Fork 88
Matcher
When using Locator patches, you need to use the Matcher
class to specify where in the game you want a patch to be inserted. Javassist can match many different types of expressions and ModTheSpire provides a Matcher for each type.
Matches: type cast expressions, i.e. Dog myDog = (Dog) myAnimal
Constructor:
-
String typeName
the name of the class that the type cast is casting to
Matches: constructor call, i.e. super()
or this()
Constructor:
-
Class<?> clazz
the Class type of the the class that the constructor is calling -
String methodName
(optional) the name of the method being called, eithersuper
orthis
Or:
-
String className
the name of the class that the constructor is calling -
String methodName
(optional) the name of the method being called, eithersuper
orthis
Matches: field access expressions, i.e. myObject.myField
Constructor:
-
Class<?> clazz
the Class type of the the class that is having its field accessed -
String fieldName
the name of the field being accessed
Or:
-
String className
the name of the class that is having its field accessed -
String fieldName
the name of the field being accessed
Matches: catch clauses, i.e. catch (SomethingException e) {// do stuff}
Constructor:
-
Class<?> exceptionType
the Class type of the class of exception that is being caught -
boolean isFinally
if this matches acatch
orfinally
clause
Or:
-
String exceptionType
the name of the class of exception that is being caught -
boolean isFinally
if this matches acatch
orfinally
clause
Matches: instanceof expressions, i.e. myObject instanceof Animal
Constructor:
-
Class<?> clazz
the Class type the type that we're checking if the object is an instance of
Or:
-
String comparedToType
the name of the type that we're checking if the object is an instance of
Matches: method calls, i.e. myObject.doAThing()
Constructor:
-
Class<?> clazz
the Class type of the class of the object this method is being called on -
String methodName
the name of the method that is being called
Or:
-
String className
the name of the class of the object this method is being called on -
String methodName
the name of the method that is being called
Matches: new array expressions, i.e. myArray = new int[3]
Constructor:
-
Class<?> clazz
the Class type of the class that is the type of the array
Or:
-
String className
the name of the class that is the type of the array
Matches: new expressions, i.e. new Object()
Constructor:
-
Class<?> clazz
the Class type of the class that is being constructed
Or:
-
String className
the name of the class that is being constructed