Interface VariableValueParameters.RegistryEntryBuilder<T>

    • Method Detail

      • defaultNamespace

        VariableValueParameters.RegistryEntryBuilder<T> defaultNamespace​(String prefix)
        Adds a prefix that could be prepended to the input argument if it initially does not match any of the chosen RegistryKeys. Any prefixes that are prepended will include the ":" identifier, this should not be part of the supplied prefix in this method.

        Consider the following example. Assume that we have a catalog type that this element targets with the following IDs currently registered:

        • sponge:test
        • minecraft:test
        • test:test

        Now consider that the argument "test:test" is passed (with any capitalization thereof). It's an exact match, so there is no bother, it's returned by the parameter.

        Then consider that the argument "test" is passed - this is NOT an exact match. Without specifying any prefixes - this parameter will fail to parse the argument. Sometimes, this isn't desired, and plugins will want to allow players to not have to specify a prefix. So, if the prefix "sponge" is specified here, then "test" will match "sponge:test".

        Multiple prefixes can be specified. They will be tested in order - in the example above, if the following is specified:

        prefix("sponge").prefix("minecraft").prefix("test")

        then if the argument "test" is passed to the parameter, it will check "test", "sponge:test", "minecraft:test" then "test:test". In the above example, this would match "sponge:test" and return that element.

        Parameters:
        prefix - The prefix, without the ":" suffix, to add to the argument if the parameter fails to find a catalog type without such a prefix
        Returns:
        This builder, for chaining.