Annotation Interface BracketResolver


@Documented @Retention(RUNTIME) @Target(METHOD) public @interface BracketResolver
Marks a method as being responsible for resolving a particular bracket.

Methods annotated with this annotation must be both public and static. Moreover, they must accept a single parameter of type String and their return type must be a sub-class of CommandStringDisplayable. The classes containing these methods must also be annotated with ZenRegister to allow for discovery.

The single parameter of the method is a string with the contents of the bracket handler converted to a string and merged together, excluding the bracket handler name. It is up to the method to parse the string as it sees fit. As an example, given a bracket resolver for the handler "item" and the bracket expression <item:minecraft:dried_kelp>, the resolver will be invoked with the string "minecraft:dried_kelp".

If the bracket handler also specifies a validator, then this method will be invoked only if the validator confirms the validity of the bracket expression, assuming it is possible to do so.

It is not necessary for a mod to manually register a method annotated with this annotation through a plugin's IBracketParserRegistrationHandler: using the annotation as described above is sufficient for CraftTweaker to handle registration automatically.

Since:
9.1.0
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    Gets the name of the bracket handler this resolver is for.
  • Element Details

    • value

      String value
      Gets the name of the bracket handler this resolver is for.
      Returns:
      The name of the bracket handler.
      Since:
      9.1.0