Matcher - kiooeht/ModTheSpire GitHub Wiki
Locator Patches
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.
Matcher.TypeCastMatcher
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
Matcher.ConstructorCallMatcher
Matches: constructor call, i.e. super()
or this()
Constructor:
Class<?> clazz
the Class type of the the class that the constructor is callingString methodName
(optional) the name of the method being called, eithersuper
orthis
Or:
String className
the name of the class that the constructor is callingString methodName
(optional) the name of the method being called, eithersuper
orthis
Matcher.FieldAccessMatcher
Matches: field access expressions, i.e. myObject.myField
Constructor:
Class<?> clazz
the Class type of the the class that is having its field accessedString fieldName
the name of the field being accessed
Or:
String className
the name of the class that is having its field accessedString fieldName
the name of the field being accessed
Matcher.CatchClauseMatcher
Matches: catch clauses, i.e. catch (SomethingException e) {// do stuff}
Constructor:
Class<?> exceptionType
the Class type of the class of exception that is being caughtboolean isFinally
if this matches acatch
orfinally
clause
Or:
String exceptionType
the name of the class of exception that is being caughtboolean isFinally
if this matches acatch
orfinally
clause
Matcher.InstanceOfMatcher
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
Matcher.MethodCallMatcher
Matches: method calls, i.e. myObject.doAThing()
Constructor:
Class<?> clazz
the Class type of the class of the object this method is being called onString 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 onString methodName
the name of the method that is being called
Matcher.NewArrayMatcher
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
Matcher.NewExprMatcher
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